Commit 8a915d96 authored by David E. DeMarle's avatar David E. DeMarle Committed by Kitware Robot
Browse files

Merge topic 'bump-ospray-1.6.1'

74b3a2b8 ensure that the new ispc module is installed too
6ae99718 workaround a compiler bug in vis studio 2015
a0edb8a7 patch ospray to allow compilation on VS2013
a3d0ff75

 bump ospray to 1.6.1 and therefore embree to 3.2.0
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !485
parents e38c4a82 74b3a2b8
Pipeline #115021 failed with stage
in 0 seconds
set(embree_BUILD_ISA "DEFAULT" CACHE STRING "ISAs to build Embree for")
mark_as_advanced(embree_BUILD_ISA)
set(embree_isa_args)
set(embree_allow_skx "-DEMBREE_ISA_AVX512SKX:BOOL=OFF") #default off due to flaky trycompile
if(NOT (embree_BUILD_ISA STREQUAL "DEFAULT"))
if(embree_BUILD_ISA STREQUAL "ALL")
set(embree_BUILD_ISA SSE2 SSE42 AVX AVX2 AVX512KNL AVX512SKX)
......@@ -8,6 +9,9 @@ if(NOT (embree_BUILD_ISA STREQUAL "DEFAULT"))
list(APPEND embree_isa_args -DEMBREE_MAX_ISA:BOOL=NONE)
foreach(isa IN LISTS embree_BUILD_ISA)
list(APPEND embree_isa_args -DEMBREE_ISA_${isa}:BOOL=ON)
if (MATCHES isa "AVX512SKX")
set(embree_allow_skx)
endif()
endforeach()
endif()
......@@ -15,19 +19,16 @@ superbuild_add_project(embree
DEPENDS ispc tbb cxx11
CMAKE_ARGS
${embree_isa_args}
${embree_allow_skx}
-DBUILD_TESTING:BOOL=OFF
-DEMBREE_ISPC_EXECUTABLE:PATH=<INSTALL_DIR>/bin/ispc
-DEMBREE_GEOMETRY_HAIR:BOOL=OFF
-DEMBREE_GEOMETRY_HAIR:BOOL=ON
-DEMBREE_GEOMETRY_LINES:BOOL=OFF
-DEMBREE_GEOMETRY_QUADS:BOOL=OFF
-DEMBREE_GEOMETRY_SUBDIV:BOOL=OFF
-DEMBREE_TUTORIALS:BOOL=OFF
-DCMAKE_INSTALL_LIBDIR:STRING=lib)
superbuild_apply_patch(embree improve-findtbb
"Improve FindTBB")
superbuild_apply_patch(embree rename-options-file
"Rename compiler options file")
superbuild_apply_patch(embree craype-include
"Let CrayPE include other compiler options")
superbuild_apply_patch(embree move-sse2-flags
"Move FLAGS_SSE2 out of CMAKE_CXX_FLAGS")
if (MSVC_VERSION EQUAL 1900)
superbuild_append_flags(cxx_flags "-d2SSAOptimizer-" PROJECT_ONLY)
endif()
......@@ -26,6 +26,7 @@ superbuild_add_project(ospray
-DOSPRAY_APPS_VOLUMEVIEWER:BOOL=OFF
-DOSPRAY_COMMANDLINE_TACHYON_SUPPORT:BOOL=OFF
-DOSPRAY_ENABLE_APPS:BOOL=OFF
-DOSPRAY_ENABLE_TESTING:BOOL=OFF
-DOSPRAY_MODULE_DISPLAY_WALD:BOOL=OFF
-DOSPRAY_MODULE_LOADERS:BOOL=OFF
-DOSPRAY_MODULE_OPENGL_UTIL:BOOL=OFF
......@@ -33,5 +34,6 @@ superbuild_add_project(ospray
-DOSPRAY_MODULE_TACHYON:BOOL=OFF
-DCMAKE_INSTALL_LIBDIR:STRING=lib)
superbuild_apply_patch(ospray disable-testing "Really disable testing")
superbuild_add_extra_cmake_args(
-DOSPRAY_INSTALL_DIR:PATH=<INSTALL_DIR>)
From 0eae5cd681d0321e8eea04cdd18f0a09ac684349 Mon Sep 17 00:00:00 2001
From: Chuck Atkins <chuck.atkins@kitware.com>
Date: Mon, 5 Mar 2018 09:23:31 -0600
Subject: [PATCH 2/3] Have Cray options include underlying compiler options
---
common/cmake/clang.cmake | 20 +++++++++++---------
common/cmake/crayprgenv.cmake | 10 +++++++---
common/cmake/gnu.cmake | 18 ++++++++++++------
common/cmake/intel.cmake | 32 +++++++++++++++++++-------------
4 files changed, 49 insertions(+), 31 deletions(-)
diff --git a/common/cmake/clang.cmake b/common/cmake/clang.cmake
index 439588580..58dc39c94 100644
--- a/common/cmake/clang.cmake
+++ b/common/cmake/clang.cmake
@@ -13,16 +13,18 @@
## See the License for the specific language governing permissions and ##
## limitations under the License. ##
## ======================================================================== ##
+MACRO(_SET_IF_EMPTY VAR VALUE)
+ IF(NOT ${VAR})
+ SET(${VAR} "${VALUE}")
+ ENDIF()
+ENDMACRO()
-SET(FLAGS_SSE2 "-msse2")
-SET(FLAGS_SSE3 "-msse3")
-SET(FLAGS_SSSE3 "-mssse3")
-SET(FLAGS_SSE41 "-msse4.1")
-SET(FLAGS_SSE42 "-msse4.2")
-SET(FLAGS_AVX "-mavx")
-SET(FLAGS_AVX2 "-mf16c -mavx2 -mfma -mlzcnt -mbmi -mbmi2")
-SET(FLAGS_AVX512KNL "-march=knl")
-SET(FLAGS_AVX512SKX "-march=skx")
+_SET_IF_EMPTY(FLAGS_SSE2 "-msse2")
+_SET_IF_EMPTY(FLAGS_SSE42 "-msse4.2")
+_SET_IF_EMPTY(FLAGS_AVX "-mavx")
+_SET_IF_EMPTY(FLAGS_AVX2 "-mf16c -mavx2 -mfma -mlzcnt -mbmi -mbmi2")
+_SET_IF_EMPTY(FLAGS_AVX512KNL "-march=knl")
+_SET_IF_EMPTY(FLAGS_AVX512SKX "-march=skx")
IF (WIN32)
diff --git a/common/cmake/crayprgenv.cmake b/common/cmake/crayprgenv.cmake
index 87abed619..c466330da 100644
--- a/common/cmake/crayprgenv.cmake
+++ b/common/cmake/crayprgenv.cmake
@@ -13,10 +13,14 @@
## See the License for the specific language governing permissions and ##
## limitations under the License. ##
## ======================================================================== ##
-
-SET(FLAGS_SSE2 "-target-cpu=xeon")
-SET(FLAGS_SSE42 "-target-cpu=interlagos")
+SET(FLAGS_SSE2 "-target-cpu=x86_64")
+SET(FLAGS_SSE42 "NOT_SUPPORTED")
SET(FLAGS_AVX "-target-cpu=sandybridge")
SET(FLAGS_AVX2 "-target-cpu=haswell")
SET(FLAGS_AVX512KNL "-target-cpu=mic-knl")
SET(FLAGS_AVX512SKX "-target-cpu=x86-skylake")
+
+SET_PROPERTY(CACHE EMBREE_ISA_SSE42 PROPERTY VALUE OFF)
+
+STRING(TOLOWER "${CMAKE_CXX_COMPILER_ID}" _lower_compiler_id)
+INCLUDE("${CMAKE_CURRENT_LIST_DIR}/${_lower_compiler_id}.cmake" OPTIONAL)
diff --git a/common/cmake/gnu.cmake b/common/cmake/gnu.cmake
index 80620a75f..191c134ae 100644
--- a/common/cmake/gnu.cmake
+++ b/common/cmake/gnu.cmake
@@ -14,12 +14,18 @@
## limitations under the License. ##
## ======================================================================== ##
-SET(FLAGS_SSE2 "-msse2")
-SET(FLAGS_SSE42 "-msse4.2")
-SET(FLAGS_AVX "-mavx")
-SET(FLAGS_AVX2 "-mf16c -mavx2 -mfma -mlzcnt -mbmi -mbmi2")
-SET(FLAGS_AVX512KNL "-mavx512f -mavx512pf -mavx512er -mavx512cd -mf16c -mavx2 -mfma -mlzcnt -mbmi -mbmi2")
-SET(FLAGS_AVX512SKX "-mavx512f -mavx512dq -mavx512cd -mavx512bw -mavx512vl -mf16c -mavx2 -mfma -mlzcnt -mbmi -mbmi2")
+MACRO(_SET_IF_EMPTY VAR VALUE)
+ IF(NOT ${VAR})
+ SET(${VAR} "${VALUE}")
+ ENDIF()
+ENDMACRO()
+
+_SET_IF_EMPTY(FLAGS_SSE2 "-msse2")
+_SET_IF_EMPTY(FLAGS_SSE42 "-msse4.2")
+_SET_IF_EMPTY(FLAGS_AVX "-mavx")
+_SET_IF_EMPTY(FLAGS_AVX2 "-mf16c -mavx2 -mfma -mlzcnt -mbmi -mbmi2")
+_SET_IF_EMPTY(FLAGS_AVX512KNL "-mavx512f -mavx512pf -mavx512er -mavx512cd -mf16c -mavx2 -mfma -mlzcnt -mbmi -mbmi2")
+_SET_IF_EMPTY(FLAGS_AVX512SKX "-mavx512f -mavx512dq -mavx512cd -mavx512bw -mavx512vl -mf16c -mavx2 -mfma -mlzcnt -mbmi -mbmi2")
OPTION(EMBREE_IGNORE_CMAKE_CXX_FLAGS "When enabled Embree ignores default CMAKE_CXX_FLAGS." ON)
IF (EMBREE_IGNORE_CMAKE_CXX_FLAGS)
diff --git a/common/cmake/intel.cmake b/common/cmake/intel.cmake
index 1d99d2e7b..4c414032c 100644
--- a/common/cmake/intel.cmake
+++ b/common/cmake/intel.cmake
@@ -14,14 +14,20 @@
## limitations under the License. ##
## ======================================================================== ##
+MACRO(_SET_IF_EMPTY VAR VALUE)
+ IF(NOT ${VAR})
+ SET(${VAR} "${VALUE}")
+ ENDIF()
+ENDMACRO()
+
IF (WIN32)
- SET(FLAGS_SSE2 "/QxSSE2")
- SET(FLAGS_SSE42 "/QxSSE4.2")
- SET(FLAGS_AVX "/arch:AVX")
- SET(FLAGS_AVX2 "/QxCORE-AVX2")
- SET(FLAGS_AVX512KNL "/QxMIC-AVX512")
- SET(FLAGS_AVX512SKX "/QxCORE-AVX512")
+ _SET_IF_EMPTY(FLAGS_SSE2 "/QxSSE2")
+ _SET_IF_EMPTY(FLAGS_SSE42 "/QxSSE4.2")
+ _SET_IF_EMPTY(FLAGS_AVX "/arch:AVX")
+ _SET_IF_EMPTY(FLAGS_AVX2 "/QxCORE-AVX2")
+ _SET_IF_EMPTY(FLAGS_AVX512KNL "/QxMIC-AVX512")
+ _SET_IF_EMPTY(FLAGS_AVX512SKX "/QxCORE-AVX512")
SET(COMMON_CXX_FLAGS "")
SET(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} /EHsc") # catch C++ exceptions only and extern "C" functions never throw a C++ exception
@@ -79,15 +85,15 @@ IF (WIN32)
ELSE()
IF (APPLE)
- SET(FLAGS_SSE2 "-xssse3") # on MacOSX ICC does not support SSE2
+ _SET_IF_EMPTY(FLAGS_SSE2 "-xssse3") # on MacOSX ICC does not support SSE2
ELSE()
- SET(FLAGS_SSE2 "-xsse2")
+ _SET_IF_EMPTY(FLAGS_SSE2 "-xsse2")
ENDIF()
- SET(FLAGS_SSE42 "-xsse4.2")
- SET(FLAGS_AVX "-xAVX")
- SET(FLAGS_AVX2 "-xCORE-AVX2")
- SET(FLAGS_AVX512KNL "-xMIC-AVX512")
- SET(FLAGS_AVX512SKX "-xCORE-AVX512")
+ _SET_IF_EMPTY(FLAGS_SSE42 "-xsse4.2")
+ _SET_IF_EMPTY(FLAGS_AVX "-xAVX")
+ _SET_IF_EMPTY(FLAGS_AVX2 "-xCORE-AVX2")
+ _SET_IF_EMPTY(FLAGS_AVX512KNL "-xMIC-AVX512")
+ _SET_IF_EMPTY(FLAGS_AVX512SKX "-xCORE-AVX512")
OPTION(EMBREE_IGNORE_CMAKE_CXX_FLAGS "When enabled Embree ignores default CMAKE_CXX_FLAGS." ON)
IF (EMBREE_IGNORE_CMAKE_CXX_FLAGS)
--
2.14.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)
From a94ed12e8f35d28cec3e72e47e129f9485c29fe4 Mon Sep 17 00:00:00 2001
From: Chuck Atkins <chuck.atkins@kitware.com>
Date: Mon, 5 Mar 2018 09:26:30 -0600
Subject: [PATCH 3/3] Move SSE2 options from CMAKE_CXX_FLAGS to common target
properties
---
common/algorithms/CMakeLists.txt | 4 ++--
common/cmake/msvc.cmake | 2 +-
common/lexers/CMakeLists.txt | 2 ++
common/math/CMakeLists.txt | 2 ++
common/simd/CMakeLists.txt | 3 ++-
common/sys/CMakeLists.txt | 2 ++
common/tasking/CMakeLists.txt | 10 ++++------
7 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/common/algorithms/CMakeLists.txt b/common/algorithms/CMakeLists.txt
index dc35c6237..0c6d98dc3 100644
--- a/common/algorithms/CMakeLists.txt
+++ b/common/algorithms/CMakeLists.txt
@@ -28,5 +28,5 @@ ADD_LIBRARY(algorithms OBJECT
)
SET_PROPERTY(TARGET algorithms PROPERTY FOLDER common)
-
-
+SET_PROPERTY(TARGET algorithms APPEND PROPERTY
+ COMPILE_FLAGS " ${FLAGS_LOWEST}")
diff --git a/common/cmake/msvc.cmake b/common/cmake/msvc.cmake
index 939ec325a..55bd7d2be 100644
--- a/common/cmake/msvc.cmake
+++ b/common/cmake/msvc.cmake
@@ -33,7 +33,7 @@ MACRO(DISABLE_STACK_PROTECTOR_FOR_FILE file)
SET_SOURCE_FILES_PROPERTIES(${file} PROPERTIES COMPILE_FLAGS "/GS-")
ENDIF()
ENDMACRO()
-SET(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} ${FLAGS_SSE2}")
+SET(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS}")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${COMMON_CXX_FLAGS}")
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /DEBUG") # generate debug information
diff --git a/common/lexers/CMakeLists.txt b/common/lexers/CMakeLists.txt
index 77809eddd..a637ad5e9 100644
--- a/common/lexers/CMakeLists.txt
+++ b/common/lexers/CMakeLists.txt
@@ -20,3 +20,5 @@ ADD_LIBRARY(lexers STATIC
)
TARGET_LINK_LIBRARIES(lexers sys math)
SET_PROPERTY(TARGET lexers PROPERTY FOLDER common)
+SET_PROPERTY(TARGET lexers APPEND PROPERTY
+ COMPILE_FLAGS " ${FLAGS_LOWEST}")
diff --git a/common/math/CMakeLists.txt b/common/math/CMakeLists.txt
index 8a56adea1..872e427ce 100644
--- a/common/math/CMakeLists.txt
+++ b/common/math/CMakeLists.txt
@@ -16,3 +16,5 @@
ADD_LIBRARY(math STATIC constants.cpp)
SET_PROPERTY(TARGET math PROPERTY FOLDER common)
+SET_PROPERTY(TARGET math APPEND PROPERTY
+ COMPILE_FLAGS " ${FLAGS_LOWEST}")
diff --git a/common/simd/CMakeLists.txt b/common/simd/CMakeLists.txt
index bc5c1f208..fc462098e 100644
--- a/common/simd/CMakeLists.txt
+++ b/common/simd/CMakeLists.txt
@@ -16,4 +16,5 @@
ADD_LIBRARY(simd STATIC sse.cpp)
SET_PROPERTY(TARGET simd PROPERTY FOLDER common)
-
+SET_PROPERTY(TARGET simd APPEND PROPERTY
+ COMPILE_FLAGS " ${FLAGS_LOWEST}")
diff --git a/common/sys/CMakeLists.txt b/common/sys/CMakeLists.txt
index c953ffb8f..9701a6e5e 100644
--- a/common/sys/CMakeLists.txt
+++ b/common/sys/CMakeLists.txt
@@ -32,3 +32,5 @@ ADD_LIBRARY(sys STATIC
TARGET_LINK_LIBRARIES(sys ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS})
SET_PROPERTY(TARGET sys PROPERTY FOLDER common)
+SET_PROPERTY(TARGET sys APPEND PROPERTY
+ COMPILE_FLAGS " ${FLAGS_LOWEST}")
diff --git a/common/tasking/CMakeLists.txt b/common/tasking/CMakeLists.txt
index 1e779310e..0b4003676 100644
--- a/common/tasking/CMakeLists.txt
+++ b/common/tasking/CMakeLists.txt
@@ -16,16 +16,14 @@
IF (TASKING_INTERNAL)
ADD_LIBRARY(tasking STATIC taskschedulerinternal.cpp)
-ENDIF()
-
-IF (TASKING_TBB)
+ELSEIF (TASKING_TBB)
ADD_LIBRARY(tasking STATIC taskschedulertbb.cpp)
TARGET_LINK_LIBRARIES(tasking sys math ${TBB_LIBRARIES})
-ENDIF()
-
-IF (TASKING_PPL)
+ELSEIF (TASKING_PPL)
ADD_LIBRARY(tasking STATIC taskschedulerppl.cpp)
TARGET_LINK_LIBRARIES(tasking sys math ${PPL_LIBRARIES})
ENDIF()
SET_PROPERTY(TARGET tasking PROPERTY FOLDER common)
+SET_PROPERTY(TARGET tasking APPEND PROPERTY
+ COMPILE_FLAGS " ${FLAGS_LOWEST}")
--
2.14.3
From c9a3b4925d1faa285c82744267a78f6230716d52 Mon Sep 17 00:00:00 2001
From: Chuck Atkins <chuck.atkins@kitware.com>
Date: Mon, 5 Mar 2018 09:22:22 -0600
Subject: [PATCH 1/3] Use compiler ID for cmake options file name
---
CMakeLists.txt | 16 +++++++---------
common/cmake/{gcc.cmake => gnu.cmake} | 0
common/cmake/{icc.cmake => intel.cmake} | 0
3 files changed, 7 insertions(+), 9 deletions(-)
rename common/cmake/{gcc.cmake => gnu.cmake} (100%)
rename common/cmake/{icc.cmake => intel.cmake} (100%)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 07fa0a61f..3091d9df0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -262,15 +262,13 @@ IF (WIN32)
ELSE (WIN32)
IF(CMAKE_CXX_COMPILER_WRAPPER STREQUAL "CrayPrgEnv")
- INCLUDE(crayprgenv)
- ELSEIF (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
- INCLUDE (gcc)
- ELSEIF (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
- INCLUDE (clang)
- ELSEIF (${CMAKE_CXX_COMPILER_ID} STREQUAL "Intel")
- INCLUDE (icc)
- ELSE ()
- MESSAGE(FATAL_ERROR "Unsupported compiler: " ${CMAKE_CXX_COMPILER_ID})
+ INCLUDE (crayprgenv)
+ ELSE()
+ STRING(TOLOWER "${CMAKE_CXX_COMPILER_ID}" _LOWER_CXX_COMPILER_ID)
+ INCLUDE(${_LOWER_CXX_COMPILER_ID} OPTIONAL RESULT_VARIABLE COMPILER_FOUND)
+ IF (NOT COMPILER_FOUND)
+ MESSAGE(FATAL_ERROR "Unsupported compiler: " ${CMAKE_CXX_COMPILER_ID})
+ ENDIF ()
ENDIF ()
IF(NOT CMAKE_BUILD_TYPE)
diff --git a/common/cmake/gcc.cmake b/common/cmake/gnu.cmake
similarity index 100%
rename from common/cmake/gcc.cmake
rename to common/cmake/gnu.cmake
diff --git a/common/cmake/icc.cmake b/common/cmake/intel.cmake
similarity index 100%
rename from common/cmake/icc.cmake
rename to common/cmake/intel.cmake
--
2.14.3
diff --git a/components/ospcommon/CMakeLists.txt b/components/ospcommon/CMakeLists.txt
index a6641df..9392fa1 100644
--- a/components/ospcommon/CMakeLists.txt
+++ b/components/ospcommon/CMakeLists.txt
@@ -197,7 +197,9 @@ else()
## Build Test Apps ##
- add_library(ospray_test_main STATIC testing/catch_main.cpp)
+ if (OSPRAY_ENABLE_TESTING)
+ add_library(ospray_test_main STATIC testing/catch_main.cpp)