Travis: include libomp in macOS .app
parent
88b26aabdb
commit
73bbbdef83
|
@ -4,12 +4,6 @@ mkdir build || true
|
|||
cd build
|
||||
|
||||
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
|
||||
BUILD_TYPE=RelWithDebInfo
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/sh -xe
|
||||
|
||||
brew install llvm@9
|
||||
brew install libomp
|
||||
git submodule update --init
|
|
@ -115,27 +115,11 @@ if(ENABLE_LTO)
|
|||
endif()
|
||||
|
||||
if(ENABLE_OPENMP)
|
||||
if(APPLE)
|
||||
# OpenMP does not work with the default Apple llvm/clang++
|
||||
# Install a more recent version using Homebrew (version 11.0.0 which is the next available tag on homebrew at this time crashed):
|
||||
# "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")
|
||||
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} )
|
||||
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()
|
||||
|
||||
|
|
|
@ -404,10 +404,15 @@ endif()
|
|||
if(APPLE)
|
||||
set(bundle SolveSpace)
|
||||
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
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${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"
|
||||
VERBATIM)
|
||||
endif()
|
||||
|
|
Loading…
Reference in New Issue