Added shell script to compile Universal 2 binary (x86_64+arm64)

This commit is contained in:
Tom Kidd 2021-06-26 21:42:36 -05:00
parent 25492264f8
commit db8883d9e2
4 changed files with 57 additions and 3 deletions

View File

@ -480,7 +480,7 @@ ifeq ($(PLATFORM),darwin)
BASE_CFLAGS += -arch x86_64
endif
ifeq ($(ARCH),arm64)
HAVE_VM_COMPILED=false # TODO: implement compiled vm
# HAVE_VM_COMPILED=false # TODO: implement compiled vm
BASE_CFLAGS += -arch arm64
endif

View File

@ -263,7 +263,11 @@ fi
# set the final application bundle output directory
if [ "${2}" == "" ]; then
if [ -n "${MACOSX_DEPLOYMENT_TARGET_ARM64}" ]; then
BUILT_PRODUCTS_DIR="${OBJROOT}/${TARGET_NAME}-darwin-universal2"
else
BUILT_PRODUCTS_DIR="${OBJROOT}/${TARGET_NAME}-darwin-universal"
fi
if [ ! -d ${BUILT_PRODUCTS_DIR} ]; then
mkdir -p ${BUILT_PRODUCTS_DIR} || exit 1;
fi

50
make-macosx-ub2.sh Executable file
View File

@ -0,0 +1,50 @@
#!/bin/bash
CC=gcc-4.0
cd `dirname $0`
if [ ! -f Makefile ]; then
echo "This script must be run from the ioquake3 build directory"
exit 1
fi
# This script is to build a Universal 2 binary
# (Apple's term for an x86_64 and arm64 binary)
unset X86_64_SDK
unset X86_64_CFLAGS
unset X86_64_MACOSX_VERSION_MIN
unset ARM64_SDK
unset ARM64_CFLAGS
unset ARM64_MACOSX_VERSION_MIN
X86_64_MACOSX_VERSION_MIN="10.7"
ARM64_MACOSX_VERSION_MIN="11.0"
echo "Building X86_64 Client/Dedicated Server"
echo "Building ARM64 Client/Dedicated Server"
echo
# For parallel make on multicore boxes...
NCPU=`sysctl -n hw.ncpu`
# x86_64 client and server
#if [ -d build/release-release-x86_64 ]; then
# rm -r build/release-darwin-x86_64
#fi
(ARCH=x86_64 CFLAGS=$X86_64_CFLAGS MACOSX_VERSION_MIN=$X86_64_MACOSX_VERSION_MIN make -j$NCPU) || exit 1;
echo;echo
# arm64 client and server
#if [ -d build/release-release-arm64 ]; then
# rm -r build/release-darwin-arm64
#fi
(ARCH=arm64 CFLAGS=$ARM64_CFLAGS MACOSX_VERSION_MIN=$ARM64_MACOSX_VERSION_MIN make -j$NCPU) || exit 1;
echo
# use the following shell script to build a universal 2 application bundle
export MACOSX_DEPLOYMENT_TARGET="10.7"
export MACOSX_DEPLOYMENT_TARGET_X86_64="$X86_64_MACOSX_VERSION_MIN"
export MACOSX_DEPLOYMENT_TARGET_ARM64="$ARM64_MACOSX_VERSION_MIN"
"./make-macosx-app.sh" release

View File

@ -6,7 +6,7 @@
if [ $# -ne 1 ]; then
echo "Usage: $0 target_architecture"
echo "Example: $0 x86"
echo "other valid options are x86_64 or ppc"
echo "other valid options are arm64, x86_64 or ppc"
echo
echo "If you don't know or care about architectures please consider using make-macosx-ub.sh instead of this script."
exit 1