Skip to content

Commit

Permalink
[embree3] Update to 3.12.2 and add features (microsoft#17925)
Browse files Browse the repository at this point in the history
* [embree3] Update to 3.12.2 and add features

* update version record

* Update ports/embree3/portfile.cmake

* revert patch EOL, add keyword FEATURES

* Update versions/e-/embree3.json
  • Loading branch information
JackBoosY authored May 18, 2021
1 parent 2f56fd8 commit eff6f06
Show file tree
Hide file tree
Showing 7 changed files with 112 additions and 80 deletions.
6 changes: 0 additions & 6 deletions ports/embree3/CONTROL

This file was deleted.

90 changes: 29 additions & 61 deletions ports/embree3/fix-path.patch
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
diff --git a/common/algorithms/CMakeLists.txt b/common/algorithms/CMakeLists.txt
index 5667d2bd3..cb26776a4 100644
index 680c3ec..fea4a37 100644
--- a/common/algorithms/CMakeLists.txt
+++ b/common/algorithms/CMakeLists.txt
@@ -17,11 +17,4 @@ ADD_LIBRARY(algorithms OBJECT
SET_PROPERTY(TARGET algorithms PROPERTY FOLDER common)
SET_PROPERTY(TARGET algorithms APPEND PROPERTY COMPILE_FLAGS " ${FLAGS_LOWEST}")

-# ideally we would use target_link_libraries to provide the algorithms target
-# with the TBB include directory information. Howeve, this is only possible in
-# very recent versions of TBB and therefore we use the target property instead
-GET_TARGET_PROPERTY(tasking_include_dirs tasking INCLUDE_DIRECTORIES)
-if (tasking_include_dirs)
- TARGET_INCLUDE_DIRECTORIES(algorithms PUBLIC "${tasking_include_dirs}")
- GET_TARGET_PROPERTY(algorithms_include_dirs algorithms INCLUDE_DIRECTORIES)
-endif()
@@ -20,8 +20,11 @@ SET_PROPERTY(TARGET algorithms APPEND PROPERTY COMPILE_FLAGS " ${FLAGS_LOWEST}")
# ideally we would use target_link_libraries to provide the algorithms target
# with the TBB include directory information. Howeve, this is only possible in
# very recent versions of TBB and therefore we use the target property instead
+if (0)
GET_TARGET_PROPERTY(tasking_include_dirs tasking INCLUDE_DIRECTORIES)
if (tasking_include_dirs)
TARGET_INCLUDE_DIRECTORIES(algorithms PUBLIC "${tasking_include_dirs}")
GET_TARGET_PROPERTY(algorithms_include_dirs algorithms INCLUDE_DIRECTORIES)
endif()
+endif()
+TARGET_LINK_LIBRARIES(algorithms PUBLIC tasking)
\ No newline at end of file
diff --git a/common/cmake/embree-config.cmake b/common/cmake/embree-config.cmake
index 9b7370ccd..14ce929d6 100644
index 2c08cd7..5087ca0 100644
--- a/common/cmake/embree-config.cmake
+++ b/common/cmake/embree-config.cmake
@@ -5,8 +5,6 @@ SET(EMBREE_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/@EMBREE_RELATIV_ROOT_DIR@)
@@ -5,8 +5,6 @@ SET(EMBREE_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/@EMBREE_RELATIVE_ROOT_DIR@)
GET_FILENAME_COMPONENT(EMBREE_ROOT_DIR "${EMBREE_ROOT_DIR}" ABSOLUTE)

SET(EMBREE_INCLUDE_DIRS ${EMBREE_ROOT_DIR}/@CMAKE_INSTALL_INCLUDEDIR@)
Expand All @@ -29,69 +29,37 @@ index 9b7370ccd..14ce929d6 100644
SET(EMBREE_VERSION @EMBREE_VERSION@)
SET(EMBREE_VERSION_MAJOR @EMBREE_VERSION_MAJOR@)
@@ -22,7 +20,6 @@ SET(EMBREE_ISA_AVX2 @EMBREE_ISA_AVX2@)
SET(EMBREE_ISA_AVX512KNL @EMBREE_ISA_AVX512KNL@)
SET(EMBREE_ISA_AVX512SKX @EMBREE_ISA_AVX512SKX@)
SET(EMBREE_ISA_AVX512 @EMBREE_ISA_AVX512@)
SET(EMBREE_ISA_AVX512SKX @EMBREE_ISA_AVX512@) # just for compatibility

-SET(EMBREE_BUILD_TYPE @CMAKE_BUILD_TYPE@)
SET(EMBREE_ISPC_SUPPORT @EMBREE_ISPC_SUPPORT@)
SET(EMBREE_STATIC_LIB @EMBREE_STATIC_LIB@)
SET(EMBREE_TUTORIALS @EMBREE_TUTORIALS@)
@@ -53,10 +50,6 @@ IF (EMBREE_STATIC_LIB)
INCLUDE("${EMBREE_ROOT_DIR}/@EMBREE_CMAKEEXPORT_DIR@/simd-targets.cmake")
@@ -54,8 +51,6 @@ IF (EMBREE_STATIC_LIB)
INCLUDE("${EMBREE_ROOT_DIR}/@EMBREE_CMAKEEXPORT_DIR@/lexers-targets.cmake")
INCLUDE("${EMBREE_ROOT_DIR}/@EMBREE_CMAKEEXPORT_DIR@/tasking-targets.cmake")
-
- add_library(TBB::tbb SHARED IMPORTED)
- set_target_properties(TBB::tbb PROPERTIES IMPORTED_LOCATION "${EMBREE_ROOT_DIR}/@EMBREE_INSTALLED_TBB@")
-
ENDIF()

INCLUDE("${EMBREE_ROOT_DIR}/@EMBREE_CMAKEEXPORT_DIR@/embree-targets.cmake")
diff --git a/common/cmake/package.cmake b/common/cmake/package.cmake
index a4da0001a..b6f82e981 100644
index 5429436..8c89f5b 100644
--- a/common/cmake/package.cmake
+++ b/common/cmake/package.cmake
@@ -20,16 +20,6 @@ ELSE()
ENDIF()
ENDIF()

-##############################################################
-# Install MSVC runtime
-##############################################################
-
-IF (WIN32)
- SET(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE)
- INCLUDE(InstallRequiredSystemLibraries)
- LIST(FILTER CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS INCLUDE REGEX ".*msvcp[0-9]+\.dll|.*vcruntime[0-9]+\.dll|.*vcruntime[0-9]+_[0-9]+\.dll")
- INSTALL(FILES ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT lib)
-ENDIF()

@@ -24,7 +24,7 @@ ENDIF()
# Install MSVC runtime
##############################################################
# Install Headers
@@ -106,18 +96,9 @@ ELSE()
ENDIF()
ENDIF()

-IF (WIN32 OR EMBREE_ZIP_MODE)
- # for local "installs" and on Windows we want the cmake config files placed
- # in the install root, such that users can point the CMake variable
- # embree_DIR just to the install folder
- SET(EMBREE_CMAKECONFIG_DIR ".")
- SET(EMBREE_CMAKEEXPORT_DIR "cmake")
- SET(EMBREE_RELATIV_ROOT_DIR ".")
-ELSE()
- SET(EMBREE_CMAKECONFIG_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/embree-${EMBREE_VERSION}")
- SET(EMBREE_CMAKEEXPORT_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/embree-${EMBREE_VERSION}")
- FILE(RELATIVE_PATH EMBREE_RELATIV_ROOT_DIR "/${EMBREE_CMAKECONFIG_DIR}" "/")
-ENDIF()
+SET(EMBREE_CMAKECONFIG_DIR "share/embree")
+SET(EMBREE_CMAKEEXPORT_DIR "share/embree3")
+SET(EMBREE_RELATIV_ROOT_DIR "../..")

CONFIGURE_FILE(common/cmake/embree-config.cmake embree-config-install.cmake @ONLY)
CONFIGURE_FILE(common/cmake/embree-config-version.cmake embree-config-version.cmake @ONLY)
-IF (WIN32)
+IF (0)
SET(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE)
INCLUDE(InstallRequiredSystemLibraries)
LIST(FILTER CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS INCLUDE REGEX ".*msvcp[0-9]+\.dll|.*vcruntime[0-9]+\.dll|.*vcruntime[0-9]+_[0-9]+\.dll")
diff --git a/common/tasking/CMakeLists.txt b/common/tasking/CMakeLists.txt
index 71ef29612..c846004e3 100644
index 3085096..258d24e 100644
--- a/common/tasking/CMakeLists.txt
+++ b/common/tasking/CMakeLists.txt
@@ -10,7 +10,7 @@ ELSEIF (TASKING_TBB)
Expand Down
9 changes: 4 additions & 5 deletions ports/embree3/fix-static-usage.patch
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
diff --git a/common/cmake/embree-config.cmake b/common/cmake/embree-config.cmake
index 14ce929..7e2e8f5 100644
index 5087ca0..fdf8135 100644
--- a/common/cmake/embree-config.cmake
+++ b/common/cmake/embree-config.cmake
@@ -50,6 +50,22 @@ IF (EMBREE_STATIC_LIB)
INCLUDE("${EMBREE_ROOT_DIR}/@EMBREE_CMAKEEXPORT_DIR@/simd-targets.cmake")
INCLUDE("${EMBREE_ROOT_DIR}/@EMBREE_CMAKEEXPORT_DIR@/lexers-targets.cmake")
@@ -52,6 +52,21 @@ IF (EMBREE_STATIC_LIB)
INCLUDE("${EMBREE_ROOT_DIR}/@EMBREE_CMAKEEXPORT_DIR@/tasking-targets.cmake")
+


+ IF(EMBREE_ISA_SSE42)
+ INCLUDE("${EMBREE_ROOT_DIR}/@EMBREE_CMAKEEXPORT_DIR@/embree_sse42-targets.cmake")
+ ENDIF()
Expand Down
46 changes: 40 additions & 6 deletions ports/embree3/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
set(EMBREE3_VERSION 3.12.2)

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO embree/embree
REF v3.11.0
SHA512 a20acb07103d322eebc85d41152210466f8d9b97e7a332589c692f649ee02079465f89561748ddc8448fb40bc63f2595d728cc31a927f7b95bea13446c5c775d
REF v${EMBREE3_VERSION}
SHA512 a63b483a92f4653e07a21ed3b545d86003295e0aacd8ec7a40ee72bad7bb70c6ea019af511e78c5c598336b162d53e296e9c87150c0adce6463b058e7a5394d4
HEAD_REF master
PATCHES
fix-path.patch
Expand All @@ -12,11 +14,42 @@ vcpkg_from_github(
string(COMPARE EQUAL ${VCPKG_LIBRARY_LINKAGE} static EMBREE_STATIC_LIB)
string(COMPARE EQUAL ${VCPKG_CRT_LINKAGE} static EMBREE_STATIC_RUNTIME)

if (NOT VCPKG_TARGET_IS_OSX)
if ("avx512" IN_LIST FEATURES)
message(FATAL_ERROR "Microsoft Visual C++ Compiler does not support feature avx512 officially.")
endif()

vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
avx EMBREE_ISA_AVX
avx2 EMBREE_ISA_AVX2
avx512 EMBREE_ISA_AVX512
sse2 EMBREE_ISA_SSE2
sse42 EMBREE_ISA_SSE42
)
elseif (VCPKG_LIBRARY_LINKAGE STREQUAL static)
list(LENGTH FEATURES FEATURE_COUNT)
if (FEATURE_COUNT GREATER 2)
message(WARNING [[
Using Embree as static library is not supported with AppleClang >= 9.0 when multiple ISAs are selected.
Please install embree3 with only one feature using command "./vcpkg install embree3[core,FEATURE_NAME]"
Only set feature avx automaticlly.
]])
set(FEATURE_OPTIONS
-DEMBREE_ISA_AVX=ON
-DEMBREE_ISA_AVX2=OFF
-DEMBREE_ISA_AVX512=OFF
-DEMBREE_ISA_SSE2=OFF
-DEMBREE_ISA_SSE42=OFF
)
endif()
endif()

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
DISABLE_PARALLEL_CONFIGURE
PREFER_NINJA
OPTIONS
OPTIONS ${FEATURE_OPTIONS}
-DEMBREE_ISPC_SUPPORT=OFF
-DEMBREE_TUTORIALS=OFF
-DEMBREE_STATIC_RUNTIME=${EMBREE_STATIC_RUNTIME}
Expand All @@ -25,17 +58,18 @@ vcpkg_configure_cmake(

vcpkg_install_cmake()
vcpkg_copy_pdbs()
vcpkg_fixup_cmake_targets()
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/embree-${EMBREE3_VERSION} TARGET_PATH share/embree)

file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)

if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
endif()
if(APPLE)
file(REMOVE ${CURRENT_PACKAGES_DIR}/uninstall.command ${CURRENT_PACKAGES_DIR}/debug/uninstall.command)
endif()
file(RENAME ${CURRENT_PACKAGES_DIR}/share/doc ${CURRENT_PACKAGES_DIR}/share/${PORT}/doc)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/doc ${CURRENT_PACKAGES_DIR}/share/${PORT}/)

file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
32 changes: 32 additions & 0 deletions ports/embree3/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "embree3",
"version": "3.12.2",
"description": "High Performance Ray Tracing Kernels.",
"homepage": "https://github.com/embree/embree",
"dependencies": [
"tbb"
],
"default-features": [
"avx",
"avx2",
"sse2",
"sse42"
],
"features": {
"avx": {
"description": "Enables AVX ISA."
},
"avx2": {
"description": "Enables AVX2 ISA."
},
"avx512": {
"description": "Enables AVX512 ISA."
},
"sse2": {
"description": "Enables SSE2 ISA."
},
"sse42": {
"description": "Enables SSE4.2 ISA."
}
}
}
4 changes: 2 additions & 2 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -1833,8 +1833,8 @@
"port-version": 0
},
"embree3": {
"baseline": "3.11.0",
"port-version": 2
"baseline": "3.12.2",
"port-version": 0
},
"enet": {
"baseline": "1.3.16",
Expand Down
5 changes: 5 additions & 0 deletions versions/e-/embree3.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "8684283b1251cae5f299462307ff5cac0cf1f4fd",
"version": "3.12.2",
"port-version": 0
},
{
"git-tree": "955eb7f17ebf475e96ee8fe283b56cbc3944da44",
"version-string": "3.11.0",
Expand Down

0 comments on commit eff6f06

Please sign in to comment.