Enable TBB for Linux builds

- Fix FindTBB.cmake
- Add TBB logic to various CMakeLists
- Update documentation
This commit is contained in:
manuelk 2013-08-15 16:11:33 -07:00
parent d28dad10e5
commit d57df0eae0
4 changed files with 124 additions and 59 deletions

View File

@ -246,6 +246,9 @@ set(CMAKE_SUPPRESS_REGENERATION TRUE)
if(NOT NO_OMP)
find_package(OpenMP)
endif()
if(NOT NO_TBB)
find_package(TBB 4.0)
endif()
find_package(OpenGL)
find_package(OpenGLES)
find_package(OpenCL 1.1)
@ -300,6 +303,20 @@ else()
"in your cmake installation.")
endif()
if(TBB_FOUND)
add_definitions(
-DOPENSUBDIV_HAS_TBB
${TBB_CXX_FLAGS}
)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TBB_CXX_FLAGS}")
else()
message(WARNING
"TBB was not found : support for TBB parallel compute kernels "
"will be diabled in Osd. If your compiler supports TBB "
"directives, please refer to the FindTBB.cmake shared module "
"in your cmake installation.")
endif()
if(GLFW_FOUND AND (GLFW_VERSION VERSION_EQUAL 3.0 OR GLFW_VERSION VERSION_GREATER 3.0))
add_definitions( -DGLFW_VERSION_3 )
endif()

View File

@ -63,13 +63,9 @@ else ()
DOC "The directory where TBB headers reside")
endif ()
# List library files
foreach(TBB_LIB tbb tbb_debug
tbbmalloc tbbmalloc_debug
tbbmalloc_proxy tbbmalloc_proxy_debug
tbb_preview tbb_preview_debug)
set (TBB_LIB_ARCH "")
if (WIN32)
if (WIN32)
if ("${CMAKE_GENERATOR}" MATCHES "[Ww]in64")
set(WINPATH intel64)
@ -86,22 +82,47 @@ foreach(TBB_LIB tbb tbb_debug
elseif (MSVC11)
set(WINPATH "${WINPATH}/vc11")
endif()
list(APPEND TBB_LIB_ARCH ${WINPATH})
elseif(ANDROID)
list(APPEND TBB_LIB_ARCH "android")
else()
if(CMAKE_SIZEOF_VOID_P MATCHES "8")
list(APPEND TBB_LIB_ARCH "intel64")
elseif(CMAKE_SIZEOF_VOID_P MATCHES "4")
list(APPEND TBB_LIB_ARCH "ia32")
endif()
endif()
# List library files
foreach(TBB_LIB tbb tbb_debug
tbbmalloc tbbmalloc_debug
tbbmalloc_proxy tbbmalloc_proxy_debug
tbb_preview tbb_preview_debug)
find_library(TBB_${TBB_LIB}_LIBRARY
NAMES
${TBB_LIB}
PATHS
${TBB_LOCATION}/lib
${TBB_LOCATION}/bin/${WINPATH}
${TBB_LOCATION}/lib/${WINPATH}
${TBB_LOCATION}/bin
$ENV{TBB_LOCATION}/lib
$ENV{TBB_LOCATION}/bin/${WINPATH}
$ENV{TBB_LOCATION}/bin
$ENV{PROGRAMFILES}/TBB/lib
/usr/lib
/usr/lib/w32api
/usr/local/lib
/usr/X11R6/lib
PATH_SUFFIXES
${TBB_LIB_ARCH}
${TBB_LIB_ARCH}/${TBB_COMPILER}
${TBB_LIB_ARCH}/gcc4.4
${TBB_LIB_ARCH}/gcc4.1
DOC "Intel's Threading Building Blocks library")
if (TBB_${TBB_LIB}_LIBRARY)

View File

@ -74,6 +74,7 @@ ________
- `Zlib <http://www.zlib.net/>`__ (required for Ptex under Windows)
- `GLEW <http://glew.sourceforge.net/>`__ (Windows/Linux only)
- `CUDA <http://www.nvidia.com/object/cuda_home_new.html>`__
- `TBB <http://www.threadingbuildingblocks.org/>`__
- `OpenCL <http://www.khronos.org/opencl/>`__
- `DX11 SDK <http://www.microsoft.com/>`__
- `GLFW <https://github.com/glfw/glfw>`__ (required for standalone examples
@ -111,6 +112,7 @@ The following configuration arguments can be passed to the cmake command line.
-DGLEW_LOCATION=[path to GLEW]
-DGLFW_LOCATION=[path to GLFW]
-DMAYA_LOCATION=[path to Maya]
-DTBB_LOCATION=[path to Intel's TBB]
-DICC_LOCATION=[path to Intel's C++ Studio XE]
-DNO_LIB=1 // disable the opensubdiv libs build (caveat emptor)
@ -119,6 +121,7 @@ The following configuration arguments can be passed to the cmake command line.
-DNO_PYTHON=1 // disable Python SWIG build
-DNO_DOC=1 // disable documentation build
-DNO_OMP=1 // disable OpenMP
-DNO_TBB=1 // disable TBB
-DNO_CUDA=1 // disable CUDA
-DNO_GCD=1 // disable GrandCentralDispatch on OSX

View File

@ -167,6 +167,30 @@ endif()
list(APPEND DOXY_HEADER_FILES ${OPENMP_PUBLIC_HEADERS})
#-------------------------------------------------------------------------------
if( TBB_FOUND )
include_directories(
${TBB_INCLUDE_DIR}
)
list(APPEND CPU_SOURCE_FILES
tbbKernel.cpp
tbbComputeController.cpp
)
list(APPEND PUBLIC_HEADER_FILES
tbbKernel.h
tbbComputeController.h
)
if (CMAKE_COMPILER_IS_GNUCXX)
list(APPEND PLATFORM_CPU_LIBRARIES
gomp
)
endif()
list(APPEND PLATFORM_CPU_LIBRARIES
${TBB_LIBRARIES}
)
endif()
#-------------------------------------------------------------------------------
set(GCD_PUBLIC_HEADERS
gcdKernel.h