macOS: Default to modern linker on x64
This patch changes the default macOS x64 linker from the slower legacy "classic" linker, to the much faster default modern macOS linker. A new CMake option `WITH_LEGACY_MACOS_X64_LINKER` was also introduced to use the old linker, set to OFF by default. As an example from testing on an Intel Macbook, this makes linking time go from 3min25s to 10s after this change. The reason why the legacy linker was enforced on x64 in the first place was to silence "platform load command not found" warnings during linking. Since this behavior is still desired on the BuildBot, the `WITH_LEGACY_MACOS_X64_LINKER` option is enforced in the BuildBot macOS configs. Pull Request: https://projects.blender.org/blender/blender/pulls/134639
This commit is contained in:
committed by
Jonas Holzman
parent
132a676120
commit
8afde59054
@@ -1259,6 +1259,10 @@ if(APPLE)
|
||||
include(platform_apple_xcode)
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
option(WITH_LEGACY_MACOS_X64_LINKER "Use legacy macOS linker. Only on x64 platform. Minutes slower, but emits fewer warnings." OFF)
|
||||
mark_as_advanced(WITH_LEGACY_MACOS_X64_LINKER)
|
||||
endif()
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Check for Conflicting/Unsupported Configurations
|
||||
|
||||
@@ -5,3 +5,4 @@
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/../../cmake/config/blender_release.cmake")
|
||||
|
||||
set(WITH_CYCLES_TEST_OSL ON CACHE BOOL "" FORCE)
|
||||
set(WITH_LEGACY_MACOS_X64_LINKER ON CACHE BOOL "" FORCE)
|
||||
|
||||
@@ -427,8 +427,10 @@ string(APPEND PLATFORM_LINKFLAGS
|
||||
)
|
||||
|
||||
if(${XCODE_VERSION} VERSION_GREATER_EQUAL 15.0)
|
||||
if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "x86_64")
|
||||
if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "x86_64" AND WITH_LEGACY_MACOS_X64_LINKER)
|
||||
# Silence "no platform load command found in <static library>, assuming: macOS".
|
||||
#
|
||||
# NOTE: Using ld_classic costs minutes of extra linking time.
|
||||
string(APPEND PLATFORM_LINKFLAGS " -Wl,-ld_classic")
|
||||
else()
|
||||
# Silence "ld: warning: ignoring duplicate libraries".
|
||||
|
||||
Reference in New Issue
Block a user