mirror of
https://github.com/ceres-solver/ceres-solver.git
synced 2026-08-29 16:40:38 +08:00
Cleanup import of TBB in CMake.
- Update FindSuiteSparse to use FindTBB.cmake to find TBB. - Fix logic handling of TBB=ON if TBB is not found to continue with build after disabling TBB rather than throwing a fatal error. - Use TBB_LIBRARIES instead of TBB_tbb_LIBRARY as a Ceres dependency, the former also includes the TBB malloc library. - Add warning message about GPL licensing if TBB version < 2017. - Add ‘TBB’ & ‘Mulithreading’ component options to find_package(Ceres), where ‘Mulithreading’ is equivalent to ‘TBB’ || ‘OpenMP’. Change-Id: Ifc7f1d01b050ba6e2097ad1913b178805df4769a
This commit is contained in:
@@ -83,7 +83,9 @@ function(ceres_compile_options_to_components CURRENT_CERES_COMPILE_OPTIONS CERES
|
||||
add_to_output_if_found(CURRENT_CERES_COMPILE_OPTIONS ${CERES_COMPONENTS_VAR}
|
||||
CERES_USE_CXX11 "C++11")
|
||||
add_to_output_if_found(CURRENT_CERES_COMPILE_OPTIONS ${CERES_COMPONENTS_VAR}
|
||||
CERES_USE_OPENMP "OpenMP")
|
||||
CERES_USE_OPENMP "OpenMP;Multithreading")
|
||||
add_to_output_if_found(CURRENT_CERES_COMPILE_OPTIONS ${CERES_COMPONENTS_VAR}
|
||||
CERES_USE_TBB "TBB;Multithreading")
|
||||
# Remove duplicates of SparseLinearAlgebraLibrary if multiple sparse backends
|
||||
# are present.
|
||||
list(REMOVE_DUPLICATES ${CERES_COMPONENTS_VAR})
|
||||
|
||||
@@ -291,21 +291,14 @@ if (SUITESPARSEQR_FOUND)
|
||||
# SuiteSparseQR may be compiled with Intel Threading Building Blocks,
|
||||
# we assume that if TBB is installed, SuiteSparseQR was compiled with
|
||||
# support for it, this will do no harm if it wasn't.
|
||||
suitesparse_find_component(TBB LIBRARIES tbb)
|
||||
find_package(TBB QUIET)
|
||||
if (TBB_FOUND)
|
||||
message(STATUS "Found Intel Thread Building Blocks (TBB) library: "
|
||||
"${TBB_LIBRARY}, assuming SuiteSparseQR was compiled with TBB.")
|
||||
suitesparse_find_component(TBB_MALLOC LIBRARIES tbbmalloc)
|
||||
if (TBB_MALLOC_FOUND)
|
||||
message(STATUS "Found Intel Thread Building Blocks (TBB) Malloc library: "
|
||||
"${TBB_MALLOC_LIBRARY}")
|
||||
# Add the TBB libraries to the SuiteSparseQR libraries (the only
|
||||
# libraries to optionally depend on TBB).
|
||||
list(APPEND SUITESPARSEQR_LIBRARY ${TBB_LIBRARY} ${TBB_MALLOC_LIBRARY})
|
||||
else()
|
||||
message(STATUS "Did not find Intel Thread Building Blocks (TBB) Malloc "
|
||||
"Library, discarding TBB as a dependency.")
|
||||
endif()
|
||||
message(STATUS "Found Intel Thread Building Blocks (TBB) library "
|
||||
"(${TBB_VERSION}) assuming SuiteSparseQR was compiled "
|
||||
"with TBB.")
|
||||
# Add the TBB libraries to the SuiteSparseQR libraries (the only
|
||||
# libraries to optionally depend on TBB).
|
||||
list(APPEND SUITESPARSEQR_LIBRARY ${TBB_LIBRARIES})
|
||||
else()
|
||||
message(STATUS "Did not find Intel TBB library, assuming SuiteSparseQR was "
|
||||
"not compiled with TBB.")
|
||||
|
||||
Reference in New Issue
Block a user