Skip to content

Commit

Permalink
Fix CMake compatibility issues
Browse files Browse the repository at this point in the history
  • Loading branch information
TeoGiane committed Sep 19, 2023
1 parent b63fbaa commit 4c2f685
Showing 1 changed file with 12 additions and 17 deletions.
29 changes: 12 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,21 @@ set(FETCHCONTENT_UPDATES_DISCONNECTED ON)
set(BUILD_SHARED_LIBS OFF)
set(BUILD_TESTING OFF)

# Set BASEPATH variable
set(BASEPATH "${CMAKE_CURRENT_LIST_DIR}")

# Make available bayesmix-dev/math (and TBB)
include(cmake/math.cmake)

# Check math is found
if(math_FOUND)
# Check math has been populated
if(math_POPULATED)
message(STATUS "math source dir: ${math_SOURCE_DIR}")
message(STATUS "math binary dir: ${math_BINARY_DIR}")
else()
message(FATAL_ERROR "math library required but not found!")
endif()

# Check if TBB is found
if(TBB_FOUND)
message(STATUS "TBB version : ${TBB_VERSION}")
message(STATUS "TBB include path : ${TBB_ROOT}/include")
message(STATUS "TBB imported targets: ${TBB_IMPORTED_TARGETS}")
else()
message(FATAL_ERROR "TBB library required but not found!")
endif()

# Make available protocolbuffers/protobuf (v3.14.0)
# Make available protocolbuffers/protobuf (v3.16.0)
include(cmake/protobuf.cmake)

# Check if protobuf is found
Expand All @@ -83,14 +77,13 @@ option(BUILD_RUN "" ON)

# Include pathstests
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(BASEPATH "${CMAKE_CURRENT_LIST_DIR}")
set(INCLUDE_PATHS
${BASEPATH}
${math_SOURCE_DIR}
${math_SOURCE_DIR}/lib/boost_1.78.0
${math_SOURCE_DIR}/lib/eigen_3.4.0
${math_SOURCE_DIR}/lib/sundials_6.1.1/include
${TBB_ROOT}/include
${math_SOURCE_DIR}/lib/tbb_2020.3/include
${CMAKE_CURRENT_BINARY_DIR}
${Protobuf_INCLUDE_DIRS}
)
Expand All @@ -99,7 +92,7 @@ set(INCLUDE_PATHS
set(LINK_LIBRARIES
pthread
protobuf::libprotobuf
TBB::tbb
tbb
OpenMP::OpenMP_CXX
)

Expand Down Expand Up @@ -178,10 +171,12 @@ endif()
if (NOT DISABLE_PLOTS)
# Make available matplotplusplus
include(cmake/matplotplusplus.cmake)
# Check matplotplusplus is found
if(matplotplusplus_FOUND)
# Check matplotplusplus has been populated
if(matplotplusplus_POPULATED)
message(STATUS "matplotplusplus source dir: ${matplotplusplus_SOURCE_DIR}")
message(STATUS "matplotplusplus binary dir: ${matplotplusplus_BINARY_DIR}")
else()
message(FATAL_ERROR "matplotplusplus library required but not found!")
endif()
# Build plot_mcmc executable
add_executable(plot_mcmc
Expand Down

0 comments on commit 4c2f685

Please sign in to comment.