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/cmake/sparta-config.cmake b/sparta/cmake/sparta-config.cmake index c5d1ba3e00..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}") @@ -45,16 +40,8 @@ else () set (USING_CONDA OFF) endif () +find_package (Boost 1.76.0 REQUIRED COMPONENTS ${_BOOST_COMPONENTS}) -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 () - -set (BUILD_SHARED_LIBS ${existing_build_shared}) message (STATUS "Using BOOST ${Boost_VERSION_STRING}") # Find YAML CPP 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