From ab65fe5a2dcca9cb5de14eaeabe5a441bc41f15a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastia=CC=81n=20Barschkis?= Date: Fri, 25 Sep 2020 10:17:10 +0200 Subject: Fluid: Use hidden symbol visibility This resolves a long list of linker warnings that is currently only showing up on macOS arm builds. The warnings themselves are of this shape (one example): ``` ld: warning: direct access in function 'Manta::MeshDataImpl >::_W_39(_object, object, object*)' from file '../../lib/libextern_mantaflow.a(mesh.h.reg.cpp.o)' to global weak symbol 'typeinfo for Manta::MeshDataImpl >' from file '../../lib/libextern_mantaflow.a(mesh.cpp.o)' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings. ``` Just would like to get your opinion to make sure this is an acceptable way to handle this on all platforms. Reviewed By: LazyDodo Differential Revision: https://developer.blender.org/D9002 --- extern/mantaflow/CMakeLists.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/extern/mantaflow/CMakeLists.txt b/extern/mantaflow/CMakeLists.txt index 8bb0bc69f98..fe6c72660e0 100644 --- a/extern/mantaflow/CMakeLists.txt +++ b/extern/mantaflow/CMakeLists.txt @@ -31,6 +31,17 @@ 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. +# For now and until Apple arm64 is officially supported, these will just be silenced here. +# TODO (sebbas): Check if official arm64 devices give linker warnings without this block. + +if(APPLE AND ("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")) + if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden") + endif() +endif() + set(MANTAVERSION "0.13") add_definitions(-DWITH_FLUID=1) -- cgit v1.2.3