2016-04-19 12:19:00 +00:00
|
|
|
#!/bin/sh -xe
|
|
|
|
|
2021-02-08 00:07:21 +00:00
|
|
|
ENABLE_SANITIZERS="OFF"
|
2020-10-24 09:08:40 +00:00
|
|
|
if [ "$1" = "release" ]; then
|
2021-02-08 00:07:21 +00:00
|
|
|
BUILD_TYPE="RelWithDebInfo"
|
|
|
|
ENABLE_LTO="ON"
|
|
|
|
else
|
|
|
|
BUILD_TYPE="Debug"
|
|
|
|
ENABLE_LTO="OFF"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# this is an option for our Github CI only, since it doesn't have a macos arm64 image yet
|
|
|
|
CMAKE_GENERATOR="Unix Makefiles"
|
|
|
|
CMAKE_PREFIX_PATH=""
|
|
|
|
if [ "$2" = "arm64" ]; then
|
|
|
|
OSX_ARCHITECTURE="arm64"
|
2021-08-18 10:19:02 +00:00
|
|
|
CMAKE_PREFIX_PATH=$(find /tmp/libomp-arm64/libomp -depth 1)
|
2021-02-08 00:07:21 +00:00
|
|
|
git apply cmake/libpng-macos-arm64.patch || echo "Could not apply patch, probably already patched..."
|
|
|
|
mkdir build-arm64 || true
|
|
|
|
cd build-arm64
|
|
|
|
elif [ "$2" = "x86_64" ]; then
|
|
|
|
OSX_ARCHITECTURE="x86_64"
|
2021-08-18 10:19:02 +00:00
|
|
|
CMAKE_PREFIX_PATH=$(find /tmp/libomp-x86_64/libomp -depth 1)
|
2021-02-08 00:07:21 +00:00
|
|
|
mkdir build || true
|
|
|
|
cd build
|
2020-10-20 15:31:26 +00:00
|
|
|
else
|
2021-02-08 00:07:21 +00:00
|
|
|
mkdir build || true
|
|
|
|
cd build
|
2020-10-20 15:31:26 +00:00
|
|
|
fi
|
2020-10-20 07:39:26 +00:00
|
|
|
|
2021-02-08 00:07:21 +00:00
|
|
|
if [ "$3" = "xcode" ]; then
|
|
|
|
CMAKE_GENERATOR="Xcode"
|
|
|
|
fi
|
|
|
|
|
|
|
|
cmake \
|
|
|
|
-G "${CMAKE_GENERATOR}" \
|
|
|
|
-D CMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}" \
|
|
|
|
-D CMAKE_OSX_ARCHITECTURES="${OSX_ARCHITECTURE}" \
|
|
|
|
-D CMAKE_BUILD_TYPE="${BUILD_TYPE}" \
|
|
|
|
-D ENABLE_OPENMP="ON" \
|
|
|
|
-D ENABLE_SANITIZERS="${ENABLE_SANITIZERS}" \
|
|
|
|
-D ENABLE_LTO="${ENABLE_LTO}" \
|
|
|
|
..
|
|
|
|
|
|
|
|
if [ "$3" = "xcode" ]; then
|
|
|
|
open solvespace.xcodeproj
|
|
|
|
else
|
|
|
|
cmake --build . --config "${BUILD_TYPE}" -j$(sysctl -n hw.logicalcpu)
|
|
|
|
if [ $(uname -m) = "$2" ]; then
|
|
|
|
make -j$(sysctl -n hw.logicalcpu) test_solvespace
|
|
|
|
fi
|
2021-06-24 14:47:49 +00:00
|
|
|
fi
|