Commit 90647135 authored by David E. DeMarle's avatar David E. DeMarle
Browse files

keep embree 2.17 but patch over ospray's findtbb like before

parent 947ec0d9
......@@ -22,3 +22,6 @@ superbuild_add_project(embree
-DEMBREE_GEOMETRY_SUBDIV:BOOL=OFF
-DEMBREE_TUTORIALS:BOOL=OFF
-DCMAKE_INSTALL_LIBDIR:STRING=lib)
superbuild_apply_patch(embree improve-findtbb
"Improve FindTBB")
From c7170143fae885fcb89b5ed9d9968bc3e454152e Mon Sep 17 00:00:00 2001
From: Chuck Atkins <chuck.atkins@kitware.com>
Date: Tue, 1 Aug 2017 13:55:44 -0400
Subject: [PATCH] Remove relative paths in cmake pacakge-config
Using relative paths in the cmake config can result in broken
dependencies in downstream packaging when embree is a private
dependency. This converts the relative paths generated in
embree-config.cmake from /foo/bar/baz/../../libFoo.so to /foo/libFoo.so
---
common/cmake/embree-config.cmake | 1 +
1 file changed, 1 insertion(+)
diff --git a/common/cmake/embree-config.cmake b/common/cmake/embree-config.cmake
index 689f6990e..b3d6793a0 100644
--- a/common/cmake/embree-config.cmake
+++ b/common/cmake/embree-config.cmake
@@ -15,6 +15,7 @@
## ======================================================================== ##
SET(EMBREE_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/@EMBREE_RELATIV_ROOT_DIR@)
+GET_FILENAME_COMPONENT(EMBREE_ROOT_DIR "${EMBREE_ROOT_DIR}" ABSOLUTE)
SET(EMBREE_INCLUDE_DIRS ${EMBREE_ROOT_DIR}/@CMAKE_INSTALL_INCLUDEDIR@)
SET(EMBREE_LIBRARY ${EMBREE_ROOT_DIR}/@CMAKE_INSTALL_LIBDIR@/@EMBREE_LIBRARY_NAME@)
--
2.13.3
diff --git a/common/cmake/FindTBB.cmake b/common/cmake/FindTBB.cmake
index faa53ad16..839f82bce 100644
--- a/common/cmake/FindTBB.cmake
+++ b/common/cmake/FindTBB.cmake
@@ -14,13 +14,44 @@
## limitations under the License. ##
## ======================================================================== ##
+SET(TBB_VERSION_REQUIRED "3.0")
+
+IF (NOT TBB_ROOT)
+ SET(TBB_ROOT $ENV{TBB_ROOT})
+ENDIF()
+IF (NOT TBB_ROOT)
+ SET(TBB_ROOT $ENV{TBBROOT})
+ENDIF()
+
+# detect changed TBB_ROOT
+IF (NOT TBB_ROOT STREQUAL TBB_ROOT_LAST)
+ UNSET(TBB_INCLUDE_DIR CACHE)
+ UNSET(TBB_LIBRARY CACHE)
+ UNSET(TBB_LIBRARY_DEBUG CACHE)
+ UNSET(TBB_LIBRARY_MALLOC CACHE)
+ UNSET(TBB_LIBRARY_MALLOC_DEBUG CACHE)
+ENDIF()
+
IF (WIN32)
- FIND_PATH(EMBREE_TBB_ROOT include/tbb/tbb.h
+ # workaround for parentheses in variable name / CMP0053
+ SET(PROGRAMFILESx86 "PROGRAMFILES(x86)")
+ SET(PROGRAMFILES32 "$ENV{${PROGRAMFILESx86}}")
+ IF (NOT PROGRAMFILES32)
+ SET(PROGRAMFILES32 "$ENV{PROGRAMFILES}")
+ ENDIF()
+ IF (NOT PROGRAMFILES32)
+ SET(PROGRAMFILES32 "C:/Program Files (x86)")
+ ENDIF()
+ FIND_PATH(TBB_ROOT include/tbb/task_scheduler_init.h
DOC "Root of TBB installation"
- PATHS ${PROJECT_SOURCE_DIR}/tbb "C:/Program Files (x86)/Intel/Composer XE/tbb"
- NO_DEFAULT_PATH
+ HINTS ${TBB_ROOT}
+ PATHS
+ ${PROJECT_SOURCE_DIR}/tbb
+ ${PROJECT_SOURCE_DIR}/../tbb
+ "${PROGRAMFILES32}/IntelSWTools/compilers_and_libraries/windows/tbb"
+ "${PROGRAMFILES32}/Intel/Composer XE/tbb"
+ "${PROGRAMFILES32}/Intel/compilers_and_libraries/windows/tbb"
)
- FIND_PATH(EMBREE_TBB_ROOT include/tbb/tbb.h)
IF (CMAKE_SIZEOF_VOID_P EQUAL 8)
SET(TBB_ARCH intel64)
@@ -32,96 +63,112 @@ IF (WIN32)
SET(TBB_VCVER vc10)
ELSEIF (MSVC11)
SET(TBB_VCVER vc11)
- ELSE()
+ ELSEIF (MSVC12)
SET(TBB_VCVER vc12)
+ ELSE()
+ SET(TBB_VCVER vc14)
ENDIF()
- SET(TBB_LIBDIR ${EMBREE_TBB_ROOT}/lib/${TBB_ARCH}/${TBB_VCVER})
- SET(TBB_BINDIR ${EMBREE_TBB_ROOT}/bin/${TBB_ARCH}/${TBB_VCVER})
+ SET(TBB_LIBDIR ${TBB_ROOT}/lib)
- IF (EMBREE_TBB_ROOT STREQUAL "")
- FIND_PATH(TBB_INCLUDE_DIR tbb/task_scheduler_init.h)
- FIND_LIBRARY(TBB_LIBRARY tbb)
- FIND_LIBRARY(TBB_LIBRARY_MALLOC tbbmalloc)
- ELSE()
- SET(TBB_INCLUDE_DIR TBB_INCLUDE_DIR-NOTFOUND)
- SET(TBB_LIBRARY TBB_LIBRARY-NOTFOUND)
- SET(TBB_LIBRARY_MALLOC TBB_LIBRARY_MALLOC-NOTFOUND)
- FIND_PATH(TBB_INCLUDE_DIR tbb/task_scheduler_init.h PATHS ${EMBREE_TBB_ROOT}/include NO_DEFAULT_PATH)
- FIND_LIBRARY(TBB_LIBRARY tbb PATHS ${TBB_LIBDIR} NO_DEFAULT_PATH)
- FIND_LIBRARY(TBB_LIBRARY_MALLOC tbbmalloc PATHS ${TBB_LIBDIR} NO_DEFAULT_PATH)
- ENDIF()
+ FIND_PATH(TBB_INCLUDE_DIR tbb/task_scheduler_init.h PATHS ${TBB_ROOT}/include NO_DEFAULT_PATH)
+ FIND_LIBRARY(TBB_LIBRARY tbb
+ PATHS
+ ${TBB_LIBDIR}/${TBB_ARCH}/${TBB_VCVER}
+ ${TBB_LIBDIR}
+ NO_DEFAULT_PATH)
+ FIND_LIBRARY(TBB_LIBRARY_DEBUG tbb_debug
+ PATHS
+ ${TBB_LIBDIR}/${TBB_ARCH}/${TBB_VCVER}
+ ${TBB_LIBDIR}
+ NO_DEFAULT_PATH)
+ FIND_LIBRARY(TBB_LIBRARY_MALLOC tbbmalloc
+ PATHS
+ ${TBB_LIBDIR}/${TBB_ARCH}/${TBB_VCVER}
+ ${TBB_LIBDIR}
+ NO_DEFAULT_PATH)
+ FIND_LIBRARY(TBB_LIBRARY_MALLOC_DEBUG tbbmalloc_debug
+ PATHS
+ ${TBB_LIBDIR}/${TBB_ARCH}/${TBB_VCVER}
+ ${TBB_LIBDIR}
+ NO_DEFAULT_PATH)
ELSE ()
- FIND_PATH(EMBREE_TBB_ROOT include/tbb/tbb.h
+ FIND_PATH(TBB_ROOT include/tbb/task_scheduler_init.h
DOC "Root of TBB installation"
- PATHS ${PROJECT_SOURCE_DIR}/tbb /opt/intel/tbb
- NO_DEFAULT_PATH
+ HINTS ${TBB_ROOT}
+ PATHS
+ ${PROJECT_SOURCE_DIR}/tbb
+ /opt/intel/composerxe/tbb
+ /opt/intel/compilers_and_libraries/tbb
+ /opt/intel/tbb
)
- FIND_PATH(EMBREE_TBB_ROOT include/tbb/tbb.h)
-
- IF (EMBREE_TBB_ROOT STREQUAL "")
- FIND_PATH(TBB_INCLUDE_DIR tbb/task_scheduler_init.h)
- FIND_LIBRARY(TBB_LIBRARY tbb)
- FIND_LIBRARY(TBB_LIBRARY_MALLOC tbbmalloc)
-
- ELSEIF (EXISTS ${EMBREE_TBB_ROOT}/cmake/TBBBuild.cmake)
- OPTION(EMBREE_TBB_STATIC_LIB "Build TBB as a static library (building TBB as a static library is NOT recommended)")
- if (EMBREE_TBB_STATIC_LIB)
- include(${EMBREE_TBB_ROOT}/cmake/TBBBuild.cmake)
- tbb_build(TBB_ROOT ${EMBREE_TBB_ROOT} CONFIG_DIR TBB_DIR MAKE_ARGS extra_inc=big_iron.inc)
- SET(TBB_INCLUDE_DIR ${EMBREE_TBB_ROOT}/include)
- SET(TBB_LIBRARY ${PROJECT_BINARY_DIR}/tbb_cmake_build/tbb_cmake_build_subdir_release/libtbb.a)
- SET(TBB_LIBRARY_MALLOC ${PROJECT_BINARY_DIR}/tbb_cmake_build/tbb_cmake_build_subdir_release/libtbbmalloc.a)
- else()
- include(${EMBREE_TBB_ROOT}/cmake/TBBBuild.cmake)
- tbb_build(TBB_ROOT ${EMBREE_TBB_ROOT} CONFIG_DIR TBB_DIR)
- SET(TBB_INCLUDE_DIR ${EMBREE_TBB_ROOT}/include)
- SET(TBB_LIBRARY ${PROJECT_BINARY_DIR}/tbb_cmake_build/tbb_cmake_build_subdir_release/libtbb.so.2)
- SET(TBB_LIBRARY_MALLOC ${PROJECT_BINARY_DIR}/tbb_cmake_build/tbb_cmake_build_subdir_release/libtbbmalloc.so.2)
- endif()
-
+
+ IF (APPLE)
+ FIND_PATH(TBB_INCLUDE_DIR tbb/task_scheduler_init.h PATHS ${TBB_ROOT}/include NO_DEFAULT_PATH)
+ FIND_LIBRARY(TBB_LIBRARY tbb PATHS ${TBB_ROOT}/lib NO_DEFAULT_PATH)
+ FIND_LIBRARY(TBB_LIBRARY_DEBUG tbb_debug PATHS ${TBB_ROOT}/lib NO_DEFAULT_PATH)
+ FIND_LIBRARY(TBB_LIBRARY_MALLOC tbbmalloc PATHS ${TBB_ROOT}/lib NO_DEFAULT_PATH)
+ FIND_LIBRARY(TBB_LIBRARY_MALLOC_DEBUG tbbmalloc_debug PATHS ${TBB_ROOT}/lib NO_DEFAULT_PATH)
ELSE()
- SET(TBB_INCLUDE_DIR TBB_INCLUDE_DIR-NOTFOUND)
- SET(TBB_LIBRARY TBB_LIBRARY-NOTFOUND)
- SET(TBB_LIBRARY_MALLOC TBB_LIBRARY_MALLOC-NOTFOUND)
- IF (APPLE)
- FIND_PATH(TBB_INCLUDE_DIR tbb/task_scheduler_init.h PATHS ${EMBREE_TBB_ROOT}/include NO_DEFAULT_PATH)
- FIND_LIBRARY(TBB_LIBRARY tbb PATHS ${EMBREE_TBB_ROOT}/lib NO_DEFAULT_PATH)
- FIND_LIBRARY(TBB_LIBRARY_MALLOC tbbmalloc PATHS ${EMBREE_TBB_ROOT}/lib NO_DEFAULT_PATH)
- ELSE()
- FIND_PATH(TBB_INCLUDE_DIR tbb/task_scheduler_init.h PATHS ${EMBREE_TBB_ROOT}/include NO_DEFAULT_PATH)
- FIND_LIBRARY(TBB_LIBRARY tbb PATHS ${EMBREE_TBB_ROOT}/lib/intel64/gcc4.4 ${EMBREE_TBB_ROOT}/lib ${EMBREE_TBB_ROOT}/lib64 /usr/libx86_64-linux-gnu/ NO_DEFAULT_PATH)
- FIND_LIBRARY(TBB_LIBRARY_MALLOC tbbmalloc PATHS ${EMBREE_TBB_ROOT}/lib/intel64/gcc4.4 ${EMBREE_TBB_ROOT}/lib ${EMBREE_TBB_ROOT}/lib64 /usr/libx86_64-linux-gnu/ NO_DEFAULT_PATH)
- ENDIF()
+ FIND_PATH(TBB_INCLUDE_DIR tbb/task_scheduler_init.h PATHS ${TBB_ROOT}/include NO_DEFAULT_PATH)
+ SET(TBB_HINTS HINTS ${TBB_ROOT}/lib/intel64/gcc4.4 ${TBB_ROOT}/lib ${TBB_ROOT}/lib64 PATHS /usr/libx86_64-linux-gnu/)
+ FIND_LIBRARY(TBB_LIBRARY libtbb.so.2 ${TBB_HINTS})
+ FIND_LIBRARY(TBB_LIBRARY_DEBUG libtbb_debug.so.2 ${TBB_HINTS})
+ FIND_LIBRARY(TBB_LIBRARY_MALLOC libtbbmalloc.so.2 ${TBB_HINTS})
+ FIND_LIBRARY(TBB_LIBRARY_MALLOC_DEBUG libtbbmalloc_debug.so.2 ${TBB_HINTS})
ENDIF()
-
ENDIF()
+SET(TBB_ROOT_LAST ${TBB_ROOT} CACHE INTERNAL "Last value of TBB_ROOT to detect changes")
+
+SET(TBB_ERROR_MESSAGE
+ "Threading Building Blocks (TBB) with minimum version ${TBB_VERSION_REQUIRED} not found.
+OSPRay uses TBB as default tasking system. Please make sure you have the TBB headers installed as well (the package is typically named 'libtbb-dev' or 'tbb-devel') and/or hint the location of TBB in TBB_ROOT.
+Alternatively, you can try to use OpenMP as tasking system by setting OSPRAY_TASKING_SYSTEM=OpenMP")
+
INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(TBB DEFAULT_MSG TBB_INCLUDE_DIR TBB_LIBRARY TBB_LIBRARY_MALLOC)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(TBB
+ ${TBB_ERROR_MESSAGE}
+ TBB_INCLUDE_DIR TBB_LIBRARY TBB_LIBRARY_MALLOC
+)
+
+# check version
+IF (TBB_INCLUDE_DIR)
+ FILE(READ ${TBB_INCLUDE_DIR}/tbb/tbb_stddef.h TBB_STDDEF_H)
+
+ STRING(REGEX MATCH "#define TBB_VERSION_MAJOR ([0-9]+)" DUMMY "${TBB_STDDEF_H}")
+ SET(TBB_VERSION_MAJOR ${CMAKE_MATCH_1})
+
+ STRING(REGEX MATCH "#define TBB_VERSION_MINOR ([0-9]+)" DUMMY "${TBB_STDDEF_H}")
+ SET(TBB_VERSION "${TBB_VERSION_MAJOR}.${CMAKE_MATCH_1}")
+
+ IF (TBB_VERSION VERSION_LESS TBB_VERSION_REQUIRED)
+ MESSAGE(FATAL_ERROR ${TBB_ERROR_MESSAGE})
+ ENDIF()
+
+ SET(TBB_VERSION ${TBB_VERSION} CACHE STRING "TBB Version")
+ MARK_AS_ADVANCED(TBB_VERSION)
+ENDIF()
IF (TBB_FOUND)
SET(TBB_INCLUDE_DIRS ${TBB_INCLUDE_DIR})
- SET(TBB_LIBRARIES ${TBB_LIBRARY} ${TBB_LIBRARY_MALLOC})
+ # NOTE(jda) - TBB found in CentOS 6/7 package manager does not have debug
+ # versions of the library...silently fall-back to using only the
+ # libraries which we actually found.
+ IF (NOT TBB_LIBRARY_DEBUG)
+ SET(TBB_LIBRARIES ${TBB_LIBRARY} ${TBB_LIBRARY_MALLOC})
+ ELSE ()
+ SET(TBB_LIBRARIES
+ optimized ${TBB_LIBRARY} optimized ${TBB_LIBRARY_MALLOC}
+ debug ${TBB_LIBRARY_DEBUG} debug ${TBB_LIBRARY_MALLOC_DEBUG}
+ )
+ ENDIF()
ENDIF()
MARK_AS_ADVANCED(TBB_INCLUDE_DIR)
MARK_AS_ADVANCED(TBB_LIBRARY)
+MARK_AS_ADVANCED(TBB_LIBRARY_DEBUG)
MARK_AS_ADVANCED(TBB_LIBRARY_MALLOC)
-
-##############################################################
-# Install TBB
-##############################################################
-
-IF (WIN32)
- INSTALL(PROGRAMS ${TBB_BINDIR}/tbb.dll ${TBB_BINDIR}/tbbmalloc.dll DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT examples)
- INSTALL(PROGRAMS ${TBB_LIBDIR}/tbb.lib ${TBB_LIBDIR}/tbbmalloc.lib DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT lib)
-ELSEIF (EMBREE_ZIP_MODE)
- IF (APPLE)
- INSTALL(PROGRAMS ${EMBREE_TBB_ROOT}/lib/libtbb.dylib ${EMBREE_TBB_ROOT}/lib/libtbbmalloc.dylib DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT lib)
- ELSE()
- INSTALL(PROGRAMS ${EMBREE_TBB_ROOT}/lib/intel64/gcc4.4/libtbb.so.2 ${EMBREE_TBB_ROOT}/lib/intel64/gcc4.4/libtbbmalloc.so.2 DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT lib)
- ENDIF()
-ENDIF()
+MARK_AS_ADVANCED(TBB_LIBRARY_MALLOC_DEBUG)
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