[Bf-blender-cvs] [bcd369c3c12] master: Fix macOS SSE support not detected correctly after recent changes

Brecht Van Lommel noreply at git.blender.org
Thu Feb 25 15:09:57 CET 2021


Commit: bcd369c3c12e48dd2be544fbd3ebed2ce8b4c1fb
Author: Brecht Van Lommel
Date:   Thu Feb 25 15:02:38 2021 +0100
Branches: master
https://developer.blender.org/rBbcd369c3c12e48dd2be544fbd3ebed2ce8b4c1fb

Fix macOS SSE support not detected correctly after recent changes

Due to moving the code the test binary was incorrectly compiled with OpenMP
flags. Move setting of the OpenMP flags to the appropriate place.

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

M	CMakeLists.txt
M	build_files/cmake/platform/platform_apple.cmake
M	build_files/cmake/platform/platform_win32.cmake

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

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5b8d68a60f0..24201ae6869 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1215,6 +1215,7 @@ if(WITH_OPENMP)
     if(NOT WITH_OPENMP_STATIC)
       string(APPEND CMAKE_C_FLAGS " ${OpenMP_C_FLAGS}")
       string(APPEND CMAKE_CXX_FLAGS " ${OpenMP_CXX_FLAGS}")
+      string(APPEND CMAKE_EXE_LINKER_FLAGS " ${OpenMP_LINKER_FLAGS}")
     else()
       # Typically avoid adding flags as defines but we can't
       # pass OpenMP flags to the linker for static builds, meaning
diff --git a/build_files/cmake/platform/platform_apple.cmake b/build_files/cmake/platform/platform_apple.cmake
index 31302bf1100..6e6c75c85f0 100644
--- a/build_files/cmake/platform/platform_apple.cmake
+++ b/build_files/cmake/platform/platform_apple.cmake
@@ -410,7 +410,7 @@ if(WITH_OPENMP)
     set(OPENMP_FOUND ON)
     set(OpenMP_C_FLAGS "-Xclang -fopenmp -I'${LIBDIR}/openmp/include'")
     set(OpenMP_CXX_FLAGS "-Xclang -fopenmp -I'${LIBDIR}/openmp/include'")
-    string(APPEND CMAKE_EXE_LINKER_FLAGS " -L'${LIBDIR}/openmp/lib' -lomp")
+    set(OpenMP_LINKER_FLAGS "-L'${LIBDIR}/openmp/lib' -lomp")
 
     # Copy libomp.dylib to allow executables like datatoc and tests to work.
     # `@executable_path/../Resources/lib/` is a default dylib search path.
diff --git a/build_files/cmake/platform/platform_win32.cmake b/build_files/cmake/platform/platform_win32.cmake
index e1cc1219249..acd6028e2ae 100644
--- a/build_files/cmake/platform/platform_win32.cmake
+++ b/build_files/cmake/platform/platform_win32.cmake
@@ -49,7 +49,7 @@ if(CMAKE_C_COMPILER_ID MATCHES "Clang")
     if(NOT EXISTS "${CLANG_OPENMP_DLL}")
       message(FATAL_ERROR "Clang OpenMP library (${CLANG_OPENMP_DLL}) not found.")
     endif()
-    string(APPEND CMAKE_EXE_LINKER_FLAGS " \"${CLANG_OPENMP_LIB}\"")
+    set(OpenMP_LINKER_FLAGS "\"${CLANG_OPENMP_LIB}\"")
   endif()
   if(WITH_WINDOWS_STRIPPED_PDB)
     message(WARNING "stripped pdb not supported with clang, disabling..")



More information about the Bf-blender-cvs mailing list