[Bf-blender-cvs] [d405d7c87e3] tmp-macminver: macOS: set minimum deployment target correctly

Ankit Meel noreply at git.blender.org
Thu May 20 12:21:42 CEST 2021


Commit: d405d7c87e3e6c65c33773ee07834f39c0976762
Author: Ankit Meel
Date:   Thu May 20 15:47:06 2021 +0530
Branches: tmp-macminver
https://developer.blender.org/rBd405d7c87e3e6c65c33773ee07834f39c0976762

macOS: set minimum deployment target correctly

Fix T88419

`CMAKE_OSX_DEPLOYMENT_TARGET` is now always the same as
`OSX_MIN_DEPLOYMENT_TARGET`. I don't know the historical reason of
why they were allowed to be different.

`MACOSX_DEPLOYMENT_TARGET` has been moved to platform_apple_xcode
because it's helpful to deduce `CMAKE_OSX_DEPLOYMENT_TARGET` and
platform_apple is included after platform_apple_xcode. Although it seems
useless now that we're explicitly setting `CMAKE_OSX_DEPLOYMENT_TARGET`.
Remove it ? `man clang` says that `MACOSX_DEPLOYMENT_TARGET` is used
if `mmacosx-version-min` is not present.

Docs suggest that `CMAKE_OSX_DEPLOYMENT_TARGET` should be set before
project call. Should we do that, like in D10838, using
`blender_project_hack_pre` ?

Maniphest Tasks: T88419

Differential Revision: https://developer.blender.org/D11323

===================================================================

M	build_files/cmake/platform/platform_apple.cmake
M	build_files/cmake/platform/platform_apple_xcode.cmake

===================================================================

diff --git a/build_files/cmake/platform/platform_apple.cmake b/build_files/cmake/platform/platform_apple.cmake
index a5eee46349a..fe9dd6a58de 100644
--- a/build_files/cmake/platform/platform_apple.cmake
+++ b/build_files/cmake/platform/platform_apple.cmake
@@ -20,12 +20,6 @@
 
 # Libraries configuration for Apple.
 
-if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")
-  set(MACOSX_DEPLOYMENT_TARGET 11.00)
-else()
-  set(MACOSX_DEPLOYMENT_TARGET 10.13)
-endif()
-
 macro(find_package_wrapper)
 # do nothing, just satisfy the macro
 endmacro()
diff --git a/build_files/cmake/platform/platform_apple_xcode.cmake b/build_files/cmake/platform/platform_apple_xcode.cmake
index 4d15fee75b7..38d74b5613e 100644
--- a/build_files/cmake/platform/platform_apple_xcode.cmake
+++ b/build_files/cmake/platform/platform_apple_xcode.cmake
@@ -171,18 +171,13 @@ unset(OSX_SDKROOT)
 # 10.13 is our min. target, if you use higher sdk, weak linking happens
 if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")
   set(OSX_MIN_DEPLOYMENT_TARGET 11.00)
+  set($ENV{MACOSX_DEPLOYMENT_TARGET}  11.00)
 else()
   set(OSX_MIN_DEPLOYMENT_TARGET 10.13)
+  set($ENV{MACOSX_DEPLOYMENT_TARGET}  10.13)
 endif()
 
-if(CMAKE_OSX_DEPLOYMENT_TARGET)
-  if(${CMAKE_OSX_DEPLOYMENT_TARGET} VERSION_LESS ${OSX_MIN_DEPLOYMENT_TARGET})
-    message(STATUS "Setting deployment target to ${OSX_MIN_DEPLOYMENT_TARGET}, lower versions are not supported")
-    set(CMAKE_OSX_DEPLOYMENT_TARGET "${OSX_MIN_DEPLOYMENT_TARGET}" CACHE STRING "" FORCE)
-  endif()
-else()
-  set(CMAKE_OSX_DEPLOYMENT_TARGET "${OSX_MIN_DEPLOYMENT_TARGET}" CACHE STRING "" FORCE)
-endif()
+set(CMAKE_OSX_DEPLOYMENT_TARGET "${OSX_MIN_DEPLOYMENT_TARGET}" CACHE STRING "" FORCE)
 
 if(NOT ${CMAKE_GENERATOR} MATCHES "Xcode")
   # Force CMAKE_OSX_DEPLOYMENT_TARGET for makefiles, will not work else (CMake bug?)



More information about the Bf-blender-cvs mailing list