From 21067ca2b452e9272de0b2e99a3a8eb50dbdf00e Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Tue, 14 Nov 2023 18:09:29 +0200 Subject: [PATCH] Update build scripts (remove unsupported 32-bit ARM, remove duplicate scripts, bump iOS version to match the engine). --- SConstruct | 25 +++++++++---------------- plugins/apn/apn.mm | 2 +- scripts/generate_headers.sh | 2 +- scripts/generate_static_library.sh | 18 ------------------ scripts/generate_xcframework.sh | 9 +++------ scripts/release_static_library.sh | 21 --------------------- scripts/release_xcframework.sh | 7 ++++++- 7 files changed, 20 insertions(+), 64 deletions(-) delete mode 100755 scripts/generate_static_library.sh delete mode 100755 scripts/release_static_library.sh diff --git a/SConstruct b/SConstruct index c943b12..8c40603 100644 --- a/SConstruct +++ b/SConstruct @@ -20,7 +20,7 @@ env = DefaultEnvironment() # Define our options opts.Add(EnumVariable('target', "Compilation target", 'debug', ['debug', 'release', "release_debug"])) -opts.Add(EnumVariable('arch', "Compilation Architecture", '', ['', 'arm64', 'armv7', 'x86_64'])) +opts.Add(EnumVariable('arch', "Compilation Architecture", '', ['', 'arm64', 'x86_64'])) opts.Add(BoolVariable('simulator', "Compilation platform", 'no')) opts.Add(BoolVariable('use_llvm', "Use the LLVM / Clang compiler", 'no')) opts.Add(PathVariable('target_path', 'The path where the lib is installed.', 'bin/')) @@ -60,12 +60,12 @@ env.Append(CCFLAGS=["-fmodules", "-fcxx-modules"]) if env['simulator']: sdk_name = 'iphonesimulator' - env.Append(CCFLAGS=['-mios-simulator-version-min=10.0']) - env.Append(LINKFLAGS=["-mios-simulator-version-min=10.0"]) + env.Append(CCFLAGS=['-mios-simulator-version-min=12.0']) + env.Append(LINKFLAGS=["-mios-simulator-version-min=12.0"]) else: sdk_name = 'iphoneos' - env.Append(CCFLAGS=['-miphoneos-version-min=10.0']) - env.Append(LINKFLAGS=["-miphoneos-version-min=10.0"]) + env.Append(CCFLAGS=['-miphoneos-version-min=12.0']) + env.Append(LINKFLAGS=["-miphoneos-version-min=12.0"]) try: sdk_path = decode_utf8(subprocess.check_output(['xcrun', '--sdk', sdk_name, '--show-sdk-path']).strip()) @@ -90,9 +90,6 @@ env.Prepend(CXXFLAGS=[ ]) env.Append(LINKFLAGS=["-arch", env['arch'], '-isysroot', sdk_path, '-F' + sdk_path]) -if env['arch'] == 'armv7': - env.Prepend(CXXFLAGS=['-fno-aligned-allocation']) - if env['version'] == '3.x': env.Prepend(CFLAGS=['-std=gnu11']) env.Prepend(CXXFLAGS=['-DGLES_ENABLED', '-std=gnu++14']) @@ -110,8 +107,7 @@ if env['version'] == '3.x': '-DPTRCALL_ENABLED', ]) - if env['arch'] != 'armv7': - env.Prepend(CXXFLAGS=['-fomit-frame-pointer']) + env.Prepend(CXXFLAGS=['-fomit-frame-pointer']) else: env.Prepend(CXXFLAGS=[ '-O2', '-ftree-vectorize', @@ -119,8 +115,7 @@ if env['version'] == '3.x': '-DPTRCALL_ENABLED', ]) - if env['arch'] != 'armv7': - env.Prepend(CXXFLAGS=['-fomit-frame-pointer']) + env.Prepend(CXXFLAGS=['-fomit-frame-pointer']) elif env['version'] == '4.0': env.Prepend(CFLAGS=['-std=gnu11']) env.Prepend(CXXFLAGS=['-DVULKAN_ENABLED', '-std=gnu++17']) @@ -137,16 +132,14 @@ elif env['version'] == '4.0': '-DNDEBUG', '-DNS_BLOCK_ASSERTIONS=1', '-DDEBUG_ENABLED', ]) - if env['arch'] != 'armv7': - env.Prepend(CXXFLAGS=['-fomit-frame-pointer']) + env.Prepend(CXXFLAGS=['-fomit-frame-pointer']) else: env.Prepend(CXXFLAGS=[ '-O2', '-ftree-vectorize', '-DNDEBUG', '-DNS_BLOCK_ASSERTIONS=1', ]) - if env['arch'] != 'armv7': - env.Prepend(CXXFLAGS=['-fomit-frame-pointer']) + env.Prepend(CXXFLAGS=['-fomit-frame-pointer']) else: print("No valid version to set flags for.") quit(); diff --git a/plugins/apn/apn.mm b/plugins/apn/apn.mm index 35f3325..6122243 100644 --- a/plugins/apn/apn.mm +++ b/plugins/apn/apn.mm @@ -78,7 +78,7 @@ notificationsOptions |= UNAuthorizationOptionSound; } - [[GodotAPNAppDelegate shared] registerPushNotificationsWithOptions:options]; + [[GodotAPNAppDelegate shared] registerPushNotificationsWithOptions:notificationsOptions]; } void APNPlugin::update_device_token(String token) { diff --git a/scripts/generate_headers.sh b/scripts/generate_headers.sh index f2610a7..5f46d27 100755 --- a/scripts/generate_headers.sh +++ b/scripts/generate_headers.sh @@ -5,5 +5,5 @@ then ./../scripts/timeout scons platform=iphone target=release_debug else cd ./godot && \ - ./../scripts/timeout scons platform=ios target=release_debug + ./../scripts/timeout scons platform=ios target=release_debug fi diff --git a/scripts/generate_static_library.sh b/scripts/generate_static_library.sh deleted file mode 100755 index 972bc6c..0000000 --- a/scripts/generate_static_library.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -set -e - -# Compile static libraries - -# ARM64 Device -scons target=$2 arch=arm64 plugin=$1 version=$3 -# ARM7 Device -scons target=$2 arch=armv7 plugin=$1 version=$3 -# x86_64 Simulator -scons target=$2 arch=x86_64 simulator=yes plugin=$1 version=$3 - -# Creating a fat libraries for device and simulator -# lib.-..a -lipo -create "./bin/lib$1.x86_64-simulator.$2.a" \ - "./bin/lib$1.armv7-ios.$2.a" \ - "./bin/lib$1.arm64-ios.$2.a" \ - -output "./bin/$1.$2.a" \ No newline at end of file diff --git a/scripts/generate_xcframework.sh b/scripts/generate_xcframework.sh index 67b97e9..4b11b0f 100755 --- a/scripts/generate_xcframework.sh +++ b/scripts/generate_xcframework.sh @@ -5,8 +5,6 @@ set -e # ARM64 Device scons target=$2 arch=arm64 plugin=$1 version=$3 -# ARM7 Device -scons target=$2 arch=armv7 plugin=$1 version=$3 # x86_64 Simulator scons target=$2 arch=x86_64 simulator=yes plugin=$1 version=$3 # ARM64 Simulator @@ -14,11 +12,10 @@ scons target=$2 arch=arm64 simulator=yes plugin=$1 version=$3 # Creating a fat libraries for device and simulator # lib.-..a -lipo -create "./bin/lib$1.x86_64-simulator.$2.a" "./bin/lib$1.arm64-simulator.$2.a" -output "./bin/$1-simulator.$2.a" -lipo -create "./bin/lib$1.armv7-ios.$2.a" "./bin/lib$1.arm64-ios.$2.a" -output "./bin/$1-device.$2.a" +lipo -create "./bin/lib$1.x86_64-simulator.$2.a" "./bin/lib$1.arm64-simulator.$2.a" -output "./bin/lib$1-simulator.$2.a" # Creating a xcframework xcodebuild -create-xcframework \ - -library "./bin/$1-device.$2.a" \ - -library "./bin/$1-simulator.$2.a" \ + -library "./bin/lib$1.arm64-ios.$2.a" \ + -library "./bin/lib$1-simulator.$2.a" \ -output "./bin/$1.$2.xcframework" diff --git a/scripts/release_static_library.sh b/scripts/release_static_library.sh deleted file mode 100755 index 80758b8..0000000 --- a/scripts/release_static_library.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -GODOT_PLUGINS="gamecenter inappstore icloud camera arkit apn photo_picker" - -# Compile Plugin -for lib in $GODOT_PLUGINS; do - ./scripts/generate_static_library.sh $lib release $1 - ./scripts/generate_static_library.sh $lib release_debug $1 - mv ./bin/${lib}.release_debug.a ./bin/${lib}.debug.a -done - -# Move to release folder - -rm -rf ./bin/release -mkdir ./bin/release - -# Move Plugin -for lib in $GODOT_PLUGINS; do - mkdir ./bin/release/${lib} - mv ./bin/${lib}.{release,debug}.a ./bin/release/${lib} -done \ No newline at end of file diff --git a/scripts/release_xcframework.sh b/scripts/release_xcframework.sh index dfd4c7c..faaba97 100755 --- a/scripts/release_xcframework.sh +++ b/scripts/release_xcframework.sh @@ -1,7 +1,12 @@ #!/bin/bash set -e -GODOT_PLUGINS="gamecenter inappstore icloud camera arkit apn photo_picker" +if [[ "$1" == "3.x" ]]; +then + GODOT_PLUGINS="gamecenter inappstore icloud camera arkit apn photo_picker" +else + GODOT_PLUGINS="gamecenter inappstore icloud camera apn photo_picker" +fi # Compile Plugin for lib in $GODOT_PLUGINS; do