Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Commit

Permalink
Dev 3.3.0 (#139)
Browse files Browse the repository at this point in the history
Version 3.3.0 of the Godot Quest plugin

- Upgrade to version 33.0 of the Oculus mobile SDK
- Upgrade to version 3.4.0 of the Godot Android library
- Misc bug fixes and features add
  • Loading branch information
Fredia Huya-Kouadio authored Nov 5, 2021
1 parent 7205e2c commit eadb1ff
Show file tree
Hide file tree
Showing 29 changed files with 648 additions and 279 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Clone the repository and **initialise the submodules** with `git submodule updat

#### Oculus Mobile SDK
- Download the [latest version](https://developer.oculus.com/downloads/package/oculus-mobile-sdk/)
(**Oculus Mobile SDK 27.0** (1.44.0) or higher) of the Oculus Mobile SDK and extract it into the
(**Oculus Mobile SDK 33.0** (1.50.0) or higher) of the Oculus Mobile SDK and extract it into the
`plugin/libs/ovr_sdk_mobile` directory (create the directory if it doesn't exist).
- If you change the default install location, update the `OVR_ROOT_DIR` cmake variable in the the
`plugin/CMakeLists.txt` build file to point to the Oculus Mobile SDK install location.
Expand All @@ -68,7 +68,7 @@ Clone the repository and **initialise the submodules** with `git submodule updat

#### Android SDK & NDK
- Download and setup
[Android Studio version **4.1** or higher](https://developer.android.com/studio).
[Android Studio version **4.2** or higher](https://developer.android.com/studio).
- After setup, ensure you have the latest versions by checking the [SDK Manager](https://developer.android.com/studio/intro/update.html#sdk-manager) for updates.
- Set the environment variable `ANDROID_HOME` to the Android SDK location.
- Follow the instructions [here](https://developer.android.com/studio/projects/install-ndk#specific-version) and install version **21.1.6352462** of the NDK.
Expand Down
12 changes: 6 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {

repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:$versions.gradlePluginVersion"
Expand All @@ -16,7 +16,7 @@ buildscript {
allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}

Expand Down Expand Up @@ -46,20 +46,20 @@ task generatePluginBinary(type: Copy) {
* This is mostly to be used by maintainers to update the https://github.com/GodotVR/godot-oculus-mobile-asset repo.
*/
task generateSharedLibs(type: Copy) {
dependsOn(":OVRMobile:externalNativeBuildDebug")
dependsOn(":OVRMobile:externalNativeBuildRelease")
dependsOn(":OVRMobile:externalNativeBuildFullDebug")
dependsOn(":OVRMobile:externalNativeBuildFullRelease")

// Specify the base directory. All following 'into' targets will be relative
// to this directory.
into("$outputDir/sharedLibs")

// Copy the generated debug shared libs into the outputs directory
from("plugin/build/intermediates/cmake/debug/obj") {
from("plugin/build/intermediates/cmake/fullDebug/obj") {
into("debug")
}

// Copy the generated release shared libs into the outputs directory
from("plugin/build/intermediates/cmake/release/obj") {
from("plugin/build/intermediates/cmake/fullRelease/obj") {
into("release")
}
}
13 changes: 8 additions & 5 deletions config.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
ext.versions = [
gradlePluginVersion: '4.1.0',
gradlePluginVersion: '4.2.1',
compileSdk : 30,
minSdk : 18,
minSdk : 19,
targetSdk : 30,
buildTools : '30.0.1',
kotlinVersion : '1.4.31',
ndkVersion : "21.3.6528147"
buildTools : '30.0.3',
kotlinVersion : '1.5.20',
ndkVersion : "21.4.7075529",
javaVersion : JavaVersion.VERSION_1_8,
libVersionCode : 30300,
libVersionName : '3.3.0'
]
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Sep 23 18:33:41 PDT 2020
#Wed Jun 23 23:40:19 PDT 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
170 changes: 2 additions & 168 deletions plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,171 +1,5 @@
cmake_minimum_required(VERSION 3.6)

# Default android abi is arm64-v8a
if (NOT ANDROID_ABI)
set(ANDROID_ABI "arm64-v8a")
endif (NOT ANDROID_ABI)

# Default android platform is android-24
if (NOT ANDROID_PLATFORM)
set(ANDROID_PLATFORM "android-24")
endif (NOT ANDROID_PLATFORM)

# 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(VRAPI_LIB_BUILD_TYPE Debug)
else ()
add_definitions(-DNDEBUG)
set(VRAPI_LIB_BUILD_TYPE Release)
endif (CMAKE_BUILD_TYPE MATCHES Debug)

if (NOT (ANDROID_STL STREQUAL "c++_shared"))
set(ANDROID_STL "c++_shared")
endif (NOT (ANDROID_STL STREQUAL "c++_shared"))

# 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)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

project(godot_ovrmobile VERSION 2.0.0)

###############################################################################
## PROJECT SETUP
## The variables below should be updated based on the setup instructions
## in the project README.

# Sets the path to the VrApi containing directory. Update this variable if the api is in another location.
set(OVR_ROOT_DIR "${CMAKE_SOURCE_DIR}/libs/ovr_sdk_mobile")

# Location to the Godot headers directory.
set(GODOT_CPP_DIR "${CMAKE_SOURCE_DIR}/libs/godot-cpp")
set(GODOT_HEADERS_DIR "${GODOT_CPP_DIR}/godot_headers")
###############################################################################

set(OVR_HEADERS_DIR "${OVR_ROOT_DIR}/VrApi/Include" CACHE STRING "")

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")
if (FLAVOR STREQUAL "FULL")
add_subdirectory(${CMAKE_SOURCE_DIR}/src/main/cpp)
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)

## OVR library
set(VRAPI_LIB_PATH "${OVR_ROOT_DIR}/VrApi/Libs/Android/${ANDROID_ABI}/${VRAPI_LIB_BUILD_TYPE}/libvrapi.so")
add_library(vrapi SHARED IMPORTED GLOBAL)
set_target_properties(vrapi PROPERTIES IMPORTED_LOCATION ${VRAPI_LIB_PATH})

## godot-cpp library
set(GODOT-CPP "godot-cpp")

file(GLOB_RECURSE GODOT_CPP_SOURCES ${GODOT_CPP_DIR}/src/*.c**)
file(GLOB_RECURSE GODOT_CPP_HEADERS ${GODOT_CPP_DIR}/include/*.h**)

add_library(${GODOT-CPP}
STATIC
${GODOT_CPP_SOURCES} ${GODOT_CPP_HEADERS})

target_include_directories(${GODOT-CPP}
PUBLIC
${GODOT_CPP_DIR}/include
${GODOT_CPP_DIR}/include/core
${GODOT_CPP_DIR}/include/gen
)

# Put godot headers as SYSTEM PUBLIC to exclude warnings from irrelevant headers
target_include_directories(${GODOT-CPP}
SYSTEM PUBLIC
${GODOT_HEADERS_DIR}
)

# Add the compile flags
set_property(TARGET ${GODOT-CPP} APPEND_STRING PROPERTY COMPILE_FLAGS ${GODOT_COMPILE_FLAGS})
set_property(TARGET ${GODOT-CPP} APPEND_STRING PROPERTY LINK_FLAGS ${GODOT_LINKER_FLAGS})

## Setup the plugin library
# Get Sources
file(GLOB_RECURSE SOURCES src/main/cpp/*.c**)
file(GLOB_RECURSE HEADERS src/main/cpp/*.h**)

add_library(${PROJECT_NAME}
SHARED
${SOURCES} ${HEADERS} VRAPI_SO_LIB)

target_include_directories(${PROJECT_NAME}
PRIVATE
src/main/cpp
${GODOT_CPP_DIR}/src
${GODOT_CPP_DIR}/src/core
${GODOT_CPP_DIR}/src/gen
${GODOT_CPP_DIR}/include
${GODOT_CPP_DIR}/include/core
${GODOT_CPP_DIR}/include/gen
)

# Put godot headers as SYSTEM PUBLIC to exclude warnings from irrelevant headers
target_include_directories(${PROJECT_NAME}
SYSTEM PUBLIC
${GODOT_HEADERS_DIR}
${OVR_HEADERS_DIR}
)

target_link_libraries(${PROJECT_NAME}
android
log
EGL
GLESv3
vrapi
${GODOT-CPP})

# 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})

# Copy the VrApi shared library to the output directory.
add_custom_command(OUTPUT VRAPI_SO_LIB
COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${PROJECT_NAME}>
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${VRAPI_LIB_PATH} $<TARGET_FILE_DIR:${PROJECT_NAME}>)

set(BITS 32)
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
set(BITS 64)
endif (CMAKE_SIZEOF_VOID_P EQUAL 8)
37 changes: 22 additions & 15 deletions plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,15 @@ android {
defaultConfig {
minSdkVersion versions.minSdk
targetSdkVersion versions.targetSdk
versionCode 8
versionName '3.1.0'
versionCode versions.libVersionCode
versionName versions.libVersionName
setProperty("archivesBaseName", "gdovrmobile.${versionName}")

externalNativeBuild {
cmake {
cppFlags "-std=c++14"
}
}

ndk {
abiFilters "arm64-v8a", "armeabi-v7a"
}
}

externalNativeBuild {
Expand All @@ -31,17 +27,28 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

buildFeatures {
prefabPublishing true
sourceCompatibility versions.javaVersion
targetCompatibility versions.javaVersion
}

prefab {
godot_ovrmobile {
headers "src/main/cpp"
flavorDimensions "functionality"
productFlavors {
full {
ndk {
abiFilters "arm64-v8a", "armeabi-v7a"
}
externalNativeBuild {
cmake {
arguments "-DFLAVOR=FULL"
}
}
}
stub {
externalNativeBuild {
cmake {
arguments "-DFLAVOR=STUB"
}
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion plugin/gdovrmobile.gdap
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

name="OVRMobile"
binary_type="local"
binary="gdovrmobile.3.1.0-release.aar"
binary="gdovrmobile.3.3.0-full-release.aar"
2 changes: 1 addition & 1 deletion plugin/libs/godot-cpp
Binary file not shown.
7 changes: 6 additions & 1 deletion plugin/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="org.godotengine.plugin.vr.oculus.mobile">
package="org.godotengine.plugin.vr.oculus.mobile"
android:versionCode="30300"
android:versionName="3.3.0">

<uses-sdk android:minSdkVersion="19"
android:targetSdkVersion="30" />

<uses-feature
android:name="android.hardware.vr.headtracking"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ reloadable=false
[entry]

Android.arm64-v8a="res://addons/godot_ovrmobile/libs/arm64-v8a/libgodot_ovrmobile.so"
Android.armeabi-v7a="res://addons/godot_ovrmobile/libs/armeabi-v7a/libgodot_ovrmobile.so"

[dependencies]

Android.arm64-v8a=[ "res://addons/godot_ovrmobile/libs/arm64-v8a/libvrapi.so" ]
Android.armeabi-v7a=[ "res://addons/godot_ovrmobile/libs/armeabi-v7a/libvrapi.so" ]
Loading

0 comments on commit eadb1ff

Please sign in to comment.