From d5ec3dbdd3770bbc8846e7ee09bdcf7601e4fe5f Mon Sep 17 00:00:00 2001 From: Landon Owen Date: Tue, 29 Aug 2023 17:18:07 -0700 Subject: [PATCH 01/23] Export targets mostly working, changes in PYB11 are necessary and other python interface stuff is still broken --- CMakeLists.txt | 1 + cmake/InstallTPLs.cmake | 93 ++++++++++-------- cmake/SetupSpheral.cmake | 8 ++ cmake/SpheralConfig.cmake | 28 ++++++ cmake/spheral/SpheralAddLibs.cmake | 108 ++++++++++---------- cmake/spheral/SpheralHandleTPL.cmake | 142 +++++++++------------------ cmake/spheral_cxx-config.cmake.in | 24 +++++ src/CMakeLists.txt | 9 +- src/CXXTests/CMakeLists.txt | 2 +- 9 files changed, 218 insertions(+), 197 deletions(-) create mode 100644 cmake/SpheralConfig.cmake create mode 100644 cmake/spheral_cxx-config.cmake.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 52fa93526..140cb486d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,3 +10,4 @@ set(SPHERAL_TEST_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}) include(cmake/SetupSpheral.cmake) add_subdirectory(${SPHERAL_ROOT_DIR}/scripts) +include(cmake/SpheralConfig.cmake) diff --git a/cmake/InstallTPLs.cmake b/cmake/InstallTPLs.cmake index 76182950c..fb7cd37ff 100644 --- a/cmake/InstallTPLs.cmake +++ b/cmake/InstallTPLs.cmake @@ -5,21 +5,23 @@ # Do NOT add any TPLs to the clean target set_directory_properties(PROPERTIES CLEAN_NO_CUSTOM 1) +# Set the location of the .cmake files +set(TPL_CMAKE_DIR ${SPHERAL_ROOT_DIR}/cmake/tpl) + #----------------------------------------------------------------------------------- # Submodules #----------------------------------------------------------------------------------- -# Things all Spheral packages have in their include path -set(SPHERAL_EXTERN_INCLUDES ) - # PolyClipper if (NOT polyclipper_DIR) set(polyclipper_DIR "${SPHERAL_ROOT_DIR}/extern/PolyClipper" CACHE PATH "") endif() -set(polyclipper_INCLUDES "${polyclipper_DIR}/src") - -list(APPEND SPHERAL_EXTERN_INCLUDES ${polyclipper_INCLUDES}) - +add_subdirectory(${polyclipper_DIR}) +list(APPEND spheral_blt_depends PolyClipperAPI) +install(TARGETS PolyClipperAPI + EXPORT spheral_cxx-targets + DESTINATION lib/cmake) +set_target_properties(PolyClipperAPI PROPERTIES EXPORT_NAME spheral::PolyClipperAPI) if (NOT ENABLE_CXXONLY) # Find the appropriate Python @@ -37,55 +39,62 @@ if (NOT ENABLE_CXXONLY) set(PYBIND11_ROOT_DIR "${PYB11GENERATOR_ROOT_DIR}/extern/pybind11" CACHE PATH "") endif() - list(APPEND SPHERAL_EXTERN_INCLUDES ${PYBIND11_ROOT_DIR}/include) + list(APPEND SPHERAL_SUBMOD_INCLUDES ${PYBIND11_ROOT_DIR}/include) endif() +set_property(GLOBAL PROPERTY SPHERAL_SUBMOD_INCLUDES "${SPHERAL_SUBMOD_INCLUDES}") #----------------------------------------------------------------------------------- # Find pre-compiled TPLs #----------------------------------------------------------------------------------- -# Initialize TPL options -include(${SPHERAL_ROOT_DIR}/cmake/spheral/SpheralHandleTPL.cmake) +# TPLs that can use find_package +list(APPEND SPHERAL_EXTERN_PACKAGES axom) -# These libs are always needed -Spheral_Handle_TPL(zlib spheral_depends cxx) -Spheral_Handle_TPL(boost spheral_depends cxx) -Spheral_Handle_TPL(eigen spheral_depends cxx) -Spheral_Handle_TPL(qhull spheral_depends cxx) -Spheral_Handle_TPL(silo spheral_depends cxx) - -# AXOM PUlls in HDF5 and Conduit for us -#Spheral_Handle_TPL(conduit spheral_depends cxx) -find_package(axom REQUIRED QUIET NO_DEFAULT_PATH PATHS ${axom_DIR}/lib/cmake) -if(axom_FOUND) - list(APPEND spheral_blt_cxx_depends axom fmt) - blt_patch_target(NAME fmt TREAT_INCLUDES_AS_SYSTEM On) - message(STATUS "Found axom: ${axom_DIR} (found version ${axom_VERSION})") +# TPLs that must be imported +list(APPEND SPHERAL_EXTERN_LIBS zlib boost eigen qhull silo hdf5 polytope) +if(ENABLE_ANEOS) + list(APPEND SPHERAL_EXTERN_LIBS aneos) endif() - -# Axom imports hdf5 lib but Spheral also requires hdf5_hl -Spheral_Handle_TPL(hdf5 spheral_depends cxx) - -# Some libraries are optional -if (ENABLE_ANEOS) - Spheral_Handle_TPL(aneos spheral_depends cxx) -endif() -if (ENABLE_OPENSUBDIV) - Spheral_Handle_TPL(opensubdiv spheral_depends cxx) +if(ENABLE_OPENSUBDIV) + list(APPEND SPHERAL_EXTERN_LIBS opensubdiv) endif() if(ENABLE_TIMER) - Spheral_Handle_TPL(caliper spheral_depends cxx) + list(APPEND SPHERAL_EXTERN_LIBS caliper) endif() - -# Only needed when building the python interface of spheral if(NOT ENABLE_CXXONLY) - Spheral_Handle_TPL(python spheral_depends cxx) - #Spheral_Handle_TPL(pyb11generator spheral_depends py) - #Spheral_Handle_TPL(pybind11 spheral_depends py) + list(APPEND SPHERAL_EXTERN_LIBS python) endif() -Spheral_Handle_TPL(polytope spheral_depends cxx) -#Spheral_Handle_TPL(polyclipper spheral_depends cxx) +# Initialize TPL options +include(${SPHERAL_ROOT_DIR}/cmake/spheral/SpheralHandleTPL.cmake) + +foreach(lib ${SPHERAL_EXTERN_PACKAGES}) + # Not sure why but _lib becomes an empty string after find_package so + # _lib must be added to list before find package + list(APPEND spheral_blt_depends ${lib}) + find_package(${lib} REQUIRED QUIET NO_DEFAULT_PATH PATHS ${${lib}_DIR}/lib/cmake) +endforeach() +# Add fmt library to external library list +list(APPEND spheral_blt_depends fmt) +blt_patch_target(NAME fmt TREAT_INCLUDES_AS_SYSTEM ON) + +# Create target library for each external library +foreach(lib ${SPHERAL_EXTERN_LIBS}) + Spheral_Handle_TPL(${lib} FALSE) + list(APPEND spheral_blt_depends ${lib}) +endforeach() +# Install each TPL target library +foreach(lib ${SPHERAL_EXTERN_LIBS}) + get_target_property(_is_imported ${lib} IMPORTED) + if(NOT ${_is_imported}) + install(TARGETS ${lib} + EXPORT spheral_cxx-targets + DESTINATION lib/cmake) + set_target_properties(${lib} PROPERTIES EXPORT_NAME spheral::${lib}) + endif() +endforeach() +# Make the list of all TPLs global +set_property(GLOBAL PROPERTY spheral_blt_depends "${spheral_blt_depends}") if (EXISTS ${EXTERNAL_SPHERAL_TPL_CMAKE}) include(${EXTERNAL_SPHERAL_TPL_CMAKE}) diff --git a/cmake/SetupSpheral.cmake b/cmake/SetupSpheral.cmake index 690c050ea..0c0c9a9c4 100644 --- a/cmake/SetupSpheral.cmake +++ b/cmake/SetupSpheral.cmake @@ -36,6 +36,14 @@ endif() include(${SPHERAL_BLT_DIR}/SetupBLT.cmake) +#------------------------------------------------------------------------------- +# Set global variables used for dependencies +#------------------------------------------------------------------------------- +set_property(GLOBAL PROPERTY spheral_blt_depends) + +# These are includes for packages that are git submodules +set_property(GLOBAL PROPERTY SPHERAL_SUBMOD_INCLUDES) + #------------------------------------------------------------------------------- # Include standard build system logic and options / definitions #------------------------------------------------------------------------------- diff --git a/cmake/SpheralConfig.cmake b/cmake/SpheralConfig.cmake new file mode 100644 index 000000000..4f51f2d8a --- /dev/null +++ b/cmake/SpheralConfig.cmake @@ -0,0 +1,28 @@ + +message(STATUS "Configuring Spheral version ${SPHERAL_VERSION}") + +set(SPHERAL_INSTALL_INCLUDE_DIR "include" CACHE STRING "") +set(SPHERAL_INSTALL_CONFIG_DIR "lib" CACHE STRING "") +set(SPHERAL_INSTALL_LIB_DIR "lib" CACHE STRING "") +set(SPHERAL_INSTALL_BIN_DIR "bin" CACHE STRING "") +set(SPHERAL_INSTALL_CMAKE_MODULE_DIR "${SPHERAL_INSTALL_CONFIG_DIR}/cmake" CACHE STRING "") +set(SPHERAL_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} CACHE STRING "" FORCE) +set(SPHERAL_INSTALL_SPHERAL "Spheral" CACHE STRING "") + +include(CMakePackageConfigHelpers) + +configure_package_config_file( + ${SPHERAL_ROOT_DIR}/cmake/spheral_cxx-config.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/spheral_cxx-config.cmake + INSTALL_DESTINATION ${SPHERAL_INSTALL_CONFIG_DIR} + PATH_VARS + SPHERAL_INSTALL_INCLUDE_DIR + SPHERAL_INSTALL_LIB_DIR + SPHERAL_INSTALL_BIN_DIR + SPHERAL_INSTALL_CMAKE_MODULE_DIR + SPHERAL_INSTALL_SPHERAL +) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/spheral_cxx-config.cmake + DESTINATION ${SPHERAL_INSTALL_CMAKE_MODULE_DIR} +) + diff --git a/cmake/spheral/SpheralAddLibs.cmake b/cmake/spheral/SpheralAddLibs.cmake index 935067cd9..3bd5c61b5 100644 --- a/cmake/spheral/SpheralAddLibs.cmake +++ b/cmake/spheral/SpheralAddLibs.cmake @@ -18,51 +18,53 @@ # - List of blt/libs the library depends on # #----------------------------------------------------------------------------------- -function(spheral_add_obj_library - package_name) +function(spheral_add_obj_library package_name) - set(obj_libs_list SPHERAL_OBJ_LIBS) - - # We can optionally specify the obj_libs_list set(extra_args ${ARGN}) list(LENGTH extra_args extra_count) if (${extra_count} GREATER 0) list(GET extra_args 0 obj_libs_list) endif() - + get_property(spheral_blt_depends GLOBAL PROPERTY spheral_blt_depends) blt_add_library(NAME Spheral_${package_name} - HEADERS ${${package_name}_headers} - SOURCES ${${package_name}_sources} - DEPENDS_ON ${spheral_blt_depends} ${spheral_blt_cxx_depends} ${${package_name}_ADDITIONAL_DEPENDS} ${SPHERAL_CXX_DEPENDS} - OBJECT TRUE - ) - target_include_directories(Spheral_${package_name} PRIVATE ${SPHERAL_INCLUDES}) - target_include_directories(Spheral_${package_name} SYSTEM PRIVATE ${SPHERAL_EXTERN_INCLUDES}) - + HEADERS ${${package_name}_headers} + SOURCES ${${package_name}_sources} + DEPENDS_ON ${spheral_blt_depends} ${${package_name}_ADDITIONAL_DEPENDS} ${SPHERAL_CXX_DEPENDS} + OBJECT TRUE) + target_include_directories(Spheral_${package_name} SYSTEM PUBLIC ${SPHERAL_SUBMOD_INCLUDES}) # Install the headers - install(FILES ${${package_name}_headers} - DESTINATION include/${package_name} - ) + install(FILES ${${package_name}_headers} + DESTINATION include/${package_name}) if(ENABLE_CUDA) set_target_properties(Spheral_${package_name} PROPERTIES CUDA_SEPARABLE_COMPILATION ON) endif() - # Add this to the obj_libs_list list - get_property(${obj_libs_list} GLOBAL PROPERTY ${obj_libs_list}) - list(APPEND ${obj_libs_list} Spheral_${package_name}) - set_property(GLOBAL PROPERTY ${obj_libs_list} "${${obj_libs_list}}") - endfunction() -#----------------------------------------------------------------------------------- -# spheral_add_cxx_library -# - same interface as spheral_add_obj_library -#----------------------------------------------------------------------------------- -function(spheral_add_cxx_library - package_name) - - set(obj_libs_list SPHERAL_OBJ_LIBS) +#---------------------------------------------------------------------------------------- +# spheral_add_cxx_library +#---------------------------------------------------------------------------------------- +# ------------------------------------------- +# VARIBALES THAT NEED TO BE PREVIOUSLY DEFINED +# ------------------------------------------- +# spheral_blt_depends : REQUIRED : List of external dependencies +# SPHERAL_SUBMOD_DEPENDS : REQUIRED : List of submodule dependencies + +# ---------------------- +# INPUT-OUTPUT VARIBALES +# ---------------------- +# : REQUIRED : Desired package name +# : REQUIRED : List of internal targets to include + +# ----------------------- +# OUTPUT VARIABLES TO USE - Made available implicitly after function call +# ----------------------- +# : Exportable target for interal package name library +#---------------------------------------------------------------------------------------- +function(spheral_add_cxx_library package_name obj_libs_list) + + get_property(spheral_blt_depends GLOBAL PROPERTY spheral_blt_depends) set(EXTRA_CXX_DEPENDS ) # We can optionally specify the obj_libs_list and any additional dependencies @@ -75,47 +77,37 @@ function(spheral_add_cxx_library list(GET extra_args 1 optional_arg) list(APPEND EXTRA_CXX_DEPENDS ${optional_arg}) endif() - get_property(${obj_libs_list} GLOBAL PROPERTY ${obj_libs_list}) + get_property(SPHERAL_SUBMOD_INCLUDES GLOBAL PROPERTY SPHERAL_SUBMOD_INCLUDES) if(NOT ENABLE_SHARED) # Build static spheral C++ library blt_add_library(NAME Spheral_${package_name} - HEADERS ${${package_name}_headers} - SOURCES ${${package_name}_sources} - DEPENDS_ON ${${obj_libs_list}} ${SPHERAL_CXX_DEPENDS} ${EXTRA_CXX_DEPENDS} - SHARED FALSE - ) + HEADERS ${${package_name}_headers} + SOURCES ${${package_name}_sources} + DEPENDS_ON ${obj_libs_list} ${spheral_blt_depends} ${EXTRA_CXX_DEPENDS} ${SPHERAL_CXX_DEPENDS} + SHARED FALSE) else() # Build shared spheral C++ library blt_add_library(NAME Spheral_${package_name} - HEADERS ${${package_name}_headers} - SOURCES ${${package_name}_sources} - DEPENDS_ON ${${obj_libs_list}} ${SPHERAL_CXX_DEPENDS} ${EXTRA_CXX_DEPENDS} - SHARED TRUE - ) + HEADERS ${${package_name}_headers} + SOURCES ${${package_name}_sources} + DEPENDS_ON ${obj_libs_list} ${spheral_blt_depends} ${EXTRA_CXX_DEPENDS} ${SPHERAL_CXX_DEPENDS} + SHARED TRUE) endif() - - get_target_property(_INTERFACE_INCLUDE_DIRECTORIES Spheral_${package_name} INTERFACE_INCLUDE_DIRECTORIES) - set_target_properties(Spheral_${package_name} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "$") - - get_target_property(_LINK_LIBRARIES Spheral_${package_name} LINK_LIBRARIES) - LIST(REMOVE_DUPLICATES _LINK_LIBRARIES) - set_target_properties(Spheral_${package_name} PROPERTIES LINK_LIBRARIES "${_LINK_LIBRARIES};${_LINK_LIBRARIES}") + target_include_directories(Spheral_${package_name} SYSTEM PRIVATE ${SPHERAL_SUBMOD_INCLUDES}) if(ENABLE_CUDA) set_target_properties(Spheral_${package_name} PROPERTIES CUDA_SEPARABLE_COMPILATION ON) endif() # Install Spheral C++ target and set it as an exportable CMake target - install(TARGETS Spheral_${package_name} - DESTINATION lib - EXPORT ${PROJECT_NAME}-targets - ) + install(TARGETS Spheral_${package_name} + DESTINATION lib + EXPORT spheral_cxx-targets) # Set the r-path of the C++ lib such that it is independent of the build dir when installed set_target_properties(Spheral_${package_name} PROPERTIES - INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib;${conduit_DIR}/lib;${axom_DIR}/lib;${boost_DIR}/lib;${hdf5_DIR}/lib;${zlib_DIR}/lib;${SPHERAL_ADDITIONAL_RPATHS}" - ) + INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib;${conduit_DIR}/lib;${axom_DIR}/lib;${boost_DIR}/lib;${hdf5_DIR}/lib;${zlib_DIR}/lib;${SPHERAL_ADDITIONAL_RPATHS}") endfunction() @@ -215,15 +207,15 @@ function(spheral_add_pybind11_library package_name) EXTRA_SOURCE ${${package_name}_SOURCES} INSTALL OFF ) - target_include_directories(${package_name} SYSTEM PRIVATE ${SPHERAL_EXTERN_INCLUDES}) - target_compile_options(${package_name} PRIVATE ${SPHERAL_PYB11_TARGET_FLAGS}) + target_include_directories(${MODULE_NAME} SYSTEM PRIVATE ${SPHERAL_EXTERN_INCLUDES}) + target_compile_options(${MODULE_NAME} PRIVATE ${SPHERAL_PYB11_TARGET_FLAGS}) - install(TARGETS ${package_name} + install(TARGETS ${MODULE_NAME} DESTINATION Spheral ) # Set the r-path of the C++ lib such that it is independent of the build dir when installed - set_target_properties(${package_name} PROPERTIES + set_target_properties(${MODULE_NAME} PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib;${conduit_DIR}/lib;${axom_DIR}/lib;${boost_DIR}/lib;${python_DIR}/lib;${hdf5_DIR}/lib;${zlib_DIR}/lib;${SPHERAL_ADDITIONAL_RPATHS}" ) diff --git a/cmake/spheral/SpheralHandleTPL.cmake b/cmake/spheral/SpheralHandleTPL.cmake index c5bc5be06..47b7672d0 100644 --- a/cmake/spheral/SpheralHandleTPL.cmake +++ b/cmake/spheral/SpheralHandleTPL.cmake @@ -1,125 +1,81 @@ -# Initialize commonly used paths during TPL installs -set(CACHE_DIR ${CMAKE_BINARY_DIR}/tpl/cache) -set(PATCH_DIR ${SPHERAL_ROOT_DIR}/src/tpl/patch) -set(TPL_CMAKE_DIR ${SPHERAL_ROOT_DIR}/cmake/tpl) - -# Verboseness of TPL builds -if (TPL_VERBOSE) - set(OUT_PROTOCOL_EP 0) -else() - set(OUT_PROTOCOL_EP 1) - set(OUT_PROTOCOL_PIP "-q") -endif() - -# Set the build directory for TPL to default to BUILD/Spheral-tpl if SPHERAL_TPL_DIR -# is not set. -if (NOT SPHERAL_TPL_DIR) - get_filename_component(DEFAULT_TPL_LOCATION ${CMAKE_BINARY_DIR}/Spheral/tpl ABSOLUTE) -else() - if (NOT IS_ABSOLUTE ${SPHERAL_TPL_DIR}) - set(SPHERAL_TPL_DIR ${CMAKE_BINARY_DIR}/${SPHERAL_TPL_DIR}) - endif() - get_filename_component(DEFAULT_TPL_LOCATION ${SPHERAL_TPL_DIR} ABSOLUTE) -endif() -message("Default TPL location : ${DEFAULT_TPL_LOCATION}\n") #---------------------------------------------------------------------------------------- # Spheral_Handle_TPL #---------------------------------------------------------------------------------------- # ------------------------------------------- -# VARIBALES THAT NEED TO BE PREVIOSLY DEFINED +# VARIBALES THAT NEED TO BE PREVIOUSLY DEFINED # ------------------------------------------- -# BUILD_TPL : REQUIRED : Set at configure time defines weather to search or build tpl. -# _DIR : OPTIONAL : The installation location of the tpl, if installed or not. -# If not set and BUILD_TPL=On will be installed to a -# default loc. +# TPL_CMAKE_DIR : REQUIRED : Directory containing files for each TPL +# listing their library names +# _DIR : REQUIRED : The installation location of the TPL # ---------------------- # INPUT-OUTPUT VARIBALES # ---------------------- -# : REQUIRED : The name of the target tpl -# : REQUIRED : list that appends new target to itself. +# : REQUIRED : The name of the target TPL # ----------------------- -# OUTPUT VARIABLES TO USE - Made available implicitly after funciton call. +# OUTPUT VARIABLES TO USE - Made available implicitly after function call # ----------------------- -# _libs : list of full paths to tpl lib files to be linked to. +# : Exportable target for the TPL #---------------------------------------------------------------------------------------- -function(Spheral_Handle_TPL lib_name dep_list target_type) +function(Spheral_Handle_TPL lib_name) - # If no location to search is sepcified, search default dir + # Make shortcut variable for directory assigned to ${lib_name}_DIR + set(lib_dir "${${lib_name}_DIR}") if (NOT ${lib_name}_DIR) - message("${lib_name}_DIR not set.") + message(FATAL_ERROR "${lib_name}_DIR not set.") else() message("${lib_name}_DIR set.") message("Searching ${lib_name} for : ${${lib_name}_DIR}") endif() - # Default this flag for the TPL to be added as a BLT lib, - # in the .cmake file we may change this so as not to - # add a blt lib component - set(${lib_name}_ADD_BLT_TARGET ON) - - # Include the actual .cmake file + # Find libraries + set(${lib_name}_libs "") + # Library names to be set in .cmake file include(${TPL_CMAKE_DIR}/${lib_name}.cmake) - - if (NOT DEFINED ${lib_name}_NO_INCLUDES) - list(APPEND ${lib_name}_INCLUDES $) + string(COMPARE EQUAL "${${lib_name}_libs}" "" lib_test) + # If library names are given, find them + if(NOT lib_test) + find_library(${lib_name}_LIBRARIES NAMES ${${lib_name}_libs} + PATHS ${lib_dir}/lib + NO_DEFAULT_PATH + NO_CMAKE_ENVIRONMENT_PATH + NO_CMAKE_PATH + NO_SYSTEM_ENVIRONMENT_PATH + NO_CMAKE_SYSTEM_PATH) + message("Importing libraries for ${lib_name}") + message("") endif() - # Generate full path to lib file for output list - set(${lib_name}_LIBRARIES ) - foreach(libpath ${${lib_name}_libs}) - if(IS_ABSOLUTE ${libpath}) - get_filename_component(lib ${libpath} NAME) - set(temp_abs_path ${libpath}) - else() - set(lib ${libpath}) - find_file(temp_abs_path - NAME ${lib} - PATHS ${${lib_name}_DIR} - PATH_SUFFIXES lib lib64 - NO_CACHE - NO_DEFAULT_PATH - ) + # Find includes by assuming they are explicitly provided as ${lib_name}_INCLUDES + set(${lib_name}_INCLUDE_DIR ${${lib_name}_INCLUDES}) + + # If include directories are not explicity set, look for an include directory + string(COMPARE EQUAL "${${lib_name}_INCLUDE_DIR}" "" incl_test) + if(incl_test) # Includes are not explicitly provided + # Look for an include directory but it isn't required + if(EXISTS "${lib_dir}/include/") + set(${lib_name}_INCLUDE_DIR "${lib_dir}/include") + message("Importing includes for ${lib_name}") + message("") endif() - # set(temp_abs_path "${${lib_name}_DIR}/lib/${lib}") - list(APPEND ${lib_name}_LIBRARIES $) - - # Check all necessary files exist during config time when not installing TPL - if (NOT EXISTS ${temp_abs_path}) - message(FATAL_ERROR "Cannot find ${lib} in ${${lib_name}_DIR} for TPL ${lib_name}. Full path: ${tmp_abs_path}") + else() # Includes are explicitly provided + # Check to be sure they exist + if(EXISTS ${${lib_name}_INCLUDE_DIR}) + message("Importing includes for ${lib_name}") + message("") else() - message("Found: ${temp_abs_path}") + message(FATAL_ERROR "Include directories for ${lib_name} not found") endif() - - # find_file treats output as a standard variable from 3.21+ We get different behavior on later CMake versions. - if(${CMAKE_VERSION} VERSION_LESS "3.21.0") - unset(temp_abs_path CACHE) - else() - unset(temp_abs_path) - endif() - - endforeach() - - # Register any libs/includes under a blt dir for later use/depends - blt_register_library(NAME blt_${lib_name} - INCLUDES ${${lib_name}_INCLUDES} - LIBRARIES ${${lib_name}_LIBRARIES} - TREAT_INCLUDES_AS_SYSTEM On - ) - - # Add the blt target to a list of libs that can be depended on - if (${lib_name}_ADD_BLT_TARGET) - list(APPEND spheral_blt_${target_type}_depends blt_${lib_name}) endif() - set(${lib_name}_DIR ${${lib_name}_DIR} PARENT_SCOPE) - set(${dep_list} ${${dep_list}} PARENT_SCOPE) - set(spheral_blt_${target_type}_depends ${spheral_blt_${target_type}_depends} PARENT_SCOPE) - - message("") - + blt_import_library(NAME ${lib_name} + TREAT_INCLUDE_AS_SYSTEM ON + INCLUDES ${${lib_name}_INCLUDE_DIR} + LIBRARIES ${${lib_name}_LIBRARIES} + EXPORTABLE ON) + # INCLUDE $ $ endfunction() diff --git a/cmake/spheral_cxx-config.cmake.in b/cmake/spheral_cxx-config.cmake.in new file mode 100644 index 000000000..f0e29f807 --- /dev/null +++ b/cmake/spheral_cxx-config.cmake.in @@ -0,0 +1,24 @@ + +@PACKAGE_INIT@ + +set(ENABLE_CXXONLY "@ENABLE_CXXONLY@") +set(axom_DIR "@axom_DIR@" CACHE PATH "") +set(silo_DIR "@silo_DIR@" CACHE PATH "") +set(hdf5_DIR "@hdf5_DIR@" CACHE PATH "") +set(eigen_DIR "@eigen_DIR@" CACHE PATH "") +set(eigen_INCLUDES "@eigen_INCLUDES@" CACHE PATH "") +set(polytope_DIR "@polytope_DIR@" CACHE PATH "") +set(boost_DIR "@boost_DIR@" CACHE PATH "") +set(qhull_DIR "@qhull_DIR@" CACHE PATH "") + +set(SPHERAL_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@") +set(SPHERAL_INCLUDE_DIRS "${SPHERAL_INSTALL_PREFIX}/include") +find_package(axom REQUIRED QUIET NO_DEFAULT_PATH PATHS ${axom_DIR}/lib/cmake) +include("${SPHERAL_INSTALL_PREFIX}/lib/cmake/spheral_cxx-targets.cmake") + +set_property(TARGET Spheral_CXX + APPEND PROPERTY + INTERFACE_INCLUDE_DIRECTORIES ${SPHERAL_INCLUDE_DIRS} +) + +set(spheral_cxx_FOUND TRUE) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b15cd4de9..d1bd7a49c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -67,7 +67,10 @@ foreach(e_package ${extra_packages}) endforeach() set(CXX_sources spheralCXX.cc) +set(cxx_obj_list ) +foreach(_package ${_packages}) + list(APPEND cxx_obj_list Spheral_${_package}) +endforeach() +spheral_add_cxx_library(CXX ${cxx_obj_list}) -spheral_add_cxx_library(CXX) - -install(EXPORT ${PROJECT_NAME}-targets DESTINATION Spheral/lib/cmake) +install(EXPORT spheral_cxx-targets DESTINATION lib/cmake) diff --git a/src/CXXTests/CMakeLists.txt b/src/CXXTests/CMakeLists.txt index 69a635fc0..42c59eb8d 100644 --- a/src/CXXTests/CMakeLists.txt +++ b/src/CXXTests/CMakeLists.txt @@ -2,7 +2,7 @@ get_property(SPHERAL_CXX_LIBS GLOBAL PROPERTY SPHERAL_CXX_LIBS) add_subdirectory(DeviceTestLib) -if(ENABLE_TESTS) +if(ENABLE_TESTS AND ENABLE_CUDA) blt_add_executable( NAME spheral_cuda_test SOURCES Spheral_CUDA_Test.cc DEPENDS_ON Spheral_CXX ${spheral_blt_cxx_depends}) From 746fc0ef70574488cfc67578b3a423aead4f8ef7 Mon Sep 17 00:00:00 2001 From: Landon Owen Date: Mon, 11 Sep 2023 09:49:56 -0700 Subject: [PATCH 02/23] SpheralC tests are working with this export configuration, next is working on python build --- cmake/Compilers.cmake | 2 + cmake/InstallTPLs.cmake | 4 +- cmake/SetupSpheral.cmake | 21 ++------- cmake/spheral/SpheralAddLibs.cmake | 29 ++++++------ cmake/spheral/SpheralHandleTPL.cmake | 2 +- cmake/spheral_cxx-config.cmake.in | 58 ++++++++++++++++++------ src/CMakeLists.txt | 9 ++-- src/CXXTests/DeviceTestLib/DeviceTest.cc | 2 +- src/CXXTests/DeviceTestLib/DeviceTest.hh | 2 +- 9 files changed, 77 insertions(+), 52 deletions(-) diff --git a/cmake/Compilers.cmake b/cmake/Compilers.cmake index b19b31480..9110e6b08 100644 --- a/cmake/Compilers.cmake +++ b/cmake/Compilers.cmake @@ -19,6 +19,8 @@ if (ENABLE_WARNINGS) else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w") endif() +# This prevents all of the warnings for Polyclipper +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-local-typedefs") message("-- Compiler warnings ${ENABLE_WARNINGS}") if (ENABLE_WARNINGS_AS_ERRORS) diff --git a/cmake/InstallTPLs.cmake b/cmake/InstallTPLs.cmake index fb7cd37ff..19406c591 100644 --- a/cmake/InstallTPLs.cmake +++ b/cmake/InstallTPLs.cmake @@ -83,6 +83,7 @@ foreach(lib ${SPHERAL_EXTERN_LIBS}) Spheral_Handle_TPL(${lib} FALSE) list(APPEND spheral_blt_depends ${lib}) endforeach() + # Install each TPL target library foreach(lib ${SPHERAL_EXTERN_LIBS}) get_target_property(_is_imported ${lib} IMPORTED) @@ -93,8 +94,7 @@ foreach(lib ${SPHERAL_EXTERN_LIBS}) set_target_properties(${lib} PROPERTIES EXPORT_NAME spheral::${lib}) endif() endforeach() -# Make the list of all TPLs global -set_property(GLOBAL PROPERTY spheral_blt_depends "${spheral_blt_depends}") +# Note: spheral_blt_depends is made global after this in SetupSpheral.cmake if (EXISTS ${EXTERNAL_SPHERAL_TPL_CMAKE}) include(${EXTERNAL_SPHERAL_TPL_CMAKE}) diff --git a/cmake/SetupSpheral.cmake b/cmake/SetupSpheral.cmake index 0c0c9a9c4..f1f654927 100644 --- a/cmake/SetupSpheral.cmake +++ b/cmake/SetupSpheral.cmake @@ -36,14 +36,6 @@ endif() include(${SPHERAL_BLT_DIR}/SetupBLT.cmake) -#------------------------------------------------------------------------------- -# Set global variables used for dependencies -#------------------------------------------------------------------------------- -set_property(GLOBAL PROPERTY spheral_blt_depends) - -# These are includes for packages that are git submodules -set_property(GLOBAL PROPERTY SPHERAL_SUBMOD_INCLUDES) - #------------------------------------------------------------------------------- # Include standard build system logic and options / definitions #------------------------------------------------------------------------------- @@ -125,15 +117,12 @@ set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}") set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) #------------------------------------------------------------------------------- -# We need the set of Spheral C++ libraries globally -#------------------------------------------------------------------------------- -set_property(GLOBAL PROPERTY SPHERAL_CXX_LIBS) - -#------------------------------------------------------------------------------- -# Also globally set the variable for the list we accumulate the obj files from -# each library into +# Set global variables used for dependencies #------------------------------------------------------------------------------- -set_property(GLOBAL PROPERTY SPHERAL_OBJ_LIBS) +# List of external dependencies +set_property(GLOBAL PROPERTY spheral_blt_depends "${spheral_blt_depends}") +# List of compiler dependencies +set_property(GLOBAL PROPERTY SPHERAL_CXX_DEPENDS "${SPHERAL_CXX_DEPENDS}") #------------------------------------------------------------------------------- # Prepare to build the src diff --git a/cmake/spheral/SpheralAddLibs.cmake b/cmake/spheral/SpheralAddLibs.cmake index 3bd5c61b5..0cae9a34e 100644 --- a/cmake/spheral/SpheralAddLibs.cmake +++ b/cmake/spheral/SpheralAddLibs.cmake @@ -19,14 +19,17 @@ # #----------------------------------------------------------------------------------- function(spheral_add_obj_library package_name) + # Assumes global variable spheral_blt_depends exists and is filled with external dependencies + get_property(spheral_blt_depends GLOBAL PROPERTY spheral_blt_depends) + # Assumes global variable spheral_cxx_depends exists and is filled with compiler dependencies + get_property(SPHERAL_CXX_DEPENDS GLOBAL PROPERTY SPHERAL_CXX_DEPENDS) set(extra_args ${ARGN}) list(LENGTH extra_args extra_count) if (${extra_count} GREATER 0) list(GET extra_args 0 obj_libs_list) endif() - get_property(spheral_blt_depends GLOBAL PROPERTY spheral_blt_depends) - blt_add_library(NAME Spheral_${package_name} + blt_add_library(NAME Spheral_${package_name} HEADERS ${${package_name}_headers} SOURCES ${${package_name}_sources} DEPENDS_ON ${spheral_blt_depends} ${${package_name}_ADDITIONAL_DEPENDS} ${SPHERAL_CXX_DEPENDS} @@ -55,47 +58,46 @@ endfunction() # INPUT-OUTPUT VARIBALES # ---------------------- # : REQUIRED : Desired package name -# : REQUIRED : List of internal targets to include +# <_cxx_obj_list> : REQUIRED : List of internal targets to include # ----------------------- # OUTPUT VARIABLES TO USE - Made available implicitly after function call # ----------------------- # : Exportable target for interal package name library #---------------------------------------------------------------------------------------- -function(spheral_add_cxx_library package_name obj_libs_list) +function(spheral_add_cxx_library package_name _cxx_obj_list) get_property(spheral_blt_depends GLOBAL PROPERTY spheral_blt_depends) - set(EXTRA_CXX_DEPENDS ) + get_property(SPHERAL_CXX_DEPENDS GLOBAL PROPERTY SPHERAL_CXX_DEPENDS) + set(EXTRA_CXX_DEPENDS ) # We can optionally specify the obj_libs_list and any additional dependencies set(extra_args ${ARGN}) list(LENGTH extra_args extra_count) if (${extra_count} GREATER 0) - list(GET extra_args 0 obj_libs_list) + list(GET extra_args 0 spheral_blt_depends) endif() if (${extra_count} GREATER 1) list(GET extra_args 1 optional_arg) list(APPEND EXTRA_CXX_DEPENDS ${optional_arg}) endif() get_property(SPHERAL_SUBMOD_INCLUDES GLOBAL PROPERTY SPHERAL_SUBMOD_INCLUDES) - if(NOT ENABLE_SHARED) # Build static spheral C++ library - blt_add_library(NAME Spheral_${package_name} + blt_add_library(NAME Spheral_${package_name} HEADERS ${${package_name}_headers} SOURCES ${${package_name}_sources} - DEPENDS_ON ${obj_libs_list} ${spheral_blt_depends} ${EXTRA_CXX_DEPENDS} ${SPHERAL_CXX_DEPENDS} + DEPENDS_ON ${_cxx_obj_list} ${spheral_blt_depends} ${EXTRA_CXX_DEPENDS} ${SPHERAL_CXX_DEPENDS} SHARED FALSE) else() # Build shared spheral C++ library blt_add_library(NAME Spheral_${package_name} HEADERS ${${package_name}_headers} SOURCES ${${package_name}_sources} - DEPENDS_ON ${obj_libs_list} ${spheral_blt_depends} ${EXTRA_CXX_DEPENDS} ${SPHERAL_CXX_DEPENDS} + DEPENDS_ON ${_cxx_obj_list} ${spheral_blt_depends} ${EXTRA_CXX_DEPENDS} ${SPHERAL_CXX_DEPENDS} SHARED TRUE) endif() target_include_directories(Spheral_${package_name} SYSTEM PRIVATE ${SPHERAL_SUBMOD_INCLUDES}) - if(ENABLE_CUDA) set_target_properties(Spheral_${package_name} PROPERTIES CUDA_SEPARABLE_COMPILATION ON) endif() @@ -106,8 +108,9 @@ function(spheral_add_cxx_library package_name obj_libs_list) EXPORT spheral_cxx-targets) # Set the r-path of the C++ lib such that it is independent of the build dir when installed - set_target_properties(Spheral_${package_name} PROPERTIES - INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib;${conduit_DIR}/lib;${axom_DIR}/lib;${boost_DIR}/lib;${hdf5_DIR}/lib;${zlib_DIR}/lib;${SPHERAL_ADDITIONAL_RPATHS}") + # TODO: Determine if this is still necessary + # set_target_properties(Spheral_${package_name} PROPERTIES + # INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib;${conduit_DIR}/lib;${axom_DIR}/lib;${boost_DIR}/lib;${hdf5_DIR}/lib;${zlib_DIR}/lib;${SPHERAL_ADDITIONAL_RPATHS}") endfunction() diff --git a/cmake/spheral/SpheralHandleTPL.cmake b/cmake/spheral/SpheralHandleTPL.cmake index 47b7672d0..c7dbbf9b7 100644 --- a/cmake/spheral/SpheralHandleTPL.cmake +++ b/cmake/spheral/SpheralHandleTPL.cmake @@ -9,6 +9,7 @@ # TPL_CMAKE_DIR : REQUIRED : Directory containing files for each TPL # listing their library names # _DIR : REQUIRED : The installation location of the TPL +# _INCLUDES : OPTIONAL : Specific includes for the TPL # ---------------------- # INPUT-OUTPUT VARIBALES @@ -77,5 +78,4 @@ function(Spheral_Handle_TPL lib_name) INCLUDES ${${lib_name}_INCLUDE_DIR} LIBRARIES ${${lib_name}_LIBRARIES} EXPORTABLE ON) - # INCLUDE $ $ endfunction() diff --git a/cmake/spheral_cxx-config.cmake.in b/cmake/spheral_cxx-config.cmake.in index f0e29f807..d76b58bbf 100644 --- a/cmake/spheral_cxx-config.cmake.in +++ b/cmake/spheral_cxx-config.cmake.in @@ -2,23 +2,53 @@ @PACKAGE_INIT@ set(ENABLE_CXXONLY "@ENABLE_CXXONLY@") -set(axom_DIR "@axom_DIR@" CACHE PATH "") -set(silo_DIR "@silo_DIR@" CACHE PATH "") -set(hdf5_DIR "@hdf5_DIR@" CACHE PATH "") -set(eigen_DIR "@eigen_DIR@" CACHE PATH "") -set(eigen_INCLUDES "@eigen_INCLUDES@" CACHE PATH "") -set(polytope_DIR "@polytope_DIR@" CACHE PATH "") -set(boost_DIR "@boost_DIR@" CACHE PATH "") -set(qhull_DIR "@qhull_DIR@" CACHE PATH "") - -set(SPHERAL_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@") -set(SPHERAL_INCLUDE_DIRS "${SPHERAL_INSTALL_PREFIX}/include") -find_package(axom REQUIRED QUIET NO_DEFAULT_PATH PATHS ${axom_DIR}/lib/cmake) -include("${SPHERAL_INSTALL_PREFIX}/lib/cmake/spheral_cxx-targets.cmake") +set(SPHERAL_ENABLE_CUDA "@ENABLE_CUDA@") +set(SPHERAL_ENABLE_MPI "@ENABLE_MPI@") +set(SPHERAL_ENABLE_OPENMP "@ENABLE_OPENMP@") +# TODO: Add check to avoid setting these when unnecessary +set(CMAKE_C_COMPILER "@CMAKE_C_COMPILER@" CACHE PATH "") +set(CMAKE_CXX_COMPILER "@CMAKE_CXX_COMPILER@" CACHE PATH "") +set(CMAKE_Fortran_COMPILER "@CMAKE_Fortran_COMPILER@" CACHE PATH "") +set(MPI_C_COMPILER "@MPI_C_COMPILER@" CACHE PATH "") +set(MPI_CXX_COMPILER "@MPI_CXX_COMPILER@" CACHE PATH "") +set(MPI_Fortran_COMPILER "@MPI_Fortran_COMPILER@" CACHE PATH "") +set(MPIEXEC_EXECUTABLE "@MPIEXEC_EXECUTABLE@" CACHE PATH "") +set(MPIEXEC_NUMPROC_FLAG "@MPIEXEC_NUMPROC_FLAG@" CACHE STRING "") +set(-DMPI_C_COMPILER "@-DMPI_C_COMPILER@" CACHE PATH "") +set(-DMPI_CXX_COMPILER "@-DMPI_CXX_COMPILER@" CACHE PATH "") +if(NOT axom_DIR) + set(axom_DIR "@axom_DIR@" CACHE PATH "") +endif() +if(NOT silo_DIR) + set(silo_DIR "@silo_DIR@" CACHE PATH "") +endif() +if(NOT hdf5_DIR) + set(hdf5_DIR "@hdf5_DIR@" CACHE PATH "") +endif() +if(NOT eigen_DIR) + set(eigen_DIR "@eigen_DIR@" CACHE PATH "") + set(eigen_INCLUDES "@eigen_INCLUDES@" CACHE PATH "") +endif() +if(NOT polytope_DIR) + set(polytope_DIR "@polytope_DIR@" CACHE PATH "") +endif() +if(NOT boost_DIR) + set(boost_DIR "@boost_DIR@" CACHE PATH "") +endif() +if(NOT qhull_DIR) + set(qhull_DIR "@qhull_DIR@" CACHE PATH "") +endif() +set(SPHERAL_CXX_ROOT_DIR "@SPHERAL_ROOT_DIR@") +set(SPHERAL_CXX_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@") +set(SPHERAL_CXX_INCLUDE_DIRS "${SPHERAL_CXX_INSTALL_PREFIX}/include") +if(NOT TARGET axom) + find_package(axom REQUIRED QUIET NO_DEFAULT_PATH PATHS ${axom_DIR}/lib/cmake) +endif() +include("${SPHERAL_CXX_INSTALL_PREFIX}/lib/cmake/spheral_cxx-targets.cmake") set_property(TARGET Spheral_CXX APPEND PROPERTY - INTERFACE_INCLUDE_DIRECTORIES ${SPHERAL_INCLUDE_DIRS} + INTERFACE_INCLUDE_DIRECTORIES ${SPHERAL_CXX_INCLUDE_DIRS} ) set(spheral_cxx_FOUND TRUE) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d1bd7a49c..b4f905a60 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -15,7 +15,6 @@ list(APPEND _packages ArtificialConduction Boundary CRKSPH - CXXTests Damage DataBase DataOutput @@ -56,7 +55,8 @@ endif() configure_file(config.hh.in ${PROJECT_BINARY_DIR}/src/config.hh) - +# CXXTests should be added but not made into a target +add_subdirectory(CXXTests) foreach(_package ${_packages}) add_subdirectory(${_package}) endforeach() @@ -69,8 +69,9 @@ endforeach() set(CXX_sources spheralCXX.cc) set(cxx_obj_list ) foreach(_package ${_packages}) - list(APPEND cxx_obj_list Spheral_${_package}) + list(APPEND cxx_obj_list "Spheral_${_package}") endforeach() -spheral_add_cxx_library(CXX ${cxx_obj_list}) +# Must use quotes when passing lists as inputs for functions +spheral_add_cxx_library(CXX "${cxx_obj_list}") install(EXPORT spheral_cxx-targets DESTINATION lib/cmake) diff --git a/src/CXXTests/DeviceTestLib/DeviceTest.cc b/src/CXXTests/DeviceTestLib/DeviceTest.cc index 0954462cc..78fc8efb0 100644 --- a/src/CXXTests/DeviceTestLib/DeviceTest.cc +++ b/src/CXXTests/DeviceTestLib/DeviceTest.cc @@ -40,4 +40,4 @@ int launchCaller(int a, int b) #endif -} // namespace Spehral +} // namespace Spheral diff --git a/src/CXXTests/DeviceTestLib/DeviceTest.hh b/src/CXXTests/DeviceTestLib/DeviceTest.hh index a6778d0a1..232b98f67 100644 --- a/src/CXXTests/DeviceTestLib/DeviceTest.hh +++ b/src/CXXTests/DeviceTestLib/DeviceTest.hh @@ -17,6 +17,6 @@ int launchCaller(int a, int b); #endif -} // namespace Spehral +} // namespace Spheral #endif // __Spheral_DeviceTest_hh__ From 129df60ded0bb46a622b755f5cc7a58451264014 Mon Sep 17 00:00:00 2001 From: Landon Owen Date: Wed, 13 Sep 2023 10:37:57 -0700 Subject: [PATCH 03/23] Added logic with function inputs to align with LLNLSpheral needs, should be working with python version now, temporarily using different branches for polyclipper and pyb11generator --- .gitmodules | 2 + cmake/InstallTPLs.cmake | 44 ++++++----- cmake/spheral/SpheralAddLibs.cmake | 108 ++++++++++++++++----------- cmake/spheral/SpheralHandleTPL.cmake | 12 +-- extern/PYB11Generator | 2 +- extern/PolyClipper | 2 +- src/CMakeLists.txt | 19 ++--- 7 files changed, 110 insertions(+), 79 deletions(-) diff --git a/.gitmodules b/.gitmodules index f2b124eeb..97affacfc 100644 --- a/.gitmodules +++ b/.gitmodules @@ -8,7 +8,9 @@ branch = origin/master [submodule "extern/PYB11Generator"] path = extern/PYB11Generator + branch = update_for_cmake_exports url = https://github.com/LLNL/PYB11Generator [submodule "extern/PolyClipper"] path = extern/PolyClipper + branch = update_for_cmake_exports url = https://github.com/LLNL/PolyClipper diff --git a/cmake/InstallTPLs.cmake b/cmake/InstallTPLs.cmake index 19406c591..cc3469d3a 100644 --- a/cmake/InstallTPLs.cmake +++ b/cmake/InstallTPLs.cmake @@ -6,47 +6,54 @@ set_directory_properties(PROPERTIES CLEAN_NO_CUSTOM 1) # Set the location of the .cmake files -set(TPL_CMAKE_DIR ${SPHERAL_ROOT_DIR}/cmake/tpl) +set(TPL_SPHERAL_CMAKE_DIR ${SPHERAL_ROOT_DIR}/cmake/tpl) #----------------------------------------------------------------------------------- # Submodules #----------------------------------------------------------------------------------- -# PolyClipper -if (NOT polyclipper_DIR) - set(polyclipper_DIR "${SPHERAL_ROOT_DIR}/extern/PolyClipper" CACHE PATH "") -endif() -add_subdirectory(${polyclipper_DIR}) -list(APPEND spheral_blt_depends PolyClipperAPI) -install(TARGETS PolyClipperAPI - EXPORT spheral_cxx-targets - DESTINATION lib/cmake) -set_target_properties(PolyClipperAPI PROPERTIES EXPORT_NAME spheral::PolyClipperAPI) - if (NOT ENABLE_CXXONLY) # Find the appropriate Python set(Python3_ROOT_DIR ${python_DIR}) find_package(Python3 COMPONENTS Interpreter Development) + set(PYTHON_EXE ${Python3_EXECUTABLE}) + list(APPEND spheral_blt_depends Python3::Python) # Set the PYB11Generator path if (NOT PYB11GENERATOR_ROOT_DIR) set(PYB11GENERATOR_ROOT_DIR "${SPHERAL_ROOT_DIR}/extern/PYB11Generator" CACHE PATH "") endif() - include(${PYB11GENERATOR_ROOT_DIR}/cmake/PYB11Generator.cmake) - # Set the pybind11 path if (NOT PYBIND11_ROOT_DIR) set(PYBIND11_ROOT_DIR "${PYB11GENERATOR_ROOT_DIR}/extern/pybind11" CACHE PATH "") endif() - - list(APPEND SPHERAL_SUBMOD_INCLUDES ${PYBIND11_ROOT_DIR}/include) + include(${PYB11GENERATOR_ROOT_DIR}/cmake/PYB11Generator.cmake) + list(APPEND spheral_blt_depends pybind11_headers) + install(TARGETS pybind11_headers + EXPORT spheral_cxx-targets + DESTINATION lib/cmake) + set_target_properties(pybind11_headers PROPERTIES EXPORT_NAME spheral::pybind11_headers) endif() +# This is currently unfilled in spheral set_property(GLOBAL PROPERTY SPHERAL_SUBMOD_INCLUDES "${SPHERAL_SUBMOD_INCLUDES}") #----------------------------------------------------------------------------------- # Find pre-compiled TPLs #----------------------------------------------------------------------------------- +# PolyClipper +if (NOT polyclipper_DIR) + set(polyclipper_DIR "${SPHERAL_ROOT_DIR}/extern/PolyClipper" CACHE PATH "") +endif() +# Must set this so PolyClipper doesn't include unnecessary python scripts +set(IMPORTED_POLYCLIPPER ON CACHE BOOL "") +add_subdirectory(${polyclipper_DIR}) +list(APPEND spheral_blt_depends PolyClipperAPI) +install(TARGETS PolyClipperAPI + EXPORT spheral_cxx-targets + DESTINATION lib/cmake) +set_target_properties(PolyClipperAPI PROPERTIES EXPORT_NAME spheral::PolyClipperAPI) + # TPLs that can use find_package list(APPEND SPHERAL_EXTERN_PACKAGES axom) @@ -61,9 +68,6 @@ endif() if(ENABLE_TIMER) list(APPEND SPHERAL_EXTERN_LIBS caliper) endif() -if(NOT ENABLE_CXXONLY) - list(APPEND SPHERAL_EXTERN_LIBS python) -endif() # Initialize TPL options include(${SPHERAL_ROOT_DIR}/cmake/spheral/SpheralHandleTPL.cmake) @@ -80,7 +84,7 @@ blt_patch_target(NAME fmt TREAT_INCLUDES_AS_SYSTEM ON) # Create target library for each external library foreach(lib ${SPHERAL_EXTERN_LIBS}) - Spheral_Handle_TPL(${lib} FALSE) + Spheral_Handle_TPL(${lib} ${TPL_SPHERAL_CMAKE_DIR}) list(APPEND spheral_blt_depends ${lib}) endforeach() diff --git a/cmake/spheral/SpheralAddLibs.cmake b/cmake/spheral/SpheralAddLibs.cmake index 0cae9a34e..e0e1351e6 100644 --- a/cmake/spheral/SpheralAddLibs.cmake +++ b/cmake/spheral/SpheralAddLibs.cmake @@ -1,38 +1,51 @@ -#----------------------------------------------------------------------------------- -# spheral_add_obj_library -# - Generates the blt libraries for a given spheral C++ package -# -# package_name : *name* of spheral package to make into a library -# obj_libs_list : *name* of a CMake list which we will add the library object files to -# -# Variables that must be set before calling spheral_add_obj_library: -# ENABLE_STATIC_CXXONLY : Default False -# - If set to true all libs will be made static -# _headers -# - List of headers to be installed -# _sources -# - List of sources to build library with -# spheral_depends -# - List of targets the library depends on -# spheral_blt_depends -# - List of blt/libs the library depends on -# -#----------------------------------------------------------------------------------- +#---------------------------------------------------------------------------------------- +# spheral_add_obj_library +#---------------------------------------------------------------------------------------- +# ------------------------------------------- +# VARIABLES THAT NEED TO BE PREVIOUSLY DEFINED +# ------------------------------------------- +# spheral_blt_depends : REQUIRED : List of external dependencies +# SPHERAL_CXX_DEPENDS : REQUIRED : List of compiler dependencies +# _headers : OPTIONAL : List of necessary headers to include +# _sources : OPTIONAL : List of necessary source files to include +# SPHERAL_SUBMOD_DEPENDS : REQUIRED : List of submodule dependencies +# ---------------------- +# INPUT-OUTPUT VARIABLES +# ---------------------- +# : REQUIRED : Desired package name +# any extra args : OPTIONAL : Can provide the NAME of a global list +# containing additional dependencies +# -----------------------, +# OUTPUT VARIABLES TO USE - Made available implicitly after function call +# ----------------------- +# : Target for a given spheral package +#---------------------------------------------------------------------------------------- function(spheral_add_obj_library package_name) # Assumes global variable spheral_blt_depends exists and is filled with external dependencies get_property(spheral_blt_depends GLOBAL PROPERTY spheral_blt_depends) # Assumes global variable spheral_cxx_depends exists and is filled with compiler dependencies get_property(SPHERAL_CXX_DEPENDS GLOBAL PROPERTY SPHERAL_CXX_DEPENDS) + # For including files in submodules, currently unused + get_property(SPHERAL_SUBMOD_INCLUDES GLOBAL PROPERTY SPHERAL_SUBMOD_INCLUDES) + + # Only the package_name is expected; any extra arguments are stored in ${ARGN}. + # This allows the NAME of a global list (not the list itself) + # with additional dependencies to be passed to the function. + # First, check if additional arguments are provided + # CMake requires ${ARGN} is assigned before using with list set(extra_args ${ARGN}) list(LENGTH extra_args extra_count) + # Empty list unless extra arguments are provided + set(extra_depends ) if (${extra_count} GREATER 0) - list(GET extra_args 0 obj_libs_list) + # Set list to global variable named by the argument + get_property(extra_depends GLOBAL PROPERTY ${ARGN}) endif() blt_add_library(NAME Spheral_${package_name} HEADERS ${${package_name}_headers} SOURCES ${${package_name}_sources} - DEPENDS_ON ${spheral_blt_depends} ${${package_name}_ADDITIONAL_DEPENDS} ${SPHERAL_CXX_DEPENDS} + DEPENDS_ON ${spheral_blt_depends} ${${package_name}_ADDITIONAL_DEPENDS} ${SPHERAL_CXX_DEPENDS} ${extra_depends} OBJECT TRUE) target_include_directories(Spheral_${package_name} SYSTEM PUBLIC ${SPHERAL_SUBMOD_INCLUDES}) # Install the headers @@ -49,52 +62,55 @@ endfunction() # spheral_add_cxx_library #---------------------------------------------------------------------------------------- # ------------------------------------------- -# VARIBALES THAT NEED TO BE PREVIOUSLY DEFINED +# VARIABLES THAT NEED TO BE PREVIOUSLY DEFINED # ------------------------------------------- # spheral_blt_depends : REQUIRED : List of external dependencies +# SPHERAL_CXX_DEPENDS : REQUIRED : List of compiler dependencies +# _headers : OPTIONAL : List of necessary headers to include +# _sources : OPTIONAL : List of necessary source files to include # SPHERAL_SUBMOD_DEPENDS : REQUIRED : List of submodule dependencies - # ---------------------- -# INPUT-OUTPUT VARIBALES +# INPUT-OUTPUT VARIABLES # ---------------------- # : REQUIRED : Desired package name # <_cxx_obj_list> : REQUIRED : List of internal targets to include - # ----------------------- # OUTPUT VARIABLES TO USE - Made available implicitly after function call # ----------------------- # : Exportable target for interal package name library #---------------------------------------------------------------------------------------- function(spheral_add_cxx_library package_name _cxx_obj_list) - + # Assumes global variable spheral_blt_depends exists and is filled with external dependencies get_property(spheral_blt_depends GLOBAL PROPERTY spheral_blt_depends) + # Assumes global variable spheral_cxx_depends exists and is filled with compiler dependencies get_property(SPHERAL_CXX_DEPENDS GLOBAL PROPERTY SPHERAL_CXX_DEPENDS) - - set(EXTRA_CXX_DEPENDS ) - # We can optionally specify the obj_libs_list and any additional dependencies - set(extra_args ${ARGN}) - list(LENGTH extra_args extra_count) - if (${extra_count} GREATER 0) - list(GET extra_args 0 spheral_blt_depends) - endif() - if (${extra_count} GREATER 1) - list(GET extra_args 1 optional_arg) - list(APPEND EXTRA_CXX_DEPENDS ${optional_arg}) - endif() + # For including files in submodules, currently unused get_property(SPHERAL_SUBMOD_INCLUDES GLOBAL PROPERTY SPHERAL_SUBMOD_INCLUDES) + + # set(EXTRA_CXX_DEPENDS ) + # # We can optionally specify the obj_libs_list and any additional dependencies + # set(extra_args ${ARGN}) + # list(LENGTH extra_args extra_count) + # if (${extra_count} GREATER 0) + # list(GET extra_args 0 spheral_blt_depends) + # endif() + # if (${extra_count} GREATER 1) + # list(GET extra_args 1 optional_arg) + # list(APPEND EXTRA_CXX_DEPENDS ${optional_arg}) + # endif() if(NOT ENABLE_SHARED) # Build static spheral C++ library blt_add_library(NAME Spheral_${package_name} HEADERS ${${package_name}_headers} SOURCES ${${package_name}_sources} - DEPENDS_ON ${_cxx_obj_list} ${spheral_blt_depends} ${EXTRA_CXX_DEPENDS} ${SPHERAL_CXX_DEPENDS} + DEPENDS_ON ${_cxx_obj_list} ${spheral_blt_depends} ${SPHERAL_CXX_DEPENDS} SHARED FALSE) else() # Build shared spheral C++ library blt_add_library(NAME Spheral_${package_name} HEADERS ${${package_name}_headers} SOURCES ${${package_name}_sources} - DEPENDS_ON ${_cxx_obj_list} ${spheral_blt_depends} ${EXTRA_CXX_DEPENDS} ${SPHERAL_CXX_DEPENDS} + DEPENDS_ON ${_cxx_obj_list} ${spheral_blt_depends} ${SPHERAL_CXX_DEPENDS} SHARED TRUE) endif() target_include_directories(Spheral_${package_name} SYSTEM PRIVATE ${SPHERAL_SUBMOD_INCLUDES}) @@ -102,10 +118,15 @@ function(spheral_add_cxx_library package_name _cxx_obj_list) set_target_properties(Spheral_${package_name} PROPERTIES CUDA_SEPARABLE_COMPILATION ON) endif() + # Convert package name to lower-case for export target name + string(TOLOWER ${package_name} lower_case_package) + # Install Spheral C++ target and set it as an exportable CMake target install(TARGETS Spheral_${package_name} DESTINATION lib - EXPORT spheral_cxx-targets) + EXPORT spheral_${lower_case_package}-targets) + # Export Spheral target + install(EXPORT spheral_${lower_case_package}-targets DESTINATION lib/cmake) # Set the r-path of the C++ lib such that it is independent of the build dir when installed # TODO: Determine if this is still necessary @@ -193,7 +214,10 @@ function(spheral_add_pybind11_library package_name) string(JOIN ":" PYTHON_ENV_STR ${PYTHON_ENV_STR} ${SPACK_PYTHONPATH}) + # Flag to tell PYB11Generator to use blt_add_library + set(${package_name}_USE_BLT ON BOOL) # Get the TPL dependencies + get_property(spheral_blt_depends GLOBAL PROPERTY spheral_blt_depends) get_property(spheral_tpl_includes GLOBAL PROPERTY spheral_tpl_includes) get_property(spheral_tpl_libraries GLOBAL PROPERTY spheral_tpl_libraries) diff --git a/cmake/spheral/SpheralHandleTPL.cmake b/cmake/spheral/SpheralHandleTPL.cmake index c7dbbf9b7..e4dbd55f1 100644 --- a/cmake/spheral/SpheralHandleTPL.cmake +++ b/cmake/spheral/SpheralHandleTPL.cmake @@ -4,17 +4,17 @@ #---------------------------------------------------------------------------------------- # ------------------------------------------- -# VARIBALES THAT NEED TO BE PREVIOUSLY DEFINED +# VARIABLES THAT NEED TO BE PREVIOUSLY DEFINED # ------------------------------------------- -# TPL_CMAKE_DIR : REQUIRED : Directory containing files for each TPL -# listing their library names # _DIR : REQUIRED : The installation location of the TPL # _INCLUDES : OPTIONAL : Specific includes for the TPL # ---------------------- -# INPUT-OUTPUT VARIBALES +# INPUT-OUTPUT VARIABLES # ---------------------- -# : REQUIRED : The name of the target TPL +# : REQUIRED : The name of the target TPL +# TPL_CMAKE_DIR : REQUIRED : Directory containing files for each TPL +# listing their library names # ----------------------- # OUTPUT VARIABLES TO USE - Made available implicitly after function call @@ -22,7 +22,7 @@ # : Exportable target for the TPL #---------------------------------------------------------------------------------------- -function(Spheral_Handle_TPL lib_name) +function(Spheral_Handle_TPL lib_name TPL_CMAKE_DIR) # Make shortcut variable for directory assigned to ${lib_name}_DIR set(lib_dir "${${lib_name}_DIR}") diff --git a/extern/PYB11Generator b/extern/PYB11Generator index e22a661a7..1c7eef7b5 160000 --- a/extern/PYB11Generator +++ b/extern/PYB11Generator @@ -1 +1 @@ -Subproject commit e22a661a73492d0d6e2ad109c6ff5ed9cf050ae3 +Subproject commit 1c7eef7b5c42746f1ddd4a2d37b2f7ade0ab5f53 diff --git a/extern/PolyClipper b/extern/PolyClipper index 038fb672d..fd499d4a6 160000 --- a/extern/PolyClipper +++ b/extern/PolyClipper @@ -1 +1 @@ -Subproject commit 038fb672d6b21a345a8e33c5b4d6c1df068dcf11 +Subproject commit fd499d4a64ff0241effe18fa288e0b3b3beb2ba0 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b4f905a60..bcd1b2b78 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -10,6 +10,7 @@ include_directories(${PROJECT_BINARY_DIR}/src) set(SPHERAL_PYTHON_INSTALL ${PROJECT_BINARY_DIR}/lib) +# These are packages that must be made into targets and added as dependencies to SpheralCXX list(APPEND _packages ArtificialViscosity ArtificialConduction @@ -47,10 +48,8 @@ list(APPEND _packages ) if(NOT ENABLE_CXXONLY) - list(APPEND _packages - SimulationControl - PYB11 - ) + add_subdirectory(SimulationControl) + add_subdirectory(PYB11) endif() configure_file(config.hh.in @@ -61,17 +60,19 @@ foreach(_package ${_packages}) add_subdirectory(${_package}) endforeach() -include_directories(${extra_packages_DIR}) -foreach(e_package ${extra_packages}) - add_subdirectory(${extra_packages_DIR}/${e_package} ${CMAKE_CURRENT_BINARY_DIR}/${e_package}) -endforeach() +# include_directories(${extra_packages_DIR}) +# foreach(e_package ${extra_packages}) +# add_subdirectory(${extra_packages_DIR}/${e_package} ${CMAKE_CURRENT_BINARY_DIR}/${e_package}) +# endforeach() set(CXX_sources spheralCXX.cc) set(cxx_obj_list ) foreach(_package ${_packages}) list(APPEND cxx_obj_list "Spheral_${_package}") endforeach() +# Add target nested in CXXTests +list(APPEND cxx_obj_list "Spheral_DeviceTestLib") # Must use quotes when passing lists as inputs for functions spheral_add_cxx_library(CXX "${cxx_obj_list}") -install(EXPORT spheral_cxx-targets DESTINATION lib/cmake) +#install(EXPORT spheral_cxx-targets DESTINATION lib/cmake) From 4755df3f309a9ed623ca7251f44da7e3c1c9cb73 Mon Sep 17 00:00:00 2001 From: Landon Owen Date: Wed, 13 Sep 2023 12:33:26 -0700 Subject: [PATCH 04/23] Added include for LLNLSpheral obj install cmake file --- cmake/InstallTPLs.cmake | 1 + src/CMakeLists.txt | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/cmake/InstallTPLs.cmake b/cmake/InstallTPLs.cmake index cc3469d3a..ff51916d2 100644 --- a/cmake/InstallTPLs.cmake +++ b/cmake/InstallTPLs.cmake @@ -100,6 +100,7 @@ foreach(lib ${SPHERAL_EXTERN_LIBS}) endforeach() # Note: spheral_blt_depends is made global after this in SetupSpheral.cmake +# This calls LLNLSpheralInstallTPLs.cmake if (EXISTS ${EXTERNAL_SPHERAL_TPL_CMAKE}) include(${EXTERNAL_SPHERAL_TPL_CMAKE}) endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bcd1b2b78..ec8281752 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -6,7 +6,7 @@ include(${SPHERAL_CMAKE_MODULE_PATH}/spheral/SpheralAddLibs.cmake) include(${SPHERAL_CMAKE_MODULE_PATH}/spheral/SpheralInstallPythonFiles.cmake) include_directories(.) -include_directories(${PROJECT_BINARY_DIR}/src) +#include_directories(${PROJECT_BINARY_DIR}/src) set(SPHERAL_PYTHON_INSTALL ${PROJECT_BINARY_DIR}/lib) @@ -76,3 +76,7 @@ list(APPEND cxx_obj_list "Spheral_DeviceTestLib") spheral_add_cxx_library(CXX "${cxx_obj_list}") #install(EXPORT spheral_cxx-targets DESTINATION lib/cmake) +# This calls LLNLSpheralInstallObjs.cmake +if(EXISTS ${EXTERNAL_SPHERAL_OBJ_CMAKE}) + include(${EXTERNAL_SPHERAL_OBJ_CMAKE}) +endif() From 16c2198e0e85eb1957a0551e24401c3b009626e5 Mon Sep 17 00:00:00 2001 From: Landon Owen Date: Wed, 13 Sep 2023 13:09:17 -0700 Subject: [PATCH 05/23] Add include_directories statement back in --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ec8281752..bf9b5d2b1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -6,7 +6,7 @@ include(${SPHERAL_CMAKE_MODULE_PATH}/spheral/SpheralAddLibs.cmake) include(${SPHERAL_CMAKE_MODULE_PATH}/spheral/SpheralInstallPythonFiles.cmake) include_directories(.) -#include_directories(${PROJECT_BINARY_DIR}/src) +include_directories(${PROJECT_BINARY_DIR}/src) set(SPHERAL_PYTHON_INSTALL ${PROJECT_BINARY_DIR}/lib) From ca042fe4b950e2cfd74e4e56b2abb426ce86adbc Mon Sep 17 00:00:00 2001 From: Landon Owen Date: Wed, 13 Sep 2023 14:18:58 -0700 Subject: [PATCH 06/23] Remove the BUILD_INTERFACE before the eigen_INCLUDE statement from spack --- scripts/spack/packages/spheral/package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/spack/packages/spheral/package.py b/scripts/spack/packages/spheral/package.py index 5a75f5386..7f8fd6650 100644 --- a/scripts/spack/packages/spheral/package.py +++ b/scripts/spack/packages/spheral/package.py @@ -176,7 +176,7 @@ def initconfig_package_entries(self): entries.append(cmake_cache_path('silo_DIR', spec['silo'].prefix)) entries.append(cmake_cache_path('eigen_DIR', spec['eigen'].prefix)) - entries.append(cmake_cache_path('eigen_INCLUDES','$')) + entries.append(cmake_cache_path('eigen_INCLUDES',spec['eigen'].prefix.include.eigen3)) entries.append(cmake_cache_path('opensubdiv_DIR', spec['opensubdiv'].prefix)) From 83d341451f3108415634c2f624dc37d83e2a0612 Mon Sep 17 00:00:00 2001 From: Landon Owen Date: Wed, 13 Sep 2023 16:41:19 -0700 Subject: [PATCH 07/23] Prevent warnings for PolyClipper by treating it as system --- cmake/Compilers.cmake | 2 -- cmake/InstallTPLs.cmake | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/cmake/Compilers.cmake b/cmake/Compilers.cmake index 9110e6b08..b19b31480 100644 --- a/cmake/Compilers.cmake +++ b/cmake/Compilers.cmake @@ -19,8 +19,6 @@ if (ENABLE_WARNINGS) else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w") endif() -# This prevents all of the warnings for Polyclipper -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-local-typedefs") message("-- Compiler warnings ${ENABLE_WARNINGS}") if (ENABLE_WARNINGS_AS_ERRORS) diff --git a/cmake/InstallTPLs.cmake b/cmake/InstallTPLs.cmake index ff51916d2..ddb847edb 100644 --- a/cmake/InstallTPLs.cmake +++ b/cmake/InstallTPLs.cmake @@ -48,6 +48,7 @@ endif() # Must set this so PolyClipper doesn't include unnecessary python scripts set(IMPORTED_POLYCLIPPER ON CACHE BOOL "") add_subdirectory(${polyclipper_DIR}) +blt_patch_target(NAME PolyClipperAPI TREAT_INCLUDES_AS_SYSTEM ON) list(APPEND spheral_blt_depends PolyClipperAPI) install(TARGETS PolyClipperAPI EXPORT spheral_cxx-targets From bc715229718faaa9f31c866bebfff8f9862692d6 Mon Sep 17 00:00:00 2001 From: Landon Owen Date: Wed, 13 Sep 2023 16:50:08 -0700 Subject: [PATCH 08/23] Add redundant system calls on targets for testing --- cmake/InstallTPLs.cmake | 1 + cmake/spheral/SpheralHandleTPL.cmake | 2 ++ 2 files changed, 3 insertions(+) diff --git a/cmake/InstallTPLs.cmake b/cmake/InstallTPLs.cmake index ddb847edb..3d278d8e6 100644 --- a/cmake/InstallTPLs.cmake +++ b/cmake/InstallTPLs.cmake @@ -48,6 +48,7 @@ endif() # Must set this so PolyClipper doesn't include unnecessary python scripts set(IMPORTED_POLYCLIPPER ON CACHE BOOL "") add_subdirectory(${polyclipper_DIR}) +# Treat includes as system to prevent warnings blt_patch_target(NAME PolyClipperAPI TREAT_INCLUDES_AS_SYSTEM ON) list(APPEND spheral_blt_depends PolyClipperAPI) install(TARGETS PolyClipperAPI diff --git a/cmake/spheral/SpheralHandleTPL.cmake b/cmake/spheral/SpheralHandleTPL.cmake index e4dbd55f1..a8720a7ea 100644 --- a/cmake/spheral/SpheralHandleTPL.cmake +++ b/cmake/spheral/SpheralHandleTPL.cmake @@ -78,4 +78,6 @@ function(Spheral_Handle_TPL lib_name TPL_CMAKE_DIR) INCLUDES ${${lib_name}_INCLUDE_DIR} LIBRARIES ${${lib_name}_LIBRARIES} EXPORTABLE ON) + # TODO: This shouldn't be necessary since it is set above + blt_patch_target(NAME ${lib_name} TREAT_INCLUDE_AS_SYSTEM ON) endfunction() From 6d081a047bcb8023ac6f7dda1910343b67d4f13b Mon Sep 17 00:00:00 2001 From: Landon Owen Date: Thu, 14 Sep 2023 10:25:40 -0700 Subject: [PATCH 09/23] Fixed typo for treating imported includes as system --- cmake/spheral/SpheralHandleTPL.cmake | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/cmake/spheral/SpheralHandleTPL.cmake b/cmake/spheral/SpheralHandleTPL.cmake index a8720a7ea..36e11512d 100644 --- a/cmake/spheral/SpheralHandleTPL.cmake +++ b/cmake/spheral/SpheralHandleTPL.cmake @@ -74,10 +74,8 @@ function(Spheral_Handle_TPL lib_name TPL_CMAKE_DIR) endif() blt_import_library(NAME ${lib_name} - TREAT_INCLUDE_AS_SYSTEM ON + TREAT_INCLUDES_AS_SYSTEM ON INCLUDES ${${lib_name}_INCLUDE_DIR} LIBRARIES ${${lib_name}_LIBRARIES} EXPORTABLE ON) - # TODO: This shouldn't be necessary since it is set above - blt_patch_target(NAME ${lib_name} TREAT_INCLUDE_AS_SYSTEM ON) endfunction() From fb8857bf969a7d414e78d0568cf935b22ca6668a Mon Sep 17 00:00:00 2001 From: Landon Owen Date: Thu, 14 Sep 2023 12:29:43 -0700 Subject: [PATCH 10/23] Fixed bug with serial compilation, updated PYB11 and PolyClipper submodules and relevant cmake variable names --- cmake/InstallTPLs.cmake | 2 +- extern/PYB11Generator | 2 +- extern/PolyClipper | 2 +- src/CMakeLists.txt | 36 +++++++++++++++++++++--------------- 4 files changed, 24 insertions(+), 18 deletions(-) diff --git a/cmake/InstallTPLs.cmake b/cmake/InstallTPLs.cmake index 3d278d8e6..a9fc0908c 100644 --- a/cmake/InstallTPLs.cmake +++ b/cmake/InstallTPLs.cmake @@ -46,7 +46,7 @@ if (NOT polyclipper_DIR) set(polyclipper_DIR "${SPHERAL_ROOT_DIR}/extern/PolyClipper" CACHE PATH "") endif() # Must set this so PolyClipper doesn't include unnecessary python scripts -set(IMPORTED_POLYCLIPPER ON CACHE BOOL "") +set(POLYCLIPPER_MODULE_GEN OFF CACHE BOOL "Turn off Python module generation for PolyClipper") add_subdirectory(${polyclipper_DIR}) # Treat includes as system to prevent warnings blt_patch_target(NAME PolyClipperAPI TREAT_INCLUDES_AS_SYSTEM ON) diff --git a/extern/PYB11Generator b/extern/PYB11Generator index 1c7eef7b5..39edc5981 160000 --- a/extern/PYB11Generator +++ b/extern/PYB11Generator @@ -1 +1 @@ -Subproject commit 1c7eef7b5c42746f1ddd4a2d37b2f7ade0ab5f53 +Subproject commit 39edc5981bbe4c2d303ea3a1bbd08b0362c120c6 diff --git a/extern/PolyClipper b/extern/PolyClipper index fd499d4a6..5bd9408d0 160000 --- a/extern/PolyClipper +++ b/extern/PolyClipper @@ -1 +1 @@ -Subproject commit fd499d4a64ff0241effe18fa288e0b3b3beb2ba0 +Subproject commit 5bd9408d0cba2399429027445ec9f43b33b98b14 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bf9b5d2b1..dccb7873f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -11,7 +11,7 @@ include_directories(${PROJECT_BINARY_DIR}/src) set(SPHERAL_PYTHON_INSTALL ${PROJECT_BINARY_DIR}/lib) # These are packages that must be made into targets and added as dependencies to SpheralCXX -list(APPEND _packages +list(APPEND _target_packages ArtificialViscosity ArtificialConduction Boundary @@ -20,7 +20,6 @@ list(APPEND _packages DataBase DataOutput DEM - Distributed ExternalForce Field FieldOperations @@ -47,35 +46,42 @@ list(APPEND _packages Utilities ) +# These are directories that should be added but not made into targets +list(APPEND _dir_packages + CXXTests) + +if(ENABLE_MPI) + # Add Distributed target + list(APPEND _target_packages Distributed) +else() + # Otherwise, run add_subdirectory + list(APPEND _dir_packages Distributed) +endif() + if(NOT ENABLE_CXXONLY) - add_subdirectory(SimulationControl) - add_subdirectory(PYB11) + list(APPEND _dir_packages SimulationControl PYB11) endif() configure_file(config.hh.in ${PROJECT_BINARY_DIR}/src/config.hh) -# CXXTests should be added but not made into a target -add_subdirectory(CXXTests) -foreach(_package ${_packages}) + +foreach(_package ${_dir_packages}) add_subdirectory(${_package}) endforeach() -# include_directories(${extra_packages_DIR}) -# foreach(e_package ${extra_packages}) -# add_subdirectory(${extra_packages_DIR}/${e_package} ${CMAKE_CURRENT_BINARY_DIR}/${e_package}) -# endforeach() - -set(CXX_sources spheralCXX.cc) +# Create a list of internal targets needed as dependencies for SpheralCXX set(cxx_obj_list ) -foreach(_package ${_packages}) +foreach(_package ${_target_packages}) list(APPEND cxx_obj_list "Spheral_${_package}") + add_subdirectory(${_package}) endforeach() # Add target nested in CXXTests list(APPEND cxx_obj_list "Spheral_DeviceTestLib") + +set(CXX_sources spheralCXX.cc) # Must use quotes when passing lists as inputs for functions spheral_add_cxx_library(CXX "${cxx_obj_list}") -#install(EXPORT spheral_cxx-targets DESTINATION lib/cmake) # This calls LLNLSpheralInstallObjs.cmake if(EXISTS ${EXTERNAL_SPHERAL_OBJ_CMAKE}) include(${EXTERNAL_SPHERAL_OBJ_CMAKE}) From b95dcc1517cb43d4b53369e836aa23d37b7f5a3b Mon Sep 17 00:00:00 2001 From: Landon Owen Date: Thu, 14 Sep 2023 13:19:19 -0700 Subject: [PATCH 11/23] Update PolyClipper submodule --- extern/PolyClipper | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extern/PolyClipper b/extern/PolyClipper index 5bd9408d0..4437e793b 160000 --- a/extern/PolyClipper +++ b/extern/PolyClipper @@ -1 +1 @@ -Subproject commit 5bd9408d0cba2399429027445ec9f43b33b98b14 +Subproject commit 4437e793b4515aaaac50a27bf06669d2bbc3ac56 From 2d721c5e4d57c5071f92932eeb0a4a0cc6397e2a Mon Sep 17 00:00:00 2001 From: Landon Owen Date: Fri, 15 Sep 2023 11:34:29 -0700 Subject: [PATCH 12/23] Fixed issue with PolyClipper docs trying to build during CI --- cmake/InstallTPLs.cmake | 1 + extern/PolyClipper | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/InstallTPLs.cmake b/cmake/InstallTPLs.cmake index a9fc0908c..d9ee17c2a 100644 --- a/cmake/InstallTPLs.cmake +++ b/cmake/InstallTPLs.cmake @@ -47,6 +47,7 @@ if (NOT polyclipper_DIR) endif() # Must set this so PolyClipper doesn't include unnecessary python scripts set(POLYCLIPPER_MODULE_GEN OFF CACHE BOOL "Turn off Python module generation for PolyClipper") +set(POLYCLIPPER_ENABLE_DOCS OFF CACHE BOOL "Turn off document building for PolyClipper") add_subdirectory(${polyclipper_DIR}) # Treat includes as system to prevent warnings blt_patch_target(NAME PolyClipperAPI TREAT_INCLUDES_AS_SYSTEM ON) diff --git a/extern/PolyClipper b/extern/PolyClipper index 4437e793b..a96fd1565 160000 --- a/extern/PolyClipper +++ b/extern/PolyClipper @@ -1 +1 @@ -Subproject commit 4437e793b4515aaaac50a27bf06669d2bbc3ac56 +Subproject commit a96fd15650d2b0d825c470099b10c1d53ea6ed5b From 5b6ac717cad3fc45df46435e0412285d091440de Mon Sep 17 00:00:00 2001 From: Landon Owen Date: Fri, 15 Sep 2023 12:03:22 -0700 Subject: [PATCH 13/23] Update PolyClipper --- extern/PolyClipper | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extern/PolyClipper b/extern/PolyClipper index a96fd1565..c56f5f1db 160000 --- a/extern/PolyClipper +++ b/extern/PolyClipper @@ -1 +1 @@ -Subproject commit a96fd15650d2b0d825c470099b10c1d53ea6ed5b +Subproject commit c56f5f1dbeaaf34dec194b90ca263156fcc65999 From 04be531142e07f5a1f6906db190145df894ba513 Mon Sep 17 00:00:00 2001 From: Landon Owen Date: Wed, 20 Sep 2023 09:13:21 -0700 Subject: [PATCH 14/23] Fix bug where find_library was only called for first library file, add lib to directory to INSTALL_RPATH for CXX targets --- cmake/spheral/SpheralAddLibs.cmake | 6 +++--- cmake/spheral/SpheralHandleTPL.cmake | 22 +++++++++++++++------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/cmake/spheral/SpheralAddLibs.cmake b/cmake/spheral/SpheralAddLibs.cmake index e0e1351e6..55c1d1edf 100644 --- a/cmake/spheral/SpheralAddLibs.cmake +++ b/cmake/spheral/SpheralAddLibs.cmake @@ -107,7 +107,7 @@ function(spheral_add_cxx_library package_name _cxx_obj_list) SHARED FALSE) else() # Build shared spheral C++ library - blt_add_library(NAME Spheral_${package_name} + blt_add_library(NAME Spheral_${package_name} HEADERS ${${package_name}_headers} SOURCES ${${package_name}_sources} DEPENDS_ON ${_cxx_obj_list} ${spheral_blt_depends} ${SPHERAL_CXX_DEPENDS} @@ -130,8 +130,8 @@ function(spheral_add_cxx_library package_name _cxx_obj_list) # Set the r-path of the C++ lib such that it is independent of the build dir when installed # TODO: Determine if this is still necessary - # set_target_properties(Spheral_${package_name} PROPERTIES - # INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib;${conduit_DIR}/lib;${axom_DIR}/lib;${boost_DIR}/lib;${hdf5_DIR}/lib;${zlib_DIR}/lib;${SPHERAL_ADDITIONAL_RPATHS}") + set_target_properties(Spheral_${package_name} PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") + #${conduit_DIR}/lib;${axom_DIR}/lib;${boost_DIR}/lib;${hdf5_DIR}/lib;${zlib_DIR}/lib;${SPHERAL_ADDITIONAL_RPATHS}") endfunction() diff --git a/cmake/spheral/SpheralHandleTPL.cmake b/cmake/spheral/SpheralHandleTPL.cmake index 36e11512d..7670a14d2 100644 --- a/cmake/spheral/SpheralHandleTPL.cmake +++ b/cmake/spheral/SpheralHandleTPL.cmake @@ -37,20 +37,28 @@ function(Spheral_Handle_TPL lib_name TPL_CMAKE_DIR) set(${lib_name}_libs "") # Library names to be set in .cmake file include(${TPL_CMAKE_DIR}/${lib_name}.cmake) - string(COMPARE EQUAL "${${lib_name}_libs}" "" lib_test) # If library names are given, find them - if(NOT lib_test) - find_library(${lib_name}_LIBRARIES NAMES ${${lib_name}_libs} + set(${lib_name}_LIBRARIES ) + foreach(libpath ${${lib_name}_libs}) + find_library(${libpath}_clib NAMES ${libpath} PATHS ${lib_dir}/lib + REQUIRED + NO_CACHE NO_DEFAULT_PATH NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_PATH NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH) - message("Importing libraries for ${lib_name}") - message("") - endif() - + list(APPEND ${lib_name}_LIBRARIES ${${libpath}_clib}) + message("Importing libraries for ${${libpath}_clib}") + # find_library treats output as a standard variable from 3.21+ + # We get different behavior on earlier CMake versions. + if(${CMAKE_VERSION} VERSION_LESS "3.21.0") + unset(${libpath}_clib CACHE) + else() + unset(${libpath}_clib) + endif() + endforeach() # Find includes by assuming they are explicitly provided as ${lib_name}_INCLUDES set(${lib_name}_INCLUDE_DIR ${${lib_name}_INCLUDES}) From 94caa8952c440d76aa0408934aec460df2094c3f Mon Sep 17 00:00:00 2001 From: Landon Owen Date: Wed, 20 Sep 2023 13:41:19 -0700 Subject: [PATCH 15/23] Change spheral_config file to set BLT location, update PolyClipper and added variable for setting a separate install location for it, add a build-dir option to host-config-build.py --- cmake/InstallTPLs.cmake | 5 +++-- cmake/spheral_cxx-config.cmake.in | 9 +++------ extern/PolyClipper | 2 +- scripts/devtools/host-config-build.py | 12 +++++++++--- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/cmake/InstallTPLs.cmake b/cmake/InstallTPLs.cmake index d9ee17c2a..a4b6e2491 100644 --- a/cmake/InstallTPLs.cmake +++ b/cmake/InstallTPLs.cmake @@ -46,8 +46,9 @@ if (NOT polyclipper_DIR) set(polyclipper_DIR "${SPHERAL_ROOT_DIR}/extern/PolyClipper" CACHE PATH "") endif() # Must set this so PolyClipper doesn't include unnecessary python scripts -set(POLYCLIPPER_MODULE_GEN OFF CACHE BOOL "Turn off Python module generation for PolyClipper") -set(POLYCLIPPER_ENABLE_DOCS OFF CACHE BOOL "Turn off document building for PolyClipper") +set(POLYCLIPPER_MODULE_GEN OFF) +set(POLYCLIPPER_ENABLE_DOCS OFF) +set(POLYCLIPPER_INSTALL_DIR "PolyClipper/include") add_subdirectory(${polyclipper_DIR}) # Treat includes as system to prevent warnings blt_patch_target(NAME PolyClipperAPI TREAT_INCLUDES_AS_SYSTEM ON) diff --git a/cmake/spheral_cxx-config.cmake.in b/cmake/spheral_cxx-config.cmake.in index d76b58bbf..53e8b8a80 100644 --- a/cmake/spheral_cxx-config.cmake.in +++ b/cmake/spheral_cxx-config.cmake.in @@ -38,17 +38,14 @@ endif() if(NOT qhull_DIR) set(qhull_DIR "@qhull_DIR@" CACHE PATH "") endif() -set(SPHERAL_CXX_ROOT_DIR "@SPHERAL_ROOT_DIR@") +set(SPHERAL_BLT_DIR "@SPHERAL_BLT_DIR@") set(SPHERAL_CXX_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@") set(SPHERAL_CXX_INCLUDE_DIRS "${SPHERAL_CXX_INSTALL_PREFIX}/include") if(NOT TARGET axom) - find_package(axom REQUIRED QUIET NO_DEFAULT_PATH PATHS ${axom_DIR}/lib/cmake) + find_package(axom REQUIRED QUIET NO_DEFAULT_PATH PATHS ${axom_DIR} ${axom_DIR}/lib ${axom_DIR}/lib/cmake) endif() include("${SPHERAL_CXX_INSTALL_PREFIX}/lib/cmake/spheral_cxx-targets.cmake") set_property(TARGET Spheral_CXX APPEND PROPERTY - INTERFACE_INCLUDE_DIRECTORIES ${SPHERAL_CXX_INCLUDE_DIRS} -) - -set(spheral_cxx_FOUND TRUE) + INTERFACE_INCLUDE_DIRECTORIES ${SPHERAL_CXX_INCLUDE_DIRS}) diff --git a/extern/PolyClipper b/extern/PolyClipper index c56f5f1db..de4ca63d4 160000 --- a/extern/PolyClipper +++ b/extern/PolyClipper @@ -1 +1 @@ -Subproject commit c56f5f1dbeaaf34dec194b90ca263156fcc65999 +Subproject commit de4ca63d4c0cfbaf44439c2a42e3310e4cabba50 diff --git a/scripts/devtools/host-config-build.py b/scripts/devtools/host-config-build.py index 2c9336b1e..1990e5c82 100755 --- a/scripts/devtools/host-config-build.py +++ b/scripts/devtools/host-config-build.py @@ -19,6 +19,9 @@ def parse_args(): parser.add_argument('-i', '--install-dir', type=str, default="", help='Location of spheral source directory.') + parser.add_argument('--build-dir', type=str, default="", + help='Name of build directory.') + parser.add_argument('--no-clean', action='store_true', help='Do not delete build and install locations.') @@ -63,12 +66,15 @@ def main(): # Set up our directory structure paths. - build_dir="{0}/build_{1}/build".format(source_dir, hostconfig) + if not args.build_dir: + build_dir="{0}/build_{1}".format(source_dir, hostconfig) + else: + build_dir="{0}/{1}".format(source_dir, args.build_dir) if not args.install_dir: - install_dir="{0}/build_{1}/install".format(source_dir, hostconfig) + install_dir="{0}/install".format(build_dir) else: install_dir=args.install_dir - + build_dir=build_dir+"/build" # Pull the cmake command to use out of our host config. cmake_cmd=sexe("grep 'CMake executable' \"{0}\"".format(hostconfig_path), ret_output=True, echo=True)[1].split()[-1] From 053d25a0742e5a03c1d69ecfaf4de715552cddda Mon Sep 17 00:00:00 2001 From: Landon Owen Date: Mon, 25 Sep 2023 17:24:21 -0700 Subject: [PATCH 16/23] Rename spheral_blt_depends to SPHERAL_BLT_DEPENDS, made changes according to PR comments, updated submodules --- .gitmodules | 2 -- CMakeLists.txt | 1 - cmake/InstallTPLs.cmake | 42 ++++++++++------------ cmake/SetupSpheral.cmake | 8 +++-- cmake/spheral/SpheralAddLibs.cmake | 57 +++++++----------------------- cmake/spheral_cxx-config.cmake.in | 34 ------------------ extern/PYB11Generator | 2 +- extern/PolyClipper | 2 +- src/CMakeLists.txt | 3 -- src/CXXTests/CMakeLists.txt | 2 +- 10 files changed, 40 insertions(+), 113 deletions(-) diff --git a/.gitmodules b/.gitmodules index 97affacfc..f2b124eeb 100644 --- a/.gitmodules +++ b/.gitmodules @@ -8,9 +8,7 @@ branch = origin/master [submodule "extern/PYB11Generator"] path = extern/PYB11Generator - branch = update_for_cmake_exports url = https://github.com/LLNL/PYB11Generator [submodule "extern/PolyClipper"] path = extern/PolyClipper - branch = update_for_cmake_exports url = https://github.com/LLNL/PolyClipper diff --git a/CMakeLists.txt b/CMakeLists.txt index 140cb486d..52fa93526 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,4 +10,3 @@ set(SPHERAL_TEST_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}) include(cmake/SetupSpheral.cmake) add_subdirectory(${SPHERAL_ROOT_DIR}/scripts) -include(cmake/SpheralConfig.cmake) diff --git a/cmake/InstallTPLs.cmake b/cmake/InstallTPLs.cmake index a4b6e2491..93c7390f8 100644 --- a/cmake/InstallTPLs.cmake +++ b/cmake/InstallTPLs.cmake @@ -17,7 +17,7 @@ if (NOT ENABLE_CXXONLY) set(Python3_ROOT_DIR ${python_DIR}) find_package(Python3 COMPONENTS Interpreter Development) set(PYTHON_EXE ${Python3_EXECUTABLE}) - list(APPEND spheral_blt_depends Python3::Python) + list(APPEND SPHERAL_BLT_DEPENDS Python3::Python) # Set the PYB11Generator path if (NOT PYB11GENERATOR_ROOT_DIR) @@ -28,7 +28,7 @@ if (NOT ENABLE_CXXONLY) set(PYBIND11_ROOT_DIR "${PYB11GENERATOR_ROOT_DIR}/extern/pybind11" CACHE PATH "") endif() include(${PYB11GENERATOR_ROOT_DIR}/cmake/PYB11Generator.cmake) - list(APPEND spheral_blt_depends pybind11_headers) + list(APPEND SPHERAL_BLT_DEPENDS pybind11_headers) install(TARGETS pybind11_headers EXPORT spheral_cxx-targets DESTINATION lib/cmake) @@ -37,9 +37,6 @@ endif() # This is currently unfilled in spheral set_property(GLOBAL PROPERTY SPHERAL_SUBMOD_INCLUDES "${SPHERAL_SUBMOD_INCLUDES}") -#----------------------------------------------------------------------------------- -# Find pre-compiled TPLs -#----------------------------------------------------------------------------------- # PolyClipper if (NOT polyclipper_DIR) @@ -52,17 +49,29 @@ set(POLYCLIPPER_INSTALL_DIR "PolyClipper/include") add_subdirectory(${polyclipper_DIR}) # Treat includes as system to prevent warnings blt_patch_target(NAME PolyClipperAPI TREAT_INCLUDES_AS_SYSTEM ON) -list(APPEND spheral_blt_depends PolyClipperAPI) +list(APPEND SPHERAL_BLT_DEPENDS PolyClipperAPI) install(TARGETS PolyClipperAPI EXPORT spheral_cxx-targets DESTINATION lib/cmake) set_target_properties(PolyClipperAPI PROPERTIES EXPORT_NAME spheral::PolyClipperAPI) -# TPLs that can use find_package -list(APPEND SPHERAL_EXTERN_PACKAGES axom) +#----------------------------------------------------------------------------------- +# Find pre-compiled TPLs +#----------------------------------------------------------------------------------- + +# Use find_package to get axom (which brings in fmt) and patch fmt +list(APPEND SPHERAL_BLT_DEPENDS axom) +find_package(axom REQUIRED QUIET NO_DEFAULT_PATH PATHS ${axom_DIR}/lib/cmake) +# Add fmt library to external library list +list(APPEND SPHERAL_BLT_DEPENDS fmt) +blt_patch_target(NAME fmt TREAT_INCLUDES_AS_SYSTEM ON) + +# Initialize TPL options +include(${SPHERAL_ROOT_DIR}/cmake/spheral/SpheralHandleTPL.cmake) # TPLs that must be imported list(APPEND SPHERAL_EXTERN_LIBS zlib boost eigen qhull silo hdf5 polytope) + if(ENABLE_ANEOS) list(APPEND SPHERAL_EXTERN_LIBS aneos) endif() @@ -73,23 +82,10 @@ if(ENABLE_TIMER) list(APPEND SPHERAL_EXTERN_LIBS caliper) endif() -# Initialize TPL options -include(${SPHERAL_ROOT_DIR}/cmake/spheral/SpheralHandleTPL.cmake) - -foreach(lib ${SPHERAL_EXTERN_PACKAGES}) - # Not sure why but _lib becomes an empty string after find_package so - # _lib must be added to list before find package - list(APPEND spheral_blt_depends ${lib}) - find_package(${lib} REQUIRED QUIET NO_DEFAULT_PATH PATHS ${${lib}_DIR}/lib/cmake) -endforeach() -# Add fmt library to external library list -list(APPEND spheral_blt_depends fmt) -blt_patch_target(NAME fmt TREAT_INCLUDES_AS_SYSTEM ON) - # Create target library for each external library foreach(lib ${SPHERAL_EXTERN_LIBS}) Spheral_Handle_TPL(${lib} ${TPL_SPHERAL_CMAKE_DIR}) - list(APPEND spheral_blt_depends ${lib}) + list(APPEND SPHERAL_BLT_DEPENDS ${lib}) endforeach() # Install each TPL target library @@ -102,7 +98,7 @@ foreach(lib ${SPHERAL_EXTERN_LIBS}) set_target_properties(${lib} PROPERTIES EXPORT_NAME spheral::${lib}) endif() endforeach() -# Note: spheral_blt_depends is made global after this in SetupSpheral.cmake +# Note: SPHERAL_BLT_DEPENDS is made global after this in SetupSpheral.cmake # This calls LLNLSpheralInstallTPLs.cmake if (EXISTS ${EXTERNAL_SPHERAL_TPL_CMAKE}) diff --git a/cmake/SetupSpheral.cmake b/cmake/SetupSpheral.cmake index f1f654927..3716cc989 100644 --- a/cmake/SetupSpheral.cmake +++ b/cmake/SetupSpheral.cmake @@ -59,11 +59,11 @@ endif() if(ENABLE_MPI) set(BLT_MPI_COMPILE_FLAGS -DUSE_MPI -DMPICH_SKIP_MPICXX -ULAM_WANT_MPI2CPP -DOMPI_SKIP_MPICXX) - list(APPEND spheral_blt_depends mpi) + list(APPEND SPHERAL_BLT_DEPENDS mpi) endif() if(ENABLE_OPENMP) - list(APPEND spheral_blt_depends openmp) + list(APPEND SPHERAL_BLT_DEPENDS openmp) endif() if(ENABLE_CUDA) @@ -120,7 +120,7 @@ set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) # Set global variables used for dependencies #------------------------------------------------------------------------------- # List of external dependencies -set_property(GLOBAL PROPERTY spheral_blt_depends "${spheral_blt_depends}") +set_property(GLOBAL PROPERTY SPHERAL_BLT_DEPENDS "${SPHERAL_BLT_DEPENDS}") # List of compiler dependencies set_property(GLOBAL PROPERTY SPHERAL_CXX_DEPENDS "${SPHERAL_CXX_DEPENDS}") @@ -175,3 +175,5 @@ if (ENABLE_TESTS) SOURCE ${SPHERAL_ROOT_DIR} DESTINATION ${SPHERAL_TEST_INSTALL_PREFIX}) endif() + +include(SpheralConfig) diff --git a/cmake/spheral/SpheralAddLibs.cmake b/cmake/spheral/SpheralAddLibs.cmake index 55c1d1edf..f36600d71 100644 --- a/cmake/spheral/SpheralAddLibs.cmake +++ b/cmake/spheral/SpheralAddLibs.cmake @@ -4,7 +4,7 @@ # ------------------------------------------- # VARIABLES THAT NEED TO BE PREVIOUSLY DEFINED # ------------------------------------------- -# spheral_blt_depends : REQUIRED : List of external dependencies +# SPHERAL_BLT_DEPENDS : REQUIRED : List of external dependencies # SPHERAL_CXX_DEPENDS : REQUIRED : List of compiler dependencies # _headers : OPTIONAL : List of necessary headers to include # _sources : OPTIONAL : List of necessary source files to include @@ -21,31 +21,17 @@ # : Target for a given spheral package #---------------------------------------------------------------------------------------- function(spheral_add_obj_library package_name) - # Assumes global variable spheral_blt_depends exists and is filled with external dependencies - get_property(spheral_blt_depends GLOBAL PROPERTY spheral_blt_depends) + # Assumes global variable SPHERAL_BLT_DEPENDS exists and is filled with external dependencies + get_property(SPHERAL_BLT_DEPENDS GLOBAL PROPERTY SPHERAL_BLT_DEPENDS) # Assumes global variable spheral_cxx_depends exists and is filled with compiler dependencies get_property(SPHERAL_CXX_DEPENDS GLOBAL PROPERTY SPHERAL_CXX_DEPENDS) # For including files in submodules, currently unused get_property(SPHERAL_SUBMOD_INCLUDES GLOBAL PROPERTY SPHERAL_SUBMOD_INCLUDES) - # Only the package_name is expected; any extra arguments are stored in ${ARGN}. - # This allows the NAME of a global list (not the list itself) - # with additional dependencies to be passed to the function. - - # First, check if additional arguments are provided - # CMake requires ${ARGN} is assigned before using with list - set(extra_args ${ARGN}) - list(LENGTH extra_args extra_count) - # Empty list unless extra arguments are provided - set(extra_depends ) - if (${extra_count} GREATER 0) - # Set list to global variable named by the argument - get_property(extra_depends GLOBAL PROPERTY ${ARGN}) - endif() blt_add_library(NAME Spheral_${package_name} HEADERS ${${package_name}_headers} SOURCES ${${package_name}_sources} - DEPENDS_ON ${spheral_blt_depends} ${${package_name}_ADDITIONAL_DEPENDS} ${SPHERAL_CXX_DEPENDS} ${extra_depends} + DEPENDS_ON ${SPHERAL_BLT_DEPENDS} ${SPHERAL_CXX_DEPENDS} OBJECT TRUE) target_include_directories(Spheral_${package_name} SYSTEM PUBLIC ${SPHERAL_SUBMOD_INCLUDES}) # Install the headers @@ -64,7 +50,7 @@ endfunction() # ------------------------------------------- # VARIABLES THAT NEED TO BE PREVIOUSLY DEFINED # ------------------------------------------- -# spheral_blt_depends : REQUIRED : List of external dependencies +# SPHERAL_BLT_DEPENDS : REQUIRED : List of external dependencies # SPHERAL_CXX_DEPENDS : REQUIRED : List of compiler dependencies # _headers : OPTIONAL : List of necessary headers to include # _sources : OPTIONAL : List of necessary source files to include @@ -80,37 +66,26 @@ endfunction() # : Exportable target for interal package name library #---------------------------------------------------------------------------------------- function(spheral_add_cxx_library package_name _cxx_obj_list) - # Assumes global variable spheral_blt_depends exists and is filled with external dependencies - get_property(spheral_blt_depends GLOBAL PROPERTY spheral_blt_depends) + # Assumes global variable SPHERAL_BLT_DEPENDS exists and is filled with external dependencies + get_property(SPHERAL_BLT_DEPENDS GLOBAL PROPERTY SPHERAL_BLT_DEPENDS) # Assumes global variable spheral_cxx_depends exists and is filled with compiler dependencies get_property(SPHERAL_CXX_DEPENDS GLOBAL PROPERTY SPHERAL_CXX_DEPENDS) # For including files in submodules, currently unused get_property(SPHERAL_SUBMOD_INCLUDES GLOBAL PROPERTY SPHERAL_SUBMOD_INCLUDES) - # set(EXTRA_CXX_DEPENDS ) - # # We can optionally specify the obj_libs_list and any additional dependencies - # set(extra_args ${ARGN}) - # list(LENGTH extra_args extra_count) - # if (${extra_count} GREATER 0) - # list(GET extra_args 0 spheral_blt_depends) - # endif() - # if (${extra_count} GREATER 1) - # list(GET extra_args 1 optional_arg) - # list(APPEND EXTRA_CXX_DEPENDS ${optional_arg}) - # endif() if(NOT ENABLE_SHARED) # Build static spheral C++ library blt_add_library(NAME Spheral_${package_name} HEADERS ${${package_name}_headers} SOURCES ${${package_name}_sources} - DEPENDS_ON ${_cxx_obj_list} ${spheral_blt_depends} ${SPHERAL_CXX_DEPENDS} + DEPENDS_ON ${_cxx_obj_list} ${SPHERAL_BLT_DEPENDS} ${SPHERAL_CXX_DEPENDS} SHARED FALSE) else() # Build shared spheral C++ library blt_add_library(NAME Spheral_${package_name} HEADERS ${${package_name}_headers} SOURCES ${${package_name}_sources} - DEPENDS_ON ${_cxx_obj_list} ${spheral_blt_depends} ${SPHERAL_CXX_DEPENDS} + DEPENDS_ON ${_cxx_obj_list} ${SPHERAL_BLT_DEPENDS} ${SPHERAL_CXX_DEPENDS} SHARED TRUE) endif() target_include_directories(Spheral_${package_name} SYSTEM PRIVATE ${SPHERAL_SUBMOD_INCLUDES}) @@ -129,9 +104,7 @@ function(spheral_add_cxx_library package_name _cxx_obj_list) install(EXPORT spheral_${lower_case_package}-targets DESTINATION lib/cmake) # Set the r-path of the C++ lib such that it is independent of the build dir when installed - # TODO: Determine if this is still necessary set_target_properties(Spheral_${package_name} PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") - #${conduit_DIR}/lib;${axom_DIR}/lib;${boost_DIR}/lib;${hdf5_DIR}/lib;${zlib_DIR}/lib;${SPHERAL_ADDITIONAL_RPATHS}") endfunction() @@ -148,7 +121,7 @@ endfunction() # Variables that must be set before calling spheral_add_obj_library: # spheral_depends # - List of targets the library depends on -# spheral_blt_depends +# SPHERAL_BLT_DEPENDS # - List of blt/libs the library depends on # #----------------------------------------------------------------------------------- @@ -214,10 +187,8 @@ function(spheral_add_pybind11_library package_name) string(JOIN ":" PYTHON_ENV_STR ${PYTHON_ENV_STR} ${SPACK_PYTHONPATH}) - # Flag to tell PYB11Generator to use blt_add_library - set(${package_name}_USE_BLT ON BOOL) # Get the TPL dependencies - get_property(spheral_blt_depends GLOBAL PROPERTY spheral_blt_depends) + get_property(SPHERAL_BLT_DEPENDS GLOBAL PROPERTY SPHERAL_BLT_DEPENDS) get_property(spheral_tpl_includes GLOBAL PROPERTY spheral_tpl_includes) get_property(spheral_tpl_libraries GLOBAL PROPERTY spheral_tpl_libraries) @@ -225,7 +196,7 @@ function(spheral_add_pybind11_library package_name) PYB11Generator_add_module(${package_name} MODULE ${MODULE_NAME} SOURCE ${package_name}_PYB11.py - DEPENDS ${spheral_depends} ${spheral_blt_depends} ${${package_name}_DEPENDS} ${SPHERAL_CXX_DEPENDS} ${EXTRA_CXX_DEPENDS} Spheral_CXX + DEPENDS ${spheral_depends} ${SPHERAL_BLT_DEPENDS} ${${package_name}_DEPENDS} ${SPHERAL_CXX_DEPENDS} ${EXTRA_CXX_DEPENDS} Spheral_CXX PYTHONPATH ${PYTHON_ENV_STR} INCLUDES ${CMAKE_CURRENT_SOURCE_DIR} ${SPHERAL_INCLUDES} ${${package_name}_INCLUDES} ${spheral_tpl_includes} ${PYBIND11_ROOT_DIR}/include LINKS ${spheral_tpl_libraries} @@ -242,8 +213,6 @@ function(spheral_add_pybind11_library package_name) ) # Set the r-path of the C++ lib such that it is independent of the build dir when installed - set_target_properties(${MODULE_NAME} PROPERTIES - INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib;${conduit_DIR}/lib;${axom_DIR}/lib;${boost_DIR}/lib;${python_DIR}/lib;${hdf5_DIR}/lib;${zlib_DIR}/lib;${SPHERAL_ADDITIONAL_RPATHS}" - ) + set_target_properties(${MODULE_NAME} PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") endfunction() diff --git a/cmake/spheral_cxx-config.cmake.in b/cmake/spheral_cxx-config.cmake.in index 53e8b8a80..d982d2945 100644 --- a/cmake/spheral_cxx-config.cmake.in +++ b/cmake/spheral_cxx-config.cmake.in @@ -1,43 +1,9 @@ @PACKAGE_INIT@ -set(ENABLE_CXXONLY "@ENABLE_CXXONLY@") -set(SPHERAL_ENABLE_CUDA "@ENABLE_CUDA@") -set(SPHERAL_ENABLE_MPI "@ENABLE_MPI@") -set(SPHERAL_ENABLE_OPENMP "@ENABLE_OPENMP@") -# TODO: Add check to avoid setting these when unnecessary -set(CMAKE_C_COMPILER "@CMAKE_C_COMPILER@" CACHE PATH "") -set(CMAKE_CXX_COMPILER "@CMAKE_CXX_COMPILER@" CACHE PATH "") -set(CMAKE_Fortran_COMPILER "@CMAKE_Fortran_COMPILER@" CACHE PATH "") -set(MPI_C_COMPILER "@MPI_C_COMPILER@" CACHE PATH "") -set(MPI_CXX_COMPILER "@MPI_CXX_COMPILER@" CACHE PATH "") -set(MPI_Fortran_COMPILER "@MPI_Fortran_COMPILER@" CACHE PATH "") -set(MPIEXEC_EXECUTABLE "@MPIEXEC_EXECUTABLE@" CACHE PATH "") -set(MPIEXEC_NUMPROC_FLAG "@MPIEXEC_NUMPROC_FLAG@" CACHE STRING "") -set(-DMPI_C_COMPILER "@-DMPI_C_COMPILER@" CACHE PATH "") -set(-DMPI_CXX_COMPILER "@-DMPI_CXX_COMPILER@" CACHE PATH "") if(NOT axom_DIR) set(axom_DIR "@axom_DIR@" CACHE PATH "") endif() -if(NOT silo_DIR) - set(silo_DIR "@silo_DIR@" CACHE PATH "") -endif() -if(NOT hdf5_DIR) - set(hdf5_DIR "@hdf5_DIR@" CACHE PATH "") -endif() -if(NOT eigen_DIR) - set(eigen_DIR "@eigen_DIR@" CACHE PATH "") - set(eigen_INCLUDES "@eigen_INCLUDES@" CACHE PATH "") -endif() -if(NOT polytope_DIR) - set(polytope_DIR "@polytope_DIR@" CACHE PATH "") -endif() -if(NOT boost_DIR) - set(boost_DIR "@boost_DIR@" CACHE PATH "") -endif() -if(NOT qhull_DIR) - set(qhull_DIR "@qhull_DIR@" CACHE PATH "") -endif() set(SPHERAL_BLT_DIR "@SPHERAL_BLT_DIR@") set(SPHERAL_CXX_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@") set(SPHERAL_CXX_INCLUDE_DIRS "${SPHERAL_CXX_INSTALL_PREFIX}/include") diff --git a/extern/PYB11Generator b/extern/PYB11Generator index 39edc5981..608f12c7c 160000 --- a/extern/PYB11Generator +++ b/extern/PYB11Generator @@ -1 +1 @@ -Subproject commit 39edc5981bbe4c2d303ea3a1bbd08b0362c120c6 +Subproject commit 608f12c7c439d40742cc8971efe74cbcc6b78663 diff --git a/extern/PolyClipper b/extern/PolyClipper index de4ca63d4..6ab94c23a 160000 --- a/extern/PolyClipper +++ b/extern/PolyClipper @@ -1 +1 @@ -Subproject commit de4ca63d4c0cfbaf44439c2a42e3310e4cabba50 +Subproject commit 6ab94c23a5beccc6f1c417c9a0b944b657de9936 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index dccb7873f..cdc31d016 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -53,9 +53,6 @@ list(APPEND _dir_packages if(ENABLE_MPI) # Add Distributed target list(APPEND _target_packages Distributed) -else() - # Otherwise, run add_subdirectory - list(APPEND _dir_packages Distributed) endif() if(NOT ENABLE_CXXONLY) diff --git a/src/CXXTests/CMakeLists.txt b/src/CXXTests/CMakeLists.txt index 42c59eb8d..69a635fc0 100644 --- a/src/CXXTests/CMakeLists.txt +++ b/src/CXXTests/CMakeLists.txt @@ -2,7 +2,7 @@ get_property(SPHERAL_CXX_LIBS GLOBAL PROPERTY SPHERAL_CXX_LIBS) add_subdirectory(DeviceTestLib) -if(ENABLE_TESTS AND ENABLE_CUDA) +if(ENABLE_TESTS) blt_add_executable( NAME spheral_cuda_test SOURCES Spheral_CUDA_Test.cc DEPENDS_ON Spheral_CXX ${spheral_blt_cxx_depends}) From f5d5b34b7108a894713e86ca98acfbfc22216f13 Mon Sep 17 00:00:00 2001 From: Landon Owen Date: Mon, 25 Sep 2023 17:32:07 -0700 Subject: [PATCH 17/23] Fix comments for spheral obj function --- cmake/spheral/SpheralAddLibs.cmake | 2 -- 1 file changed, 2 deletions(-) diff --git a/cmake/spheral/SpheralAddLibs.cmake b/cmake/spheral/SpheralAddLibs.cmake index f36600d71..87df2efc4 100644 --- a/cmake/spheral/SpheralAddLibs.cmake +++ b/cmake/spheral/SpheralAddLibs.cmake @@ -13,8 +13,6 @@ # INPUT-OUTPUT VARIABLES # ---------------------- # : REQUIRED : Desired package name -# any extra args : OPTIONAL : Can provide the NAME of a global list -# containing additional dependencies # -----------------------, # OUTPUT VARIABLES TO USE - Made available implicitly after function call # ----------------------- From c6e2f7e5c4f78facb7dc20c0eb90c1f66b6a1708 Mon Sep 17 00:00:00 2001 From: Landon Owen Date: Tue, 26 Sep 2023 16:21:58 -0700 Subject: [PATCH 18/23] Changed spheral_add_obj_library function to require global variable name as input, added variable name input for these function calls, moved the install and export calls into the TPL function, merged lists for source CMakeList.txt --- cmake/InstallTPLs.cmake | 13 +-------- cmake/SetupSpheral.cmake | 2 +- cmake/spheral/SpheralAddLibs.cmake | 22 ++++++++------ cmake/spheral/SpheralHandleTPL.cmake | 7 +++++ src/ArtificialConduction/CMakeLists.txt | 2 +- src/ArtificialViscosity/CMakeLists.txt | 2 +- src/Boundary/CMakeLists.txt | 2 +- src/CMakeLists.txt | 35 +++++++---------------- src/CRKSPH/CMakeLists.txt | 4 +-- src/CXXTests/DeviceTestLib/CMakeLists.txt | 2 +- src/DEM/CMakeLists.txt | 2 +- src/Damage/CMakeLists.txt | 2 +- src/DataBase/CMakeLists.txt | 2 +- src/DataOutput/CMakeLists.txt | 2 +- src/Distributed/CMakeLists.txt | 2 +- src/ExternalForce/CMakeLists.txt | 2 +- src/FSISPH/CMakeLists.txt | 2 +- src/Field/CMakeLists.txt | 2 +- src/FieldOperations/CMakeLists.txt | 2 +- src/FileIO/CMakeLists.txt | 2 +- src/GSPH/CMakeLists.txt | 2 +- src/Geometry/CMakeLists.txt | 2 +- src/Gravity/CMakeLists.txt | 2 +- src/Hydro/CMakeLists.txt | 2 +- src/Integrator/CMakeLists.txt | 2 +- src/Kernel/CMakeLists.txt | 2 +- src/KernelIntegrator/CMakeLists.txt | 2 +- src/Material/CMakeLists.txt | 2 +- src/Mesh/CMakeLists.txt | 2 +- src/Neighbor/CMakeLists.txt | 2 +- src/NodeGenerators/CMakeLists.txt | 2 +- src/NodeList/CMakeLists.txt | 2 +- src/Physics/CMakeLists.txt | 2 +- src/RK/CMakeLists.txt | 2 +- src/SPH/CMakeLists.txt | 2 +- src/SVPH/CMakeLists.txt | 2 +- src/SolidMaterial/CMakeLists.txt | 2 +- src/Strength/CMakeLists.txt | 2 +- src/Utilities/CMakeLists.txt | 2 +- 39 files changed, 68 insertions(+), 81 deletions(-) diff --git a/cmake/InstallTPLs.cmake b/cmake/InstallTPLs.cmake index 93c7390f8..772b673e4 100644 --- a/cmake/InstallTPLs.cmake +++ b/cmake/InstallTPLs.cmake @@ -82,22 +82,11 @@ if(ENABLE_TIMER) list(APPEND SPHERAL_EXTERN_LIBS caliper) endif() -# Create target library for each external library +# Create and install target library for each external library foreach(lib ${SPHERAL_EXTERN_LIBS}) Spheral_Handle_TPL(${lib} ${TPL_SPHERAL_CMAKE_DIR}) list(APPEND SPHERAL_BLT_DEPENDS ${lib}) endforeach() - -# Install each TPL target library -foreach(lib ${SPHERAL_EXTERN_LIBS}) - get_target_property(_is_imported ${lib} IMPORTED) - if(NOT ${_is_imported}) - install(TARGETS ${lib} - EXPORT spheral_cxx-targets - DESTINATION lib/cmake) - set_target_properties(${lib} PROPERTIES EXPORT_NAME spheral::${lib}) - endif() -endforeach() # Note: SPHERAL_BLT_DEPENDS is made global after this in SetupSpheral.cmake # This calls LLNLSpheralInstallTPLs.cmake diff --git a/cmake/SetupSpheral.cmake b/cmake/SetupSpheral.cmake index 3716cc989..8e28f95f9 100644 --- a/cmake/SetupSpheral.cmake +++ b/cmake/SetupSpheral.cmake @@ -176,4 +176,4 @@ if (ENABLE_TESTS) DESTINATION ${SPHERAL_TEST_INSTALL_PREFIX}) endif() -include(SpheralConfig) +include(${SPHERAL_ROOT_DIR}/cmake/SpheralConfig.cmake) diff --git a/cmake/spheral/SpheralAddLibs.cmake b/cmake/spheral/SpheralAddLibs.cmake index 87df2efc4..e1c896138 100644 --- a/cmake/spheral/SpheralAddLibs.cmake +++ b/cmake/spheral/SpheralAddLibs.cmake @@ -12,16 +12,19 @@ # ---------------------- # INPUT-OUTPUT VARIABLES # ---------------------- -# : REQUIRED : Desired package name -# -----------------------, +# package_name : REQUIRED : Desired package name +# obj_list_name : REQUIRED : The NAME of the global variable that is the list of +# internal target libraries (not the list itself) +# ----------------------- # OUTPUT VARIABLES TO USE - Made available implicitly after function call # ----------------------- -# : Target for a given spheral package +# Spheral_ : Target for a given spheral package +# : List of internal Spheral target objects, appended with target name #---------------------------------------------------------------------------------------- -function(spheral_add_obj_library package_name) +function(spheral_add_obj_library package_name obj_list_name) # Assumes global variable SPHERAL_BLT_DEPENDS exists and is filled with external dependencies get_property(SPHERAL_BLT_DEPENDS GLOBAL PROPERTY SPHERAL_BLT_DEPENDS) - # Assumes global variable spheral_cxx_depends exists and is filled with compiler dependencies + # Assumes global variable SPHERAL_CXX_DEPENDS exists and is filled with compiler dependencies get_property(SPHERAL_CXX_DEPENDS GLOBAL PROPERTY SPHERAL_CXX_DEPENDS) # For including files in submodules, currently unused get_property(SPHERAL_SUBMOD_INCLUDES GLOBAL PROPERTY SPHERAL_SUBMOD_INCLUDES) @@ -36,6 +39,9 @@ function(spheral_add_obj_library package_name) install(FILES ${${package_name}_headers} DESTINATION include/${package_name}) + # Append Spheral_${package_name} to the global object list + # For example, SPHERAL_OBJ_LIBS or LLNLSPHERAL_OBJ_LIBS + set_property(GLOBAL APPEND PROPERTY ${obj_list_name} Spheral_${package_name}) if(ENABLE_CUDA) set_target_properties(Spheral_${package_name} PROPERTIES CUDA_SEPARABLE_COMPILATION ON) endif() @@ -56,12 +62,12 @@ endfunction() # ---------------------- # INPUT-OUTPUT VARIABLES # ---------------------- -# : REQUIRED : Desired package name -# <_cxx_obj_list> : REQUIRED : List of internal targets to include +# package_name : REQUIRED : Desired package name +# _cxx_obj_list : REQUIRED : List of internal targets to include # ----------------------- # OUTPUT VARIABLES TO USE - Made available implicitly after function call # ----------------------- -# : Exportable target for interal package name library +# Spheral_ : Exportable target for interal package name library #---------------------------------------------------------------------------------------- function(spheral_add_cxx_library package_name _cxx_obj_list) # Assumes global variable SPHERAL_BLT_DEPENDS exists and is filled with external dependencies diff --git a/cmake/spheral/SpheralHandleTPL.cmake b/cmake/spheral/SpheralHandleTPL.cmake index 7670a14d2..3e75a8978 100644 --- a/cmake/spheral/SpheralHandleTPL.cmake +++ b/cmake/spheral/SpheralHandleTPL.cmake @@ -86,4 +86,11 @@ function(Spheral_Handle_TPL lib_name TPL_CMAKE_DIR) INCLUDES ${${lib_name}_INCLUDE_DIR} LIBRARIES ${${lib_name}_LIBRARIES} EXPORTABLE ON) + get_target_property(_is_imported ${lib_name} IMPORTED) + if(NOT ${_is_imported}) + install(TARGETS ${lib_name} + EXPORT spheral_cxx-targets + DESTINATION lib/cmake) + endif() + set_target_properties(${lib_name} PROPERTIES EXPORT_NAME spheral::${lib_name}) endfunction() diff --git a/src/ArtificialConduction/CMakeLists.txt b/src/ArtificialConduction/CMakeLists.txt index 6e3b4d4ba..dfb5f5d29 100644 --- a/src/ArtificialConduction/CMakeLists.txt +++ b/src/ArtificialConduction/CMakeLists.txt @@ -12,5 +12,5 @@ set(ArtificialConduction_headers ArtificialConductionPolicy.hh ) -spheral_add_obj_library(ArtificialConduction) +spheral_add_obj_library(ArtificialConduction "SPHERAL_OBJ_LIBS") diff --git a/src/ArtificialViscosity/CMakeLists.txt b/src/ArtificialViscosity/CMakeLists.txt index f2ac2cfbf..e29ac69eb 100644 --- a/src/ArtificialViscosity/CMakeLists.txt +++ b/src/ArtificialViscosity/CMakeLists.txt @@ -50,5 +50,5 @@ set(ArtificialViscosity_headers VonNeumanViscosity.hh ) -spheral_add_obj_library(ArtificialViscosity) +spheral_add_obj_library(ArtificialViscosity "SPHERAL_OBJ_LIBS") diff --git a/src/Boundary/CMakeLists.txt b/src/Boundary/CMakeLists.txt index a91f407bb..108b58aca 100644 --- a/src/Boundary/CMakeLists.txt +++ b/src/Boundary/CMakeLists.txt @@ -80,5 +80,5 @@ set(Boundary_headers spheral_install_python_files(ExpandingDomain.py) -spheral_add_obj_library(Boundary) +spheral_add_obj_library(Boundary "SPHERAL_OBJ_LIBS") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index cdc31d016..e8b24ecf5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -10,16 +10,18 @@ include_directories(${PROJECT_BINARY_DIR}/src) set(SPHERAL_PYTHON_INSTALL ${PROJECT_BINARY_DIR}/lib) -# These are packages that must be made into targets and added as dependencies to SpheralCXX -list(APPEND _target_packages +# These are internal Spheral packages +list(APPEND _packages ArtificialViscosity ArtificialConduction Boundary CRKSPH + CXXTests Damage DataBase DataOutput DEM + Distributed ExternalForce Field FieldOperations @@ -37,8 +39,10 @@ list(APPEND _target_packages NodeGenerators NodeList Physics + PYB11 RK GSPH + SimulationControl SolidMaterial SPH Strength @@ -46,38 +50,19 @@ list(APPEND _target_packages Utilities ) -# These are directories that should be added but not made into targets -list(APPEND _dir_packages - CXXTests) - -if(ENABLE_MPI) - # Add Distributed target - list(APPEND _target_packages Distributed) -endif() - -if(NOT ENABLE_CXXONLY) - list(APPEND _dir_packages SimulationControl PYB11) -endif() - configure_file(config.hh.in ${PROJECT_BINARY_DIR}/src/config.hh) -foreach(_package ${_dir_packages}) +foreach(_package ${_packages}) add_subdirectory(${_package}) endforeach() -# Create a list of internal targets needed as dependencies for SpheralCXX -set(cxx_obj_list ) -foreach(_package ${_target_packages}) - list(APPEND cxx_obj_list "Spheral_${_package}") - add_subdirectory(${_package}) -endforeach() -# Add target nested in CXXTests -list(APPEND cxx_obj_list "Spheral_DeviceTestLib") +# Retrieve the global list populated in spheral_obj_add_library +get_property(SPHERAL_OBJ_LIBS GLOBAL PROPERTY SPHERAL_OBJ_LIBS) set(CXX_sources spheralCXX.cc) # Must use quotes when passing lists as inputs for functions -spheral_add_cxx_library(CXX "${cxx_obj_list}") +spheral_add_cxx_library(CXX "${SPHERAL_OBJ_LIBS}") # This calls LLNLSpheralInstallObjs.cmake if(EXISTS ${EXTERNAL_SPHERAL_OBJ_CMAKE}) diff --git a/src/CRKSPH/CMakeLists.txt b/src/CRKSPH/CMakeLists.txt index 31714d995..fb788d9f3 100644 --- a/src/CRKSPH/CMakeLists.txt +++ b/src/CRKSPH/CMakeLists.txt @@ -49,7 +49,7 @@ set(CRKSPH_headers zerothOrderSurfaceCorrections.hh ) -spheral_add_obj_library(CRKSPH) - +spheral_add_obj_library(CRKSPH "SPHERAL_OBJ_LIBS") + spheral_install_python_files(CRKSPHHydros.py) diff --git a/src/CXXTests/DeviceTestLib/CMakeLists.txt b/src/CXXTests/DeviceTestLib/CMakeLists.txt index 2cd58ed35..1a52299dc 100644 --- a/src/CXXTests/DeviceTestLib/CMakeLists.txt +++ b/src/CXXTests/DeviceTestLib/CMakeLists.txt @@ -14,5 +14,5 @@ set(DeviceTestLib_headers spheral_install_python_files( ) -spheral_add_obj_library(DeviceTestLib) +spheral_add_obj_library(DeviceTestLib "SPHERAL_OBJ_LIBS") diff --git a/src/DEM/CMakeLists.txt b/src/DEM/CMakeLists.txt index cf2bcc1bb..737a823f9 100644 --- a/src/DEM/CMakeLists.txt +++ b/src/DEM/CMakeLists.txt @@ -44,5 +44,5 @@ add_subdirectory(SolidBoundary) spheral_install_python_files(DEM.py) -spheral_add_obj_library(DEM) +spheral_add_obj_library(DEM "SPHERAL_OBJ_LIBS") diff --git a/src/Damage/CMakeLists.txt b/src/Damage/CMakeLists.txt index 1da11e7d1..ae060e346 100644 --- a/src/Damage/CMakeLists.txt +++ b/src/Damage/CMakeLists.txt @@ -73,5 +73,5 @@ spheral_install_python_files( ShadowIvanoviSALEDamageModel.py ) -spheral_add_obj_library(Damage) +spheral_add_obj_library(Damage "SPHERAL_OBJ_LIBS") diff --git a/src/DataBase/CMakeLists.txt b/src/DataBase/CMakeLists.txt index b1da8363c..20cb373ea 100644 --- a/src/DataBase/CMakeLists.txt +++ b/src/DataBase/CMakeLists.txt @@ -54,5 +54,5 @@ set(DataBase_headers UpdatePolicyBaseInline.hh ) -spheral_add_obj_library(DataBase) +spheral_add_obj_library(DataBase "SPHERAL_OBJ_LIBS") diff --git a/src/DataOutput/CMakeLists.txt b/src/DataOutput/CMakeLists.txt index 49d5c3c50..555b8f0c3 100644 --- a/src/DataOutput/CMakeLists.txt +++ b/src/DataOutput/CMakeLists.txt @@ -14,5 +14,5 @@ set(DataOutput_headers registerWithRestart.hh ) -spheral_add_obj_library(DataOutput) +spheral_add_obj_library(DataOutput "SPHERAL_OBJ_LIBS") diff --git a/src/Distributed/CMakeLists.txt b/src/Distributed/CMakeLists.txt index b3aabb706..767f8bac9 100644 --- a/src/Distributed/CMakeLists.txt +++ b/src/Distributed/CMakeLists.txt @@ -70,7 +70,7 @@ if (ENABLE_MPI) RENAME mpi.py ) - spheral_add_obj_library(Distributed) + spheral_add_obj_library(Distributed "SPHERAL_OBJ_LIBS") else() #---------------------------------------------------------------------------- diff --git a/src/ExternalForce/CMakeLists.txt b/src/ExternalForce/CMakeLists.txt index bebadc89d..c373b6e81 100644 --- a/src/ExternalForce/CMakeLists.txt +++ b/src/ExternalForce/CMakeLists.txt @@ -27,5 +27,5 @@ set(ExternalForce_includes ) -spheral_add_obj_library(ExternalForce) +spheral_add_obj_library(ExternalForce "SPHERAL_OBJ_LIBS") diff --git a/src/FSISPH/CMakeLists.txt b/src/FSISPH/CMakeLists.txt index be9de90e8..43ecde849 100644 --- a/src/FSISPH/CMakeLists.txt +++ b/src/FSISPH/CMakeLists.txt @@ -28,5 +28,5 @@ spheral_install_python_files( SlideSurfaces.py ) -spheral_add_obj_library(FSISPH) +spheral_add_obj_library(FSISPH "SPHERAL_OBJ_LIBS") diff --git a/src/Field/CMakeLists.txt b/src/Field/CMakeLists.txt index 76d12f4f1..faf0394f9 100644 --- a/src/Field/CMakeLists.txt +++ b/src/Field/CMakeLists.txt @@ -45,5 +45,5 @@ set(Field_headers uvm_allocator.hh ) -spheral_add_obj_library(Field) +spheral_add_obj_library(Field "SPHERAL_OBJ_LIBS") diff --git a/src/FieldOperations/CMakeLists.txt b/src/FieldOperations/CMakeLists.txt index 2a2728374..da9937b91 100644 --- a/src/FieldOperations/CMakeLists.txt +++ b/src/FieldOperations/CMakeLists.txt @@ -40,5 +40,5 @@ set(FieldOperations_headers sampleMultipleFields2Lattice.hh ) -spheral_add_obj_library(FieldOperations) +spheral_add_obj_library(FieldOperations "SPHERAL_OBJ_LIBS") diff --git a/src/FileIO/CMakeLists.txt b/src/FileIO/CMakeLists.txt index 098a1b265..97c64bd2c 100644 --- a/src/FileIO/CMakeLists.txt +++ b/src/FileIO/CMakeLists.txt @@ -30,5 +30,5 @@ spheral_install_python_files( PlyFileIO.py ) -spheral_add_obj_library(FileIO) +spheral_add_obj_library(FileIO "SPHERAL_OBJ_LIBS") diff --git a/src/GSPH/CMakeLists.txt b/src/GSPH/CMakeLists.txt index 13a01ee97..4d25939cd 100644 --- a/src/GSPH/CMakeLists.txt +++ b/src/GSPH/CMakeLists.txt @@ -59,5 +59,5 @@ instantiate(GSPH_inst GSPH_sources) spheral_install_python_files(GSPHHydros.py) -spheral_add_obj_library(GSPH) +spheral_add_obj_library(GSPH "SPHERAL_OBJ_LIBS") diff --git a/src/Geometry/CMakeLists.txt b/src/Geometry/CMakeLists.txt index 13976ece0..5256b7f06 100644 --- a/src/Geometry/CMakeLists.txt +++ b/src/Geometry/CMakeLists.txt @@ -100,5 +100,5 @@ set(Geometry_headers outerProduct.hh ) -spheral_add_obj_library(Geometry) +spheral_add_obj_library(Geometry "SPHERAL_OBJ_LIBS") diff --git a/src/Gravity/CMakeLists.txt b/src/Gravity/CMakeLists.txt index 14323dd77..e1ee8c8bb 100644 --- a/src/Gravity/CMakeLists.txt +++ b/src/Gravity/CMakeLists.txt @@ -23,5 +23,5 @@ set(Gravity_headers PolyGravity.hh ) -spheral_add_obj_library(Gravity) +spheral_add_obj_library(Gravity "SPHERAL_OBJ_LIBS") diff --git a/src/Hydro/CMakeLists.txt b/src/Hydro/CMakeLists.txt index 95f8fdaae..8c4fb7c91 100644 --- a/src/Hydro/CMakeLists.txt +++ b/src/Hydro/CMakeLists.txt @@ -59,5 +59,5 @@ set(Hydro_headers entropyWeightingFunction.hh ) -spheral_add_obj_library(Hydro) +spheral_add_obj_library(Hydro "SPHERAL_OBJ_LIBS") diff --git a/src/Integrator/CMakeLists.txt b/src/Integrator/CMakeLists.txt index e0a445f3c..4061dbd0b 100644 --- a/src/Integrator/CMakeLists.txt +++ b/src/Integrator/CMakeLists.txt @@ -24,5 +24,5 @@ set(Integrator_headers Verlet.hh ) -spheral_add_obj_library(Integrator) +spheral_add_obj_library(Integrator "SPHERAL_OBJ_LIBS") diff --git a/src/Kernel/CMakeLists.txt b/src/Kernel/CMakeLists.txt index 8c3769403..d5ad4cc74 100644 --- a/src/Kernel/CMakeLists.txt +++ b/src/Kernel/CMakeLists.txt @@ -68,5 +68,5 @@ set(Kernel_headers WendlandC6KernelInline.hh ) -spheral_add_obj_library(Kernel) +spheral_add_obj_library(Kernel "SPHERAL_OBJ_LIBS") diff --git a/src/KernelIntegrator/CMakeLists.txt b/src/KernelIntegrator/CMakeLists.txt index db1291dfe..d130e0257 100644 --- a/src/KernelIntegrator/CMakeLists.txt +++ b/src/KernelIntegrator/CMakeLists.txt @@ -39,4 +39,4 @@ set(KernelIntegrator_headers SymmetricTriangularValues.hh ) -spheral_add_obj_library(KernelIntegrator) +spheral_add_obj_library(KernelIntegrator "SPHERAL_OBJ_LIBS") diff --git a/src/Material/CMakeLists.txt b/src/Material/CMakeLists.txt index 3a2070726..abe5d0eb2 100644 --- a/src/Material/CMakeLists.txt +++ b/src/Material/CMakeLists.txt @@ -42,5 +42,5 @@ endif() instantiate(Material_inst Material_sources) -spheral_add_obj_library(Material) +spheral_add_obj_library(Material "SPHERAL_OBJ_LIBS") diff --git a/src/Mesh/CMakeLists.txt b/src/Mesh/CMakeLists.txt index 9f5a368ca..ca26b8adf 100644 --- a/src/Mesh/CMakeLists.txt +++ b/src/Mesh/CMakeLists.txt @@ -54,5 +54,5 @@ spheral_install_python_files( siloMeshDump.py ) -spheral_add_obj_library(Mesh) +spheral_add_obj_library(Mesh "SPHERAL_OBJ_LIBS") diff --git a/src/Neighbor/CMakeLists.txt b/src/Neighbor/CMakeLists.txt index 324669873..762896fb5 100644 --- a/src/Neighbor/CMakeLists.txt +++ b/src/Neighbor/CMakeLists.txt @@ -30,5 +30,5 @@ set(Neighbor_headers TreeNeighbor.hh ) -spheral_add_obj_library(Neighbor) +spheral_add_obj_library(Neighbor "SPHERAL_OBJ_LIBS") diff --git a/src/NodeGenerators/CMakeLists.txt b/src/NodeGenerators/CMakeLists.txt index a63425f5c..eea36f136 100644 --- a/src/NodeGenerators/CMakeLists.txt +++ b/src/NodeGenerators/CMakeLists.txt @@ -69,5 +69,5 @@ spheral_install_python_files( GenerateSphericalNodeDistribution1d.py ) -spheral_add_obj_library(NodeGenerators) +spheral_add_obj_library(NodeGenerators "SPHERAL_OBJ_LIBS") diff --git a/src/NodeList/CMakeLists.txt b/src/NodeList/CMakeLists.txt index be4853434..1fdfb6f87 100644 --- a/src/NodeList/CMakeLists.txt +++ b/src/NodeList/CMakeLists.txt @@ -46,5 +46,5 @@ spheral_install_python_files( DEMNodeLists.py ) -spheral_add_obj_library(NodeList) +spheral_add_obj_library(NodeList "SPHERAL_OBJ_LIBS") diff --git a/src/Physics/CMakeLists.txt b/src/Physics/CMakeLists.txt index 23395b992..5fda0e9fa 100644 --- a/src/Physics/CMakeLists.txt +++ b/src/Physics/CMakeLists.txt @@ -17,5 +17,5 @@ set(Physics_headers PhysicsInline.hh ) -spheral_add_obj_library(Physics) +spheral_add_obj_library(Physics "SPHERAL_OBJ_LIBS") diff --git a/src/RK/CMakeLists.txt b/src/RK/CMakeLists.txt index 185df0007..a51817c4c 100644 --- a/src/RK/CMakeLists.txt +++ b/src/RK/CMakeLists.txt @@ -61,5 +61,5 @@ set(RK_headers interpolateRK.hh ) -spheral_add_obj_library(RK) +spheral_add_obj_library(RK "SPHERAL_OBJ_LIBS") diff --git a/src/SPH/CMakeLists.txt b/src/SPH/CMakeLists.txt index eace4fd15..881db7b0e 100644 --- a/src/SPH/CMakeLists.txt +++ b/src/SPH/CMakeLists.txt @@ -63,5 +63,5 @@ spheral_install_python_files( FacetedSurfaceASPHHydro.py ) -spheral_add_obj_library(SPH) +spheral_add_obj_library(SPH "SPHERAL_OBJ_LIBS") diff --git a/src/SVPH/CMakeLists.txt b/src/SVPH/CMakeLists.txt index 42b6034f1..32cefe798 100644 --- a/src/SVPH/CMakeLists.txt +++ b/src/SVPH/CMakeLists.txt @@ -42,5 +42,5 @@ set(SVPH_headers spheral_install_python_files(SVPHHydros.py) -spheral_add_obj_library(SVPH) +spheral_add_obj_library(SVPH "SPHERAL_OBJ_LIBS") diff --git a/src/SolidMaterial/CMakeLists.txt b/src/SolidMaterial/CMakeLists.txt index fdd835333..2fff67055 100644 --- a/src/SolidMaterial/CMakeLists.txt +++ b/src/SolidMaterial/CMakeLists.txt @@ -82,5 +82,5 @@ instantiate(SolidMaterial_inst SolidMaterial_sources) # Ignore -W-maybe-uninitialized warnings thrown from bisectSearch for possibly uninitialized iterators from boost multi-array. set_source_files_properties(ANEOSInst1d.cc ANEOSInst2d.cc ANEOSInst3d.cc PROPERTIES COMPILE_FLAGS "$<$:-Wno-uninitialized>") -spheral_add_obj_library(SolidMaterial) +spheral_add_obj_library(SolidMaterial "SPHERAL_OBJ_LIBS") diff --git a/src/Strength/CMakeLists.txt b/src/Strength/CMakeLists.txt index 66cf309ae..db837f5c0 100644 --- a/src/Strength/CMakeLists.txt +++ b/src/Strength/CMakeLists.txt @@ -27,5 +27,5 @@ set(Strength_headers effectiveKernelVolume.hh ) -spheral_add_obj_library(Strength) +spheral_add_obj_library(Strength "SPHERAL_OBJ_LIBS") diff --git a/src/Utilities/CMakeLists.txt b/src/Utilities/CMakeLists.txt index 196e15bda..bb2ae8ffa 100644 --- a/src/Utilities/CMakeLists.txt +++ b/src/Utilities/CMakeLists.txt @@ -140,5 +140,5 @@ set(Utilities_headers spheral_install_python_files(fitspline.py) -spheral_add_obj_library(Utilities) +spheral_add_obj_library(Utilities "SPHERAL_OBJ_LIBS") From be452f7651591a3a06fc0c9ab1459c801f2da4f6 Mon Sep 17 00:00:00 2001 From: Landon Owen Date: Tue, 26 Sep 2023 16:58:43 -0700 Subject: [PATCH 19/23] Need to check if ENABLE_CXXONLY is on before including certain packages --- src/CMakeLists.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e8b24ecf5..e2a0ffeb9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -39,10 +39,8 @@ list(APPEND _packages NodeGenerators NodeList Physics - PYB11 RK GSPH - SimulationControl SolidMaterial SPH Strength @@ -50,6 +48,11 @@ list(APPEND _packages Utilities ) + if(NOT ENABLE_CXXONLY) + list(APPEND _packages + SimulationControl + PYB11) + endif() configure_file(config.hh.in ${PROJECT_BINARY_DIR}/src/config.hh) From f700bde68bbd80c2d6ba4b816d600c8b868a0ad6 Mon Sep 17 00:00:00 2001 From: Landon Owen Date: Tue, 26 Sep 2023 17:16:52 -0700 Subject: [PATCH 20/23] Minor cosmetic changes --- src/CMakeLists.txt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e2a0ffeb9..0f82c1da5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -48,11 +48,12 @@ list(APPEND _packages Utilities ) - if(NOT ENABLE_CXXONLY) - list(APPEND _packages - SimulationControl - PYB11) - endif() +if(NOT ENABLE_CXXONLY) + list(APPEND _packages + SimulationControl + PYB11) +endif() + configure_file(config.hh.in ${PROJECT_BINARY_DIR}/src/config.hh) From 97c51ab9acc726aa9b194da7f3e89b5eadd1f4fe Mon Sep 17 00:00:00 2001 From: Landon Owen Date: Wed, 27 Sep 2023 13:34:29 -0700 Subject: [PATCH 21/23] Point PYB11Generator and PolyClipper submodules back to their master branches and update them --- extern/PYB11Generator | 2 +- extern/PolyClipper | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/extern/PYB11Generator b/extern/PYB11Generator index 608f12c7c..71608127d 160000 --- a/extern/PYB11Generator +++ b/extern/PYB11Generator @@ -1 +1 @@ -Subproject commit 608f12c7c439d40742cc8971efe74cbcc6b78663 +Subproject commit 71608127d276e9135c2c81d65bd0822adb006e91 diff --git a/extern/PolyClipper b/extern/PolyClipper index 6ab94c23a..68bde6c15 160000 --- a/extern/PolyClipper +++ b/extern/PolyClipper @@ -1 +1 @@ -Subproject commit 6ab94c23a5beccc6f1c417c9a0b944b657de9936 +Subproject commit 68bde6c150a2f4d555011cbf52a6b3af6bf63d27 From 402d1dd03803b169a1276337f60890302d4c8594 Mon Sep 17 00:00:00 2001 From: Landon Owen Date: Thu, 28 Sep 2023 15:58:49 -0700 Subject: [PATCH 22/23] Removed quotes around spheral_add_obj_library input --- src/ArtificialConduction/CMakeLists.txt | 2 +- src/ArtificialViscosity/CMakeLists.txt | 2 +- src/Boundary/CMakeLists.txt | 2 +- src/CRKSPH/CMakeLists.txt | 2 +- src/CXXTests/DeviceTestLib/CMakeLists.txt | 2 +- src/DEM/CMakeLists.txt | 2 +- src/Damage/CMakeLists.txt | 2 +- src/DataBase/CMakeLists.txt | 2 +- src/DataOutput/CMakeLists.txt | 2 +- src/Distributed/CMakeLists.txt | 2 +- src/ExternalForce/CMakeLists.txt | 2 +- src/FSISPH/CMakeLists.txt | 2 +- src/Field/CMakeLists.txt | 2 +- src/FieldOperations/CMakeLists.txt | 2 +- src/FileIO/CMakeLists.txt | 2 +- src/GSPH/CMakeLists.txt | 2 +- src/Geometry/CMakeLists.txt | 2 +- src/Gravity/CMakeLists.txt | 2 +- src/Hydro/CMakeLists.txt | 2 +- src/Integrator/CMakeLists.txt | 2 +- src/Kernel/CMakeLists.txt | 2 +- src/KernelIntegrator/CMakeLists.txt | 2 +- src/Material/CMakeLists.txt | 2 +- src/Mesh/CMakeLists.txt | 2 +- src/Neighbor/CMakeLists.txt | 2 +- src/NodeGenerators/CMakeLists.txt | 2 +- src/NodeList/CMakeLists.txt | 2 +- src/Physics/CMakeLists.txt | 2 +- src/RK/CMakeLists.txt | 2 +- src/SPH/CMakeLists.txt | 2 +- src/SVPH/CMakeLists.txt | 2 +- src/SolidMaterial/CMakeLists.txt | 2 +- src/Strength/CMakeLists.txt | 2 +- src/Utilities/CMakeLists.txt | 2 +- 34 files changed, 34 insertions(+), 34 deletions(-) diff --git a/src/ArtificialConduction/CMakeLists.txt b/src/ArtificialConduction/CMakeLists.txt index dfb5f5d29..6fd38fd1b 100644 --- a/src/ArtificialConduction/CMakeLists.txt +++ b/src/ArtificialConduction/CMakeLists.txt @@ -12,5 +12,5 @@ set(ArtificialConduction_headers ArtificialConductionPolicy.hh ) -spheral_add_obj_library(ArtificialConduction "SPHERAL_OBJ_LIBS") +spheral_add_obj_library(ArtificialConduction SPHERAL_OBJ_LIBS) diff --git a/src/ArtificialViscosity/CMakeLists.txt b/src/ArtificialViscosity/CMakeLists.txt index e29ac69eb..96f7a50b5 100644 --- a/src/ArtificialViscosity/CMakeLists.txt +++ b/src/ArtificialViscosity/CMakeLists.txt @@ -50,5 +50,5 @@ set(ArtificialViscosity_headers VonNeumanViscosity.hh ) -spheral_add_obj_library(ArtificialViscosity "SPHERAL_OBJ_LIBS") +spheral_add_obj_library(ArtificialViscosity SPHERAL_OBJ_LIBS) diff --git a/src/Boundary/CMakeLists.txt b/src/Boundary/CMakeLists.txt index 108b58aca..317e65231 100644 --- a/src/Boundary/CMakeLists.txt +++ b/src/Boundary/CMakeLists.txt @@ -80,5 +80,5 @@ set(Boundary_headers spheral_install_python_files(ExpandingDomain.py) -spheral_add_obj_library(Boundary "SPHERAL_OBJ_LIBS") +spheral_add_obj_library(Boundary SPHERAL_OBJ_LIBS) diff --git a/src/CRKSPH/CMakeLists.txt b/src/CRKSPH/CMakeLists.txt index fb788d9f3..c00c9e8e2 100644 --- a/src/CRKSPH/CMakeLists.txt +++ b/src/CRKSPH/CMakeLists.txt @@ -49,7 +49,7 @@ set(CRKSPH_headers zerothOrderSurfaceCorrections.hh ) -spheral_add_obj_library(CRKSPH "SPHERAL_OBJ_LIBS") +spheral_add_obj_library(CRKSPH SPHERAL_OBJ_LIBS) spheral_install_python_files(CRKSPHHydros.py) diff --git a/src/CXXTests/DeviceTestLib/CMakeLists.txt b/src/CXXTests/DeviceTestLib/CMakeLists.txt index 1a52299dc..b44e32e5d 100644 --- a/src/CXXTests/DeviceTestLib/CMakeLists.txt +++ b/src/CXXTests/DeviceTestLib/CMakeLists.txt @@ -14,5 +14,5 @@ set(DeviceTestLib_headers spheral_install_python_files( ) -spheral_add_obj_library(DeviceTestLib "SPHERAL_OBJ_LIBS") +spheral_add_obj_library(DeviceTestLib SPHERAL_OBJ_LIBS) diff --git a/src/DEM/CMakeLists.txt b/src/DEM/CMakeLists.txt index 737a823f9..28606c290 100644 --- a/src/DEM/CMakeLists.txt +++ b/src/DEM/CMakeLists.txt @@ -44,5 +44,5 @@ add_subdirectory(SolidBoundary) spheral_install_python_files(DEM.py) -spheral_add_obj_library(DEM "SPHERAL_OBJ_LIBS") +spheral_add_obj_library(DEM SPHERAL_OBJ_LIBS) diff --git a/src/Damage/CMakeLists.txt b/src/Damage/CMakeLists.txt index ae060e346..79d0f68ec 100644 --- a/src/Damage/CMakeLists.txt +++ b/src/Damage/CMakeLists.txt @@ -73,5 +73,5 @@ spheral_install_python_files( ShadowIvanoviSALEDamageModel.py ) -spheral_add_obj_library(Damage "SPHERAL_OBJ_LIBS") +spheral_add_obj_library(Damage SPHERAL_OBJ_LIBS) diff --git a/src/DataBase/CMakeLists.txt b/src/DataBase/CMakeLists.txt index 20cb373ea..419c38dd9 100644 --- a/src/DataBase/CMakeLists.txt +++ b/src/DataBase/CMakeLists.txt @@ -54,5 +54,5 @@ set(DataBase_headers UpdatePolicyBaseInline.hh ) -spheral_add_obj_library(DataBase "SPHERAL_OBJ_LIBS") +spheral_add_obj_library(DataBase SPHERAL_OBJ_LIBS) diff --git a/src/DataOutput/CMakeLists.txt b/src/DataOutput/CMakeLists.txt index 555b8f0c3..2881ed602 100644 --- a/src/DataOutput/CMakeLists.txt +++ b/src/DataOutput/CMakeLists.txt @@ -14,5 +14,5 @@ set(DataOutput_headers registerWithRestart.hh ) -spheral_add_obj_library(DataOutput "SPHERAL_OBJ_LIBS") +spheral_add_obj_library(DataOutput SPHERAL_OBJ_LIBS) diff --git a/src/Distributed/CMakeLists.txt b/src/Distributed/CMakeLists.txt index 767f8bac9..60f123fb5 100644 --- a/src/Distributed/CMakeLists.txt +++ b/src/Distributed/CMakeLists.txt @@ -70,7 +70,7 @@ if (ENABLE_MPI) RENAME mpi.py ) - spheral_add_obj_library(Distributed "SPHERAL_OBJ_LIBS") + spheral_add_obj_library(Distributed SPHERAL_OBJ_LIBS) else() #---------------------------------------------------------------------------- diff --git a/src/ExternalForce/CMakeLists.txt b/src/ExternalForce/CMakeLists.txt index c373b6e81..20318023a 100644 --- a/src/ExternalForce/CMakeLists.txt +++ b/src/ExternalForce/CMakeLists.txt @@ -27,5 +27,5 @@ set(ExternalForce_includes ) -spheral_add_obj_library(ExternalForce "SPHERAL_OBJ_LIBS") +spheral_add_obj_library(ExternalForce SPHERAL_OBJ_LIBS) diff --git a/src/FSISPH/CMakeLists.txt b/src/FSISPH/CMakeLists.txt index 43ecde849..5c3bea7d5 100644 --- a/src/FSISPH/CMakeLists.txt +++ b/src/FSISPH/CMakeLists.txt @@ -28,5 +28,5 @@ spheral_install_python_files( SlideSurfaces.py ) -spheral_add_obj_library(FSISPH "SPHERAL_OBJ_LIBS") +spheral_add_obj_library(FSISPH SPHERAL_OBJ_LIBS) diff --git a/src/Field/CMakeLists.txt b/src/Field/CMakeLists.txt index faf0394f9..697380162 100644 --- a/src/Field/CMakeLists.txt +++ b/src/Field/CMakeLists.txt @@ -45,5 +45,5 @@ set(Field_headers uvm_allocator.hh ) -spheral_add_obj_library(Field "SPHERAL_OBJ_LIBS") +spheral_add_obj_library(Field SPHERAL_OBJ_LIBS) diff --git a/src/FieldOperations/CMakeLists.txt b/src/FieldOperations/CMakeLists.txt index da9937b91..50664f4c8 100644 --- a/src/FieldOperations/CMakeLists.txt +++ b/src/FieldOperations/CMakeLists.txt @@ -40,5 +40,5 @@ set(FieldOperations_headers sampleMultipleFields2Lattice.hh ) -spheral_add_obj_library(FieldOperations "SPHERAL_OBJ_LIBS") +spheral_add_obj_library(FieldOperations SPHERAL_OBJ_LIBS) diff --git a/src/FileIO/CMakeLists.txt b/src/FileIO/CMakeLists.txt index 97c64bd2c..214950459 100644 --- a/src/FileIO/CMakeLists.txt +++ b/src/FileIO/CMakeLists.txt @@ -30,5 +30,5 @@ spheral_install_python_files( PlyFileIO.py ) -spheral_add_obj_library(FileIO "SPHERAL_OBJ_LIBS") +spheral_add_obj_library(FileIO SPHERAL_OBJ_LIBS) diff --git a/src/GSPH/CMakeLists.txt b/src/GSPH/CMakeLists.txt index 4d25939cd..8b409cb4d 100644 --- a/src/GSPH/CMakeLists.txt +++ b/src/GSPH/CMakeLists.txt @@ -59,5 +59,5 @@ instantiate(GSPH_inst GSPH_sources) spheral_install_python_files(GSPHHydros.py) -spheral_add_obj_library(GSPH "SPHERAL_OBJ_LIBS") +spheral_add_obj_library(GSPH SPHERAL_OBJ_LIBS) diff --git a/src/Geometry/CMakeLists.txt b/src/Geometry/CMakeLists.txt index 5256b7f06..884d2917e 100644 --- a/src/Geometry/CMakeLists.txt +++ b/src/Geometry/CMakeLists.txt @@ -100,5 +100,5 @@ set(Geometry_headers outerProduct.hh ) -spheral_add_obj_library(Geometry "SPHERAL_OBJ_LIBS") +spheral_add_obj_library(Geometry SPHERAL_OBJ_LIBS) diff --git a/src/Gravity/CMakeLists.txt b/src/Gravity/CMakeLists.txt index e1ee8c8bb..f9c8bf241 100644 --- a/src/Gravity/CMakeLists.txt +++ b/src/Gravity/CMakeLists.txt @@ -23,5 +23,5 @@ set(Gravity_headers PolyGravity.hh ) -spheral_add_obj_library(Gravity "SPHERAL_OBJ_LIBS") +spheral_add_obj_library(Gravity SPHERAL_OBJ_LIBS) diff --git a/src/Hydro/CMakeLists.txt b/src/Hydro/CMakeLists.txt index 8c4fb7c91..0426dbbb1 100644 --- a/src/Hydro/CMakeLists.txt +++ b/src/Hydro/CMakeLists.txt @@ -59,5 +59,5 @@ set(Hydro_headers entropyWeightingFunction.hh ) -spheral_add_obj_library(Hydro "SPHERAL_OBJ_LIBS") +spheral_add_obj_library(Hydro SPHERAL_OBJ_LIBS) diff --git a/src/Integrator/CMakeLists.txt b/src/Integrator/CMakeLists.txt index 4061dbd0b..2e117f3e3 100644 --- a/src/Integrator/CMakeLists.txt +++ b/src/Integrator/CMakeLists.txt @@ -24,5 +24,5 @@ set(Integrator_headers Verlet.hh ) -spheral_add_obj_library(Integrator "SPHERAL_OBJ_LIBS") +spheral_add_obj_library(Integrator SPHERAL_OBJ_LIBS) diff --git a/src/Kernel/CMakeLists.txt b/src/Kernel/CMakeLists.txt index d5ad4cc74..05a14f95c 100644 --- a/src/Kernel/CMakeLists.txt +++ b/src/Kernel/CMakeLists.txt @@ -68,5 +68,5 @@ set(Kernel_headers WendlandC6KernelInline.hh ) -spheral_add_obj_library(Kernel "SPHERAL_OBJ_LIBS") +spheral_add_obj_library(Kernel SPHERAL_OBJ_LIBS) diff --git a/src/KernelIntegrator/CMakeLists.txt b/src/KernelIntegrator/CMakeLists.txt index d130e0257..d636e874c 100644 --- a/src/KernelIntegrator/CMakeLists.txt +++ b/src/KernelIntegrator/CMakeLists.txt @@ -39,4 +39,4 @@ set(KernelIntegrator_headers SymmetricTriangularValues.hh ) -spheral_add_obj_library(KernelIntegrator "SPHERAL_OBJ_LIBS") +spheral_add_obj_library(KernelIntegrator SPHERAL_OBJ_LIBS) diff --git a/src/Material/CMakeLists.txt b/src/Material/CMakeLists.txt index abe5d0eb2..d09520c72 100644 --- a/src/Material/CMakeLists.txt +++ b/src/Material/CMakeLists.txt @@ -42,5 +42,5 @@ endif() instantiate(Material_inst Material_sources) -spheral_add_obj_library(Material "SPHERAL_OBJ_LIBS") +spheral_add_obj_library(Material SPHERAL_OBJ_LIBS) diff --git a/src/Mesh/CMakeLists.txt b/src/Mesh/CMakeLists.txt index ca26b8adf..d7e739aea 100644 --- a/src/Mesh/CMakeLists.txt +++ b/src/Mesh/CMakeLists.txt @@ -54,5 +54,5 @@ spheral_install_python_files( siloMeshDump.py ) -spheral_add_obj_library(Mesh "SPHERAL_OBJ_LIBS") +spheral_add_obj_library(Mesh SPHERAL_OBJ_LIBS) diff --git a/src/Neighbor/CMakeLists.txt b/src/Neighbor/CMakeLists.txt index 762896fb5..240cbd71f 100644 --- a/src/Neighbor/CMakeLists.txt +++ b/src/Neighbor/CMakeLists.txt @@ -30,5 +30,5 @@ set(Neighbor_headers TreeNeighbor.hh ) -spheral_add_obj_library(Neighbor "SPHERAL_OBJ_LIBS") +spheral_add_obj_library(Neighbor SPHERAL_OBJ_LIBS) diff --git a/src/NodeGenerators/CMakeLists.txt b/src/NodeGenerators/CMakeLists.txt index eea36f136..527cbda96 100644 --- a/src/NodeGenerators/CMakeLists.txt +++ b/src/NodeGenerators/CMakeLists.txt @@ -69,5 +69,5 @@ spheral_install_python_files( GenerateSphericalNodeDistribution1d.py ) -spheral_add_obj_library(NodeGenerators "SPHERAL_OBJ_LIBS") +spheral_add_obj_library(NodeGenerators SPHERAL_OBJ_LIBS) diff --git a/src/NodeList/CMakeLists.txt b/src/NodeList/CMakeLists.txt index 1fdfb6f87..a14e11b8a 100644 --- a/src/NodeList/CMakeLists.txt +++ b/src/NodeList/CMakeLists.txt @@ -46,5 +46,5 @@ spheral_install_python_files( DEMNodeLists.py ) -spheral_add_obj_library(NodeList "SPHERAL_OBJ_LIBS") +spheral_add_obj_library(NodeList SPHERAL_OBJ_LIBS) diff --git a/src/Physics/CMakeLists.txt b/src/Physics/CMakeLists.txt index 5fda0e9fa..14b36e89c 100644 --- a/src/Physics/CMakeLists.txt +++ b/src/Physics/CMakeLists.txt @@ -17,5 +17,5 @@ set(Physics_headers PhysicsInline.hh ) -spheral_add_obj_library(Physics "SPHERAL_OBJ_LIBS") +spheral_add_obj_library(Physics SPHERAL_OBJ_LIBS) diff --git a/src/RK/CMakeLists.txt b/src/RK/CMakeLists.txt index a51817c4c..b249d3c3f 100644 --- a/src/RK/CMakeLists.txt +++ b/src/RK/CMakeLists.txt @@ -61,5 +61,5 @@ set(RK_headers interpolateRK.hh ) -spheral_add_obj_library(RK "SPHERAL_OBJ_LIBS") +spheral_add_obj_library(RK SPHERAL_OBJ_LIBS) diff --git a/src/SPH/CMakeLists.txt b/src/SPH/CMakeLists.txt index 881db7b0e..928411ad9 100644 --- a/src/SPH/CMakeLists.txt +++ b/src/SPH/CMakeLists.txt @@ -63,5 +63,5 @@ spheral_install_python_files( FacetedSurfaceASPHHydro.py ) -spheral_add_obj_library(SPH "SPHERAL_OBJ_LIBS") +spheral_add_obj_library(SPH SPHERAL_OBJ_LIBS) diff --git a/src/SVPH/CMakeLists.txt b/src/SVPH/CMakeLists.txt index 32cefe798..379041512 100644 --- a/src/SVPH/CMakeLists.txt +++ b/src/SVPH/CMakeLists.txt @@ -42,5 +42,5 @@ set(SVPH_headers spheral_install_python_files(SVPHHydros.py) -spheral_add_obj_library(SVPH "SPHERAL_OBJ_LIBS") +spheral_add_obj_library(SVPH SPHERAL_OBJ_LIBS) diff --git a/src/SolidMaterial/CMakeLists.txt b/src/SolidMaterial/CMakeLists.txt index 2fff67055..12feb90bc 100644 --- a/src/SolidMaterial/CMakeLists.txt +++ b/src/SolidMaterial/CMakeLists.txt @@ -82,5 +82,5 @@ instantiate(SolidMaterial_inst SolidMaterial_sources) # Ignore -W-maybe-uninitialized warnings thrown from bisectSearch for possibly uninitialized iterators from boost multi-array. set_source_files_properties(ANEOSInst1d.cc ANEOSInst2d.cc ANEOSInst3d.cc PROPERTIES COMPILE_FLAGS "$<$:-Wno-uninitialized>") -spheral_add_obj_library(SolidMaterial "SPHERAL_OBJ_LIBS") +spheral_add_obj_library(SolidMaterial SPHERAL_OBJ_LIBS) diff --git a/src/Strength/CMakeLists.txt b/src/Strength/CMakeLists.txt index db837f5c0..e920f776c 100644 --- a/src/Strength/CMakeLists.txt +++ b/src/Strength/CMakeLists.txt @@ -27,5 +27,5 @@ set(Strength_headers effectiveKernelVolume.hh ) -spheral_add_obj_library(Strength "SPHERAL_OBJ_LIBS") +spheral_add_obj_library(Strength SPHERAL_OBJ_LIBS) diff --git a/src/Utilities/CMakeLists.txt b/src/Utilities/CMakeLists.txt index bb2ae8ffa..f8890cf2f 100644 --- a/src/Utilities/CMakeLists.txt +++ b/src/Utilities/CMakeLists.txt @@ -140,5 +140,5 @@ set(Utilities_headers spheral_install_python_files(fitspline.py) -spheral_add_obj_library(Utilities "SPHERAL_OBJ_LIBS") +spheral_add_obj_library(Utilities SPHERAL_OBJ_LIBS) From b2a4f135a92d06522f228c5588c0b74399408c89 Mon Sep 17 00:00:00 2001 From: ldowen <54121008+ldowen@users.noreply.github.com> Date: Fri, 29 Sep 2023 11:37:02 -0700 Subject: [PATCH 23/23] Update RELEASE_NOTES.md --- RELEASE_NOTES.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 2c36a2ecf..34c55e6a9 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,3 +1,22 @@ +Version vYYYY.MM.p -- Release date YYYY-MM-DD +============================================== + * Important Notes: + * The PolyClipper and PYB11Generator submodules have been modified. Be sure to recursively update the submodules. + +Notable changes include: + + * New features/ API changes: + + + * Build changes / improvements: + * Spheral now provides First Class CMake support (using the BLT nomenclature). Spheral and its dependencies are now exported to simplify importing the project. To import Spheral into another project using CMake, use + ``` + find_package(Spheral_CXX ) + ``` + * CMake variables have a more consistent naming convention. Unused variables are removed. + + * Bug Fixes / improvements: + Version v2023-06-0 -- Release date 2023-06-20 ==============================================