From 5f20d833b865dc3123168254be8461f684d5f283 Mon Sep 17 00:00:00 2001 From: Fredia Huya-Kouadio Date: Thu, 1 Feb 2024 11:09:55 -0800 Subject: [PATCH] Merge GDExtension into a single implementation Move all the gdextension logic intom the `common` directory so to share the same functionality across all vendors. For the editor, this enables a single `scons` build file and a single gdextension that can be loaded by the editor. For Android vendor platforms, we still maintains separate `cmake` build files which allows to omit / include platform specific dependencies via pre-processor directives in order to generate platform specific shared libraries, which are included in platform specific AAR binaries. --- .github/workflows/build-addon-on-push.yml | 47 +++++------- SConstruct | 43 ++++++++--- common/src/main/cpp/export/export_plugin.cpp | 2 +- .../main/cpp/export/khronos_export_plugin.cpp | 0 .../main/cpp/export/khronos_export_plugin.h | 0 .../main/cpp/export/lynx_export_plugin.cpp | 0 .../src/main/cpp/export/lynx_export_plugin.h | 0 .../main/cpp/export/meta_export_plugin.cpp | 0 .../src/main/cpp/export/meta_export_plugin.h | 0 .../main/cpp/export/pico_export_plugin.cpp | 0 .../src/main/cpp/export/pico_export_plugin.h | 0 ...penxr_fb_scene_capture_extension_wrapper.h | 1 - .../openxr_fb_scene_extension_wrapper.h | 1 - ...atial_entity_container_extension_wrapper.h | 1 - ...enxr_fb_spatial_entity_extension_wrapper.h | 1 - ...b_spatial_entity_query_extension_wrapper.h | 2 - ...nxr_fb_scene_capture_extension_wrapper.cpp | 0 .../openxr_fb_scene_extension_wrapper.cpp | 11 ++- ...ial_entity_container_extension_wrapper.cpp | 0 ...xr_fb_spatial_entity_extension_wrapper.cpp | 0 ...spatial_entity_query_extension_wrapper.cpp | 0 .../src/main/cpp/register_types.cpp | 25 +++++-- .../src/main/cpp/register_types.h | 0 config.gradle | 13 ++-- demo/.gitignore | 2 +- .../khronos/plugin.gdextension | 18 ----- .../lynx/plugin.gdextension | 16 ----- .../meta/plugin.gdextension | 16 ----- .../pico/plugin.gdextension | 16 ----- .../godotopenxrvendors/plugin.gdextension | 18 +++++ godotopenxrkhronos/CMakeLists.txt | 4 +- godotopenxrkhronos/SConstruct | 48 ------------- godotopenxrkhronos/build.gradle | 5 +- .../src/main/cpp/register_types.cpp | 72 ------------------- godotopenxrlynx/CMakeLists.txt | 4 +- godotopenxrlynx/SConstruct | 48 ------------- godotopenxrlynx/build.gradle | 5 +- .../src/main/cpp/register_types.cpp | 71 ------------------ godotopenxrlynx/src/main/cpp/register_types.h | 37 ---------- godotopenxrmeta/CMakeLists.txt | 4 +- godotopenxrmeta/SConstruct | 50 ------------- godotopenxrmeta/build.gradle | 13 ++-- godotopenxrmeta/src/main/cpp/register_types.h | 37 ---------- .../openxr/vendors/meta/GodotOpenXRMeta.kt | 8 +-- godotopenxrpico/CMakeLists.txt | 4 +- godotopenxrpico/SConstruct | 48 ------------- godotopenxrpico/build.gradle | 5 +- .../src/main/cpp/register_types.cpp | 71 ------------------ godotopenxrpico/src/main/cpp/register_types.h | 37 ---------- gradle/wrapper/gradle-wrapper.properties | 2 +- 50 files changed, 141 insertions(+), 665 deletions(-) rename {godotopenxrkhronos => common}/src/main/cpp/export/khronos_export_plugin.cpp (100%) rename {godotopenxrkhronos => common}/src/main/cpp/export/khronos_export_plugin.h (100%) rename {godotopenxrlynx => common}/src/main/cpp/export/lynx_export_plugin.cpp (100%) rename {godotopenxrlynx => common}/src/main/cpp/export/lynx_export_plugin.h (100%) rename {godotopenxrmeta => common}/src/main/cpp/export/meta_export_plugin.cpp (100%) rename {godotopenxrmeta => common}/src/main/cpp/export/meta_export_plugin.h (100%) rename {godotopenxrpico => common}/src/main/cpp/export/pico_export_plugin.cpp (100%) rename {godotopenxrpico => common}/src/main/cpp/export/pico_export_plugin.h (100%) rename {godotopenxrmeta/src/main/cpp => common/src/main/cpp/extensions}/include/openxr_fb_scene_capture_extension_wrapper.h (99%) rename {godotopenxrmeta/src/main/cpp => common/src/main/cpp/extensions}/include/openxr_fb_scene_extension_wrapper.h (99%) rename {godotopenxrmeta/src/main/cpp => common/src/main/cpp/extensions}/include/openxr_fb_spatial_entity_container_extension_wrapper.h (98%) rename {godotopenxrmeta/src/main/cpp => common/src/main/cpp/extensions}/include/openxr_fb_spatial_entity_extension_wrapper.h (99%) rename {godotopenxrmeta/src/main/cpp => common/src/main/cpp/extensions}/include/openxr_fb_spatial_entity_query_extension_wrapper.h (98%) rename {godotopenxrmeta/src/main/cpp => common/src/main/cpp/extensions}/openxr_fb_scene_capture_extension_wrapper.cpp (100%) rename {godotopenxrmeta/src/main/cpp => common/src/main/cpp/extensions}/openxr_fb_scene_extension_wrapper.cpp (95%) rename {godotopenxrmeta/src/main/cpp => common/src/main/cpp/extensions}/openxr_fb_spatial_entity_container_extension_wrapper.cpp (100%) rename {godotopenxrmeta/src/main/cpp => common/src/main/cpp/extensions}/openxr_fb_spatial_entity_extension_wrapper.cpp (100%) rename {godotopenxrmeta/src/main/cpp => common/src/main/cpp/extensions}/openxr_fb_spatial_entity_query_extension_wrapper.cpp (100%) rename {godotopenxrmeta => common}/src/main/cpp/register_types.cpp (86%) rename {godotopenxrkhronos => common}/src/main/cpp/register_types.h (100%) delete mode 100644 demo/addons/godotopenxrvendors/khronos/plugin.gdextension delete mode 100644 demo/addons/godotopenxrvendors/lynx/plugin.gdextension delete mode 100644 demo/addons/godotopenxrvendors/meta/plugin.gdextension delete mode 100644 demo/addons/godotopenxrvendors/pico/plugin.gdextension create mode 100644 demo/addons/godotopenxrvendors/plugin.gdextension delete mode 100644 godotopenxrkhronos/SConstruct delete mode 100644 godotopenxrkhronos/src/main/cpp/register_types.cpp delete mode 100644 godotopenxrlynx/SConstruct delete mode 100644 godotopenxrlynx/src/main/cpp/register_types.cpp delete mode 100644 godotopenxrlynx/src/main/cpp/register_types.h delete mode 100644 godotopenxrmeta/SConstruct delete mode 100644 godotopenxrmeta/src/main/cpp/register_types.h delete mode 100644 godotopenxrpico/SConstruct delete mode 100644 godotopenxrpico/src/main/cpp/register_types.cpp delete mode 100644 godotopenxrpico/src/main/cpp/register_types.h diff --git a/.github/workflows/build-addon-on-push.yml b/.github/workflows/build-addon-on-push.yml index 105359b1..69f78a1a 100644 --- a/.github/workflows/build-addon-on-push.yml +++ b/.github/workflows/build-addon-on-push.yml @@ -17,37 +17,43 @@ jobs: platform: linux flags: arch=x86_64 artifact_name: build-files-linux-x86_64 - artifact_path: aar/demo/addons/godotopenxrvendors/*/.bin/*.so + artifact_path: aar/demo/addons/godotopenxrvendors/.bin/linux/*/*/*.so # Not sure how to cross compile these # - name: Linux (arm64) # os: ubuntu-20.04 # platform: linux # flags: arch=arm64 # artifact_name: build-files-linux-arm64 - # artifact_path: aar/demo/addons/godotopenxrvendors/*/.bin/*.so + # artifact_path: aar/demo/addons/godotopenxrvendors/.bin/linux/*/*/*.so # - name: Linux (rv64) # os: ubuntu-20.04 # platform: linux # flags: arch=rv64 # artifact_name: build-files-linux-rv64 - # artifact_path: aar/demo/addons/godotopenxrvendors/*/.bin/*.so + # artifact_path: aar/demo/addons/godotopenxrvendors/.bin/linux/*/*/*.so - name: Windows os: windows-latest platform: windows artifact_name: build-files-windows - artifact_path: aar/demo/addons/godotopenxrvendors/*/.bin/*.dll + artifact_path: aar/demo/addons/godotopenxrvendors/.bin/windows/*/*/*.dll - name: MacOS os: macos-11 platform: macos flags: arch=universal artifact_name: build-files-macos - artifact_path: aar/demo/addons/godotopenxrvendors/*/.bin/*.framework - - name: Android + artifact_path: aar/demo/addons/godotopenxrvendors/.bin/macos/*/*.framework + - name: Android AAR os: ubuntu-20.04 platform: android flags: arch=arm64 - artifact_name: build-files-android - artifact_path: aar/demo/addons/godotopenxrvendors/*/.bin/*/*.aar + artifact_name: build-files-android-aar + artifact_path: aar/demo/addons/godotopenxrvendors/.bin/android/*/*.aar + - name: Android SO + os: ubuntu-20.04 + platform: android + flags: arch=arm64 + artifact_name: build-files-android-so + artifact_path: aar/demo/addons/godotopenxrvendors/.bin/android/*/*/*.so # 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 @@ -75,7 +81,6 @@ jobs: scons platform=${{ matrix.platform }} target=template_debug ${{ matrix.flags }} scons platform=${{ matrix.platform }} target=template_release ${{ matrix.flags }} cd .. - if: matrix.platform != 'android' # On Android we build our loaders and build our extension with gradlew - name: Setup java @@ -137,25 +142,11 @@ jobs: - name: Copying artifacts run: | - cp -r build-files-android/khronos/.bin asset/addons/godotopenxrvendors/khronos/ - cp -r build-files-android/lynx/.bin asset/addons/godotopenxrvendors/lynx/ - cp -r build-files-android/meta/.bin asset/addons/godotopenxrvendors/meta/ - cp -r build-files-android/pico/.bin asset/addons/godotopenxrvendors/pico/ - - cp build-files-linux-x86_64/khronos/.bin/*.so asset/addons/godotopenxrvendors/khronos/.bin/ - cp build-files-linux-x86_64/lynx/.bin/*.so asset/addons/godotopenxrvendors/lynx/.bin/ - cp build-files-linux-x86_64/meta/.bin/*.so asset/addons/godotopenxrvendors/meta/.bin/ - cp build-files-linux-x86_64/pico/.bin/*.so asset/addons/godotopenxrvendors/pico/.bin/ - - cp build-files-windows/khronos/.bin/*.dll asset/addons/godotopenxrvendors/khronos/.bin/ - cp build-files-windows/lynx/.bin/*.dll asset/addons/godotopenxrvendors/lynx/.bin/ - cp build-files-windows/meta/.bin/*.dll asset/addons/godotopenxrvendors/meta/.bin/ - cp build-files-windows/pico/.bin/*.dll asset/addons/godotopenxrvendors/pico/.bin/ - - cp -r build-files-macos/khronos/.bin/*.framework asset/addons/godotopenxrvendors/khronos/.bin/ - cp -r build-files-macos/lynx/.bin/*.framework asset/addons/godotopenxrvendors/lynx/.bin/ - cp -r build-files-macos/meta/.bin/*.framework asset/addons/godotopenxrvendors/meta/.bin/ - cp -r build-files-macos/pico/.bin/*.framework asset/addons/godotopenxrvendors/pico/.bin/ + cp -r build-files-android-aar/.bin/android asset/addons/godotopenxrvendors/.bin/ + cp -r build-files-android-so/.bin/android asset/addons/godotopenxrvendors/.bin/ + cp -r build-files-linux-x86_64/.bin/linux asset/addons/godotopenxrvendors/.bin/ + cp -r build-files-windows/.bin/windows asset/addons/godotopenxrvendors/.bin/ + cp -r build-files-macos/.bin/macos asset/addons/godotopenxrvendors/.bin/ - name: Create Godot OpenXR Vendor addon artifact uses: actions/upload-artifact@v3 diff --git a/SConstruct b/SConstruct index 9bf5d365..ce0588fd 100644 --- a/SConstruct +++ b/SConstruct @@ -13,12 +13,37 @@ env.Append(CPPPATH=[ "#thirdparty/openxr/include/", ]) -common_objects = [] -common_objects.append(env.SharedObject(Glob("#common/src/main/cpp/export/*.cpp"))) - -SConscript([ - "godotopenxrmeta/SConstruct", - "godotopenxrpico/SConstruct", - "godotopenxrlynx/SConstruct", - "godotopenxrkhronos/SConstruct", - ], 'env common_objects') +sources = [] +sources += Glob("#common/src/main/cpp/*.cpp") +sources += Glob("#common/src/main/cpp/export/*.cpp") +sources += Glob("#common/src/main/cpp/extensions/*.cpp") + +binary_path = '#demo/addons/godotopenxrvendors/.bin' +project_name = 'godotopenxr' + +# Create the library target +if env["platform"] == "macos": + library = env.SharedLibrary( + "{0}/{1}/{2}/lib{3}.{1}.framework/{3}.{1}".format( + binary_path, + env["platform"], + env["target"], + project_name, + ), + source=sources, + ) +else: + library = env.SharedLibrary( + "{}/{}/{}/{}/lib{}{}".format( + binary_path, + env["platform"], + env["target"], + env["arch"], + project_name, + env["SHLIBSUFFIX"], + ), + source=sources, + ) + +Default(library) + diff --git a/common/src/main/cpp/export/export_plugin.cpp b/common/src/main/cpp/export/export_plugin.cpp index b8d92ee1..1d620d98 100644 --- a/common/src/main/cpp/export/export_plugin.cpp +++ b/common/src/main/cpp/export/export_plugin.cpp @@ -66,7 +66,7 @@ String OpenXREditorExportPlugin::_get_name() const { String OpenXREditorExportPlugin::_get_android_aar_file_path(bool debug) const { const String debug_label = debug ? "debug" : "release"; - return "res://addons/godotopenxrvendors/" + _vendor + "/.bin/" + debug_label + "/godotopenxr" + _vendor + "-" + debug_label + ".aar"; + return "res://addons/godotopenxrvendors/.bin/android/" + debug_label + "/godotopenxr" + _vendor + "-" + debug_label + ".aar"; } String OpenXREditorExportPlugin::_get_android_maven_central_dependency() const { diff --git a/godotopenxrkhronos/src/main/cpp/export/khronos_export_plugin.cpp b/common/src/main/cpp/export/khronos_export_plugin.cpp similarity index 100% rename from godotopenxrkhronos/src/main/cpp/export/khronos_export_plugin.cpp rename to common/src/main/cpp/export/khronos_export_plugin.cpp diff --git a/godotopenxrkhronos/src/main/cpp/export/khronos_export_plugin.h b/common/src/main/cpp/export/khronos_export_plugin.h similarity index 100% rename from godotopenxrkhronos/src/main/cpp/export/khronos_export_plugin.h rename to common/src/main/cpp/export/khronos_export_plugin.h diff --git a/godotopenxrlynx/src/main/cpp/export/lynx_export_plugin.cpp b/common/src/main/cpp/export/lynx_export_plugin.cpp similarity index 100% rename from godotopenxrlynx/src/main/cpp/export/lynx_export_plugin.cpp rename to common/src/main/cpp/export/lynx_export_plugin.cpp diff --git a/godotopenxrlynx/src/main/cpp/export/lynx_export_plugin.h b/common/src/main/cpp/export/lynx_export_plugin.h similarity index 100% rename from godotopenxrlynx/src/main/cpp/export/lynx_export_plugin.h rename to common/src/main/cpp/export/lynx_export_plugin.h diff --git a/godotopenxrmeta/src/main/cpp/export/meta_export_plugin.cpp b/common/src/main/cpp/export/meta_export_plugin.cpp similarity index 100% rename from godotopenxrmeta/src/main/cpp/export/meta_export_plugin.cpp rename to common/src/main/cpp/export/meta_export_plugin.cpp diff --git a/godotopenxrmeta/src/main/cpp/export/meta_export_plugin.h b/common/src/main/cpp/export/meta_export_plugin.h similarity index 100% rename from godotopenxrmeta/src/main/cpp/export/meta_export_plugin.h rename to common/src/main/cpp/export/meta_export_plugin.h diff --git a/godotopenxrpico/src/main/cpp/export/pico_export_plugin.cpp b/common/src/main/cpp/export/pico_export_plugin.cpp similarity index 100% rename from godotopenxrpico/src/main/cpp/export/pico_export_plugin.cpp rename to common/src/main/cpp/export/pico_export_plugin.cpp diff --git a/godotopenxrpico/src/main/cpp/export/pico_export_plugin.h b/common/src/main/cpp/export/pico_export_plugin.h similarity index 100% rename from godotopenxrpico/src/main/cpp/export/pico_export_plugin.h rename to common/src/main/cpp/export/pico_export_plugin.h diff --git a/godotopenxrmeta/src/main/cpp/include/openxr_fb_scene_capture_extension_wrapper.h b/common/src/main/cpp/extensions/include/openxr_fb_scene_capture_extension_wrapper.h similarity index 99% rename from godotopenxrmeta/src/main/cpp/include/openxr_fb_scene_capture_extension_wrapper.h rename to common/src/main/cpp/extensions/include/openxr_fb_scene_capture_extension_wrapper.h index 5bb07558..a7c1f34c 100644 --- a/godotopenxrmeta/src/main/cpp/include/openxr_fb_scene_capture_extension_wrapper.h +++ b/common/src/main/cpp/extensions/include/openxr_fb_scene_capture_extension_wrapper.h @@ -35,7 +35,6 @@ #include #include -#include #include #include "util.h" diff --git a/godotopenxrmeta/src/main/cpp/include/openxr_fb_scene_extension_wrapper.h b/common/src/main/cpp/extensions/include/openxr_fb_scene_extension_wrapper.h similarity index 99% rename from godotopenxrmeta/src/main/cpp/include/openxr_fb_scene_extension_wrapper.h rename to common/src/main/cpp/extensions/include/openxr_fb_scene_extension_wrapper.h index 1a08360d..48372860 100644 --- a/godotopenxrmeta/src/main/cpp/include/openxr_fb_scene_extension_wrapper.h +++ b/common/src/main/cpp/extensions/include/openxr_fb_scene_extension_wrapper.h @@ -31,7 +31,6 @@ #include #include -#include #include #include #include diff --git a/godotopenxrmeta/src/main/cpp/include/openxr_fb_spatial_entity_container_extension_wrapper.h b/common/src/main/cpp/extensions/include/openxr_fb_spatial_entity_container_extension_wrapper.h similarity index 98% rename from godotopenxrmeta/src/main/cpp/include/openxr_fb_spatial_entity_container_extension_wrapper.h rename to common/src/main/cpp/extensions/include/openxr_fb_spatial_entity_container_extension_wrapper.h index 1748babf..da1f5678 100644 --- a/godotopenxrmeta/src/main/cpp/include/openxr_fb_spatial_entity_container_extension_wrapper.h +++ b/common/src/main/cpp/extensions/include/openxr_fb_spatial_entity_container_extension_wrapper.h @@ -31,7 +31,6 @@ #include #include -#include #include #include #include diff --git a/godotopenxrmeta/src/main/cpp/include/openxr_fb_spatial_entity_extension_wrapper.h b/common/src/main/cpp/extensions/include/openxr_fb_spatial_entity_extension_wrapper.h similarity index 99% rename from godotopenxrmeta/src/main/cpp/include/openxr_fb_spatial_entity_extension_wrapper.h rename to common/src/main/cpp/extensions/include/openxr_fb_spatial_entity_extension_wrapper.h index d50aa100..fd6791e9 100644 --- a/godotopenxrmeta/src/main/cpp/include/openxr_fb_spatial_entity_extension_wrapper.h +++ b/common/src/main/cpp/extensions/include/openxr_fb_spatial_entity_extension_wrapper.h @@ -31,7 +31,6 @@ #include #include -#include #include #include diff --git a/godotopenxrmeta/src/main/cpp/include/openxr_fb_spatial_entity_query_extension_wrapper.h b/common/src/main/cpp/extensions/include/openxr_fb_spatial_entity_query_extension_wrapper.h similarity index 98% rename from godotopenxrmeta/src/main/cpp/include/openxr_fb_spatial_entity_query_extension_wrapper.h rename to common/src/main/cpp/extensions/include/openxr_fb_spatial_entity_query_extension_wrapper.h index f0b08ec6..8cfe7250 100644 --- a/godotopenxrmeta/src/main/cpp/include/openxr_fb_spatial_entity_query_extension_wrapper.h +++ b/common/src/main/cpp/extensions/include/openxr_fb_spatial_entity_query_extension_wrapper.h @@ -31,8 +31,6 @@ #include #include -#include -#include #include #include #include diff --git a/godotopenxrmeta/src/main/cpp/openxr_fb_scene_capture_extension_wrapper.cpp b/common/src/main/cpp/extensions/openxr_fb_scene_capture_extension_wrapper.cpp similarity index 100% rename from godotopenxrmeta/src/main/cpp/openxr_fb_scene_capture_extension_wrapper.cpp rename to common/src/main/cpp/extensions/openxr_fb_scene_capture_extension_wrapper.cpp diff --git a/godotopenxrmeta/src/main/cpp/openxr_fb_scene_extension_wrapper.cpp b/common/src/main/cpp/extensions/openxr_fb_scene_extension_wrapper.cpp similarity index 95% rename from godotopenxrmeta/src/main/cpp/openxr_fb_scene_extension_wrapper.cpp rename to common/src/main/cpp/extensions/openxr_fb_scene_extension_wrapper.cpp index 7e28cda5..3aaa66f1 100644 --- a/godotopenxrmeta/src/main/cpp/openxr_fb_scene_extension_wrapper.cpp +++ b/common/src/main/cpp/extensions/openxr_fb_scene_extension_wrapper.cpp @@ -33,6 +33,10 @@ #include #include +#ifdef META_VENDOR_ENABLED +#include +#endif + #include "include/openxr_fb_spatial_entity_extension_wrapper.h" using namespace godot; @@ -97,11 +101,14 @@ std::optional OpenXRFbSceneExtensionWrapper::get_semantic_labels(const X // List from https://developer.oculus.com/documentation/native/android/mobile-scene-api-ref/ static const CharString recognizedLabels = "CEILING,DOOR_FRAME,FLOOR,INVISIBLE_WALL_FACE,WALL_ART,WALL_FACE,WINDOW_FRAME,COUCH,TABLE,BED,LAMP,PLANT,SCREEN,STORAGE,GLOBAL_MESH,OTHER"; + XrSemanticLabelsSupportFlagsFB flags = XR_SEMANTIC_LABELS_SUPPORT_MULTIPLE_SEMANTIC_LABELS_BIT_FB | XR_SEMANTIC_LABELS_SUPPORT_ACCEPT_DESK_TO_TABLE_MIGRATION_BIT_FB; +#ifdef META_VENDOR_ENABLED + flags |= XR_SEMANTIC_LABELS_SUPPORT_ACCEPT_INVISIBLE_WALL_FACE_BIT_FB; +#endif const XrSemanticLabelsSupportInfoFB semanticLabelsSupportInfo = { XR_TYPE_SEMANTIC_LABELS_SUPPORT_INFO_FB, nullptr, - XR_SEMANTIC_LABELS_SUPPORT_MULTIPLE_SEMANTIC_LABELS_BIT_FB | XR_SEMANTIC_LABELS_SUPPORT_ACCEPT_DESK_TO_TABLE_MIGRATION_BIT_FB | - XR_SEMANTIC_LABELS_SUPPORT_ACCEPT_INVISIBLE_WALL_FACE_BIT_FB, + flags, recognizedLabels.ptr(), }; diff --git a/godotopenxrmeta/src/main/cpp/openxr_fb_spatial_entity_container_extension_wrapper.cpp b/common/src/main/cpp/extensions/openxr_fb_spatial_entity_container_extension_wrapper.cpp similarity index 100% rename from godotopenxrmeta/src/main/cpp/openxr_fb_spatial_entity_container_extension_wrapper.cpp rename to common/src/main/cpp/extensions/openxr_fb_spatial_entity_container_extension_wrapper.cpp diff --git a/godotopenxrmeta/src/main/cpp/openxr_fb_spatial_entity_extension_wrapper.cpp b/common/src/main/cpp/extensions/openxr_fb_spatial_entity_extension_wrapper.cpp similarity index 100% rename from godotopenxrmeta/src/main/cpp/openxr_fb_spatial_entity_extension_wrapper.cpp rename to common/src/main/cpp/extensions/openxr_fb_spatial_entity_extension_wrapper.cpp diff --git a/godotopenxrmeta/src/main/cpp/openxr_fb_spatial_entity_query_extension_wrapper.cpp b/common/src/main/cpp/extensions/openxr_fb_spatial_entity_query_extension_wrapper.cpp similarity index 100% rename from godotopenxrmeta/src/main/cpp/openxr_fb_spatial_entity_query_extension_wrapper.cpp rename to common/src/main/cpp/extensions/openxr_fb_spatial_entity_query_extension_wrapper.cpp diff --git a/godotopenxrmeta/src/main/cpp/register_types.cpp b/common/src/main/cpp/register_types.cpp similarity index 86% rename from godotopenxrmeta/src/main/cpp/register_types.cpp rename to common/src/main/cpp/register_types.cpp index 3476bf0d..dea34005 100644 --- a/godotopenxrmeta/src/main/cpp/register_types.cpp +++ b/common/src/main/cpp/register_types.cpp @@ -37,14 +37,17 @@ #include #include -#include "include/openxr_fb_scene_extension_wrapper.h" -#include "include/openxr_fb_scene_capture_extension_wrapper.h" -#include "include/openxr_fb_spatial_entity_extension_wrapper.h" -#include "include/openxr_fb_spatial_entity_container_extension_wrapper.h" -#include "include/openxr_fb_spatial_entity_query_extension_wrapper.h" +#include "extensions/include/openxr_fb_scene_extension_wrapper.h" +#include "extensions/include/openxr_fb_scene_capture_extension_wrapper.h" +#include "extensions/include/openxr_fb_spatial_entity_extension_wrapper.h" +#include "extensions/include/openxr_fb_spatial_entity_container_extension_wrapper.h" +#include "extensions/include/openxr_fb_spatial_entity_query_extension_wrapper.h" #include "export/export_plugin.h" +#include "export/khronos_export_plugin.h" +#include "export/lynx_export_plugin.h" #include "export/meta_export_plugin.h" +#include "export/pico_export_plugin.h" using namespace godot; @@ -81,10 +84,20 @@ void initialize_plugin_module(ModuleInitializationLevel p_level) case MODULE_INITIALIZATION_LEVEL_EDITOR: { ClassDB::register_class(); + + ClassDB::register_class(); + ClassDB::register_class(); + EditorPlugins::add_by_type(); + + ClassDB::register_class(); + EditorPlugins::add_by_type(); + ClassDB::register_class(); ClassDB::register_class(); - EditorPlugins::add_by_type(); + + ClassDB::register_class(); + EditorPlugins::add_by_type(); } break; case MODULE_INITIALIZATION_LEVEL_MAX: diff --git a/godotopenxrkhronos/src/main/cpp/register_types.h b/common/src/main/cpp/register_types.h similarity index 100% rename from godotopenxrkhronos/src/main/cpp/register_types.h rename to common/src/main/cpp/register_types.h diff --git a/config.gradle b/config.gradle index 3a6e524c..66b2183a 100644 --- a/config.gradle +++ b/config.gradle @@ -1,23 +1,24 @@ ext { versions = [ - gradlePluginVersion : '7.4.0', - compileSdk : 33, + gradlePluginVersion : '8.2.0', + compileSdk : 34, minSdk : 21, - targetSdk : 33, + targetSdk : 34, javaVersion : JavaVersion.VERSION_17, nexusPublishVersion : '1.3.0', - kotlinVersion : '1.7.0', + kotlinVersion : '1.9.20', cmakeVersion : '3.22.1', + ndkVersion : '23.2.8568313' ] libraries = [ - godotAndroidLib: "org.godotengine:godot:4.2.0.stable", + godotAndroidLib: "org.godotengine:godot:4.2.1.stable", ] } // Parse the release version from the gradle project properties (e.g: -Prelease_version=) ext.getReleaseVersion = { -> - final String defaultVersion = "2.1.0-dev-SNAPSHOT" + final String defaultVersion = "3.0.0-dev-SNAPSHOT" String releaseVersion = project.hasProperty("release_version") ? project.property("release_version") : defaultVersion if (releaseVersion == null || releaseVersion.isEmpty()) { diff --git a/demo/.gitignore b/demo/.gitignore index 443378c0..2eb102db 100644 --- a/demo/.gitignore +++ b/demo/.gitignore @@ -1,4 +1,4 @@ # Godot 4+ specific ignores .godot/ -/addons/godotopenxrvendors/*/.bin +/addons/godotopenxrvendors/.bin /android/ diff --git a/demo/addons/godotopenxrvendors/khronos/plugin.gdextension b/demo/addons/godotopenxrvendors/khronos/plugin.gdextension deleted file mode 100644 index e5a424d3..00000000 --- a/demo/addons/godotopenxrvendors/khronos/plugin.gdextension +++ /dev/null @@ -1,18 +0,0 @@ -[configuration] - -entry_symbol = "plugin_library_init" -compatibility_minimum = "4.2" -android_aar_plugin = true - -[libraries] - -android.debug.arm64 = "res://addons/godotopenxrvendors/khronos/.bin/debug/arm64-v8a/libgodotopenxrkhronos.so" -android.release.arm64 = "res://addons/godotopenxrvendors/khronos/.bin/release/arm64-v8a/libgodotopenxrkhronos.so" -android.debug.x86_64 = "res://addons/godotopenxrvendors/khronos/.bin/debug/x86_64/libgodotopenxrkhronos.so" -android.release.x86_64 = "res://addons/godotopenxrvendors/khronos/.bin/release/x86_64/libgodotopenxrkhronos.so" -macos.debug = "res://addons/godotopenxrvendors/khronos/.bin/libgodotopenxrkhronos.macos.template_debug.framework" -macos.release = "res://addons/godotopenxrvendors/khronos/.bin/libgodotopenxrkhronos.macos.template_release.framework" -windows.debug.x86_64 = "res://addons/godotopenxrvendors/khronos/.bin/libgodotopenxrkhronos.windows.template_debug.x86_64.dll" -windows.release.x86_64 = "res://addons/godotopenxrvendors/khronos/.bin/libgodotopenxrkhronos.windows.template_release.x86_64.dll" -linux.debug.x86_64 = "res://addons/godotopenxrvendors/khronos/.bin/libgodotopenxrkhronos.linux.template_debug.x86_64.so" -linux.release.x86_64 = "res://addons/godotopenxrvendors/khronos/.bin/libgodotopenxrkhronos.linux.template_release.x86_64.so" diff --git a/demo/addons/godotopenxrvendors/lynx/plugin.gdextension b/demo/addons/godotopenxrvendors/lynx/plugin.gdextension deleted file mode 100644 index 6bb83da9..00000000 --- a/demo/addons/godotopenxrvendors/lynx/plugin.gdextension +++ /dev/null @@ -1,16 +0,0 @@ -[configuration] - -entry_symbol = "plugin_library_init" -compatibility_minimum = "4.2" -android_aar_plugin = true - -[libraries] - -android.debug.arm64 = "res://addons/godotopenxrvendors/lynx/.bin/debug/arm64-v8a/libgodotopenxrlynx.so" -android.release.arm64 = "res://addons/godotopenxrvendors/lynx/.bin/release/arm64-v8a/libgodotopenxrlynx.so" -macos.debug = "res://addons/godotopenxrvendors/lynx/.bin/libgodotopenxrlynx.macos.template_debug.framework" -macos.release = "res://addons/godotopenxrvendors/lynx/.bin/libgodotopenxrlynx.macos.template_release.framework" -windows.debug.x86_64 = "res://addons/godotopenxrvendors/lynx/.bin/libgodotopenxrlynx.windows.template_debug.x86_64.dll" -windows.release.x86_64 = "res://addons/godotopenxrvendors/lynx/.bin/libgodotopenxrlynx.windows.template_release.x86_64.dll" -linux.debug.x86_64 = "res://addons/godotopenxrvendors/lynx/.bin/libgodotopenxrlynx.linux.template_debug.x86_64.so" -linux.release.x86_64 = "res://addons/godotopenxrvendors/lynx/.bin/libgodotopenxrlynx.linux.template_release.x86_64.so" diff --git a/demo/addons/godotopenxrvendors/meta/plugin.gdextension b/demo/addons/godotopenxrvendors/meta/plugin.gdextension deleted file mode 100644 index 8055b2fc..00000000 --- a/demo/addons/godotopenxrvendors/meta/plugin.gdextension +++ /dev/null @@ -1,16 +0,0 @@ -[configuration] - -entry_symbol = "plugin_library_init" -compatibility_minimum = "4.2" -android_aar_plugin = true - -[libraries] - -android.debug.arm64 = "res://addons/godotopenxrvendors/meta/.bin/debug/arm64-v8a/libgodotopenxrmeta.so" -android.release.arm64 = "res://addons/godotopenxrvendors/meta/.bin/release/arm64-v8a/libgodotopenxrmeta.so" -macos.debug = "res://addons/godotopenxrvendors/meta/.bin/libgodotopenxrmeta.macos.template_debug.framework" -macos.release = "res://addons/godotopenxrvendors/meta/.bin/libgodotopenxrmeta.macos.template_release.framework" -windows.debug.x86_64 = "res://addons/godotopenxrvendors/meta/.bin/libgodotopenxrmeta.windows.template_debug.x86_64.dll" -windows.release.x86_64 = "res://addons/godotopenxrvendors/meta/.bin/libgodotopenxrmeta.windows.template_release.x86_64.dll" -linux.debug.x86_64 = "res://addons/godotopenxrvendors/meta/.bin/libgodotopenxrmeta.linux.template_debug.x86_64.so" -linux.release.x86_64 = "res://addons/godotopenxrvendors/meta/.bin/libgodotopenxrmeta.linux.template_release.x86_64.so" diff --git a/demo/addons/godotopenxrvendors/pico/plugin.gdextension b/demo/addons/godotopenxrvendors/pico/plugin.gdextension deleted file mode 100644 index 4d5117b0..00000000 --- a/demo/addons/godotopenxrvendors/pico/plugin.gdextension +++ /dev/null @@ -1,16 +0,0 @@ -[configuration] - -entry_symbol = "plugin_library_init" -compatibility_minimum = "4.2" -android_aar_plugin = true - -[libraries] - -android.debug.arm64 = "res://addons/godotopenxrvendors/pico/.bin/debug/arm64-v8a/libgodotopenxrpico.so" -android.release.arm64 = "res://addons/godotopenxrvendors/pico/.bin/release/arm64-v8a/libgodotopenxrpico.so" -macos.debug = "res://addons/godotopenxrvendors/pico/.bin/libgodotopenxrpico.macos.template_debug.framework" -macos.release = "res://addons/godotopenxrvendors/pico/.bin/libgodotopenxrpico.macos.template_release.framework" -windows.debug.x86_64 = "res://addons/godotopenxrvendors/pico/.bin/libgodotopenxrpico.windows.template_debug.x86_64.dll" -windows.release.x86_64 = "res://addons/godotopenxrvendors/pico/.bin/libgodotopenxrpico.windows.template_release.x86_64.dll" -linux.debug.x86_64 = "res://addons/godotopenxrvendors/pico/.bin/libgodotopenxrpico.linux.template_debug.x86_64.so" -linux.release.x86_64 = "res://addons/godotopenxrvendors/pico/.bin/libgodotopenxrpico.linux.template_release.x86_64.so" diff --git a/demo/addons/godotopenxrvendors/plugin.gdextension b/demo/addons/godotopenxrvendors/plugin.gdextension new file mode 100644 index 00000000..1396d835 --- /dev/null +++ b/demo/addons/godotopenxrvendors/plugin.gdextension @@ -0,0 +1,18 @@ +[configuration] + +entry_symbol = "plugin_library_init" +compatibility_minimum = "4.2" +android_aar_plugin = true + +[libraries] + +android.debug.arm64 = "res://addons/godotopenxrvendors/.bin/android/template_debug/arm64/libgodotopenxr.so" +android.release.arm64 = "res://addons/godotopenxrvendors/.bin/android/template_release/arm64/libgodotopenxr.so" +android.debug.x86_64 = "res://addons/godotopenxrvendors/.bin/android/template_debug/x86_64/libgodotopenxr.so" +android.release.x86_64 = "res://addons/godotopenxrvendors/.bin/android/template_release/x86_64/libgodotopenxr.so" +macos.debug = "res://addons/godotopenxrvendors/.bin/macos/template_debug/libgodotopenxr.macos.framework" +macos.release = "res://addons/godotopenxrvendors/.bin/macos/template_release/libgodotopenxr.macos.framework" +windows.debug.x86_64 = "res://addons/godotopenxrvendors/.bin/windows/template_debug/x86_64/libgodotopenxr.dll" +windows.release.x86_64 = "res://addons/godotopenxrvendors/.bin/windows/template_release/x86_64/libgodotopenxr.dll" +linux.debug.x86_64 = "res://addons/godotopenxrvendors/.bin/linux/template_debug/x86_64/libgodotopenxr.so" +linux.release.x86_64 = "res://addons/godotopenxrvendors/.bin/linux/template_release/x86_64/libgodotopenxr.so" diff --git a/godotopenxrkhronos/CMakeLists.txt b/godotopenxrkhronos/CMakeLists.txt index b8fb8525..14a5578b 100644 --- a/godotopenxrkhronos/CMakeLists.txt +++ b/godotopenxrkhronos/CMakeLists.txt @@ -5,7 +5,7 @@ include(${CMAKE_SOURCE_DIR}/../common/CMakeLists.txt) ## Project definition -project(godotopenxrkhronos LANGUAGES CXX) +project(godotopenxr LANGUAGES CXX) ## khronos OpenXR loader library set(KHRONOS_OPENXR_LIB_PATH "${CMAKE_SOURCE_DIR}/libs/khronos_openxr_sdk/${ANDROID_ABI}/libopenxr_loader.so") @@ -44,3 +44,5 @@ target_link_libraries(${CMAKE_PROJECT_NAME} # Add the compile flags set_property(TARGET ${CMAKE_PROJECT_NAME} APPEND_STRING PROPERTY COMPILE_FLAGS ${GODOT_COMPILE_FLAGS}) set_property(TARGET ${CMAKE_PROJECT_NAME} APPEND_STRING PROPERTY LINK_FLAGS ${GODOT_LINKER_FLAGS}) + +add_definitions(-DKHRONOS_VENDOR_ENABLED) \ No newline at end of file diff --git a/godotopenxrkhronos/SConstruct b/godotopenxrkhronos/SConstruct deleted file mode 100644 index c77ab709..00000000 --- a/godotopenxrkhronos/SConstruct +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env python -from glob import glob -from pathlib import Path - -Import("env", "common_objects") - -env_khronos = env.Clone() - -env_khronos.Append(CPPPATH=[ - "src/main/cpp", - ]) - -# Source files -sources = common_objects.copy() -sources += Glob("src/main/cpp/*.cpp") -sources += Glob("src/main/cpp/export/*.cpp") - -binary_path = '#demo/addons/godotopenxrvendors/khronos/.bin' -project_name = 'godotopenxrkhronos' - -# Create the library target -if env_khronos["platform"] == "android": - print("Use gradle to generate the Android binaries") - Exit(255) -elif env_khronos["platform"] == "macos": - library = env_khronos.SharedLibrary( - "{0}/lib{1}.{2}.{3}.framework/{1}.{2}.{3}".format( - binary_path, - project_name, - env_khronos["platform"], - env_khronos["target"], - ), - source=sources, - ) -else: - library = env_khronos.SharedLibrary( - "{}/lib{}.{}.{}.{}{}".format( - binary_path, - project_name, - env_khronos["platform"], - env_khronos["target"], - env_khronos["arch"], - env_khronos["SHLIBSUFFIX"], - ), - source=sources, - ) - -Default(library) diff --git a/godotopenxrkhronos/build.gradle b/godotopenxrkhronos/build.gradle index af62b419..2b492c6d 100644 --- a/godotopenxrkhronos/build.gradle +++ b/godotopenxrkhronos/build.gradle @@ -12,6 +12,7 @@ apply from: "../scripts/publish-module.gradle" android { compileSdk versions.compileSdk + ndkVersion versions.ndkVersion defaultConfig { minSdk versions.minSdk @@ -60,13 +61,13 @@ dependencies { task copyDebugAARToAddons(type: Copy) { from 'build/outputs/aar' include 'godotopenxrkhronos-debug.aar' - into '../demo/addons/godotopenxrvendors/khronos/.bin/debug' + into '../demo/addons/godotopenxrvendors/.bin/android/debug' } task copyReleaseAARToAddons(type: Copy) { from 'build/outputs/aar' include 'godotopenxrkhronos-release.aar' - into '../demo/addons/godotopenxrvendors/khronos/.bin/release' + into '../demo/addons/godotopenxrvendors/.bin/android/release' } assemble.finalizedBy(copyDebugAARToAddons) diff --git a/godotopenxrkhronos/src/main/cpp/register_types.cpp b/godotopenxrkhronos/src/main/cpp/register_types.cpp deleted file mode 100644 index 50fd8ac6..00000000 --- a/godotopenxrkhronos/src/main/cpp/register_types.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************/ -/* register_types.cpp */ -/**************************************************************************/ -/* This file is part of: */ -/* GODOT XR */ -/* https://godotengine.org */ -/**************************************************************************/ -/* Copyright (c) 2022-present Godot XR contributors (see CONTRIBUTORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/**************************************************************************/ - -#include "register_types.h" - -#include - -#include -#include -#include -#include - -#include "export/export_plugin.h" -#include "export/khronos_export_plugin.h" - -using namespace godot; - -void initialize_plugin_module(ModuleInitializationLevel p_level) { - switch (p_level) { - case MODULE_INITIALIZATION_LEVEL_EDITOR: { - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - - EditorPlugins::add_by_type(); - } break; - } -} - -void terminate_plugin_module(ModuleInitializationLevel p_level) -{ -} - -extern "C" -{ -GDExtensionBool GDE_EXPORT plugin_library_init(GDExtensionInterfaceGetProcAddress p_get_proc_address, GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization) -{ - godot::GDExtensionBinding::InitObject init_obj(p_get_proc_address, p_library, r_initialization); - - init_obj.register_initializer(initialize_plugin_module); - init_obj.register_terminator(terminate_plugin_module); - init_obj.set_minimum_library_initialization_level(MODULE_INITIALIZATION_LEVEL_EDITOR); - - return init_obj.init(); -} -} diff --git a/godotopenxrlynx/CMakeLists.txt b/godotopenxrlynx/CMakeLists.txt index e86578dd..c7034d28 100644 --- a/godotopenxrlynx/CMakeLists.txt +++ b/godotopenxrlynx/CMakeLists.txt @@ -5,7 +5,7 @@ include(${CMAKE_SOURCE_DIR}/../common/CMakeLists.txt) ## Project definition -project(godotopenxrlynx LANGUAGES CXX) +project(godotopenxr LANGUAGES CXX) ## lynx OpenXR loader library set(LYNX_OPENXR_LIB_PATH "${CMAKE_SOURCE_DIR}/libs/lynx_openxr_sdk/${ANDROID_ABI}/libopenxr_loader.so") @@ -44,3 +44,5 @@ target_link_libraries(${CMAKE_PROJECT_NAME} # Add the compile flags set_property(TARGET ${CMAKE_PROJECT_NAME} APPEND_STRING PROPERTY COMPILE_FLAGS ${GODOT_COMPILE_FLAGS}) set_property(TARGET ${CMAKE_PROJECT_NAME} APPEND_STRING PROPERTY LINK_FLAGS ${GODOT_LINKER_FLAGS}) + +add_definitions(-DLYNX_VENDOR_ENABLED) \ No newline at end of file diff --git a/godotopenxrlynx/SConstruct b/godotopenxrlynx/SConstruct deleted file mode 100644 index 917f9bef..00000000 --- a/godotopenxrlynx/SConstruct +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env python -from glob import glob -from pathlib import Path - -Import("env", "common_objects") - -env_lynx = env.Clone() - -env_lynx.Append(CPPPATH=[ - "src/main/cpp", - ]) - -# Source files -sources = common_objects.copy() -sources += Glob("src/main/cpp/*.cpp") -sources += Glob("src/main/cpp/export/*.cpp") - -binary_path = '#demo/addons/godotopenxrvendors/lynx/.bin' -project_name = 'godotopenxrlynx' - -# Create the library target -if env_lynx["platform"] == "android": - print("Use gradle to generate the Android binaries") - Exit(255) -elif env_lynx["platform"] == "macos": - library = env_lynx.SharedLibrary( - "{0}/lib{1}.{2}.{3}.framework/{1}.{2}.{3}".format( - binary_path, - project_name, - env_lynx["platform"], - env_lynx["target"], - ), - source=sources, - ) -else: - library = env_lynx.SharedLibrary( - "{}/lib{}.{}.{}.{}{}".format( - binary_path, - project_name, - env_lynx["platform"], - env_lynx["target"], - env_lynx["arch"], - env_lynx["SHLIBSUFFIX"], - ), - source=sources, - ) - -Default(library) diff --git a/godotopenxrlynx/build.gradle b/godotopenxrlynx/build.gradle index 32ca7405..6db2b4b6 100644 --- a/godotopenxrlynx/build.gradle +++ b/godotopenxrlynx/build.gradle @@ -11,6 +11,7 @@ apply from: "../scripts/publish-module.gradle" android { compileSdk versions.compileSdk + ndkVersion versions.ndkVersion defaultConfig { minSdk versions.minSdk @@ -59,13 +60,13 @@ dependencies { task copyDebugAARToAddons(type: Copy) { from 'build/outputs/aar' include 'godotopenxrlynx-debug.aar' - into '../demo/addons/godotopenxrvendors/lynx/.bin/debug' + into '../demo/addons/godotopenxrvendors/.bin/android/debug' } task copyReleaseAARToAddons(type: Copy) { from 'build/outputs/aar' include 'godotopenxrlynx-release.aar' - into '../demo/addons/godotopenxrvendors/lynx/.bin/release' + into '../demo/addons/godotopenxrvendors/.bin/android/release' } assemble.finalizedBy(copyDebugAARToAddons) diff --git a/godotopenxrlynx/src/main/cpp/register_types.cpp b/godotopenxrlynx/src/main/cpp/register_types.cpp deleted file mode 100644 index ba3491c7..00000000 --- a/godotopenxrlynx/src/main/cpp/register_types.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************/ -/* register_types.cpp */ -/**************************************************************************/ -/* This file is part of: */ -/* GODOT XR */ -/* https://godotengine.org */ -/**************************************************************************/ -/* Copyright (c) 2022-present Godot XR contributors (see CONTRIBUTORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/**************************************************************************/ - -#include "register_types.h" - -#include - -#include -#include -#include -#include - -#include "export/export_plugin.h" -#include "export/lynx_export_plugin.h" - -using namespace godot; - -void initialize_plugin_module(ModuleInitializationLevel p_level) { - switch (p_level) { - case MODULE_INITIALIZATION_LEVEL_EDITOR: { - ClassDB::register_class(); - ClassDB::register_class(); - - EditorPlugins::add_by_type(); - } break; - } -} - -void terminate_plugin_module(ModuleInitializationLevel p_level) -{ -} - -extern "C" -{ -GDExtensionBool GDE_EXPORT plugin_library_init(GDExtensionInterfaceGetProcAddress p_get_proc_address, GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization) -{ - godot::GDExtensionBinding::InitObject init_obj(p_get_proc_address, p_library, r_initialization); - - init_obj.register_initializer(initialize_plugin_module); - init_obj.register_terminator(terminate_plugin_module); - init_obj.set_minimum_library_initialization_level(MODULE_INITIALIZATION_LEVEL_EDITOR); - - return init_obj.init(); -} -} diff --git a/godotopenxrlynx/src/main/cpp/register_types.h b/godotopenxrlynx/src/main/cpp/register_types.h deleted file mode 100644 index cdf62ca1..00000000 --- a/godotopenxrlynx/src/main/cpp/register_types.h +++ /dev/null @@ -1,37 +0,0 @@ -/**************************************************************************/ -/* register_types.h */ -/**************************************************************************/ -/* This file is part of: */ -/* GODOT XR */ -/* https://godotengine.org */ -/**************************************************************************/ -/* Copyright (c) 2022-present Godot XR contributors (see CONTRIBUTORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/**************************************************************************/ - -#pragma once - -#include - -using namespace godot; - -void initialize_plugin_module(ModuleInitializationLevel p_level); -void terminate_plugin_module(ModuleInitializationLevel p_level); diff --git a/godotopenxrmeta/CMakeLists.txt b/godotopenxrmeta/CMakeLists.txt index 55d30c3b..e3631795 100644 --- a/godotopenxrmeta/CMakeLists.txt +++ b/godotopenxrmeta/CMakeLists.txt @@ -5,7 +5,7 @@ include(${CMAKE_SOURCE_DIR}/../common/CMakeLists.txt) ## Project definition -project(godotopenxrmeta LANGUAGES CXX) +project(godotopenxr LANGUAGES CXX) ## OpenXR Mobile loader library # Sets the path to the OpenXR mobile library directory. @@ -50,3 +50,5 @@ target_link_libraries(${CMAKE_PROJECT_NAME} # Add the compile flags set_property(TARGET ${CMAKE_PROJECT_NAME} APPEND_STRING PROPERTY COMPILE_FLAGS ${GODOT_COMPILE_FLAGS}) set_property(TARGET ${CMAKE_PROJECT_NAME} APPEND_STRING PROPERTY LINK_FLAGS ${GODOT_LINKER_FLAGS}) + +add_definitions(-DMETA_VENDOR_ENABLED) \ No newline at end of file diff --git a/godotopenxrmeta/SConstruct b/godotopenxrmeta/SConstruct deleted file mode 100644 index abc71a9e..00000000 --- a/godotopenxrmeta/SConstruct +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env python -from glob import glob -from pathlib import Path - -Import("env", "common_objects") - -env_meta = env.Clone() - -env_meta.Append(CPPPATH=[ - "src/main/cpp", - "src/main/cpp/include", - "libs/ovr_openxr_mobile_sdk/OpenXR/Include", - ]) - -# Source files -sources = common_objects.copy() -sources += Glob("src/main/cpp/*.cpp") -sources += Glob("src/main/cpp/export/*.cpp") - -binary_path = '#demo/addons/godotopenxrvendors/meta/.bin' -project_name = 'godotopenxrmeta' - -# Create the library target -if env_meta["platform"] == "android": - print("Use gradle to generate the Android binaries") - Exit(255) -elif env_meta["platform"] == "macos": - library = env_meta.SharedLibrary( - "{0}/lib{1}.{2}.{3}.framework/{1}.{2}.{3}".format( - binary_path, - project_name, - env_meta["platform"], - env_meta["target"], - ), - source=sources, - ) -else: - library = env_meta.SharedLibrary( - "{}/lib{}.{}.{}.{}{}".format( - binary_path, - project_name, - env_meta["platform"], - env_meta["target"], - env_meta["arch"], - env_meta["SHLIBSUFFIX"], - ), - source=sources, - ) - -Default(library) diff --git a/godotopenxrmeta/build.gradle b/godotopenxrmeta/build.gradle index 2233bce4..698a3728 100644 --- a/godotopenxrmeta/build.gradle +++ b/godotopenxrmeta/build.gradle @@ -11,6 +11,7 @@ apply from: "../scripts/publish-module.gradle" android { compileSdk versions.compileSdk + ndkVersion versions.ndkVersion defaultConfig { minSdk versions.minSdk @@ -56,8 +57,8 @@ android { } prefab { - godotopenxrmeta { - headers "src/main/cpp/include" + godotopenxr { + headers "../common/src/main/cpp/extensions/include" } } } @@ -69,21 +70,21 @@ dependencies { task copyDebugAARToAddons(type: Copy) { from 'build/outputs/aar' include 'godotopenxrmeta-debug.aar' - into '../demo/addons/godotopenxrvendors/meta/.bin/debug' + into '../demo/addons/godotopenxrvendors/.bin/android/debug' } task copyReleaseAARToAddons(type: Copy) { from 'build/outputs/aar' include 'godotopenxrmeta-release.aar' - into '../demo/addons/godotopenxrvendors/meta/.bin/release' + into '../demo/addons/godotopenxrvendors/.bin/android/release' } task copyGdExtensionConfigToAssets(type: Copy) { description 'Copy plugin.gdextension from the addons directory to the assets directory' - from '../demo/addons/godotopenxrvendors/meta/' + from '../demo/addons/godotopenxrvendors/' include 'plugin.gdextension' - into 'src/main/assets/addons/godotopenxrvendors/meta' + into 'src/main/assets/addons/godotopenxrvendors/' } preBuild.dependsOn(copyGdExtensionConfigToAssets) diff --git a/godotopenxrmeta/src/main/cpp/register_types.h b/godotopenxrmeta/src/main/cpp/register_types.h deleted file mode 100644 index cdf62ca1..00000000 --- a/godotopenxrmeta/src/main/cpp/register_types.h +++ /dev/null @@ -1,37 +0,0 @@ -/**************************************************************************/ -/* register_types.h */ -/**************************************************************************/ -/* This file is part of: */ -/* GODOT XR */ -/* https://godotengine.org */ -/**************************************************************************/ -/* Copyright (c) 2022-present Godot XR contributors (see CONTRIBUTORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/**************************************************************************/ - -#pragma once - -#include - -using namespace godot; - -void initialize_plugin_module(ModuleInitializationLevel p_level); -void terminate_plugin_module(ModuleInitializationLevel p_level); diff --git a/godotopenxrmeta/src/main/java/org/godotengine/openxr/vendors/meta/GodotOpenXRMeta.kt b/godotopenxrmeta/src/main/java/org/godotengine/openxr/vendors/meta/GodotOpenXRMeta.kt index b79e74cf..d30609dc 100644 --- a/godotopenxrmeta/src/main/java/org/godotengine/openxr/vendors/meta/GodotOpenXRMeta.kt +++ b/godotopenxrmeta/src/main/java/org/godotengine/openxr/vendors/meta/GodotOpenXRMeta.kt @@ -48,10 +48,10 @@ class GodotOpenXRMeta(godot: Godot?) : GodotPlugin(godot) { init { try { - Log.v(TAG, "Loading godotopenxrmeta library") - System.loadLibrary("godotopenxrmeta") + Log.v(TAG, "Loading godotopenxr library") + System.loadLibrary("godotopenxr") } catch (e: UnsatisfiedLinkError) { - Log.e(TAG, "Unable to load godotopenxrmeta shared library") + Log.e(TAG, "Unable to load godotopenxr shared library") } } } @@ -60,7 +60,7 @@ class GodotOpenXRMeta(godot: Godot?) : GodotPlugin(godot) { return "GodotOpenXRMeta" } - override fun getPluginGDExtensionLibrariesPaths() = setOf("res://addons/godotopenxrvendors/meta/plugin.gdextension") + override fun getPluginGDExtensionLibrariesPaths() = setOf("res://addons/godotopenxrvendors/plugin.gdextension") override fun onMainCreate(activity: Activity): View? { // Request the eye tracking permission if it's included in the manifest diff --git a/godotopenxrpico/CMakeLists.txt b/godotopenxrpico/CMakeLists.txt index b8dcabc6..c1f4c816 100644 --- a/godotopenxrpico/CMakeLists.txt +++ b/godotopenxrpico/CMakeLists.txt @@ -5,7 +5,7 @@ include(${CMAKE_SOURCE_DIR}/../common/CMakeLists.txt) ## Project definition -project(godotopenxrpico LANGUAGES CXX) +project(godotopenxr LANGUAGES CXX) ## Pico OpenXR loader library set(PICO_OPENXR_LIB_PATH "${CMAKE_SOURCE_DIR}/libs/pico_openxr_sdk/${ANDROID_ABI}/libopenxr_loader.so") @@ -44,3 +44,5 @@ target_link_libraries(${CMAKE_PROJECT_NAME} # Add the compile flags set_property(TARGET ${CMAKE_PROJECT_NAME} APPEND_STRING PROPERTY COMPILE_FLAGS ${GODOT_COMPILE_FLAGS}) set_property(TARGET ${CMAKE_PROJECT_NAME} APPEND_STRING PROPERTY LINK_FLAGS ${GODOT_LINKER_FLAGS}) + +add_definitions(-DPICO_VENDOR_ENABLED) \ No newline at end of file diff --git a/godotopenxrpico/SConstruct b/godotopenxrpico/SConstruct deleted file mode 100644 index 11014347..00000000 --- a/godotopenxrpico/SConstruct +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env python -from glob import glob -from pathlib import Path - -Import("env", "common_objects") - -env_pico = env.Clone() - -env_pico.Append(CPPPATH=[ - "src/main/cpp", - ]) - -# Source files -sources = common_objects.copy() -sources += Glob("src/main/cpp/*.cpp") -sources += Glob("src/main/cpp/export/*.cpp") - -binary_path = '#demo/addons/godotopenxrvendors/pico/.bin' -project_name = 'godotopenxrpico' - -# Create the library target -if env_pico["platform"] == "android": - print("Use gradle to generate the Android binaries") - Exit(255) -elif env_pico["platform"] == "macos": - library = env_pico.SharedLibrary( - "{0}/lib{1}.{2}.{3}.framework/{1}.{2}.{3}".format( - binary_path, - project_name, - env_pico["platform"], - env_pico["target"], - ), - source=sources, - ) -else: - library = env_pico.SharedLibrary( - "{}/lib{}.{}.{}.{}{}".format( - binary_path, - project_name, - env_pico["platform"], - env_pico["target"], - env_pico["arch"], - env_pico["SHLIBSUFFIX"], - ), - source=sources, - ) - -Default(library) diff --git a/godotopenxrpico/build.gradle b/godotopenxrpico/build.gradle index d502501f..c1c7573c 100644 --- a/godotopenxrpico/build.gradle +++ b/godotopenxrpico/build.gradle @@ -11,6 +11,7 @@ apply from: "../scripts/publish-module.gradle" android { compileSdk versions.compileSdk + ndkVersion versions.ndkVersion defaultConfig { minSdk versions.minSdk @@ -59,13 +60,13 @@ dependencies { task copyDebugAARToAddons(type: Copy) { from 'build/outputs/aar' include 'godotopenxrpico-debug.aar' - into '../demo/addons/godotopenxrvendors/pico/.bin/debug' + into '../demo/addons/godotopenxrvendors/.bin/android/debug' } task copyReleaseAARToAddons(type: Copy) { from 'build/outputs/aar' include 'godotopenxrpico-release.aar' - into '../demo/addons/godotopenxrvendors/pico/.bin/release' + into '../demo/addons/godotopenxrvendors/.bin/android/release' } assemble.finalizedBy(copyDebugAARToAddons) diff --git a/godotopenxrpico/src/main/cpp/register_types.cpp b/godotopenxrpico/src/main/cpp/register_types.cpp deleted file mode 100644 index d6eceefc..00000000 --- a/godotopenxrpico/src/main/cpp/register_types.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************/ -/* register_types.cpp */ -/**************************************************************************/ -/* This file is part of: */ -/* GODOT XR */ -/* https://godotengine.org */ -/**************************************************************************/ -/* Copyright (c) 2022-present Godot XR contributors (see CONTRIBUTORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/**************************************************************************/ - -#include "register_types.h" - -#include - -#include -#include -#include -#include - -#include "export/export_plugin.h" -#include "export/pico_export_plugin.h" - -using namespace godot; - -void initialize_plugin_module(ModuleInitializationLevel p_level) { - switch (p_level) { - case MODULE_INITIALIZATION_LEVEL_EDITOR: { - ClassDB::register_class(); - ClassDB::register_class(); - - EditorPlugins::add_by_type(); - } break; - } -} - -void terminate_plugin_module(ModuleInitializationLevel p_level) -{ -} - -extern "C" -{ -GDExtensionBool GDE_EXPORT plugin_library_init(GDExtensionInterfaceGetProcAddress p_get_proc_address, GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization) -{ - godot::GDExtensionBinding::InitObject init_obj(p_get_proc_address, p_library, r_initialization); - - init_obj.register_initializer(initialize_plugin_module); - init_obj.register_terminator(terminate_plugin_module); - init_obj.set_minimum_library_initialization_level(MODULE_INITIALIZATION_LEVEL_EDITOR); - - return init_obj.init(); -} -} diff --git a/godotopenxrpico/src/main/cpp/register_types.h b/godotopenxrpico/src/main/cpp/register_types.h deleted file mode 100644 index cdf62ca1..00000000 --- a/godotopenxrpico/src/main/cpp/register_types.h +++ /dev/null @@ -1,37 +0,0 @@ -/**************************************************************************/ -/* register_types.h */ -/**************************************************************************/ -/* This file is part of: */ -/* GODOT XR */ -/* https://godotengine.org */ -/**************************************************************************/ -/* Copyright (c) 2022-present Godot XR contributors (see CONTRIBUTORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/**************************************************************************/ - -#pragma once - -#include - -using namespace godot; - -void initialize_plugin_module(ModuleInitializationLevel p_level); -void terminate_plugin_module(ModuleInitializationLevel p_level); diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ca1301ea..66f61ac7 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Fri Mar 11 11:10:12 NZDT 2022 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME