diff --git a/.github/workflows/build-addon-on-push.yml b/.github/workflows/build-addon-on-push.yml index fb730ad6..280ca2d7 100644 --- a/.github/workflows/build-addon-on-push.yml +++ b/.github/workflows/build-addon-on-push.yml @@ -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: @@ -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: 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..33656702 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,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( diff --git a/build.gradle b/build.gradle index 2858ea4b..940ba27e 100644 --- a/build.gradle +++ b/build.gradle @@ -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 { diff --git a/config.gradle b/config.gradle index b1e4916d..bf49990c 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' ] diff --git a/plugin/CMakeLists.txt b/plugin/CMakeLists.txt deleted file mode 100644 index 6945ff71..00000000 --- a/plugin/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -cmake_minimum_required(VERSION 3.22.1) - -## Project definition -project(godotopenxrvendors LANGUAGES CXX) - -## Common dependencies -include(${PROJECT_SOURCE_DIR}/src/main/common.cmake) - -## Flavor dependencies -include(src/${FLAVOR}/${FLAVOR}.cmake) - -add_library(${PROJECT_NAME} - SHARED - ${ANDROID_SOURCES} - ${ANDROID_HEADERS} - ${COMMON_LIB_SOURCES} - ${COMMON_LIB_HEADERS} -) - -target_include_directories(${PROJECT_NAME} - SYSTEM PUBLIC - ${GODOT_CPP_INCLUDE_DIRECTORIES} - ${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}) diff --git a/plugin/build.gradle b/plugin/build.gradle index e4ebf618..33ff317b 100644 --- a/plugin/build.gradle +++ b/plugin/build.gradle @@ -25,12 +25,6 @@ android { abiFilters "arm64-v8a" } } - externalNativeBuild { - cmake { - path file('CMakeLists.txt') - version versions.cmakeVersion - } - } namespace = "org.godotengine.openxr.vendors" @@ -42,27 +36,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 +49,60 @@ 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', + ] + } + 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', + ] } } @@ -128,13 +148,6 @@ android { buildFeatures { prefab true - prefabPublishing true - } - - prefab { - godotopenxrvendors { - headers "src/main/cpp/include" - } } } @@ -142,13 +155,13 @@ 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) { @@ -156,10 +169,6 @@ task cleanAssets(type: Delete) { delete("src/main/assets/addons") } -task cleanCxx(type: Delete) { - delete(".cxx") -} - task copyDebugAARToAddons(type: Copy) { from 'build/outputs/aar' include 'godotopenxr-*-debug.aar' @@ -185,4 +194,3 @@ assemble.dependsOn(copyGdExtensionConfigToAssets) assemble.finalizedBy(copyDebugAARToAddons) assemble.finalizedBy(copyReleaseAARToAddons) clean.dependsOn(cleanAssets) -clean.dependsOn(cleanCxx) 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 6592deb6..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) - -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 71823834..89080fae 100644 --- a/plugin/src/main/java/org/godotengine/openxr/vendors/GodotOpenXR.kt +++ b/plugin/src/main/java/org/godotengine/openxr/vendors/GodotOpenXR.kt @@ -43,6 +43,13 @@ abstract class GodotOpenXR(godot: Godot?) : GodotPlugin(godot) { protected val TAG = GodotOpenXR::class.java.simpleName init { + try { + Log.v(TAG, "Loading openxr_loader library") + System.loadLibrary("openxr_loader") + } catch (e: UnsatisfiedLinkError) { + Log.e(TAG, "Unable to load openxr_loader shared library") + } + try { Log.v(TAG, "Loading godotopenxrvendors library") System.loadLibrary("godotopenxrvendors") 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/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