Skip to content

Commit

Permalink
Update iOS and MacOS build system
Browse files Browse the repository at this point in the history
  • Loading branch information
2shady4u committed Aug 18, 2024
1 parent 7dfafd6 commit 3e11b10
Show file tree
Hide file tree
Showing 6 changed files with 127 additions and 52 deletions.
18 changes: 14 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:

- name: Web dependencies
if: ${{ matrix.platform == 'web' }}
uses: mymindstorm/setup-emsdk@v13
uses: mymindstorm/setup-emsdk@v14
with:
version: ${{ env.EM_VERSION }}
actions-cache-folder: ${{ env.EM_CACHE_FOLDER }}-${{ matrix.target }}
Expand All @@ -92,8 +92,18 @@ jobs:
cd ${{ env.PROJECT_FOLDER }}
scons platform=windows target=${{ matrix.target }} target_path=${{ env.TARGET_PATH }} target_name=${{ env.TARGET_NAME }} -j6 ${{ matrix.flags }}
- name: Not Windows Compilation
if: runner.os != 'Windows'
- name: iOS Compilation
if: matrix.platform == 'ios'
run: |
mkdir -v -p ${{ env.PROJECT_FOLDER }}/${{ env.TARGET_PATH }}
cd ${{ env.PROJECT_FOLDER }}
scons arch=universal ios_simulator=yes platform=ios target=${{ matrix.target }} target_path=${{ env.TARGET_PATH }} target_name=${{ env.TARGET_NAME }} -j6
scons arch=arm64 ios_simulator=no platform=ios target=${{ matrix.target }} target_path=${{ env.TARGET_PATH }} target_name=${{ env.TARGET_NAME }} -j6
xcodebuild -create-xcframework -library ${{ env.TARGET_PATH }}/${{ env.TARGET_NAME }}.ios.${{ matrix.target }}.a -library ${{ env.TARGET_PATH }}/${{ env.TARGET_NAME }}.ios.${{ matrix.target }}.simulator.a -output ${{ env.TARGET_PATH }}/${{ env.TARGET_NAME }}.ios.${{ matrix.target }}.xcframework
xcodebuild -create-xcframework -library godot-cpp/bin/libgodot-cpp.ios.${{ matrix.target }}.arm64.a -library godot-cpp/bin/libgodot-cpp.ios.${{ matrix.target }}.universal.simulator.a -output ${{ env.TARGET_PATH }}/libgodot-cpp.ios.${{ matrix.target }}.xcframework
- name: Not Windows or iOS Compilation
if: runner.os != 'Windows' && matrix.platform != 'ios'
run: |
mkdir -v -p ${{ env.PROJECT_FOLDER }}/${{ env.TARGET_PATH }}
cd ${{ env.PROJECT_FOLDER }}
Expand Down Expand Up @@ -150,4 +160,4 @@ jobs:
${{ env.PROJECT_FOLDER }}/demo.zip
${{ env.PROJECT_FOLDER }}/${{ env.TARGET_PATH }}/../bin.zip
draft: true
prerelease: true
prerelease: true
3 changes: 1 addition & 2 deletions .github/workflows/build_var.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@
"name": "iOS (arm64)",
"os": "macos-latest",
"platform": "ios",
"artifact-extension": "dylib",
"flags": "arch=arm64",
"artifact-extension": "xcframework",
"cache-name": "ios-arm64"
},
{
Expand Down
56 changes: 39 additions & 17 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -30,27 +30,49 @@ if env["target"] in ["editor", "template_debug"]:
doc_data = env.GodotCPPDocData("src/gen/doc_data.gen.cpp", source=Glob("doc_classes/*.xml"))
sources.append(doc_data)

if env["platform"] == "macos":
target = "{}.{}.{}.framework/{}.{}.{}".format(
target,
env["platform"],
env["target"],
target_name,
env["platform"],
env["target"]
)
else:
target = "{}{}{}".format(
target,
env["suffix"],
env["SHLIBSUFFIX"]
)

if env["enable_fts5"]:
print("FTS5 is enabled.")
env.Append(CPPDEFINES=['SQLITE_ENABLE_FTS5'])
else:
print("FTS5 is disabled.")

library = env.SharedLibrary(target=target, source=sources)
if env["platform"] == "macos":
library = env.SharedLibrary(
"{}.{}.{}.framework/{}.{}.{}".format(
target,
env["platform"],
env["target"],
env["platform"],
target_name,
env["target"]
),
source=sources,
)
elif env["platform"] == "ios":
if env["ios_simulator"]:
library = env.StaticLibrary(
"{}.{}.{}.simulator.a".format(
target,
env["platform"],
env["target"]),
source=sources,
)
else:
library = env.StaticLibrary(
"{}.{}.{}.a".format(
target,
env["platform"],
env["target"]),
source=sources,
)
else:
library = env.SharedLibrary(
"{}{}{}".format(
target,
env["suffix"],
env["SHLIBSUFFIX"]
),
source=sources,
)

Default(library)
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>libgdsqlite.template_debug</string>
<key>CFBundleIdentifier</key>
<string>org.godotengine.libgdsqlite</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>libgdsqlite.macos.template_debug</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CFBundleVersion</key>
<string>1.0.0</string>
<key>LSMinimumSystemVersion</key>
<string>10.12</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>libgdsqlite.template_release</string>
<key>CFBundleIdentifier</key>
<string>org.godotengine.libgdsqlite</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>libgdsqlite.macos.template_release</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CFBundleVersion</key>
<string>1.0.0</string>
<key>LSMinimumSystemVersion</key>
<string>10.12</string>
</dict>
</plist>
50 changes: 21 additions & 29 deletions demo/addons/godot-sqlite/gdsqlite.gdextension
Original file line number Diff line number Diff line change
@@ -1,38 +1,30 @@
[configuration]

entry_symbol = "sqlite_library_init"
compatibility_minimum = 4.2
compatibility_minimum = "4.3"

[libraries]

macos = "res://addons/godot-sqlite/bin/libgdsqlite.macos.template_debug.framework"
macos.template_release = "res://addons/godot-sqlite/bin/libgdsqlite.macos.template_release.framework"
windows.x86_64 = "res://addons/godot-sqlite/bin/libgdsqlite.windows.template_debug.x86_64.dll"
windows.template_release.x86_64 = "res://addons/godot-sqlite/bin/libgdsqlite.windows.template_release.x86_64.dll"
linux.x86_64 = "res://addons/godot-sqlite/bin/libgdsqlite.linux.template_debug.x86_64.so"
linux.template_release.x86_64 = "res://addons/godot-sqlite/bin/libgdsqlite.linux.template_release.x86_64.so"
android.arm64 = "res://addons/godot-sqlite/bin/libgdsqlite.android.template_debug.arm64.so"
android.template_release.arm64 = "res://addons/godot-sqlite/bin/libgdsqlite.android.template_release.arm64.so"
android.x86_64 = "res://addons/godot-sqlite/bin/libgdsqlite.android.template_debug.x86_64.so"
android.template_release.x86_64 = "res://addons/godot-sqlite/bin/libgdsqlite.android.template_release.x86_64.so"
ios.arm64 = "res://addons/godot-sqlite/bin/libgdsqlite.ios.template_debug.arm64.dylib"
ios.template_release.arm64 = "res://addons/godot-sqlite/bin/libgdsqlite.ios.template_release.arm64.dylib"
web.wasm32 = "res://addons/godot-sqlite/bin/libgdsqlite.web.template_debug.wasm32.wasm"
web.template_release.wasm32 = "res://addons/godot-sqlite/bin/libgdsqlite.web.template_release.wasm32.wasm"
macos.debug = "res://addons/godot-sqlite/bin/libgdsqlite.macos.template_debug.framework"
macos.release = "res://addons/godot-sqlite/bin/libgdsqlite.macos.template_release.framework"
windows.debug.x86_64 = "res://addons/godot-sqlite/bin/libgdsqlite.windows.template_debug.x86_64.dll"
windows.release.x86_64 = "res://addons/godot-sqlite/bin/libgdsqlite.windows.template_release.x86_64.dll"
linux.debug.x86_64 = "res://addons/godot-sqlite/bin/libgdsqlite.linux.template_debug.x86_64.so"
linux.release.x86_64 = "res://addons/godot-sqlite/bin/libgdsqlite.linux.template_release.x86_64.so"
android.debug.arm64 = "res://addons/godot-sqlite/bin/libgdsqlite.android.template_debug.arm64.so"
android.release.arm64 = "res://addons/godot-sqlite/bin/libgdsqlite.android.template_release.arm64.so"
android.debug.x86_64 = "res://addons/godot-sqlite/bin/libgdsqlite.android.template_debug.x86_64.so"
android.release.x86_64 = "res://addons/godot-sqlite/bin/libgdsqlite.android.template_release.x86_64.so"
ios.debug = "res://addons/godot-sqlite/bin/libgdsqlite.ios.template_debug.xcframework"
ios.release = "res://addons/godot-sqlite/bin/libgdsqlite.ios.template_release.xcframework"
web.debug.wasm32 = "res://addons/godot-sqlite/bin/libgdsqlite.web.template_debug.wasm32.wasm"
web.release.wasm32 = "res://addons/godot-sqlite/bin/libgdsqlite.web.template_release.wasm32.wasm"

[dependencies]

macos = {}
macos.template_release = {}
windows.x86_64 = {}
windows.template_release.x86_64 = {}
linux.x86_64 = {}
linux.template_release.x86_64 = {}
android.arm64 = {}
android.template_release.arm64 = {}
android.x86_64 = {}
android.template_release.x86_64 = {}
ios.arm64 = {}
ios.template_release.arm64 = {}
web.wasm32 = {}
web.template_release.wasm32 = {}
ios.debug = {
"res://addons/godot-sqlite/bin/libgodot-cpp.ios.template_debug.xcframework": ""
}
ios.release = {
"res://addons/godot-sqlite/bin/libgodot-cpp.ios.template_release.xcframework": ""
}

0 comments on commit 3e11b10

Please sign in to comment.