Update Find TBB to handle TBB installed with homebrew on OS X
Better Error message for TBB handling with versions greater than 2021.1 on OS Xrelease/4.3a0
							parent
							
								
									82d7cb5f29
								
							
						
					
					
						commit
						d99a9432bc
					
				|  | @ -144,7 +144,8 @@ if(NOT TBB_FOUND) | |||
| 
 | ||||
|   elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") | ||||
|     # OS X | ||||
|     set(TBB_DEFAULT_SEARCH_DIR "/opt/intel/tbb") | ||||
|     set(TBB_DEFAULT_SEARCH_DIR "/opt/intel/tbb" | ||||
|                                "/usr/local/opt/tbb") | ||||
| 
 | ||||
|     # TODO: Check to see which C++ library is being used by the compiler. | ||||
|     if(NOT ${CMAKE_SYSTEM_VERSION} VERSION_LESS 13.0) | ||||
|  | @ -181,7 +182,18 @@ if(NOT TBB_FOUND) | |||
|   ################################## | ||||
| 
 | ||||
|   if(TBB_INCLUDE_DIRS) | ||||
|     file(READ "${TBB_INCLUDE_DIRS}/tbb/tbb_stddef.h" _tbb_version_file) | ||||
|     set(_tbb_version_file_prior_to_tbb_2021_1 "${TBB_INCLUDE_DIRS}/tbb/tbb_stddef.h") | ||||
|     set(_tbb_version_file_after_tbb_2021_1 "${TBB_INCLUDE_DIRS}/oneapi/tbb/version.h") | ||||
| 
 | ||||
|     if (EXISTS "${_tbb_version_file_prior_to_tbb_2021_1}") | ||||
|       file(READ "${_tbb_version_file_prior_to_tbb_2021_1}" _tbb_version_file ) | ||||
|     elseif (EXISTS "${_tbb_version_file_after_tbb_2021_1}") | ||||
|       file(READ "${_tbb_version_file_after_tbb_2021_1}" _tbb_version_file ) | ||||
|     else() | ||||
|         message(FATAL_ERROR "Found TBB installation: ${TBB_INCLUDE_DIRS} " | ||||
|       "missing version header.") | ||||
|     endif() | ||||
| 
 | ||||
|     string(REGEX REPLACE ".*#define TBB_VERSION_MAJOR ([0-9]+).*" "\\1" | ||||
|         TBB_VERSION_MAJOR "${_tbb_version_file}") | ||||
|     string(REGEX REPLACE ".*#define TBB_VERSION_MINOR ([0-9]+).*" "\\1" | ||||
|  |  | |||
|  | @ -5,6 +5,10 @@ find_package(TBB 4.4 COMPONENTS tbb tbbmalloc) | |||
| # Set up variables if we're using TBB | ||||
| if(TBB_FOUND AND GTSAM_WITH_TBB) | ||||
|     set(GTSAM_USE_TBB 1)  # This will go into config.h | ||||
|     if ((${TBB_VERSION} VERSION_GREATER "2021.1") OR (${TBB_VERSION} VERSION_EQUAL "2021.1")) | ||||
|         message(FATAL_ERROR "TBB version greater than 2021.1 (oneTBB API) is not yet supported. Use an older version instead.") | ||||
|     endif() | ||||
| 
 | ||||
|     if ((${TBB_VERSION_MAJOR} GREATER 2020) OR (${TBB_VERSION_MAJOR} EQUAL 2020)) | ||||
|         set(TBB_GREATER_EQUAL_2020 1) | ||||
|     else() | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue