Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Flatten pr 697 into one changeset. #723

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
# author Kelly Thompson <[email protected]>
# date 2010 April 28
# brief Instructions for building root level Makefile.
# note Copyright (C) 2016-2019 Triad National Security, LLC.
# All rights reserved.
# note Copyright (C) 2019 Triad National Security, LLC. All rights reserved.
#------------------------------------------------------------------------------#

# Build notes:
Expand Down
33 changes: 33 additions & 0 deletions CMakeSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"configurations": [
{
"name": "x64-Debug",
"generator": "Visual Studio 16 2019 Win64",
"configurationType": "Debug",
"inheritEnvironments": [ "msvc_x64_x64" ],
"buildRoot": "c:/work/vs2019-${name}/draco",
"installRoot": "c:/work/vs2019-${name}/install",
"cmakeCommandArgs": "",
"buildCommandArgs": "-verbosity:minimal -m:8",
"ctestCommandArgs": "-j 8 --output-on-failure",
"cmakeToolchain": "C:/work/vendors64/vs2019-toolchain.cmake",
"variables": [],
"cmakeExecutable": "C:/Program Files/CMake/bin/cmake.exe"
},
{
"name": "x64-Release",
"generator": "Visual Studio 16 2019 Win64",
"configurationType": "Release",
"buildRoot": "c:/work/vs2019-${name}/draco",
"installRoot": "c:/work/vs2019-${name}/install",
"cmakeExecutable": "C:/Program Files/CMake/bin/cmake.exe",
"cmakeCommandArgs": "",
"buildCommandArgs": "-verbosity:minimal -m:8",
"ctestCommandArgs": "-j 8 --output-on-failure",
"cmakeToolchain": "C:/work/vendors64/vs2019-toolchain.cmake",
"inheritEnvironments": [ "msvc_x64_x64" ],
"variables": [],
"cmakeExecutable": "C:/Program Files/CMake/bin/cmake.exe"
}
]
}
29 changes: 20 additions & 9 deletions config/CMakeAddFortranSubdirectory.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@
#
# cmake_add_fortran_subdirectory(
# <subdir> # name of subdirectory
# PROJECT <project_name> # project name in subdir top CMakeLists.txt
# PROJECT <project_name> # project name in subdirectories's top
# # CMakeLists.txt
# # recommendation: use the same project name as
# # listed in <subdir>/CMakeLists.txt
# ARCHIVE_DIR <dir> # dir where project places .lib files
# RUNTIME_DIR <dir> # dir where project places .dll files
# ARCHIVE_DIR <dir> # directory where project places .lib files
# RUNTIME_DIR <dir> # directory where project places .dll files
# LIBRARIES <lib>... # names of library targets to import
# TARGET_NAMES <string>...# target names assigned to the libraries listed
# # above available in the primary project.
Expand Down Expand Up @@ -401,16 +402,24 @@ endfunction()
#-----------------------------------------------------------------------------#
function( cafs_fix_mpi_library )

# MS-MPI and gfortran do not play nice together...
if(WIN32)
set(verbose FALSE)

# MS-MPI and gfortran do not play nice together...
if(WIN32 AND "${DRACO_C4}" STREQUAL "MPI")
if(verbose)
message("CAFS: MPI_Fortran_LIBRARIES= ${MPI_Fortran_LIBRARIES}")
endif()
if( NOT MPI_Fortran_LIBRARIES OR
"${MPI_Fortran_LIBRARIES}" MATCHES "msmpi.lib" )
# should be located at
# C:\Program Files (x86)\Microsoft SDKs\MPI\Lib\[x86|x64]
# msmpi.lib should be located one of:
# - C:\Program Files (x86)\Microsoft SDKs\MPI\Lib\[x86|x64]
# - %vcpkg%/installed/x64-windows/[debug]/lib
if( MPI_msmpi_LIBRARY )
# FindMPI.cmake should have set $MPI_msmpi_LIBRARY.
get_filename_component( MSMPI_SDK_DIR ${MPI_msmpi_LIBRARY} DIRECTORY)
if(verbose)
message("CAFS: MSMPI_SDK_DIR = ${MSMPI_SDK_DIR}")
endif()
find_library( MPI_gfortran_LIBRARIES
NAMES "libmsmpi.a"
HINTS ${MSMPI_SDK_DIR} )
Expand Down Expand Up @@ -449,8 +458,10 @@ function( cafs_fix_mpi_library )
set( CMAKE_Fortran_${comp_opt} "${CMAKE_Fortran_${comp_opt}}"
CACHE STRING "Compiler flags." FORCE )
endforeach()

endif(WIN32)
if(verbose)
message("CAFS: MPI_gfortran_LIBRARIES= ${MPI_gfortran_LIBRARIES}")
endif()
endif()

