Add support MacOS arm64 (#763)
* test * separate script for osx * test * test * Fix with no tests for MACOS arm64 * fix with tests * remove comments * use 11.1 just for arm64
This commit is contained in:
Родитель
bddcfa31ac
Коммит
5421b25a6b
|
@ -64,6 +64,7 @@ if(APPLE)
|
|||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -arch arm64")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -arch arm64")
|
||||
set(CMAKE_SYSTEM_PROCESSOR arm64)
|
||||
set(APPLE True)
|
||||
else()
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -arch x86_64 -arch arm64")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -arch x86_64 -arch arm64")
|
||||
|
|
|
@ -1,11 +1,17 @@
|
|||
#!/usr/bin/env bash
|
||||
ARCH="x86_64"
|
||||
if [ "$1" == "ios" ]; then
|
||||
IOS_BUILD="YES"
|
||||
# Skip building tests on iOS as there is no way to run them
|
||||
BUILD_TESTS="OFF"
|
||||
else
|
||||
IOS_BUILD="NO"
|
||||
BUILD_TESTS="ON"
|
||||
if [ "$1" == "arm64" ]; then
|
||||
ARCH="arm64"
|
||||
BUILD_TESTS="OFF"
|
||||
else
|
||||
BUILD_TESTS="ON"
|
||||
fi
|
||||
fi
|
||||
|
||||
cd `dirname $0`
|
||||
|
@ -39,6 +45,7 @@ cmake -Dgtest_build_samples=OFF \
|
|||
-Dgmock_build_tests=OFF \
|
||||
-DCMAKE_CXX_FLAGS="-fPIC $CXX_FLAGS" \
|
||||
-DBUILD_IOS=$IOS_BUILD \
|
||||
-DARCH=$ARCH \
|
||||
..
|
||||
make
|
||||
popd
|
||||
|
|
9
build.sh
9
build.sh
|
@ -91,14 +91,19 @@ if [ "$LINK_TYPE" == "shared" ]; then
|
|||
fi
|
||||
|
||||
# Set target MacOS minver
|
||||
export MACOSX_DEPLOYMENT_TARGET=10.10
|
||||
if [ "$MAC_ARCH" == "arm64" ]; then
|
||||
export MACOSX_DEPLOYMENT_TARGET=11.10
|
||||
else
|
||||
export MACOSX_DEPLOYMENT_TARGET=10.10
|
||||
fi
|
||||
|
||||
|
||||
# Install build tools and recent sqlite3
|
||||
FILE=.buildtools
|
||||
OS_NAME=`uname -a`
|
||||
if [ ! -f $FILE ]; then
|
||||
case "$OS_NAME" in
|
||||
*Darwin*) tools/setup-buildtools-apple.sh ;;
|
||||
*Darwin*) tools/setup-buildtools-apple.sh $MAC_ARCH ;;
|
||||
*Linux*) [[ -z "$NOROOT" ]] && sudo tools/setup-buildtools.sh || echo "No root: skipping build tools installation." ;;
|
||||
*) echo "WARNING: unsupported OS $OS_NAME , skipping build tools installation.."
|
||||
esac
|
||||
|
|
|
@ -15,6 +15,11 @@ if(BUILD_IOS)
|
|||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
message("-- CMAKE_OSX_SYSROOT ${CMAKE_OSX_SYSROOT}")
|
||||
elseif(${ARCH} STREQUAL "arm64")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -arch arm64")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -arch arm64")
|
||||
set(CMAKE_SYSTEM_PROCESSOR arm64)
|
||||
set(APPLE True)
|
||||
endif()
|
||||
|
||||
project( googletest-distribution )
|
||||
|
|
Загрузка…
Ссылка в новой задаче