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

[DRAFT] Remove CMake from the build process #227

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
20 changes: 10 additions & 10 deletions .github/workflows/build-addon-on-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,21 @@ jobs:
- name: Install scons
run: |
python -m pip install scons==4.0.0
- name: Create extension library
- name: Create Desktop extension library
run: |
cd aar
scons platform=${{ matrix.platform }} target=template_debug ${{ matrix.flags }} custom_api_file=thirdparty/godot_cpp_gdextension_api/extension_api.json build_profile=thirdparty/godot_cpp_build_profile/build_profile.json
scons platform=${{ matrix.platform }} target=template_release ${{ matrix.flags }} custom_api_file=thirdparty/godot_cpp_gdextension_api/extension_api.json build_profile=thirdparty/godot_cpp_build_profile/build_profile.json
cd ..
- name: Create Android extension library
run: |
cd aar
scons platform=${{ matrix.platform }} target=template_debug arch=arm64 custom_api_file=thirdparty/godot_cpp_gdextension_api/extension_api.json build_profile=thirdparty/godot_cpp_build_profile/build_profile.json
scons platform=${{ matrix.platform }} target=template_release arch=arm64 custom_api_file=thirdparty/godot_cpp_gdextension_api/extension_api.json build_profile=thirdparty/godot_cpp_build_profile/build_profile.json
scons platform=${{ matrix.platform }} target=template_debug arch=x86_64 custom_api_file=thirdparty/godot_cpp_gdextension_api/extension_api.json build_profile=thirdparty/godot_cpp_build_profile/build_profile.json
scons platform=${{ matrix.platform }} target=template_release arch=x86_64 custom_api_file=thirdparty/godot_cpp_gdextension_api/extension_api.json build_profile=thirdparty/godot_cpp_build_profile/build_profile.json
cd ..
if: matrix.platform == 'android'
- name: Save Godot build cache
uses: ./aar/thirdparty/godot-cpp/.github/actions/godot-cache-save
with:
Expand All @@ -108,15 +117,6 @@ jobs:
- name: Validate Gradle wrapper
uses: gradle/actions/wrapper-validation@v3
if: matrix.platform == 'android'
- name: Create Godot-CPP library
run: |
cd aar/thirdparty/godot-cpp
scons platform=${{ matrix.platform }} target=template_debug arch=arm64 custom_api_file=../godot_cpp_gdextension_api/extension_api.json build_profile=../godot_cpp_build_profile/build_profile.json
scons platform=${{ matrix.platform }} target=template_release arch=arm64 custom_api_file=../godot_cpp_gdextension_api/extension_api.json build_profile=../godot_cpp_build_profile/build_profile.json
scons platform=${{ matrix.platform }} target=template_debug arch=x86_64 custom_api_file=../godot_cpp_gdextension_api/extension_api.json build_profile=../godot_cpp_build_profile/build_profile.json
scons platform=${{ matrix.platform }} target=template_release arch=x86_64 custom_api_file=../godot_cpp_gdextension_api/extension_api.json build_profile=../godot_cpp_build_profile/build_profile.json
cd ../../..
if: matrix.platform == 'android'
- name: Create Godot OpenXR Vendors AARs
uses: burrunan/gradle-cache-action@v1
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ local.properties
# Misc
.DS_Store
/plugin/src/gen/
/plugin/src/main/libs
/zippedSamples
26 changes: 26 additions & 0 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ if env["target"] in ["editor", "template_debug"]:
sources.append(doc_data)

binary_path = '#demo/addons/godotopenxrvendors/.bin'
android_src_path = '#plugin/src'
project_name = 'godotopenxrvendors'

# Statically link with libgcc and libstdc++ for more Linux compatibility.
Expand All @@ -47,6 +48,31 @@ if env["platform"] == "macos":
),
source=sources,
)
elif env["platform"] == "android":
android_target = "release" if env["target"] == "template_release" else "debug"
android_arch = ""
if env["arch"] == "arm32":
android_arch = "armeabi-v7a"
elif env["arch"] == "arm64":
android_arch = "arm64-v8a"
elif env["arch"] == "x86_32":
android_arch = "x86"
elif env["arch"] == "x86_64":
android_arch = "x86_64"
else:
raise Exception("Unable to map %s to Android architecture name" % env["arch"])

