Commit 8126699d authored by Sujin Philip's avatar Sujin Philip

Update FindTBB.cmake

Add support for gcc4.7 version of the ibrary. Based on the changes from VTK's
FindTBB.cmake file.
parent 8a44d0a5
......@@ -87,16 +87,16 @@ macro(findpkg_finish PREFIX)
${PREFIX}_LIBRARY_DEBUG
${PREFIX}_LIBRARY_RELEASE)
endif ()
endmacro(findpkg_finish)
endmacro()
#===============================================
# Generate debug names from given RELEASEease names
# Generate debug names from given release names
#===============================================
macro(get_debug_names PREFIX)
foreach(i ${${PREFIX}})
set(${PREFIX}_DEBUG ${${PREFIX}_DEBUG} ${i}d ${i}D ${i}_d ${i}_D ${i}_debug ${i})
endforeach(i)
endmacro(get_debug_names)
endforeach()
endmacro()
#===============================================
# See if we have env vars to help us find tbb
......@@ -107,10 +107,10 @@ macro(getenv_path VAR)
if (ENV_${VAR})
string( REGEX REPLACE "\\\\" "/" ENV_${VAR} ${ENV_${VAR}} )
endif ()
endmacro(getenv_path)
endmacro()
#===============================================
# Couple a set of RELEASEease AND debug libraries
# Couple a set of release AND debug libraries
#===============================================
macro(make_library_set PREFIX)
if (${PREFIX}_RELEASE AND ${PREFIX}_DEBUG)
......@@ -120,7 +120,7 @@ macro(make_library_set PREFIX)
elseif (${PREFIX}_DEBUG)
set(${PREFIX} ${${PREFIX}_DEBUG})
endif ()
endmacro(make_library_set)
endmacro()
#=============================================================================
......@@ -192,7 +192,7 @@ if (WIN32 AND MSVC)
endif ()
# for each prefix path, add ia32/64\${COMPILER_PREFIX}\lib to the lib search path
foreach (dir ${TBB_PREFIX_PATH})
foreach (dir IN LISTS TBB_PREFIX_PATH)
if (CMAKE_CL_64)
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia64/${COMPILER_PREFIX}/lib)
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia64/${COMPILER_PREFIX})
......@@ -205,63 +205,70 @@ if (WIN32 AND MSVC)
endforeach ()
endif ()
# For OS X binary distribution, choose libc++ based libraries for Maverics and
# above and AppleClang
if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" AND
NOT ${CMAKE_SYSTEM_VERSION} LESS 13.0)
# For OS X binary distribution, choose libc++ based libraries for Mavericks (10.9)
# and above and AppleClang
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND
NOT CMAKE_SYSTEM_VERSION VERSION_LESS 13.0)
set (USE_LIBCXX OFF)
cmake_policy(GET CMP0025 POLICY_VAR)
if ("${POLICY_VAR}" STREQUAL "NEW")
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "AppleClang")
set (USE_LIBCXX ON)
endif ()
else ()
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
set (USE_LIBCXX ON)
endif ()
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set (USE_LIBCXX ON)
endif ()
if (${USE_LIBCXX})
foreach (dir ${TBB_PREFIX_PATH})
if (USE_LIBCXX)
foreach (dir IN LISTS TBB_PREFIX_PATH)
list (APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/libc++ ${dir}/libc++/lib)
endforeach ()
endif ()
endif ()
# check compiler ABI
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND
CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4)
set(COMPILER_PREFIX "gcc4.1")
else () # Assume compatibility with 4.4 for other compilers
set(COMPILER_PREFIX "gcc4.4")
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(COMPILER_PREFIX)
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7)
list(APPEND COMPILER_PREFIX "gcc4.7")
endif()
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4)
list(APPEND COMPILER_PREFIX "gcc4.4")
endif()
list(APPEND COMPILER_PREFIX "gcc4.1")
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(COMPILER_PREFIX)
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.6)
list(APPEND COMPILER_PREFIX "gcc4.7")
endif()
list(APPEND COMPILER_PREFIX "gcc4.4")
else() # Assume compatibility with 4.4 for other compilers
list(APPEND COMPILER_PREFIX "gcc4.4")
endif ()
# if platform architecture is explicitly specified
set(TBB_ARCH_PLATFORM $ENV{TBB_ARCH_PLATFORM})
if (TBB_ARCH_PLATFORM)
foreach (dir ${TBB_PREFIX_PATH})
foreach (dir IN LISTS TBB_PREFIX_PATH)
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/${TBB_ARCH_PLATFORM}/lib)
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/${TBB_ARCH_PLATFORM})
endforeach ()
endif ()
foreach (dir ${TBB_PREFIX_PATH})
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/intel64)
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/intel64/${COMPILER_PREFIX})
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/intel64/lib)
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/intel64/${COMPILER_PREFIX}/lib)
else ()
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia32)
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia32/${COMPILER_PREFIX})
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia32/lib)
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia32/${COMPILER_PREFIX}/lib)
endif ()
foreach (dir IN LISTS TBB_PREFIX_PATH)
foreach (prefix IN LISTS COMPILER_PREFIX)
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/intel64)
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/intel64/${prefix})
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/intel64/lib)
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/intel64/${prefix}/lib)
else ()
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia32)
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia32/${prefix})
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia32/lib)
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia32/${prefix}/lib)
endif ()
endforeach()
endforeach ()
# add general search paths
foreach (dir ${TBB_PREFIX_PATH})
foreach (dir IN LISTS TBB_PREFIX_PATH)
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib ${dir}/Lib ${dir}/lib/tbb
${dir}/Libs)
list(APPEND TBB_INC_SEARCH_PATH ${dir}/include ${dir}/Include
......@@ -332,7 +339,7 @@ findpkg_finish(TBB_MALLOC_PROXY)
#=============================================================================
#parse all the version numbers from tbb
if(NOT TBB_VERSION_MAJOR AND NOT TBB_VERSION_MINOR)
if(NOT TBB_VERSION)
#only read the start of the file
file(READ
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment