[Bf-blender-cvs] [0a1dfb7e2f7] cycles_embree: Cycles: Added Embree to `make deps` script and changed CMake build files to find and fetch static Embree libs from the build location.
Stefan Werner
noreply at git.blender.org
Tue Nov 6 11:37:58 CET 2018
Commit: 0a1dfb7e2f79b4cb278ba79fdff38a82dc8e3c6c
Author: Stefan Werner
Date: Tue Nov 6 11:37:56 2018 +0100
Branches: cycles_embree
https://developer.blender.org/rB0a1dfb7e2f79b4cb278ba79fdff38a82dc8e3c6c
Cycles: Added Embree to `make deps` script and changed CMake build files to find and fetch static Embree libs from the build location.
===================================================================
M build_files/build_environment/CMakeLists.txt
A build_files/build_environment/cmake/embree.cmake
M build_files/build_environment/cmake/harvest.cmake
M build_files/build_environment/cmake/options.cmake
M build_files/build_environment/cmake/versions.cmake
A build_files/cmake/Modules/FindEmbree.cmake
M build_files/cmake/platform/platform_apple.cmake
M build_files/cmake/platform/platform_unix.cmake
M build_files/cmake/platform/platform_win32.cmake
M build_files/cmake/platform/platform_win32_msvc.cmake
M intern/cycles/cmake/external_libs.cmake
===================================================================
diff --git a/build_files/build_environment/CMakeLists.txt b/build_files/build_environment/CMakeLists.txt
index 00e486bbb40..8c1d38c0635 100644
--- a/build_files/build_environment/CMakeLists.txt
+++ b/build_files/build_environment/CMakeLists.txt
@@ -97,6 +97,10 @@ if(WITH_WEBP)
include(cmake/webp.cmake)
endif()
+if(WITH_EMBREE)
+ include(cmake/embree.cmake)
+endif()
+
if(WIN32)
# HMD branch deps
include(cmake/hidapi.cmake)
diff --git a/build_files/build_environment/cmake/embree.cmake b/build_files/build_environment/cmake/embree.cmake
new file mode 100644
index 00000000000..343be5ef933
--- /dev/null
+++ b/build_files/build_environment/cmake/embree.cmake
@@ -0,0 +1,45 @@
+# ***** BEGIN GPL LICENSE BLOCK *****
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ***** END GPL LICENSE BLOCK *****
+
+# Note the utility apps may use png/tiff/gif system libraries, but the
+# library itself does not depend on them, so should give no problems.
+
+set(EMBREE_EXTRA_ARGS
+ -DEMBREE_ISPC_SUPPORT=OFF
+ -DEMBREE_TUTORIALS=OFF
+ -DEMBREE_STATIC_LIB=ON
+ -DEMBREE_RAY_MASK=ON
+ -DEMBREE_FILTER_FUNCTION=ON
+ -DEMBREE_BACKFACE_CULLING=OFF
+ -DEMBREE_TASKING_SYSTEM=INTERNAL
+)
+
+if(WIN32)
+ set(EMBREE_BUILD_DIR ${BUILD_MODE}/)
+else()
+ set(EMBREE_BUILD_DIR)
+endif()
+
+ExternalProject_Add(external_embree
+ URL ${EMBREE_URI}
+ DOWNLOAD_DIR ${DOWNLOAD_DIR}
+ URL_HASH MD5=${EMBREE_HASH}
+ PREFIX ${BUILD_DIR}/embree
+ CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/embree ${DEFAULT_CMAKE_FLAGS} ${EMBREE_EXTRA_ARGS}
+ INSTALL_DIR ${LIBDIR}/embree
+)
diff --git a/build_files/build_environment/cmake/harvest.cmake b/build_files/build_environment/cmake/harvest.cmake
index 4ec71bf2ed2..d0d8b4cefb9 100644
--- a/build_files/build_environment/cmake/harvest.cmake
+++ b/build_files/build_environment/cmake/harvest.cmake
@@ -57,7 +57,9 @@ if(BUILD_MODE STREQUAL Release)
# hidapi
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/hidapi/ ${HARVEST_TARGET}/hidapi/ &&
# webp, straight up copy
- ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/webp ${HARVEST_TARGET}/webp
+ ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/webp ${HARVEST_TARGET}/webp &&
+ # embree
+ ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/embree ${HARVEST_TARGET}/embree
DEPENDS
)
endif()
@@ -191,5 +193,7 @@ harvest(vpx/lib ffmpeg/lib "*.a")
harvest(webp/lib ffmpeg/lib "*.a")
harvest(x264/lib ffmpeg/lib "*.a")
harvest(xvidcore/lib ffmpeg/lib "*.a")
+harvest(embree/include embree/include "*.h")
+harvest(embree/lib embree/lib "*.a")
endif()
diff --git a/build_files/build_environment/cmake/options.cmake b/build_files/build_environment/cmake/options.cmake
index f3125551972..20e9750bed6 100644
--- a/build_files/build_environment/cmake/options.cmake
+++ b/build_files/build_environment/cmake/options.cmake
@@ -20,6 +20,7 @@ if(WIN32)
option(ENABLE_MINGW64 "Enable building of ffmpeg/iconv/libsndfile/lapack/fftw3 by installing mingw64" ON)
endif()
option(WITH_WEBP "Enable building of oiio with webp support" OFF)
+option(WITH_EMBREE "Enable building of Embree" OFF)
set(MAKE_THREADS 1 CACHE STRING "Number of threads to run make with")
if(NOT BUILD_MODE)
diff --git a/build_files/build_environment/cmake/versions.cmake b/build_files/build_environment/cmake/versions.cmake
index 7bd994c3491..85f59762ef2 100644
--- a/build_files/build_environment/cmake/versions.cmake
+++ b/build_files/build_environment/cmake/versions.cmake
@@ -298,3 +298,7 @@ set(SSL_HASH ebbfc844a8c8cc0ea5dc10b86c9ce97f401837f3fa08c17b2cdadc118253cf99)
set(SQLITE_VERSION 3.24.0)
set(SQLITE_URI https://www.sqlite.org/2018/sqlite-src-3240000.zip)
set(SQLITE_HASH fb558c49ee21a837713c4f1e7e413309aabdd9c7)
+
+set(EMBREE_VERSION 3.2.4)
+set(EMBREE_URI https://github.com/embree/embree/archive/v${EMBREE_VERSION}.zip)
+set(EMBREE_HASH 3d4a1147002ff43939d45140aa9d6fb8)
diff --git a/build_files/cmake/Modules/FindEmbree.cmake b/build_files/cmake/Modules/FindEmbree.cmake
new file mode 100644
index 00000000000..d3ef8c6eb4c
--- /dev/null
+++ b/build_files/cmake/Modules/FindEmbree.cmake
@@ -0,0 +1,108 @@
+# - Find Embree library
+# Find the native Embree includes and library
+# This module defines
+# EMBREE_INCLUDE_DIRS, where to find rtcore.h, Set when
+# EMBREE_INCLUDE_DIR is found.
+# EMBREE_LIBRARIES, libraries to link against to use Embree.
+# EMBREE_ROOT_DIR, The base directory to search for Embree.
+# This can also be an environment variable.
+# EMBREEFOUND, If false, do not try to use Embree.
+#
+# also defined, but not for general use are
+# EMBREE_LIBRARY, where to find the Embree library.
+
+#=============================================================================
+# Copyright 2018 Blender Foundation.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+
+# If EMBREE_ROOT_DIR was defined in the environment, use it.
+IF(NOT EMBREE_ROOT_DIR AND NOT $ENV{EMBREE_ROOT_DIR} STREQUAL "")
+ SET(EMBREE_ROOT_DIR $ENV{EMBREE_ROOT_DIR})
+ENDIF()
+
+SET(_embree_SEARCH_DIRS
+ ${EMBREE_ROOT_DIR}
+ /usr/local
+ /sw # Fink
+ /opt/local # DarwinPorts
+ /opt/embree
+ /opt/lib/embree
+)
+
+FIND_PATH(EMBREE_INCLUDE_DIR
+ NAMES
+ embree3/rtcore.h
+ HINTS
+ ${_embree_SEARCH_DIRS}
+ PATH_SUFFIXES
+ include
+)
+
+
+SET(_embree_FIND_COMPONENTS
+ embree_avx
+ embree_avx2
+ embree_sse42
+ embree3
+ lexers
+ math
+ simd
+ sys
+ tasking
+)
+
+SET(_embree_LIBRARIES)
+FOREACH(COMPONENT ${_embree_FIND_COMPONENTS})
+ STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT)
+
+ FIND_LIBRARY(EMBREE_${UPPERCOMPONENT}_LIBRARY
+ NAMES
+ ${COMPONENT}
+ HINTS
+ ${_embree_SEARCH_DIRS}
+ PATH_SUFFIXES
+ lib64 lib
+ )
+ LIST(APPEND _embree_LIBRARIES "${EMBREE_${UPPERCOMPONENT}_LIBRARY}")
+ENDFOREACH()
+
+
+FIND_LIBRARY(EMBREE_LIBRARY
+ NAMES
+ libembree3
+ HINTS
+ ${_embree_SEARCH_DIRS}
+ PATH_SUFFIXES
+ lib64 lib
+)
+
+# handle the QUIETLY and REQUIRED arguments and set EMBREE_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(EMBREE DEFAULT_MSG
+ _embree_LIBRARIES EMBREE_INCLUDE_DIR)
+
+IF(EMBREE_FOUND)
+ SET(EMBREE_LIBRARIES ${_embree_LIBRARIES})
+ SET(EMBREE_INCLUDE_DIRS ${EMBREE_INCLUDE_DIR})
+ENDIF(EMBREE_FOUND)
+
+MARK_AS_ADVANCED(
+ EMBREE_INCLUDE_DIR
+)
+
+FOREACH(COMPONENT ${_embree_FIND_COMPONENTS})
+ STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT)
+ MARK_AS_ADVANCED(EMBREE_${UPPERCOMPONENT}_LIBRARY)
+ENDFOREACH()
+
+UNSET(_embree_SEARCH_DIRS)
+UNSET(_embree_FIND_COMPONENTS)
+UNSET(_embree_LIBRARIES)
diff --git a/build_files/cmake/platform/platform_apple.cmake b/build_files/cmake/platform/platform_apple.cmake
index c8501c476ce..032122fd9d3 100644
--- a/build_files/cmake/platform/platform_apple.cmake
+++ b/build_files/cmake/platform/platform_apple.cmake
@@ -379,7 +379,7 @@ if(WITH_CYCLES_OSL)
endif()
if(WITH_CYCLES_EMBREE)
- find_package(embree 3.2 REQUIRED)
+ find_package(embree 3.2.4 REQUIRED)
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Xlinker -stack_size -Xlinker 0x100000")
endif()
diff --git a/build_files/cmake/platform/platform_unix.cmake b/build_files/cmake/platform/platform_unix.cmake
index db917f7ce74..d07788d8bc2 100644
--- a/build_files/cmake/platform/platform_unix.cmake
+++ b/build_files/cmake/platform/platform_unix.cmake
@@ -360,7 +360,7 @@ if(WITH_OPENCOLORIO)
endif()
if(WITH_CYCLES_EMBREE)
- find_package(embree 3.2 REQUIRED)
+ find_package(embree 3.2.4 REQUIRED)
endif()
if(WITH_LLVM)
diff --git a/build_files/cmake/platform/platform_win32.cmake b/build_files/cmake/platform/platform_win32.cmake
index 38d3db02a32..4a38946d2b0 100644
--- a/build_files/cmake/platform/platform_win32.cmake
+++ b/build_files/cmake/platform/platform_win32.cmake
@@ -609,7 +609,7 @@ if(WITH_CYCLES_OSL)
endif()
if(WITH_CYCLES_EMBREE)
- find_package(embree 3.2 REQUIRED)
+ find_package(embree 3.2.4 REQUIRED)
endif()
if (WINDOWS_PYTHON_DEBUG)
diff --git a/build_files/cmake/platform/platform_win32_msvc.cmake b/build_files/cmake/platform/platform_win32_msvc.cmake
index 120ce2987f7..6cd495f051f 100644
--- a/build_files/cmake/platform/platform_win32_msvc.cmake
+++ b/build_files/cmake/platform/platform_win32_msvc.cmake
@@ -422,7 +422,7 @@ if(WITH_OPENCOLORIO)
endif()
if(WITH_CYCLES_EMBREE)
- find_package(embree 3.2 REQUIRED)
+ find_package(embree 3.2.4 REQUIRED)
endif()
if(WITH_OPENVDB)
diff --git a/intern/cycles/cmake/external_libs.cmake b/intern/cycles/cmake/external_libs.cmake
index 9222ad9a21f..d0f473a2939 100644
--- a/intern/cycles/cmake/external_libs.cmake
+++ b/intern/cycles/cmake/external_libs.cmake
@@ -135,7 +135,7 @@ if(CYCLES_STANDALONE_REPOSITORY)
####
# embree
if(WITH_CYCLES_EMBREE)
- find_package(embree 2.16.1 REQUIRED)
+ find_package(embree 3.2.4 REQUIRED)
endif()
####
More information about the Bf-blender-cvs
mailing list