endfunction(cafs_fix_mpi_library)

Expand Down
22 changes: 13 additions & 9 deletions config/compilerEnv.cmake
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#-----------------------------*-cmake-*----------------------------------------#
# file config/compilerEnv.cmake
# brief Default CMake build parameters
# note Copyright (C) 2016-2019 Triad National Security, LLC.
# All rights reserved.
# note Copyright (C) 2019 Triad National Security, LLC. All rights reserved.
#------------------------------------------------------------------------------#

include_guard(GLOBAL)
Expand All @@ -20,8 +19,10 @@ endif()
# ----------------------------------------
if( DEFINED ENV{PAPI_HOME} )
set( HAVE_PAPI 1 CACHE BOOL "Is PAPI available on this machine?" )
set( PAPI_INCLUDE $ENV{PAPI_INCLUDE} CACHE PATH "PAPI headers at this location" )
set( PAPI_LIBRARY $ENV{PAPI_LIBDIR}/libpapi.so CACHE FILEPATH "PAPI library." )
set( PAPI_INCLUDE $ENV{PAPI_INCLUDE} CACHE PATH
"PAPI headers at this location" )
set( PAPI_LIBRARY $ENV{PAPI_LIBDIR}/libpapi.so CACHE FILEPATH
"PAPI library." )
endif()

if( HAVE_PAPI )
Expand Down Expand Up @@ -567,22 +568,25 @@ macro(dbsSetupFortran)
else()
# If CMake doesn't know about a Fortran compiler, $ENV{FC}, then
# also look for a compiler to use with CMakeAddFortranSubdirectory.
message( STATUS "Looking for CMakeAddFortranSubdirectory Fortran compiler...")
message( STATUS "Looking for CMakeAddFortranSubdirectory Fortran "
"compiler...")
set( CAFS_Fortran_COMPILER "NOTFOUND" )

# Try to find a Fortran compiler (use MinGW gfortran for MSVC).
find_program( CAFS_Fortran_COMPILER
NAMES ${CAFS_Fortran_COMPILER} $ENV{CAFS_Fortran_COMPILER} gfortran
PATHS
c:/msys64/mingw64/bin
c:/MinGW/bin
c:/msys64/usr/bin
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MinGW;InstallLocation]/bin" )
c:/msys64/usr/bin )

if( EXISTS ${CAFS_Fortran_COMPILER} )
set( HAVE_Fortran ON )
message( STATUS "Looking for CMakeAddFortranSubdirectory Fortran compiler... found ${CAFS_Fortran_COMPILER}")
message( STATUS "Looking for CMakeAddFortranSubdirectory Fortran "
"compiler... found ${CAFS_Fortran_COMPILER}")
else()
message( STATUS "Looking for CMakeAddFortranSubdirectory Fortran compiler... not found")
message( STATUS "Looking for CMakeAddFortranSubdirectory Fortran "
"compiler... not found")
endif()

endif()
Expand Down
15 changes: 8 additions & 7 deletions config/print_target_properties.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -59,28 +59,29 @@ function(echo_target tgt)
# Convert command output into a CMake list
string(REGEX REPLACE ";" "\\\\;" CMAKE_PROPERTY_LIST "${CMAKE_PROPERTY_LIST}")
string(REGEX REPLACE "\n" ";" CMAKE_PROPERTY_LIST "${CMAKE_PROPERTY_LIST}")

list(REMOVE_DUPLICATES CMAKE_PROPERTY_LIST)

foreach(prop ${CMAKE_PROPERTY_LIST})
# special cases first

# Some targets aren't allowed:
# Ref: https://stackoverflow.com/questions/32197663/how-can-i-remove-the-the-location-property-may-not-be-read-from-target-error-i
if(prop STREQUAL "LOCATION" OR prop MATCHES "^LOCATION_" OR prop MATCHES "_LOCATION$")
continue()
elseif( prop MATCHES "<LANG>" )
continue()
endif()
#if(prop STREQUAL "LOCATION" OR prop MATCHES "^LOCATION_" OR prop MATCHES "_LOCATION$")
# continue()
#elseif( prop MATCHES "<LANG>" )
# continue()
#endif()

if( ${prop} MATCHES "<CONFIG>")
foreach (c DEBUG RELEASE RELWITHDEBINFO MINSIZEREL)
string(REPLACE "<CONFIG>" "${c}" p ${prop})
# message("prop ${p}")
echo_target_property("${tgt}" "${p}")
endforeach()
continue()
endif()

# everything else
# message("prop ${prop}")
echo_target_property("${tgt}" "${prop}")
endforeach()
message("")
Expand Down
Loading