Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

simpler boost detection on mac #396

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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 13 additions & 18 deletions sparta/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
15 changes: 1 addition & 14 deletions sparta/cmake/sparta-config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand All @@ -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
Expand Down
10 changes: 10 additions & 0 deletions sparta/simdb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down