2020-10-07 00:10:06 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								###############################################################################
  
						 
					
						
							
								
									
										
										
										
											2021-09-18 14:48:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								if  ( GTSAM_WITH_TBB ) 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    # Find TBB
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    find_package ( TBB  4.4  COMPONENTS  tbb  tbbmalloc ) 
 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-07 00:10:06 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-09-18 14:48:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    # Set up variables if we're using TBB
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if ( TBB_FOUND ) 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        set ( GTSAM_USE_TBB  1 )   # This will go into config.h
 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-19 23:46:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-10-22 07:23:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								#        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()
  
						 
					
						
							
								
									
										
										
										
											2021-09-18 05:59:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-09-18 14:48:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( ( ${ TBB_VERSION_MAJOR }  GREATER  2020 )  OR  ( ${ TBB_VERSION_MAJOR }  EQUAL  2020 ) ) 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            set ( TBB_GREATER_EQUAL_2020  1 ) 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        else ( ) 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            set ( TBB_GREATER_EQUAL_2020  0 ) 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        endif ( ) 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        # all definitions and link requisites will go via imported targets:
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        # tbb & tbbmalloc
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        list ( APPEND  GTSAM_ADDITIONAL_LIBRARIES  tbb  tbbmalloc ) 
 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-07 00:10:06 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    else ( ) 
 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-18 14:48:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        set ( GTSAM_USE_TBB  0 )   # This will go into config.h
 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-07 00:10:06 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    endif ( ) 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-09-18 14:48:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    ###############################################################################
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    # Prohibit Timing build mode in combination with TBB
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if ( GTSAM_USE_TBB  AND  ( CMAKE_BUILD_TYPE   STREQUAL  "Timing" ) ) 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        message ( FATAL_ERROR  "Timing build mode cannot be used together with TBB. Use a sampling profiler such as Instruments or Intel VTune Amplifier instead." ) 
 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-07 00:10:06 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    endif ( ) 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								endif ( )