Skip to content

Commit

Permalink
Remove CMake from the build process
Browse files Browse the repository at this point in the history
  • Loading branch information
dsnopek committed Nov 21, 2024
1 parent 226eb23 commit ad32784
Show file tree
Hide file tree
Showing 17 changed files with 90 additions and 299 deletions.
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.

76 changes: 38 additions & 38 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,60 @@ 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 {
main {
debug.jniLibs.srcDirs = ['src/main/libs/debug/arm64-v8a']
release.jniLibs.srcDirs = ['src/main/libs/release/arm64-v8a']
}
khronos {
debug.jniLibs.srcDirs = [
'src/main/libs/debug/arm64-v8a',
'src/main/libs/debug/x86_64'
]
release.jniLibs.srcDirs = [
'src/main/libs/release/arm64-v8a',
'src/main/libs/release/x86_64'
]
}
lynx {
jniLibs.srcDirs = ['thirdparty/lynx_openxr_sdk/']
debug.jniLibs.srcDirs = [
'src/main/libs/debug/arm64-v8a',
'../thirdparty/lynx_openxr_sdk',
]
release.jniLibs.srcDirs = [
'src/main/libs/release/arm64-v8a',
'../thirdparty/lynx_openxr_sdk',
]
}
meta {
debug.jniLibs.srcDirs = [
'src/main/libs/debug/arm64-v8a',
'../thirdparty/ovr_openxr_mobile_sdk/OpenXR/Libs/Android/Debug'
]
release.jniLibs.srcDirs = [
'src/main/libs/release/arm64-v8a',
'../thirdparty/ovr_openxr_mobile_sdk/OpenXR/Libs/Android/Release'
]
}
}

Expand Down Expand Up @@ -128,13 +135,6 @@ android {

buildFeatures {
prefab true
prefabPublishing true
}

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

Expand Down
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

0 comments on commit ad32784

Please sign in to comment.