From 1f3ce2a311de1051faa70d402d2cfa49a422b9b4 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 2 Jan 2024 16:22:48 +0100 Subject: [PATCH] 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 --- build_files/build_environment/cmake/options.cmake | 2 +- build_files/cmake/platform/platform_apple.cmake | 4 +++- extern/mantaflow/CMakeLists.txt | 11 ----------- source/creator/symbols_apple.map | 1 + 4 files changed, 5 insertions(+), 13 deletions(-) diff --git a/build_files/build_environment/cmake/options.cmake b/build_files/build_environment/cmake/options.cmake index bff19b700be..7e78e423d18 100644 --- a/build_files/build_environment/cmake/options.cmake +++ b/build_files/build_environment/cmake/options.cmake @@ -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() diff --git a/build_files/cmake/platform/platform_apple.cmake b/build_files/cmake/platform/platform_apple.cmake index 093a2a16d74..fb451e2d978 100644 --- a/build_files/cmake/platform/platform_apple.cmake +++ b/build_files/cmake/platform/platform_apple.cmake @@ -431,7 +431,9 @@ string(APPEND PLATFORM_LINKFLAGS # Use old, slower linker for now to avoid many linker warnings. if(${XCODE_VERSION} VERSION_GREATER_EQUAL 15.0) - string(APPEND PLATFORM_LINKFLAGS " -Wl,-ld_classic") + 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. diff --git a/extern/mantaflow/CMakeLists.txt b/extern/mantaflow/CMakeLists.txt index 9f3a64ec81d..c3a8c302c4b 100644 --- a/extern/mantaflow/CMakeLists.txt +++ b/extern/mantaflow/CMakeLists.txt @@ -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) diff --git a/source/creator/symbols_apple.map b/source/creator/symbols_apple.map index 5619f151bd2..ab094fa8fb9 100644 --- a/source/creator/symbols_apple.map +++ b/source/creator/symbols_apple.map @@ -36,6 +36,7 @@ _Jv_RegisterClasses lame_* *llvm* *LLVM* +*Manta* *MathML* *mkldnn* Name