Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht@blender.org>2021-02-15 19:30:59 +0300
committerBrecht Van Lommel <brecht@blender.org>2021-02-15 22:22:34 +0300
commitae370e292af2f7092db02301e9deb6dd9d7a1441 (patch)
tree272ebe450b2b93c8a01f3fd2e72fd37f224da792 /build_files/cmake
parent4ce57f6eb82c0c6d3a23201c8df008d29b18b5f7 (diff)
macOS: add Embree, OpenImageDenoise and sse2neon libraries for ARM
This required using a fork of Embree, newer LLVM version, unreleased ISPC version and sse2neon directly from Git. Hopefully over time all the required changes end up in official releases. For now we deviate from other platforms. Based on contributions by Apple and Stefan Werner. Ref D9527, D8237, T78710
Diffstat (limited to 'build_files/cmake')
-rw-r--r--build_files/cmake/Modules/FindEmbree.cmake11
-rw-r--r--build_files/cmake/Modules/Findsse2neon.cmake49
-rw-r--r--build_files/cmake/platform/platform_apple.cmake13
3 files changed, 64 insertions, 9 deletions
diff --git a/build_files/cmake/Modules/FindEmbree.cmake b/build_files/cmake/Modules/FindEmbree.cmake
index af545cee00c..7f7f2ae0fb3 100644
--- a/build_files/cmake/Modules/FindEmbree.cmake
+++ b/build_files/cmake/Modules/FindEmbree.cmake
@@ -34,12 +34,17 @@ FIND_PATH(EMBREE_INCLUDE_DIR
include
)
+IF(NOT (APPLE AND ("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")))
+ SET(_embree_SIMD_COMPONENTS
+ embree_sse42
+ embree_avx
+ embree_avx2
+ )
+ENDIF()
SET(_embree_FIND_COMPONENTS
embree3
- embree_sse42
- embree_avx
- embree_avx2
+ ${_embree_SIMD_COMPONENTS}
lexers
math
simd
diff --git a/build_files/cmake/Modules/Findsse2neon.cmake b/build_files/cmake/Modules/Findsse2neon.cmake
new file mode 100644
index 00000000000..2159dfac114
--- /dev/null
+++ b/build_files/cmake/Modules/Findsse2neon.cmake
@@ -0,0 +1,49 @@
+# - Find sse2neon library
+# Find the native sse2neon includes and library
+# This module defines
+# SSE2NEON_INCLUDE_DIRS, where to find sse2neon.h, Set when
+# SSE2NEON_INCLUDE_DIR is found.
+# SSE2NEON_ROOT_DIR, The base directory to search for sse2neon.
+# This can also be an environment variable.
+# SSE2NEON_FOUND, If false, do not try to use sse2neon.
+
+#=============================================================================
+# Copyright 2020 Blender Foundation.
+#
+# Distributed under the OSI-approved BSD 3-Clause License,
+# see accompanying file BSD-3-Clause-license.txt for details.
+#=============================================================================
+
+# If SSE2NEON_ROOT_DIR was defined in the environment, use it.
+IF(NOT SSE2NEON_ROOT_DIR AND NOT $ENV{SSE2NEON_ROOT_DIR} STREQUAL "")
+ SET(SSE2NEON_ROOT_DIR $ENV{SSE2NEON_ROOT_DIR})
+ENDIF()
+
+SET(_sse2neon_SEARCH_DIRS
+ ${SSE2NEON_ROOT_DIR}
+)
+
+FIND_PATH(SSE2NEON_INCLUDE_DIR
+ NAMES
+ sse2neon.h
+ HINTS
+ ${_sse2neon_SEARCH_DIRS}
+ PATH_SUFFIXES
+ include
+)
+
+# handle the QUIETLY and REQUIRED arguments and set SSE2NEON_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(sse2neon DEFAULT_MSG
+ SSE2NEON_INCLUDE_DIR)
+
+IF(SSE2NEON_FOUND)
+ SET(SSE2NEON_INCLUDE_DIRS ${SSE2NEON_INCLUDE_DIR})
+ENDIF(SSE2NEON_FOUND)
+
+MARK_AS_ADVANCED(
+ SSE2NEON_INCLUDE_DIR
+)
+
+UNSET(_sse2neon_SEARCH_DIRS)
diff --git a/build_files/cmake/platform/platform_apple.cmake b/build_files/cmake/platform/platform_apple.cmake
index b95b21da946..5203ba10863 100644
--- a/build_files/cmake/platform/platform_apple.cmake
+++ b/build_files/cmake/platform/platform_apple.cmake
@@ -206,6 +206,13 @@ set(PLATFORM_LINKFLAGS
list(APPEND PLATFORM_LINKLIBS c++)
+if(WITH_OPENIMAGEDENOISE)
+ if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")
+ # OpenImageDenoise uses BNNS from the Accelerate framework.
+ string(APPEND PLATFORM_LINKFLAGS " -framework Accelerate")
+ endif()
+endif()
+
if(WITH_JACK)
string(APPEND PLATFORM_LINKFLAGS " -F/Library/Frameworks -weak_framework jackmp")
endif()
@@ -345,12 +352,6 @@ if(WITH_CYCLES_OSL)
endif()
endif()
-if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")
- set(WITH_CYCLES_EMBREE OFF)
- set(WITH_OPENIMAGEDENOISE OFF)
- set(WITH_CPU_SSE OFF)
-endif()
-
if(WITH_CYCLES_EMBREE)
find_package(Embree 3.8.0 REQUIRED)
# Increase stack size for Embree, only works for executables.