Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update build scripts #58

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 9 additions & 16 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -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/'))
Expand Down Expand Up @@ -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())
Expand All @@ -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'])
Expand All @@ -110,17 +107,15 @@ 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',
'-DNDEBUG', '-DNS_BLOCK_ASSERTIONS=1',
'-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'])
Expand All @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion plugins/apn/apn.mm
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
notificationsOptions |= UNAuthorizationOptionSound;
}

[[GodotAPNAppDelegate shared] registerPushNotificationsWithOptions:options];
[[GodotAPNAppDelegate shared] registerPushNotificationsWithOptions:notificationsOptions];
}

void APNPlugin::update_device_token(String token) {
Expand Down
2 changes: 1 addition & 1 deletion scripts/generate_headers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
18 changes: 0 additions & 18 deletions scripts/generate_static_library.sh

This file was deleted.

9 changes: 3 additions & 6 deletions scripts/generate_xcframework.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,17 @@ 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
scons target=$2 arch=arm64 simulator=yes plugin=$1 version=$3

# Creating a fat libraries for device and simulator
# lib<plugin>.<arch>-<simulator|ios>.<release|debug|release_debug>.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"
21 changes: 0 additions & 21 deletions scripts/release_static_library.sh

This file was deleted.

7 changes: 6 additions & 1 deletion scripts/release_xcframework.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Loading