Skip to content

Commit

Permalink
make TBB optional
Browse files Browse the repository at this point in the history
  • Loading branch information
koide3 committed Nov 6, 2024
1 parent 14259b3 commit a625060
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ endif()
option(BUILD_TESTS "Build test" OFF)
option(BUILD_DEMO "Build demo programs" OFF)
option(BUILD_EXAMPLE "Build example programs" OFF)
option(BUILD_WITH_TBB "Build with TBB support" ON)
option(BUILD_WITH_TBB "Build with TBB support" OFF)
option(BUILD_WITH_OPENMP "Build with OpenMP support" ON)
option(BUILD_WITH_CUDA "Build with GPU support" OFF)
option(BUILD_WITH_CUDA_MULTIARCH "Build with CUDA multi-architecture support" OFF)
Expand Down
25 changes: 17 additions & 8 deletions cmake/FindGTSAM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,25 @@ find_library(GTSAM_UNSTABLE_LIB NAMES gtsam_unstable
HINTS /usr/local/lib /usr/lib
DOC "GTSAM_UNSTABLE libraries")

find_library(TBB_LIB NAMES tbb
HINTS /usr/local/lib /usr/lib
DOC "TBB libraries")

find_library(TBB_MALLOC_LIB NAMES tbbmalloc
HINTS /usr/local/lib /usr/lib
DOC "TBB malloc libraries")
if(GTSAM_LIB AND GTSAM_UNSTABLE_LIB)
set(GTSAM_LIBRARIES ${GTSAM_LIB} ${GTSAM_UNSTABLE_LIB})
endif()

if(GTSAM_LIB AND GTSAM_UNSTABLE_LIB AND TBB_LIB)
set(GTSAM_LIBRARIES ${GTSAM_LIB} ${GTSAM_UNSTABLE_LIB} ${TBB_LIB} ${TBB_MALLOC_LIB})
if(GTSAM_POINTS_USE_TBB)
find_library(TBB_LIB NAMES tbb
HINTS /usr/local/lib /usr/lib
DOC "TBB libraries")

find_library(TBB_MALLOC_LIB NAMES tbbmalloc
HINTS /usr/local/lib /usr/lib
DOC "TBB malloc libraries")

if(TBB_LIB AND TBB_MALLOC_LIB)
set(GTSAM_LIBRARIES ${GTSAM_LIBRARIES} ${TBB_LIB} ${TBB_MALLOC_LIB})
else()
message(FATAL_ERROR "TBB libraries not found")
endif()
endif()

add_library(GTSAM::GTSAM INTERFACE IMPORTED GLOBAL)
Expand Down

0 comments on commit a625060

Please sign in to comment.