Build: changes to macOS build flags to fix linker warnings

* Different fix for Mantaflow linker warnings that works with new OpenVDB.
* Use new linker for arm64 as it no longer produces warnings with latest
  Xcode. Still use the old one for x86_64 as some warnings remain.
* Fix wrong x86_64 build target in deps builder.

For the upcoming 4.1 libraries.

Ref #113157

Pull Request: https://projects.blender.org/blender/blender/pulls/116708
This commit is contained in:
Brecht Van Lommel 2024-01-02 16:22:48 +01:00 committed by Brecht Van Lommel
parent c6d61e8586
commit 1f3ce2a311
4 changed files with 5 additions and 13 deletions

@ -177,7 +177,7 @@ else()
set(PLATFORM_CXXFLAGS "-isysroot ${CMAKE_OSX_SYSROOT} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET} -std=c++17 -stdlib=libc++ -arch ${CMAKE_OSX_ARCHITECTURES}")
set(PLATFORM_LDFLAGS "-isysroot ${CMAKE_OSX_SYSROOT} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET} -arch ${CMAKE_OSX_ARCHITECTURES}")
if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "x86_64")
set(PLATFORM_BUILD_TARGET --build=x86_64-apple-darwin17.0.0) # OS X 10.13
set(PLATFORM_BUILD_TARGET --build=x86_64-apple-darwin19.0.0) # OS X 10.15
else()
set(PLATFORM_BUILD_TARGET --build=aarch64-apple-darwin20.0.0) # macOS 11.00
endif()

@ -431,8 +431,10 @@ string(APPEND PLATFORM_LINKFLAGS
# Use old, slower linker for now to avoid many linker warnings.
if(${XCODE_VERSION} VERSION_GREATER_EQUAL 15.0)
if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "x86_64")
string(APPEND PLATFORM_LINKFLAGS " -Wl,-ld_classic")
endif()
endif()
# Make stack size more similar to Embree, required for Embree.
string(APPEND PLATFORM_LINKFLAGS_EXECUTABLE " -Wl,-stack_size,0x100000")

@ -10,17 +10,6 @@ if(MSVC_CLANG AND WITH_OPENMP AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "9.0.1
remove_cc_flag("-fopenmp")
endif()
# Exporting functions from the blender binary gives linker warnings on Apple arm64 systems.
# Silence them here.
if(APPLE)
if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")
if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
string(APPEND CMAKE_C_FLAGS " -fvisibility=hidden")
string(APPEND CMAKE_CXX_FLAGS " -fvisibility=hidden")
endif()
endif()
endif()
set(MANTAVERSION "0.13")
add_definitions(-DWITH_FLUID=1)

@ -36,6 +36,7 @@ _Jv_RegisterClasses
lame_*
*llvm*
*LLVM*
*Manta*
*MathML*
*mkldnn*
Name