diff --git a/.github/workflows/build-addon-on-push.yml b/.github/workflows/build-addon-on-push.yml index da15df63..e3338d70 100644 --- a/.github/workflows/build-addon-on-push.yml +++ b/.github/workflows/build-addon-on-push.yml @@ -55,11 +55,19 @@ jobs: os: ubuntu-20.04 platform: android flags: arch=arm64 - artifact_name: build-files-android + artifact_name: build-files-android-arm64 artifact_path: | - aar/demo/addons/godotopenxrvendors/.bin/android/*/*.aar - aar/demo/addons/godotopenxrvendors/.bin/android/*/*/*.so + aar/plugin/src/main/libs/*/*/*/*.so cache-name: android-arm64 + - name: 🤖 Android (x86_64) + os: ubuntu-20.04 + platform: android + flags: arch=x86_64 + artifact_name: build-files-android-x86_64 + artifact_path: | + aar/plugin/src/main/libs/*/*/*/*.so + cache-name: android-x86_64 + # Note, to satisfy the asset library we need to make sure our zip files have a root folder # this is why we checkout into aar and build into asset @@ -83,6 +91,7 @@ jobs: with: ndk-version: r23c link-to-sdk: true + if: matrix.platform == 'android' - name: Install scons run: | python -m pip install scons==4.0.0 @@ -97,33 +106,6 @@ jobs: with: cache-name: ${{ matrix.cache-name }} continue-on-error: true - - # On Android we build our loaders and build our extension with gradlew - - name: Setup java - uses: actions/setup-java@v4 - with: - java-version: 17 - distribution: "adopt" - if: matrix.platform == 'android' - - 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: - build-root-directory: aar - arguments: build - if: matrix.platform == 'android' - - name: Upload build files (artifacts) uses: actions/upload-artifact@v4 with: @@ -131,13 +113,11 @@ jobs: path: | ${{ matrix.artifact_path }} - # GODOT 4.2 ADDON GENERATION SECTION asset: name: Assembling the asset runs-on: ubuntu-20.04 needs: build - # Steps represent a sequence of tasks that will be executed as part of the job steps: - name: Checkout uses: actions/checkout@v4 @@ -145,6 +125,23 @@ jobs: path: aar - name: Download all workflow run artifacts uses: actions/download-artifact@v4 + - name: Setup java + uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: "adopt" + - name: Validate Gradle wrapper + uses: gradle/actions/wrapper-validation@v3 + - name: Copy Android binaries + run: | + mkdir aar/plugin/src/main/libs + cp -r build-files-android-arm64/* aar/plugin/src/main/libs/ + cp -r build-files-android-x86_64/* aar/plugin/src/main/libs/ + - name: Create Godot OpenXR Vendors AARs + run: | + cd aar + ./gradlew build + cd .. - name: Create Godot OpenXR Vendors Addon run: | mkdir asset @@ -166,8 +163,15 @@ jobs: - name: Copying artifacts run: | - mkdir -p asset/addons/godotopenxrvendors/.bin/android/ - cp -r build-files-android/* asset/addons/godotopenxrvendors/.bin/android/ + mkdir -p asset/addons/godotopenxrvendors/.bin/android/template_debug/arm64 + mkdir -p asset/addons/godotopenxrvendors/.bin/android/template_release/arm64 + cp -r build-files-android-arm64/debug/*/*/*.so asset/addons/godotopenxrvendors/.bin/android/template_debug/arm64/ + cp -r build-files-android-arm64/release/*/*/*.so asset/addons/godotopenxrvendors/.bin/android/template_release/arm64/ + + mkdir -p asset/addons/godotopenxrvendors/.bin/android/template_debug/x86_64 + mkdir -p asset/addons/godotopenxrvendors/.bin/android/template_release/x86_64 + cp -r build-files-android-x86_64/debug/*/*/*.so asset/addons/godotopenxrvendors/.bin/android/template_debug/x86_64/ + cp -r build-files-android-x86_64/release/*/*/*.so asset/addons/godotopenxrvendors/.bin/android/template_release/x86_64/ mkdir -p asset/addons/godotopenxrvendors/.bin/linux/ cp -r build-files-linux-x86_64/* asset/addons/godotopenxrvendors/.bin/linux/ diff --git a/.github/workflows/mavencentral-publish.yml b/.github/workflows/mavencentral-publish.yml index eb3079f2..c1a9cf08 100644 --- a/.github/workflows/mavencentral-publish.yml +++ b/.github/workflows/mavencentral-publish.yml @@ -38,12 +38,10 @@ jobs: # Builds the release artifacts of the library - name: Release build run: | - cd thirdparty/godot-cpp - scons platform=android target=template_debug arch=arm64 custom_api_file=../godot_cpp_gdextension_api/extension_api.json - scons platform=android target=template_release arch=arm64 custom_api_file=../godot_cpp_gdextension_api/extension_api.json - scons platform=android target=template_debug arch=x86_64 custom_api_file=../godot_cpp_gdextension_api/extension_api.json - scons platform=android target=template_release arch=x86_64 custom_api_file=../godot_cpp_gdextension_api/extension_api.json - cd ../.. + scons platform=android 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=android 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=android 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=android 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 ./gradlew -Prelease_version=${{ github.ref_name }} build # Runs upload, and then closes & releases the repository diff --git a/.gitignore b/.gitignore index 55182b22..8f4ff73a 100644 --- a/.gitignore +++ b/.gitignore @@ -25,4 +25,5 @@ local.properties # Misc .DS_Store /plugin/src/gen/ +/plugin/src/main/libs /zippedSamples diff --git a/SConstruct b/SConstruct index cb9b4453..426f540a 100644 --- a/SConstruct +++ b/SConstruct @@ -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. @@ -47,6 +48,27 @@ 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"] == "arm64": + android_arch = "arm64-v8a" + 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( diff --git a/build.gradle b/build.gradle index 2858ea4b..1ecfb773 100644 --- a/build.gradle +++ b/build.gradle @@ -80,47 +80,53 @@ task buildSconsArtifacts { break } } - if (sconsExecutableFile == null) { - throw new GradleException("Unable to find executable path for the '$sconsName' command.") - } else { - logger.debug("Found executable path for $sconsName: ${sconsExecutableFile.absolutePath}") - } - // Build the Godot-CPP bindings - tasks.create(name: "buildGodotCPPArm64Debug", 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" - } - tasks.create(name: "buildGodotCPPArm64Release", 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" - } - tasks.create(name: "buildGodotCPPX86_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" - } - tasks.create(name: "buildGodotCPPX86_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" + // Using `doFirst` so the exception doesn't happen until this task actually runs. + doFirst { + if (sconsExecutableFile == null) { + throw new GradleException("Unable to find executable path for the '$sconsName' command.") + } else { + logger.debug("Found executable path for $sconsName: ${sconsExecutableFile.absolutePath}") + } } - dependsOn 'buildGodotCPPArm64Debug' - dependsOn 'buildGodotCPPArm64Release' - dependsOn 'buildGodotCPPX86_64Debug' - dependsOn 'buildGodotCPPX86_64Release' + if (sconsExecutableFile != null) { + // Build the GDExtension library for Android. + tasks.create(name: "buildGodotOpenXRVendorsAndroidArm64Debug", type: Exec) { + executable sconsExecutableFile.absolutePath + args "--directory=.", "platform=android", "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" + } + tasks.create(name: "buildGodotOpenXRVendorsAndroidArm64Release", type: Exec) { + executable sconsExecutableFile.absolutePath + args "--directory=.", "platform=android", "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" + } + tasks.create(name: "buildGodotOpenXRVendorsAndroidX86_64Debug", type: Exec) { + executable sconsExecutableFile.absolutePath + args "--directory=.", "platform=android", "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" + } + tasks.create(name: "buildGodotOpenXRVendorsAndroidX86_64Release", type: Exec) { + executable sconsExecutableFile.absolutePath + args "--directory=.", "platform=android", "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" + } - // Creating gradle task to generate the editor gdextension binaries - tasks.create(name: "buildGodotOpenXRVendorsDebugGDExtension", 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) { - executable sconsExecutableFile.absolutePath - args "--directory=.", "target=template_release", "custom_api_file=thirdparty/godot_cpp_gdextension_api/extension_api.json" - } + dependsOn 'buildGodotOpenXRVendorsAndroidArm64Debug' + dependsOn 'buildGodotOpenXRVendorsAndroidArm64Release' + dependsOn 'buildGodotOpenXRVendorsAndroidX86_64Debug' + dependsOn 'buildGodotOpenXRVendorsAndroidX86_64Release' - dependsOn 'buildGodotOpenXRVendorsDebugGDExtension' - dependsOn 'buildGodotOpenXRVendorsReleaseGDExtension' + // 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", "build_profile=thirdparty/godot_cpp_build_profile/build_profile.json" + } + 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", "build_profile=thirdparty/godot_cpp_build_profile/build_profile.json" + } + + dependsOn 'buildGodotOpenXRVendorsDesktopDebug' + dependsOn 'buildGodotOpenXRVendorsDesktopRelease' + } } task copyBuildToSamples { diff --git a/config.gradle b/config.gradle index 8412ec08..a4755f41 100644 --- a/config.gradle +++ b/config.gradle @@ -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', fragmentVersion : '1.7.1', diff --git a/plugin/CMakeLists.txt b/plugin/CMakeLists.txt index 6945ff71..60bdddb0 100644 --- a/plugin/CMakeLists.txt +++ b/plugin/CMakeLists.txt @@ -1,37 +1,32 @@ +# Non functional cmake build file used to provide Android Studio editor support to the project. cmake_minimum_required(VERSION 3.22.1) - -## Project definition project(godotopenxrvendors LANGUAGES CXX) -## Common dependencies -include(${PROJECT_SOURCE_DIR}/src/main/common.cmake) +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +set(GODOT_CPP_DIR "${CMAKE_CURRENT_LIST_DIR}/../thirdparty/godot-cpp") +set(OPENXR_HEADERS_DIR "${CMAKE_CURRENT_LIST_DIR}/../thirdparty/openxr/include") +set(COMMON_LIB_HEADERS_DIR "${CMAKE_CURRENT_LIST_DIR}/cpp/include") -## Flavor dependencies -include(src/${FLAVOR}/${FLAVOR}.cmake) +# Get sources +file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_LIST_DIR}/*.c**) +file(GLOB_RECURSE HEADERS ${CMAKE_CURRENT_LIST_DIR}/*.h**) add_library(${PROJECT_NAME} SHARED - ${ANDROID_SOURCES} - ${ANDROID_HEADERS} - ${COMMON_LIB_SOURCES} - ${COMMON_LIB_HEADERS} + ${SOURCES} + ${HEADERS} ) target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC - ${GODOT_CPP_INCLUDE_DIRECTORIES} + "${GODOT_CPP_DIR}/include" + "${GODOT_CPP_DIR}/gen/include" + "${GODOT_CPP_DIR}/gdextension" ${OPENXR_HEADERS_DIR} - ${VENDOR_HEADERS_DIR} ${COMMON_LIB_HEADERS_DIR} ) -target_link_libraries(${PROJECT_NAME} - android - log - ${GODOT-CPP} - ${OPENXR_LOADER} -) - -# Add the compile flags -set_property(TARGET ${PROJECT_NAME} APPEND_STRING PROPERTY COMPILE_FLAGS ${GODOT_COMPILE_FLAGS}) -set_property(TARGET ${PROJECT_NAME} APPEND_STRING PROPERTY LINK_FLAGS ${GODOT_LINKER_FLAGS}) +add_definitions(-DUNIX_ENABLED -DVULKAN_ENABLED -DANDROID_ENABLED -DGLES3_ENABLED -DTOOLS_ENABLED -DDEBUG_ENABLED) diff --git a/plugin/build.gradle b/plugin/build.gradle index 546338ff..69afd163 100644 --- a/plugin/build.gradle +++ b/plugin/build.gradle @@ -9,6 +9,46 @@ ext { apply from: "../scripts/publish-module.gradle" +def khronosOpenxrLoaderAarDir = file("${buildDir}/temp/khronos_openxr_loader_aar") +def khronosOpenxrLoaderTargetDir = file("${buildDir}/temp/khronos_openxr_sdk") + +task extractKhronosOpenxrLoader { + def khronosOpenxrLoader = configurations.detachedConfiguration(dependencies.create("org.khronos.openxr:openxr_loader_for_android:$versions.openxrVersion")) + + doLast { + khronosOpenxrLoaderAarDir.mkdirs() + + copy { + from zipTree(khronosOpenxrLoader.singleFile) + into khronosOpenxrLoaderAarDir + } + } +} + +task copyKhronosOpenxrLoader(dependsOn: extractKhronosOpenxrLoader) { + def khronosOpenxrLoaderTargetDirArm64 = file("${khronosOpenxrLoaderTargetDir}/arm64-v8a/arm64-v8a") + def khronosOpenxrLoaderTargetDirX86_64 = file("${khronosOpenxrLoaderTargetDir}/x86_64/x86_64") + + doLast { + khronosOpenxrLoaderTargetDirArm64.mkdirs() + khronosOpenxrLoaderTargetDirX86_64.mkdirs() + + copy { + from "${khronosOpenxrLoaderAarDir}/prefab/modules/openxr_loader/libs/android.arm64-v8a/libopenxr_loader.so" + into khronosOpenxrLoaderTargetDirArm64 + } + copy { + from "${khronosOpenxrLoaderAarDir}/prefab/modules/openxr_loader/libs/android.x86_64/libopenxr_loader.so" + into khronosOpenxrLoaderTargetDirX86_64 + } + } +} + +task cleanKhronosOpenxrLoader(type: Delete) { + delete khronosOpenxrLoaderAarDir + delete khronosOpenxrLoaderTargetDir +} + android { compileSdk versions.compileSdk ndkVersion versions.ndkVersion @@ -28,7 +68,6 @@ android { externalNativeBuild { cmake { path file('CMakeLists.txt') - version versions.cmakeVersion } } @@ -42,27 +81,12 @@ 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' @@ -70,19 +94,80 @@ android { } 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', + "${khronosOpenxrLoaderTargetDir}/arm64-v8a", + "${khronosOpenxrLoaderTargetDir}/x86_64", + ] + } + khronosRelease { + jniLibs.srcDirs = [ + 'src/main/libs/release/arm64-v8a', + 'src/main/libs/release/x86_64', + "${khronosOpenxrLoaderTargetDir}/arm64-v8a", + "${khronosOpenxrLoaderTargetDir}/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', + "${khronosOpenxrLoaderTargetDir}/arm64-v8a", + "${khronosOpenxrLoaderTargetDir}/x86_64", + ] + } + magicleapRelease { + jniLibs.srcDirs = [ + 'src/main/libs/release/arm64-v8a', + 'src/main/libs/release/x86_64', + "${khronosOpenxrLoaderTargetDir}/arm64-v8a", + "${khronosOpenxrLoaderTargetDir}/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', + ] + } + picoDebug { + jniLibs.srcDirs = [ + 'src/main/libs/debug/arm64-v8a', + "${khronosOpenxrLoaderTargetDir}/arm64-v8a", + ] + } + picoRelease { + jniLibs.srcDirs = [ + 'src/main/libs/release/arm64-v8a', + "${khronosOpenxrLoaderTargetDir}/arm64-v8a", + ] } } @@ -126,15 +211,15 @@ android { } } - buildFeatures { - prefab true - prefabPublishing true - } - - prefab { - godotopenxrvendors { - headers "src/main/cpp/include" + tasks.matching { it.name.contains("CMake") || it.name.contains("externalNativeBuild") }.all { task -> + def taskPrefix = "" + if (project.path != ":") { + taskPrefix = project.path + ":" } + + // Disable the externalNativeBuild* and *CMake* tasks as they would cause build failures since + // the cmake build files are only setup for editing support. + gradle.startParameter.excludedTaskNames += taskPrefix + task.name } } @@ -143,15 +228,6 @@ dependencies { implementation "androidx.fragment:fragment:$versions.fragmentVersion" implementation "androidx.core:core-splashscreen:$versions.splashscreenVersion" - - // Khronos dependencies - khronosImplementation "org.khronos.openxr:openxr_loader_for_android:$versions.openxrVersion" - - // Magicleap dependencies - magicleapImplementation "org.khronos.openxr:openxr_loader_for_android:$versions.openxrVersion" - - // Pico dependencies - picoImplementation "org.khronos.openxr:openxr_loader_for_android:$versions.openxrVersion" } task cleanAssets(type: Delete) { @@ -185,7 +261,10 @@ task copyGdExtensionConfigToAssets(type: Copy) { preBuild.dependsOn(copyGdExtensionConfigToAssets) assemble.dependsOn(copyGdExtensionConfigToAssets) +preBuild.dependsOn(copyKhronosOpenxrLoader) +assemble.dependsOn(copyKhronosOpenxrLoader) assemble.finalizedBy(copyDebugAARToAddons) assemble.finalizedBy(copyReleaseAARToAddons) clean.dependsOn(cleanAssets) clean.dependsOn(cleanCxx) +clean.dependsOn(cleanKhronosOpenxrLoader) diff --git a/plugin/src/khronos/khronos.cmake b/plugin/src/khronos/khronos.cmake deleted file mode 100644 index 253f3bd9..00000000 --- a/plugin/src/khronos/khronos.cmake +++ /dev/null @@ -1,13 +0,0 @@ -cmake_minimum_required(VERSION 3.22.1) - -## khronos OpenXR loader library -find_package(OpenXR REQUIRED CONFIG) - -set(VENDOR_HEADERS_DIR "") -set(OPENXR_LOADER "OpenXR::openxr_loader") - -## Setup the project sources -file(GLOB_RECURSE ANDROID_SOURCES ${CMAKE_CURRENT_LIST_DIR}/cpp/*.c**) -file(GLOB_RECURSE ANDROID_HEADERS ${CMAKE_CURRENT_LIST_DIR}/cpp/*.h**) - -add_definitions(-DKHRONOS_VENDOR_ENABLED) diff --git a/plugin/src/lynx/lynx.cmake b/plugin/src/lynx/lynx.cmake deleted file mode 100644 index 65dae3d9..00000000 --- a/plugin/src/lynx/lynx.cmake +++ /dev/null @@ -1,18 +0,0 @@ -cmake_minimum_required(VERSION 3.22.1) - -## lynx OpenXR loader library -set(LYNX_OPENXR_LIB_PATH "${CMAKE_CURRENT_LIST_DIR}/../../../thirdparty/lynx_openxr_sdk/${ANDROID_ABI}/libopenxr_loader.so") -add_library(openxr_loader - SHARED - IMPORTED GLOBAL -) -set_target_properties(openxr_loader PROPERTIES IMPORTED_LOCATION ${LYNX_OPENXR_LIB_PATH}) - -set(VENDOR_HEADERS_DIR "") -set(OPENXR_LOADER "openxr_loader") - -## Setup the project sources -file(GLOB_RECURSE ANDROID_SOURCES ${CMAKE_CURRENT_LIST_DIR}/cpp/*.c**) -file(GLOB_RECURSE ANDROID_HEADERS ${CMAKE_CURRENT_LIST_DIR}/cpp/*.h**) - -add_definitions(-DLYNX_VENDOR_ENABLED) diff --git a/plugin/src/magicleap/magicleap.cmake b/plugin/src/magicleap/magicleap.cmake deleted file mode 100644 index b6f45a54..00000000 --- a/plugin/src/magicleap/magicleap.cmake +++ /dev/null @@ -1,13 +0,0 @@ -cmake_minimum_required(VERSION 3.22.1) - -## khronos OpenXR loader library -find_package(OpenXR REQUIRED CONFIG) - -set(VENDOR_HEADERS_DIR "") -set(OPENXR_LOADER "OpenXR::openxr_loader") - -## Setup the project sources -file(GLOB_RECURSE ANDROID_SOURCES ${CMAKE_CURRENT_LIST_DIR}/cpp/*.c**) -file(GLOB_RECURSE ANDROID_HEADERS ${CMAKE_CURRENT_LIST_DIR}/cpp/*.h**) - -add_definitions(-DMAGICLEAP_VENDOR_ENABLED) diff --git a/plugin/src/main/common.cmake b/plugin/src/main/common.cmake deleted file mode 100644 index 4161b554..00000000 --- a/plugin/src/main/common.cmake +++ /dev/null @@ -1,126 +0,0 @@ -cmake_minimum_required(VERSION 3.22.1) - - -## Default configs -# Default android abi is arm64-v8a -if (NOT ANDROID_ABI) - set(ANDROID_ABI "arm64-v8a") -endif (NOT ANDROID_ABI) - -if (ANDROID_ABI STREQUAL "armeabi-v7a") - set(GODOT_CPP_LIB_ABI "arm32") -elseif (ANDROID_ABI STREQUAL "x86") - set(GODOT_CPP_LIB_ABI "x86_32") -elseif (ANDROID_ABI STREQUAL "x86_64") - set(GODOT_CPP_LIB_ABI "x86_64") -else () - set(GODOT_CPP_LIB_ABI "arm64") -endif () - -# Default android platform is android-21 -if (NOT ANDROID_PLATFORM) - set(ANDROID_PLATFORM "android-21") -endif (NOT ANDROID_PLATFORM) - -if (NOT (ANDROID_STL STREQUAL "c++_shared")) - set(ANDROID_STL "c++_shared") -endif (NOT (ANDROID_STL STREQUAL "c++_shared")) - -# Default build type is Debug -if (NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Debug) -endif (NOT CMAKE_BUILD_TYPE) - -if (CMAKE_BUILD_TYPE MATCHES Debug) - add_definitions(-D_DEBUG) - set(GODOT_CPP_LIB_BUILD_TYPE debug) - set(OPENXR_MOBILE_LIB_BUILD_TYPE Debug) -else () - add_definitions(-DNDEBUG) - set(GODOT_CPP_LIB_BUILD_TYPE release) - set(OPENXR_MOBILE_LIB_BUILD_TYPE Release) -endif (CMAKE_BUILD_TYPE MATCHES Debug) - -# Check if ANDROID_NDK is set. -if (NOT ANDROID_NDK) - # Set to ANDROID_NDK_HOME environment variable if it's set. - if (DEFINED ENV{ANDROID_NDK_HOME}) - set(ANDROID_NDK $ENV{ANDROID_NDK_HOME}) - else (DEFINED ENV{ANDROID_NDK_HOME}) - message(WARNING "ANDROID_NDK_HOME is not set") - endif (DEFINED ENV{ANDROID_NDK_HOME}) -endif (NOT ANDROID_NDK) - -# Check if CMAKE_TOOLCHAIN_FILE is set. -if (NOT CMAKE_TOOLCHAIN_FILE) - set(CMAKE_TOOLCHAIN_FILE "${ANDROID_NDK}/build/cmake/android.toolchain.cmake") -endif (NOT CMAKE_TOOLCHAIN_FILE) - -if (NOT DEFINED BITS) - set(BITS 32) - if (CMAKE_SIZEOF_VOID_P EQUAL 8) - set(BITS 64) - endif (CMAKE_SIZEOF_VOID_P EQUAL 8) -endif (NOT DEFINED BITS) - -set(CMAKE_CXX_STANDARD 17) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS OFF) - - -add_definitions(-DANDROID_ENABLED) - -set(GODOT_COMPILE_FLAGS) -set(GODOT_LINKER_FLAGS) - -set(GODOT_LINKER_FLAGS "-Wl") - -set(GODOT_COMPILE_FLAGS "-fPIC -g -Wwrite-strings") -set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} -Wchar-subscripts -Wcomment -Wdisabled-optimization") -set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} -Wformat -Wformat=2 -Wformat-security -Wformat-y2k") -set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} -Wimport -Winit-self -Winline -Winvalid-pch") -set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} -Wlong-long -Wmissing-braces -Wmissing-format-attribute") -set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} -Wmissing-include-dirs -Wmissing-noreturn -Wpacked -Wpointer-arith") -set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} -Wredundant-decls -Wreturn-type -Wsequence-point") -set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} -Wswitch -Wswitch-enum -Wtrigraphs") -set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} -Wuninitialized -Wunknown-pragmas -Wunreachable-code -Wunused-label") -set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} -Wunused-value -Wvariadic-macros -Wvolatile-register-var -Wno-error=attributes") - -if (NOT CMAKE_SYSTEM_NAME STREQUAL "Android") - set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} -Wno-ignored-attributes") -endif () - -if (CMAKE_BUILD_TYPE MATCHES Debug) - set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} -fno-omit-frame-pointer -O0") -else () - set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} -O3") -endif (CMAKE_BUILD_TYPE MATCHES Debug) - -## godot-cpp library -set(GODOT_CPP_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../thirdparty/godot-cpp") -set(GODOT-CPP "godot-cpp") - -# Use the godot-cpp prebuilt static binary -set(GODOT_CPP_STATIC_LIB "${GODOT_CPP_DIR}/bin/libgodot-cpp.android.template_${GODOT_CPP_LIB_BUILD_TYPE}.${GODOT_CPP_LIB_ABI}.a") - -list(APPEND GODOT_CPP_INCLUDE_DIRECTORIES "${GODOT_CPP_DIR}/include") -list(APPEND GODOT_CPP_INCLUDE_DIRECTORIES "${GODOT_CPP_DIR}/gen/include") -list(APPEND GODOT_CPP_INCLUDE_DIRECTORIES "${GODOT_CPP_DIR}/gdextension") - -add_library(${GODOT-CPP} - STATIC - IMPORTED GLOBAL - INTERFACE_INCLUDE_DIRECTORIES "${GODOT_CPP_INCLUDE_DIRECTORIES}" - ) -set_target_properties(${GODOT-CPP} PROPERTIES IMPORTED_LOCATION ${GODOT_CPP_STATIC_LIB}) - - -## OpenXR headers -set(OPENXR_HEADERS_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../thirdparty/openxr/include") - - -# Common lib -set(COMMON_LIB_HEADERS_DIR ${CMAKE_CURRENT_LIST_DIR}/cpp/include) - -file(GLOB_RECURSE COMMON_LIB_SOURCES ${CMAKE_CURRENT_LIST_DIR}/cpp/*.c**) -file(GLOB_RECURSE COMMON_LIB_HEADERS ${CMAKE_CURRENT_LIST_DIR}/cpp/*.h**) diff --git a/plugin/src/main/java/org/godotengine/openxr/vendors/GodotOpenXR.kt b/plugin/src/main/java/org/godotengine/openxr/vendors/GodotOpenXR.kt index e6801c51..b8940b04 100644 --- a/plugin/src/main/java/org/godotengine/openxr/vendors/GodotOpenXR.kt +++ b/plugin/src/main/java/org/godotengine/openxr/vendors/GodotOpenXR.kt @@ -44,10 +44,13 @@ abstract class GodotOpenXR(godot: Godot?) : GodotPlugin(godot) { init { try { + Log.v(TAG, "Loading openxr_loader library") + System.loadLibrary("openxr_loader") + Log.v(TAG, "Loading godotopenxrvendors library") System.loadLibrary("godotopenxrvendors") } catch (e: UnsatisfiedLinkError) { - Log.e(TAG, "Unable to load godotopenxrvendors shared library") + Log.e(TAG, "Unable to load native libraries") } } } diff --git a/plugin/src/meta/meta.cmake b/plugin/src/meta/meta.cmake deleted file mode 100644 index da2ca325..00000000 --- a/plugin/src/meta/meta.cmake +++ /dev/null @@ -1,22 +0,0 @@ -cmake_minimum_required(VERSION 3.22.1) - -## OpenXR Mobile loader library -# Sets the path to the OpenXR mobile library directory. -set(OPENXR_MOBILE_ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../thirdparty/ovr_openxr_mobile_sdk/OpenXR") -set(OPENXR_MOBILE_HEADERS_DIR "${OPENXR_MOBILE_ROOT_DIR}/Include" CACHE STRING "") - -set(OPENXR_MOBILE_LIB_PATH "${OPENXR_MOBILE_ROOT_DIR}/Libs/Android/${ANDROID_ABI}/${OPENXR_MOBILE_LIB_BUILD_TYPE}/libopenxr_loader.so") -add_library(openxr_loader - SHARED - IMPORTED GLOBAL -) -set_target_properties(openxr_loader PROPERTIES IMPORTED_LOCATION ${OPENXR_MOBILE_LIB_PATH}) - -set(VENDOR_HEADERS_DIR "${OPENXR_MOBILE_HEADERS_DIR}") -set(OPENXR_LOADER "openxr_loader") - -## Setup the project sources -file(GLOB_RECURSE ANDROID_SOURCES ${CMAKE_CURRENT_LIST_DIR}/cpp/*.c**) -file(GLOB_RECURSE ANDROID_HEADERS ${CMAKE_CURRENT_LIST_DIR}/cpp/*.h**) - -add_definitions(-DMETA_VENDOR_ENABLED) diff --git a/plugin/src/pico/pico.cmake b/plugin/src/pico/pico.cmake deleted file mode 100644 index 964f914e..00000000 --- a/plugin/src/pico/pico.cmake +++ /dev/null @@ -1,13 +0,0 @@ -cmake_minimum_required(VERSION 3.22.1) - -## khronos OpenXR loader library -find_package(OpenXR REQUIRED CONFIG) - -set(VENDOR_HEADERS_DIR "") -set(OPENXR_LOADER "OpenXR::openxr_loader") - -## Setup the project sources -file(GLOB_RECURSE ANDROID_SOURCES ${CMAKE_CURRENT_LIST_DIR}/cpp/*.c**) -file(GLOB_RECURSE ANDROID_HEADERS ${CMAKE_CURRENT_LIST_DIR}/cpp/*.h**) - -add_definitions(-DPICO_VENDOR_ENABLED) diff --git a/thirdparty/godot-cpp b/thirdparty/godot-cpp index dfc51960..13cd2d92 160000 --- a/thirdparty/godot-cpp +++ b/thirdparty/godot-cpp @@ -1 +1 @@ -Subproject commit dfc51960f9563c6df39a1a0ab66350374f932897 +Subproject commit 13cd2d921c9bdd21869b17e69098e3c586524fdf diff --git a/thirdparty/ovr_openxr_mobile_sdk/OpenXR/Libs/Android/arm64-v8a/Debug/libopenxr_loader.so b/thirdparty/ovr_openxr_mobile_sdk/OpenXR/Libs/Android/Debug/arm64-v8a/libopenxr_loader.so similarity index 100% rename from thirdparty/ovr_openxr_mobile_sdk/OpenXR/Libs/Android/arm64-v8a/Debug/libopenxr_loader.so rename to thirdparty/ovr_openxr_mobile_sdk/OpenXR/Libs/Android/Debug/arm64-v8a/libopenxr_loader.so diff --git a/thirdparty/ovr_openxr_mobile_sdk/OpenXR/Libs/Android/arm64-v8a/Release/libopenxr_loader.so b/thirdparty/ovr_openxr_mobile_sdk/OpenXR/Libs/Android/Release/arm64-v8a/libopenxr_loader.so similarity index 100% rename from thirdparty/ovr_openxr_mobile_sdk/OpenXR/Libs/Android/arm64-v8a/Release/libopenxr_loader.so rename to thirdparty/ovr_openxr_mobile_sdk/OpenXR/Libs/Android/Release/arm64-v8a/libopenxr_loader.so diff --git a/thirdparty/ovr_openxr_mobile_sdk/OpenXR/Libs/Android/armeabi-v7a/Debug/libopenxr_loader.so b/thirdparty/ovr_openxr_mobile_sdk/OpenXR/Libs/Android/armeabi-v7a/Debug/libopenxr_loader.so deleted file mode 100755 index e0050945..00000000 Binary files a/thirdparty/ovr_openxr_mobile_sdk/OpenXR/Libs/Android/armeabi-v7a/Debug/libopenxr_loader.so and /dev/null differ diff --git a/thirdparty/ovr_openxr_mobile_sdk/OpenXR/Libs/Android/armeabi-v7a/Release/libopenxr_loader.so b/thirdparty/ovr_openxr_mobile_sdk/OpenXR/Libs/Android/armeabi-v7a/Release/libopenxr_loader.so deleted file mode 100755 index eb34a9d9..00000000 Binary files a/thirdparty/ovr_openxr_mobile_sdk/OpenXR/Libs/Android/armeabi-v7a/Release/libopenxr_loader.so and /dev/null differ