Skip to content

Commit

Permalink
Add meta scene capture api support (#53)
Browse files Browse the repository at this point in the history
* Add support for the Meta scene capture API
* Add Copyright notices.

---------

Co-authored-by: Gergely Kis <gergely.kis@migeran.com>
  • Loading branch information
m4gr3d and kisg authored Nov 21, 2023
1 parent a3499d9 commit 67777fb
Show file tree
Hide file tree
Showing 80 changed files with 17,937 additions and 20 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/build-addon-on-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,19 @@ jobs:
uses: actions/checkout@v3
with:
path: aar
submodules: recursive
- name: Set up Python (for SCons)
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Android dependencies
uses: nttld/setup-ndk@v1
with:
ndk-version: r23c
link-to-sdk: true
- name: Install scons
run: |
python -m pip install scons==4.0.0
- name: Setup java
uses: actions/setup-java@v3
with:
Expand All @@ -26,6 +39,10 @@ jobs:
- name: Create Godot OpenXR Vendors AARs
run: |
cd aar
cd thirdparty/godot-cpp
scons platform=android target=template_debug -j4
scons platform=android target=template_release -j4
cd ../..
./gradlew build
cd ..
# GODOT 4.2 ADDON GENERATION SECTION
Expand Down
21 changes: 20 additions & 1 deletion .github/workflows/mavencentral-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@ jobs:
steps:
- name: Check out code
uses: actions/checkout@v3
with:
submodules: recursive
- name: Set up Python (for SCons)
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Android dependencies
uses: nttld/setup-ndk@v1
with:
ndk-version: r23c
link-to-sdk: true
- name: Install scons
run: |
python -m pip install scons==4.0.0
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
Expand All @@ -23,7 +37,12 @@ jobs:

# Builds the release artifacts of the library
- name: Release build
run: ./gradlew -Prelease_version=${{ github.ref_name }} build
run: |
cd thirdparty/godot-cpp
scons platform=android target=template_debug -j4
scons platform=android target=template_release -j4
cd ../..
./gradlew -Prelease_version=${{ github.ref_name }} build
# Runs upload, and then closes & releases the repository
- name: Publish to MavenCentral
Expand Down
18 changes: 17 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
# Android Studio project files
*.iml
.gradle
/local.properties
/.idea
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties

# Visual Studio Code project files
.vscode

# Binaries
*.o
*.os
*.so
*.obj
*.bc
*.pyc
*.dblite
*.pdb
*.lib

# Misc
.DS_Store
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "thirdparty/godot-cpp"]
path = thirdparty/godot-cpp
url = https://github.com/godotengine/godot-cpp
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
- Update Meta OpenXR mobile SDK to version 57
- Update the java version to 17
- Rename the plugin to 'Godot OpenXR Vendors'
- Add godot-cpp dependency
- Add OpenXR 1.0.30 headers
- Add support for the Meta scene capture API (Donated by [Migeran](https://migeran.com))

## 1.1.0
- Update Meta OpenXR loader to version 54
Expand Down
3 changes: 1 addition & 2 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ Contributors

This plugin has been developed by or received contributions from:
- [Bastiaan Olij](https://github.com/BastiaanOlij)
- [Gergely Kis](https://github.com/kisg)
- Gabor Pal Korom
- [Migeran - Software Engineering and Consulting](https://migeran.com)
- [Dirk Steinmetz](https://github.com/rsjtdrjgfuzkfg)
- [Fredia Huya-Kouadio](https://github.com/m4gr3d)
- [Ron Bessems](https://github.com/rbessems)
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022-2023 Bastiaan Olij, Gergely Kis and contributors
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
Expand Down
35 changes: 31 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,42 @@ for support on prior versions of Godot 4.

## Building this asset

### Linux
You can build this asset after cloning by simply running:
After cloning this project, run the following command in the project root directory to initialize
the `godot-cpp` submodule:
```
git submodule update --init
```

### Building the Godot-CPP bindings
Build the Android C++ bindings using the following commands. To speed up compilation, add `-jN` at
the end of the SCons command line where `N` is the number of CPU threads you have on your system.
The example below uses 4 threads.
```
cd thirdparty/godot-cpp
scons target=template_debug -j4
scons target=template_release -j4
scons platform=android target=template_debug -j4
scons platform=android target=template_release -j4
```

When the command is completed, you should have static libraries stored in `thirdparty/godot-cpp/bin`
that will be used for compilation by the plugin.

### Building the Plugin

#### Linux / MacOS
Run the following command from the root directory to build the plugin:
```
scons target=template_debug -j4
scons target=template_release -j4
./gradlew build
```

### Windows
You can build this asset after cloning by simply running:
#### Windows
Run the following command from the root directory to build the plugin:
```
scons target=template_debug -j4
scons target=template_release -j4
gradlew.bat build
```

Expand Down
53 changes: 53 additions & 0 deletions SConstruct
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/usr/bin/env python
from glob import glob
from pathlib import Path

env = SConscript("thirdparty/godot-cpp/SConstruct")

opts = Variables('custom.py')
opts.Update(env)

# Add source files.
env.Append(CPPPATH=[
# Meta includes
"godotopenxrmeta/src/main/cpp",
"godotopenxrmeta/src/main/cpp/include",
"godotopenxrmeta/libs/ovr_openxr_mobile_sdk/OpenXR/Include",
# Common includes
"thirdparty/openxr/include/",
])

# Meta source files
sources = Glob("godotopenxrmeta/src/main/cpp/*.cpp")

meta_binary_path = 'demo/addons/godotopenxrvendors/meta/.bin'
meta_project_name = 'godotopenxrmeta'

# Create the library target
if env["platform"] == "android":
print("Use gradle to generate the Android binaries")
Exit(255)
elif env["platform"] == "macos":
meta_library = env.SharedLibrary(
"{0}/lib{1}.{2}.{3}.framework/{1}.{2}.{3}".format(
meta_binary_path,
meta_project_name,
env["platform"],
env["target"],
),
source=sources,
)
else:
meta_library = env.SharedLibrary(
"{}/lib{}.{}.{}.{}{}".format(
meta_binary_path,
meta_project_name,
env["platform"],
env["target"],
env["arch"],
env["SHLIBSUFFIX"],
),
source=sources,
)

Default(meta_library)
1 change: 1 addition & 0 deletions common/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
58 changes: 58 additions & 0 deletions common/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
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 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)


project(common LANGUAGES CXX)

## godot-cpp library
set(GODOT_CPP_DIR "${CMAKE_CURRENT_SOURCE_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_SOURCE_DIR}/../thirdparty/openxr/include")
36 changes: 36 additions & 0 deletions common/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
plugins {
id 'com.android.library'
id 'org.jetbrains.kotlin.android'
}

android {
namespace 'org.godotengine.openxr.vendors.common'
compileSdk versions.compileSdk

defaultConfig {
minSdk versions.minSdk
targetSdk versions.targetSdk
}
externalNativeBuild {
cmake {
path file('CMakeLists.txt')
version versions.cmakeVersion
}
}

packagingOptions {
doNotStrip '**/*.so'
}

compileOptions {
sourceCompatibility versions.javaVersion
targetCompatibility versions.javaVersion
}
kotlinOptions {
jvmTarget = versions.javaVersion
}
}

dependencies {
implementation "androidx.core:core-ktx:$versions.coreKtxVersion"
}
4 changes: 4 additions & 0 deletions common/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

</manifest>
13 changes: 7 additions & 6 deletions config.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ final stableGodotAndroidLib = "org.godotengine:godot:4.1.0.stable"

ext {
versions = [
gradlePluginVersion: '7.4.0',
compileSdk : 33,
minSdk : 21,
targetSdk : 33,
javaVersion : JavaVersion.VERSION_17,
nexusPublishVersion : '1.3.0',
gradlePluginVersion : '7.4.0',
compileSdk : 33,
minSdk : 21,
targetSdk : 33,
javaVersion : JavaVersion.VERSION_17,
nexusPublishVersion : '1.3.0',
kotlinVersion : '1.7.22',
coreKtxVersion : '1.12.0',
cmakeVersion : '3.22.1',
]

libraries = [
Expand Down
Loading

0 comments on commit 67777fb

Please sign in to comment.