[Bf-blender-cvs] [c68338ee89f] master: CMake/macOS/OpenMP: copy the library near tests.

Ankit Meel noreply at git.blender.org
Sat Oct 10 16:02:26 CEST 2020


Commit: c68338ee89fbd9e84aea56b1815facdb4bf645e8
Author: Ankit Meel
Date:   Sat Oct 10 17:13:03 2020 +0530
Branches: master
https://developer.blender.org/rBc68338ee89fbd9e84aea56b1815facdb4bf645e8

CMake/macOS/OpenMP: copy the library near tests.

For multi-config generators, tests are in `bin/tests/<config>` folder.
and OpenMP cannot be found at `@executable_path/../Resources/lib`.
So create that folder and put the library there to be used by tests.

It is not ideal to copy the library around. When minimum CMake version
is changed to 3.12, FindOpenMP by CMake can be used for this whole
block of code. Then a nice rpath based solution can be used.

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

M	build_files/cmake/platform/platform_apple.cmake

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

diff --git a/build_files/cmake/platform/platform_apple.cmake b/build_files/cmake/platform/platform_apple.cmake
index 1eaef149f30..fa64016392c 100644
--- a/build_files/cmake/platform/platform_apple.cmake
+++ b/build_files/cmake/platform/platform_apple.cmake
@@ -375,14 +375,22 @@ if(WITH_OPENMP)
     set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_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.
+    # For single config generator datatoc, tests etc.
     execute_process(
       COMMAND mkdir -p ${CMAKE_BINARY_DIR}/Resources/lib
       COMMAND cp -p ${LIBDIR}/openmp/lib/libomp.dylib ${CMAKE_BINARY_DIR}/Resources/lib/libomp.dylib
     )
+    # For multi-config generator datatoc, etc.
     execute_process(
       COMMAND mkdir -p ${CMAKE_BINARY_DIR}/bin/Resources/lib
       COMMAND cp -p ${LIBDIR}/openmp/lib/libomp.dylib ${CMAKE_BINARY_DIR}/bin/Resources/lib/libomp.dylib
     )
+    # For multi-config generator tests.
+    execute_process(
+      COMMAND mkdir -p ${CMAKE_BINARY_DIR}/bin/tests/Resources/lib
+      COMMAND cp -p ${LIBDIR}/openmp/lib/libomp.dylib ${CMAKE_BINARY_DIR}/bin/tests/Resources/lib/libomp.dylib
+    )
   endif()
 endif()



More information about the Bf-blender-cvs mailing list