summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2021-07-09 16:03:49 +0200
committerGitHub <noreply@github.com>2021-07-09 16:03:49 +0200
commite08ecdc28c5409cb5366027227e996c342dcee93 (patch)
treeb1169129683570c129035d7ac6817f252648497b
parent784103f6766f72137b34712ee1883aea992c1ef3 (diff)
parent5b8bcb7164a5e6072ba2be46ca1c06d74503deb8 (diff)
downloadredot-cpp-e08ecdc28c5409cb5366027227e996c342dcee93.tar.gz
Merge pull request #584 from Faless/build/osx_arm64
Add OSX arm64 build target.
-rw-r--r--.github/workflows/ci.yml27
-rw-r--r--SConstruct20
2 files changed, 45 insertions, 2 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index ad75d07..f8e42fb 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -145,6 +145,33 @@ jobs:
run: |
./Godot.app/Contents/MacOS/Godot --path test -s script.gd
+ macos-arm64:
+ name: Build (macOS, Clang, cross-compile arm64)
+ runs-on: macos-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2.3.4
+ with:
+ submodules: recursive
+
+ - name: Set up Python (for SCons)
+ uses: actions/setup-python@v2
+ with:
+ python-version: '3.9.1'
+
+ - name: Install dependencies
+ run: |
+ python -m pip install scons
+
+ - name: Build godot-cpp
+ run: |
+ # The default SDK in github the actions environemnt seems to have problems compiling for arm64.
+ # Use the latest 11.x SDK.
+ SDK_BASE=/Library/Developer/CommandLineTools/SDKs
+ SDK_VER=$(ls $SDK_BASE | grep "MacOSX11." | sort -r | head -n1)
+ echo $SDK_BASE/$SDK_VER/
+ scons target=release generate_bindings=yes macos_arch=arm64 macos_deployment_target=10.15 macos_sdk_path="$SDK_BASE/$SDK_VER/" -j $(sysctl -n hw.logicalcpu)
+
static-checks:
name: Static Checks (clang-format)
runs-on: ubuntu-20.04
diff --git a/SConstruct b/SConstruct
index 1943d29..1f06a0a 100644
--- a/SConstruct
+++ b/SConstruct
@@ -143,6 +143,17 @@ opts.Add(
'macOS deployment target',
'default'
)
+opts.Add(
+ 'macos_sdk_path',
+ 'macOS SDK path',
+ ''
+)
+opts.Add(EnumVariable(
+ 'macos_arch',
+ 'Target macOS architecture',
+ 'x86_64',
+ ['x86_64', 'arm64']
+))
opts.Add(EnumVariable(
'ios_arch',
'Target iOS architecture',
@@ -217,14 +228,19 @@ elif env['platform'] == 'osx':
'Only 64-bit builds are supported for the macOS target.'
)
- env.Append(CCFLAGS=['-std=c++14', '-arch', 'x86_64'])
+ env.Append(CCFLAGS=['-std=c++14', '-arch', env['macos_arch']])
if env['macos_deployment_target'] != 'default':
env.Append(CCFLAGS=['-mmacosx-version-min=' + env['macos_deployment_target']])
+ env.Append(LINKFLAGS=['-mmacosx-version-min=' + env['macos_deployment_target']])
+
+ if env['macos_sdk_path']:
+ env.Append(CCFLAGS=['-isysroot', env['macos_sdk_path']])
+ env.Append(LINKFLAGS=['-isysroot', env['macos_sdk_path']])
env.Append(LINKFLAGS=[
'-arch',
- 'x86_64',
+ env['macos_arch'],
'-framework',
'Cocoa',
'-Wl,-undefined,dynamic_lookup',