From 098160bfae7ffa838a3f16a7d555b01a9bfb527b Mon Sep 17 00:00:00 2001 From: Peter Debacker Date: Fri, 3 Feb 2023 15:13:09 +0100 Subject: [PATCH 1/4] simpler boost detection on mac --- sparta/cmake/sparta-config.cmake | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sparta/cmake/sparta-config.cmake b/sparta/cmake/sparta-config.cmake index c5d1ba3e00..53db6d7ca8 100644 --- a/sparta/cmake/sparta-config.cmake +++ b/sparta/cmake/sparta-config.cmake @@ -47,13 +47,11 @@ endif () if (APPLE AND NOT USING_CONDA) - set (Boost_NO_BOOST_CMAKE ON) set (CMAKE_CXX_COMPILER_VERSION 10.0) - find_package (Boost 1.65.0 REQUIRED HINTS /usr/local/Cellar/boost/* COMPONENTS ${_BOOST_COMPONENTS}) -else () - find_package (Boost 1.65.0 REQUIRED COMPONENTS ${_BOOST_COMPONENTS}) endif () +find_package (Boost 1.65.0 REQUIRED COMPONENTS ${_BOOST_COMPONENTS}) + set (BUILD_SHARED_LIBS ${existing_build_shared}) message (STATUS "Using BOOST ${Boost_VERSION_STRING}") From b2b5a2e1600ca79745acc8874a15519d1535f249 Mon Sep 17 00:00:00 2001 From: Peter Debacker Date: Mon, 6 Feb 2023 10:00:22 +0100 Subject: [PATCH 2/4] cmake clean up: target specific include paths --- sparta/CMakeLists.txt | 31 +++++++++++++------------------ sparta/simdb/CMakeLists.txt | 10 ++++++++++ 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/sparta/CMakeLists.txt b/sparta/CMakeLists.txt index 932857f956..f40c074f0e 100644 --- a/sparta/CMakeLists.txt +++ b/sparta/CMakeLists.txt @@ -10,23 +10,6 @@ set (GEN_DEBUG_INFO ON CACHE BOOL "Genearate debug info in compile & link -g") set (SPARTA_BASE ${CMAKE_CURRENT_SOURCE_DIR}) include (${SPARTA_BASE}/cmake/sparta-config.cmake) -# Add RapidJSON -include_directories (SYSTEM ${RAPIDJSON_INCLUDE_DIRS}) - -# Add YAML CPP -include_directories (SYSTEM ${YAML_CPP_INCLUDE_DIR}) - -# Add local includes -include_directories ("./") -include_directories ("simdb/include") - -# Add Boost (not typical system install) -include_directories (SYSTEM ${Boost_INCLUDE_DIRS}) - -# Add HDF5 (not typical system install) -include_directories (SYSTEM ${HDF5_C_INCLUDE_DIRS}) -include_directories (SYSTEM ${HDF5_INCLUDE_DIRS}) - # Add the source for libsparta.a list (APPEND SourceCppFiles src/ArgosOutputter.cpp @@ -105,6 +88,19 @@ if (COMPILE_WITH_PYTHON) python/sparta_support/Completer.cpp) endif () +add_library (sparta ${SourceCppFiles}) + +# Add Inlude path for libs +target_include_directories (sparta SYSTEM PUBLIC ${Boost_INCLUDE_DIRS} + PUBLIC ${RAPIDJSON_INCLUDE_DIRS} + PUBLIC ${YAML_CPP_INCLUDE_DIR} + PUBLIC ${HDF5_C_INCLUDE_DIRS} + PUBLIC ${HDF5_INCLUDE_DIRS}) + +# Add local includes +target_include_directories (sparta PRIVATE "./") +target_include_directories (sparta INTERFACE "simdb/include") + execute_process (COMMAND bash "-c" "git describe --tags --always" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} OUTPUT_VARIABLE GIT_REPO_VERSION RESULT_VARIABLE rc @@ -215,7 +211,6 @@ set (CPPCHECK_EXCLUDES ) find_package (Cppcheck) -add_library (sparta ${SourceCppFiles}) set (SPARTA_STATIC_LIBS ${PROJECT_BINARY_DIR}/libsparta.a) # Build the SimDB library diff --git a/sparta/simdb/CMakeLists.txt b/sparta/simdb/CMakeLists.txt index 84fe33e2b3..c07635c6eb 100644 --- a/sparta/simdb/CMakeLists.txt +++ b/sparta/simdb/CMakeLists.txt @@ -14,6 +14,16 @@ list(APPEND SimDB_CPP src/simdb.cpp) add_library(simdb ${SimDB_CPP}) + + +# Add Inlude path for libs +target_include_directories (simdb SYSTEM PUBLIC ${Boost_INCLUDE_DIRS} + PUBLIC ${RAPIDJSON_INCLUDE_DIRS} + PUBLIC ${YAML_CPP_INCLUDE_DIR} + PUBLIC ${HDF5_C_INCLUDE_DIRS} + PUBLIC ${HDF5_INCLUDE_DIRS}) + + add_subdirectory(test EXCLUDE_FROM_ALL) install(TARGETS simdb From e141720a0ccb7d4c864dab74c8a299c994db0717 Mon Sep 17 00:00:00 2001 From: Peter Debacker Date: Mon, 6 Feb 2023 10:35:36 +0100 Subject: [PATCH 3/4] boost 1.76 --- sparta/cmake/sparta-config.cmake | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/sparta/cmake/sparta-config.cmake b/sparta/cmake/sparta-config.cmake index 53db6d7ca8..0d8ea0f211 100644 --- a/sparta/cmake/sparta-config.cmake +++ b/sparta/cmake/sparta-config.cmake @@ -45,12 +45,7 @@ else () set (USING_CONDA OFF) endif () - -if (APPLE AND NOT USING_CONDA) - set (CMAKE_CXX_COMPILER_VERSION 10.0) -endif () - -find_package (Boost 1.65.0 REQUIRED COMPONENTS ${_BOOST_COMPONENTS}) +find_package (Boost 1.76.0 REQUIRED COMPONENTS ${_BOOST_COMPONENTS}) set (BUILD_SHARED_LIBS ${existing_build_shared}) message (STATUS "Using BOOST ${Boost_VERSION_STRING}") From adce649fb8a9c42e82ea408423d40c491102d929 Mon Sep 17 00:00:00 2001 From: Peter Debacker Date: Mon, 6 Feb 2023 10:36:23 +0100 Subject: [PATCH 4/4] boost 1.72 specific magic no longer needed --- sparta/cmake/sparta-config.cmake | 6 ------ 1 file changed, 6 deletions(-) diff --git a/sparta/cmake/sparta-config.cmake b/sparta/cmake/sparta-config.cmake index 0d8ea0f211..5393d2f05d 100644 --- a/sparta/cmake/sparta-config.cmake +++ b/sparta/cmake/sparta-config.cmake @@ -27,11 +27,6 @@ endif() set (Boost_USE_STATIC_LIBS OFF) -# BOOST_CMAKE logic for in versions before 1.72 to ask for the shared libraries is broken, you can only force it to use -# them if you're building shared libs? wtf? -set (existing_build_shared ${BUILD_SHARED_LIBS}) -set (BUILD_SHARED_LIBS ON) - execute_process (COMMAND ${CMAKE_CXX_COMPILER} --version OUTPUT_VARIABLE CXX_VERSION_STRING RESULT_VARIABLE rc) if (NOT rc EQUAL "0") message (FATAL_ERROR "could not run compiler command '${CMAKE_CXX_COMPILER} --version', rc=${rc}") @@ -47,7 +42,6 @@ endif () find_package (Boost 1.76.0 REQUIRED COMPONENTS ${_BOOST_COMPONENTS}) -set (BUILD_SHARED_LIBS ${existing_build_shared}) message (STATUS "Using BOOST ${Boost_VERSION_STRING}") # Find YAML CPP