Travis: include libomp in macOS .app
This commit is contained in:
parent
88b26aabdb
commit
73bbbdef83
@ -4,12 +4,6 @@ mkdir build || true
|
|||||||
cd build
|
cd build
|
||||||
|
|
||||||
OSX_TARGET="10.9"
|
OSX_TARGET="10.9"
|
||||||
LLVM_PREFIX=$(brew --prefix llvm@9)
|
|
||||||
export CC="${LLVM_PREFIX}/bin/clang"
|
|
||||||
export CXX="${CC}++"
|
|
||||||
export LDFLAGS="-L${LLVM_PREFIX}/lib -Wl,-rpath,${LLVM_PREFIX}/lib" \
|
|
||||||
export CFLAGS="-I${LLVM_PREFIX}/include"
|
|
||||||
export CPPFLAGS="-I${LLVM_PREFIX}/include"
|
|
||||||
|
|
||||||
if [ "$1" = "release" ]; then
|
if [ "$1" = "release" ]; then
|
||||||
BUILD_TYPE=RelWithDebInfo
|
BUILD_TYPE=RelWithDebInfo
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/bin/sh -xe
|
#!/bin/sh -xe
|
||||||
|
|
||||||
brew install llvm@9
|
brew install libomp
|
||||||
git submodule update --init
|
git submodule update --init
|
@ -115,27 +115,11 @@ if(ENABLE_LTO)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ENABLE_OPENMP)
|
if(ENABLE_OPENMP)
|
||||||
if(APPLE)
|
find_package( OpenMP REQUIRED )
|
||||||
# OpenMP does not work with the default Apple llvm/clang++
|
include(FindOpenMP)
|
||||||
# Install a more recent version using Homebrew (version 11.0.0 which is the next available tag on homebrew at this time crashed):
|
if(OPENMP_FOUND)
|
||||||
# "brew install llvm@9"
|
|
||||||
# and set the right compiler flags using:
|
|
||||||
# LLVM_PREFIX=$(brew --prefix llvm@9)
|
|
||||||
# export CC="${LLVM_PREFIX}/bin/clang"
|
|
||||||
# export CXX="${CC}++"
|
|
||||||
# export LDFLAGS="-L${LLVM_PREFIX}/lib -Wl,-rpath,${LLVM_PREFIX}/lib" \
|
|
||||||
# export CFLAGS="-I${LLVM_PREFIX}/include"
|
|
||||||
# export CPPFLAGS="-I${LLVM_PREFIX}/include"
|
|
||||||
set(OpenMP_CXX_FLAGS "-fopenmp=libomp")
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
|
||||||
message(STATUS "found OpenMP, compiling with flags: " ${OpenMP_CXX_FLAGS} )
|
message(STATUS "found OpenMP, compiling with flags: " ${OpenMP_CXX_FLAGS} )
|
||||||
else()
|
|
||||||
find_package( OpenMP REQUIRED )
|
|
||||||
include(FindOpenMP)
|
|
||||||
if(OPENMP_FOUND)
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
|
|
||||||
message(STATUS "found OpenMP, compiling with flags: " ${OpenMP_CXX_FLAGS} )
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -404,10 +404,15 @@ endif()
|
|||||||
if(APPLE)
|
if(APPLE)
|
||||||
set(bundle SolveSpace)
|
set(bundle SolveSpace)
|
||||||
set(bundle_bin ${EXECUTABLE_OUTPUT_PATH}/${bundle}.app/Contents/MacOS)
|
set(bundle_bin ${EXECUTABLE_OUTPUT_PATH}/${bundle}.app/Contents/MacOS)
|
||||||
|
set(bundle_resources ${EXECUTABLE_OUTPUT_PATH}/${bundle}.app/Contents/Resources/lib)
|
||||||
|
execute_process(
|
||||||
|
COMMAND mkdir -p ${bundle_resources}
|
||||||
|
COMMAND cp -p /usr/local/opt/libomp/lib/libomp.dylib ${bundle_resources}/libomp.dylib
|
||||||
|
)
|
||||||
add_custom_command(TARGET solvespace POST_BUILD
|
add_custom_command(TARGET solvespace POST_BUILD
|
||||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${bundle_bin}
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${bundle_bin}
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:solvespace-cli> ${bundle_bin}
|
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:solvespace-cli> ${bundle_bin}
|
||||||
|
COMMAND install_name_tool -change /usr/local/opt/libomp/lib/libomp.dylib "@executable_path/../Resources/lib/libomp.dylib" ${bundle_bin}/${bundle}
|
||||||
COMMENT "Bundling executable solvespace-cli"
|
COMMENT "Bundling executable solvespace-cli"
|
||||||
VERBATIM)
|
VERBATIM)
|
||||||
endif()
|
endif()
|
||||||
|
Loading…
Reference in New Issue
Block a user