Unverified Commit 1e8cb718 authored by Zexin Yuan's avatar Zexin Yuan
Browse files

blender: fix darwin build

parent a781b7fb
Loading
Loading
Loading
Loading
+46 −22
Original line number Diff line number Diff line
--- a/CMakeLists.txt	2024-03-01 08:08:05
+++ b/CMakeLists.txt	2024-04-24 15:45:30
@@ -2134,7 +2134,7 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0611614fe18..a6dcb2f04b6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2567,7 +2567,7 @@ if(WITH_COMPILER_SHORT_FILE_MACRO)
   )
   if(C_MACRO_PREFIX_MAP AND CXX_MACRO_PREFIX_MAP)
     if(APPLE)
@@ -9,9 +11,11 @@
         # Developers may have say LLVM Clang-10.0.1 toolchain (which supports the flag)
         # with Xcode-11 (the Clang of which doesn't support the flag).
         message(
--- a/build_files/cmake/platform/platform_apple.cmake	2024-02-22 15:31:36
+++ b/build_files/cmake/platform/platform_apple.cmake	2024-04-24 16:06:13
@@ -55,7 +55,6 @@
diff --git a/build_files/cmake/platform/platform_apple.cmake b/build_files/cmake/platform/platform_apple.cmake
index b2db64bbd2e..aac4b552655 100644
--- a/build_files/cmake/platform/platform_apple.cmake
+++ b/build_files/cmake/platform/platform_apple.cmake
@@ -55,7 +55,6 @@ if(NOT DEFINED LIBDIR)
   endif()
 endif()
 if(NOT EXISTS "${LIBDIR}/.git")
@@ -19,7 +23,7 @@
 endif()
 if(FIRST_RUN)
   message(STATUS "Using pre-compiled LIBDIR: ${LIBDIR}")
@@ -115,10 +114,6 @@
@@ -121,10 +120,6 @@ if(WITH_CODEC_SNDFILE)
   find_library(_sndfile_VORBIS_LIBRARY NAMES vorbis HINTS ${LIBDIR}/ffmpeg/lib)
   find_library(_sndfile_VORBISENC_LIBRARY NAMES vorbisenc HINTS ${LIBDIR}/ffmpeg/lib)
   list(APPEND LIBSNDFILE_LIBRARIES
@@ -30,7 +34,7 @@
   )
 
   print_found_status("SndFile libraries" "${LIBSNDFILE_LIBRARIES}")
@@ -162,9 +157,7 @@
@@ -168,9 +163,7 @@ if(WITH_CODEC_FFMPEG)
   set(FFMPEG_ROOT_DIR ${LIBDIR}/ffmpeg)
   set(FFMPEG_FIND_COMPONENTS
     avcodec avdevice avformat avutil
@@ -41,24 +45,24 @@
   if(EXISTS ${LIBDIR}/ffmpeg/lib/libaom.a)
     list(APPEND FFMPEG_FIND_COMPONENTS aom)
   endif()
@@ -275,7 +268,6 @@
@@ -285,7 +278,6 @@ endif()
 add_bundled_libraries(boost/lib)
 
 if(WITH_INTERNATIONAL OR WITH_CODEC_FFMPEG)
-  string(APPEND PLATFORM_LINKFLAGS " -liconv") # boost_locale and ffmpeg needs it !
 if(WITH_CODEC_FFMPEG)
-  string(APPEND PLATFORM_LINKFLAGS " -liconv") # ffmpeg needs it !
 endif()
 
 if(WITH_PUGIXML)
@@ -350,7 +342,7 @@
 
@@ -361,7 +353,7 @@ endif()
 # CMake FindOpenMP doesn't know about AppleClang before 3.12, so provide custom flags.
 if(WITH_OPENMP)
-  if(CMAKE_C_COMPILER_ID MATCHES "Clang")
+  if(FALSE)
     # Use OpenMP from our precompiled libraries.
     message(STATUS "Using ${LIBDIR}/openmp for OpenMP")
     set(OPENMP_CUSTOM ON)
@@ -427,7 +419,7 @@
   if(CMAKE_C_COMPILER_ID MATCHES "Clang")
-    if(${CMAKE_C_COMPILER_VERSION} VERSION_GREATER_EQUAL 17.0)
+    if(FALSE) # clang in nix was compatible with openmp
       if(WITH_STRICT_BUILD_OPTIONS)
         message(SEND_ERROR "OpenMP library is not compatible with the current Clang version")
       else()
@@ -446,7 +438,7 @@ string(APPEND PLATFORM_LINKFLAGS
   " -Wl,-unexported_symbols_list,'${PLATFORM_SYMBOLS_MAP}'"
 )
 
@@ -67,3 +71,23 @@
   if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "x86_64")
     # Silence "no platform load command found in <static library>, assuming: macOS".
     string(APPEND PLATFORM_LINKFLAGS " -Wl,-ld_classic")
diff --git a/source/blender/blendthumb/CMakeLists.txt b/source/blender/blendthumb/CMakeLists.txt
index 935b3f94ee1..f3d73637f71 100644
--- a/source/blender/blendthumb/CMakeLists.txt
+++ b/source/blender/blendthumb/CMakeLists.txt
@@ -65,15 +65,6 @@ elseif(APPLE)
     # Prevent Xcode from overwriting the signature.
     XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY ""
   )
-  # CMake needs the target defined in the same file as add_custom_command.
-  # It needs to be code-signed (ad-hoc in this case)
-  # even on developer machine to generate thumbnails.
-  # Command taken from XCode build process.
-  add_custom_command(
-    TARGET blender-thumbnailer POST_BUILD
-    COMMAND codesign --deep --force --sign - --entitlements "${CMAKE_SOURCE_DIR}/release/darwin/thumbnailer_entitlements.plist"
-    --timestamp=none $<TARGET_BUNDLE_DIR:blender-thumbnailer>
-  )
 elseif(UNIX)
   # -----------------------------------------------------------------------------
   # Build `blender-thumbnailer` executable
+4 −1
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@
  SDL,
  addDriverRunpath,
  alembic,
  apple-sdk_15,
  blender,
  boost,
  brotli,
@@ -287,6 +288,9 @@ stdenv'.mkDerivation (finalAttrs: {
          OpenAL
          OpenGL
          SDL
          # blender chooses Metal features based on runtime system version
          # lets use the latest SDK and let Blender handle falling back on older systems.
          apple-sdk_15
          brotli
          llvmPackages.openmp
          sse2neon
@@ -432,7 +436,6 @@ stdenv'.mkDerivation (finalAttrs: {
      "x86_64-linux"
      "aarch64-darwin"
    ];
    broken = stdenv.hostPlatform.isDarwin; # fails due to too-old SDK, using newer SDK fails to compile
    maintainers = with lib.maintainers; [
      amarshall
      veprbl