library = env.SharedLibrary(
"{}/main/libs/{}/{}/{}/lib{}{}".format(
android_src_path,
android_target,
android_arch,
android_arch,
project_name,
env["SHLIBSUFFIX"],
),
source=sources,
)
else:
library = env.SharedLibrary(
"{}/{}/{}/{}/lib{}{}".format(
Expand Down
36 changes: 18 additions & 18 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -86,41 +86,41 @@ task buildSconsArtifacts {
logger.debug("Found executable path for $sconsName: ${sconsExecutableFile.absolutePath}")
}

// Build the Godot-CPP bindings
tasks.create(name: "buildGodotCPPArm64Debug", type: Exec) {
// Build the GDExtension library for Android.
tasks.create(name: "buildGodotOpenXRVendorsAndroidArm64Debug", type: Exec) {
executable sconsExecutableFile.absolutePath
args "--directory=thirdparty/godot-cpp", "platform=android", "target=template_debug", "arch=arm64", "custom_api_file=../godot_cpp_gdextension_api/extension_api.json"
args "--directory=.", "platform=android", "target=template_debug", "arch=arm64", "custom_api_file=thirdparty/godot_cpp_gdextension_api/extension_api.json"
}
tasks.create(name: "buildGodotCPPArm64Release", type: Exec) {
tasks.create(name: "buildGodotOpenXRVendorsAndroidArm64Release", type: Exec) {
executable sconsExecutableFile.absolutePath
args "--directory=thirdparty/godot-cpp", "platform=android", "target=template_release", "arch=arm64", "custom_api_file=../godot_cpp_gdextension_api/extension_api.json"
args "--directory=.", "platform=android", "target=template_release", "arch=arm64", "custom_api_file=thirdparty/godot_cpp_gdextension_api/extension_api.json"
}
tasks.create(name: "buildGodotCPPX86_64Debug", type: Exec) {
tasks.create(name: "buildGodotOpenXRVendorsAndroidX86_64Debug", type: Exec) {
executable sconsExecutableFile.absolutePath
args "--directory=thirdparty/godot-cpp", "platform=android", "target=template_debug", "arch=x86_64", "custom_api_file=../godot_cpp_gdextension_api/extension_api.json"
args "--directory=.", "platform=android", "target=template_debug", "arch=x86_64", "custom_api_file=thirdparty/godot_cpp_gdextension_api/extension_api.json"
}
tasks.create(name: "buildGodotCPPX86_64Release", type: Exec) {
tasks.create(name: "buildGodotOpenXRVendorsAndroidX86_64Release", type: Exec) {
executable sconsExecutableFile.absolutePath
args "--directory=thirdparty/godot-cpp", "platform=android", "target=template_release", "arch=x86_64", "custom_api_file=../godot_cpp_gdextension_api/extension_api.json"
args "--directory=.", "platform=android", "target=template_release", "arch=x86_64", "custom_api_file=thirdparty/godot_cpp_gdextension_api/extension_api.json"
}

dependsOn 'buildGodotCPPArm64Debug'
dependsOn 'buildGodotCPPArm64Release'
dependsOn 'buildGodotCPPX86_64Debug'
dependsOn 'buildGodotCPPX86_64Release'
dependsOn 'buildGodotOpenXRVendorsAndroidArm64Debug'
dependsOn 'buildGodotOpenXRVendorsAndroidArm64Release'
dependsOn 'buildGodotOpenXRVendorsAndroidX86_64Debug'
dependsOn 'buildGodotOpenXRVendorsAndroidX86_64Release'

// Creating gradle task to generate the editor gdextension binaries
tasks.create(name: "buildGodotOpenXRVendorsDebugGDExtension", type: Exec) {
// Build the GDExtension library for desktop.
tasks.create(name: "buildGodotOpenXRVendorsDesktopDebug", type: Exec) {
executable sconsExecutableFile.absolutePath
args "--directory=.", "target=template_debug", "custom_api_file=thirdparty/godot_cpp_gdextension_api/extension_api.json"
}
tasks.create(name: "buildGodotOpenXRVendorsReleaseGDExtension", type: Exec) {
tasks.create(name: "buildGodotOpenXRVendorsDesktopRelease", type: Exec) {
executable sconsExecutableFile.absolutePath
args "--directory=.", "target=template_release", "custom_api_file=thirdparty/godot_cpp_gdextension_api/extension_api.json"
}

dependsOn 'buildGodotOpenXRVendorsDebugGDExtension'
dependsOn 'buildGodotOpenXRVendorsReleaseGDExtension'
dependsOn 'buildGodotOpenXRVendorsDesktopDebug'
dependsOn 'buildGodotOpenXRVendorsDesktopRelease'
}

task copyBuildToSamples {
Expand Down
1 change: 0 additions & 1 deletion config.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ ext {
javaVersion : JavaVersion.VERSION_17,
nexusPublishVersion : '1.3.0',
kotlinVersion : '1.9.20',
cmakeVersion : '3.22.1',
ndkVersion : '23.2.8568313',
openxrVersion : '1.0.34'
]
Expand Down
37 changes: 0 additions & 37 deletions plugin/CMakeLists.txt

This file was deleted.

100 changes: 54 additions & 46 deletions plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@ android {
abiFilters "arm64-v8a"
}
}
externalNativeBuild {
cmake {
path file('CMakeLists.txt')
version versions.cmakeVersion
}
}

namespace = "org.godotengine.openxr.vendors"

Expand All @@ -42,47 +36,73 @@ android {
//noinspection ChromeOsAbiSupport
abiFilters 'arm64-v8a', 'x86_64'
}
externalNativeBuild {
cmake {
arguments "-DFLAVOR=khronos"
}
}
}
lynx {
dimension "vendor"
externalNativeBuild {
cmake {
arguments "-DFLAVOR=lynx"
}
}
}
magicleap {
dimension "vendor"
externalNativeBuild {
cmake {
arguments "-DFLAVOR=magicleap"
}
}
ndk {
//noinspection ChromeOsAbiSupport
abiFilters 'arm64-v8a', 'x86_64'
}
}
meta {
dimension "vendor"
externalNativeBuild {
cmake {
arguments "-DFLAVOR=meta"
}
}
}
pico {
dimension "vendor"
externalNativeBuild {
cmake {
arguments "-DFLAVOR=pico"
}
}
}
}

sourceSets {
khronosDebug {
jniLibs.srcDirs = [
'src/main/libs/debug/arm64-v8a',
'src/main/libs/debug/x86_64',
]
}
khronosRelease {
jniLibs.srcDirs = [
'src/main/libs/release/arm64-v8a',
'src/main/libs/release/x86_64',
]
}
lynxDebug {
jniLibs.srcDirs = [
'src/main/libs/debug/arm64-v8a',
'../thirdparty/lynx_openxr_sdk',
]
}
lynxRelease {
jniLibs.srcDirs = [
'src/main/libs/release/arm64-v8a',
'../thirdparty/lynx_openxr_sdk',
]
}
magicleapDebug {
jniLibs.srcDirs = [
'src/main/libs/debug/arm64-v8a',
'src/main/libs/debug/x86_64',
]
}
magicleapRelease {
jniLibs.srcDirs = [
'src/main/libs/release/arm64-v8a',
'src/main/libs/release/x86_64',
]
}
metaDebug {
jniLibs.srcDirs = [
'src/main/libs/debug/arm64-v8a',
'../thirdparty/ovr_openxr_mobile_sdk/OpenXR/Libs/Android/Debug',
]
}
metaRelease {
jniLibs.srcDirs = [
'src/main/libs/release/arm64-v8a',
'../thirdparty/ovr_openxr_mobile_sdk/OpenXR/Libs/Android/Release',
]
}
}

Expand Down Expand Up @@ -128,38 +148,27 @@ android {

buildFeatures {
prefab true
prefabPublishing true
}

prefab {
godotopenxrvendors {
headers "src/main/cpp/include"
}
}
}

dependencies {
compileOnly libraries.godotAndroidLib

// Khronos dependencies
khronosImplementation "org.khronos.openxr:openxr_loader_for_android:$versions.openxrVersion"
khronosApi "org.khronos.openxr:openxr_loader_for_android:$versions.openxrVersion"

// Magicleap dependencies
magicleapImplementation "org.khronos.openxr:openxr_loader_for_android:$versions.openxrVersion"
magicleapApi "org.khronos.openxr:openxr_loader_for_android:$versions.openxrVersion"

// Pico dependencies
picoImplementation "org.khronos.openxr:openxr_loader_for_android:$versions.openxrVersion"
picoApi "org.khronos.openxr:openxr_loader_for_android:$versions.openxrVersion"
}

task cleanAssets(type: Delete) {
// Delete the 'addons' directory in the 'assets' folder
delete("src/main/assets/addons")
}

task cleanCxx(type: Delete) {
delete(".cxx")
}

task copyDebugAARToAddons(type: Copy) {
from 'build/outputs/aar'
include 'godotopenxr-*-debug.aar'
Expand All @@ -185,4 +194,3 @@ assemble.dependsOn(copyGdExtensionConfigToAssets)
assemble.finalizedBy(copyDebugAARToAddons)
assemble.finalizedBy(copyReleaseAARToAddons)
clean.dependsOn(cleanAssets)
clean.dependsOn(cleanCxx)
13 changes: 0 additions & 13 deletions plugin/src/khronos/khronos.cmake

This file was deleted.

18 changes: 0 additions & 18 deletions plugin/src/lynx/lynx.cmake

This file was deleted.

13 changes: 0 additions & 13 deletions plugin/src/magicleap/magicleap.cmake

This file was deleted.

Loading
Loading