Skip to content

Commit

Permalink
Changes from hotfix OpenXR 1.0.28.2
Browse files Browse the repository at this point in the history
  • Loading branch information
rpavlik committed Jul 27, 2023
1 parent 3d02d70 commit ad7859d
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 33 deletions.
1 change: 1 addition & 0 deletions .reuse/dep5
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Upstream-Contact: Ryan Pavlik <openxr-speceditor AT khronos DOT org>
Source: https://khronos.org/registry/OpenXR/

Files: changes/*
HOTFIX
Copyright: 2019-2023, The Khronos Group Inc.
License: CC-BY-4.0

Expand Down
1 change: 1 addition & 0 deletions HOTFIX
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2
4 changes: 4 additions & 0 deletions changes/conformance/mr.2840.gl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
- issue.2053.gl
---
- Fix: Fix `<queries>` element contents in Android manifest.
6 changes: 5 additions & 1 deletion src/conformance/platform_specific/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />

<!-- If building externally with the OpenXR loader AAR, this would be merged in automatically. -->
<!-- for haptic feedback -->
<uses-permission android:name="android.permission.VIBRATE" />

<!-- If building externally with the OpenXR loader AAR, this would be merged in automatically. -->
<uses-permission android:name="org.khronos.openxr.permission.OPENXR" />
<uses-permission android:name="org.khronos.openxr.permission.OPENXR_SYSTEM" />

Expand All @@ -33,6 +35,8 @@
<!-- so client-side code of runtime/layers can talk to their service sides -->
<intent>
<action android:name="org.khronos.openxr.OpenXRRuntimeService" />
</intent>
<intent>
<action android:name="org.khronos.openxr.OpenXRApiLayerService" />
</intent>
</queries>
Expand Down
6 changes: 4 additions & 2 deletions src/loader/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@

<!-- so client-side code of runtime/layers can talk to their service sides -->
<intent>
<action android:name="org.khronos.openxr.OpenXRRuntimeService" />
<action android:name="org.khronos.openxr.OpenXRApiLayerService" />
<action android:name="org.khronos.openxr.OpenXRRuntimeService" />
</intent>
<intent>
<action android:name="org.khronos.openxr.OpenXRApiLayerService" />
</intent>
</queries>

Expand Down
4 changes: 3 additions & 1 deletion src/loader/AndroidManifest.xml.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.khronos.openxr.openxr_loader_for_android"
android:versionCode="1"
android:versionName="${MAJOR}.${MINOR}.${PATCH}${OPENXR_ANDROID_VERSION_SUFFIX}">
android:versionName="${OPENXR_FULL_VERSION}${OPENXR_ANDROID_VERSION_SUFFIX}">
<!--
Copyright (c) 2020-2023, The Khronos Group Inc.
SPDX-License-Identifier: Apache-2.0
Expand All @@ -17,6 +17,8 @@
<!-- so client-side code of runtime/layers can talk to their service sides -->
<intent>
<action android:name="org.khronos.openxr.OpenXRRuntimeService" />
</intent>
<intent>
<action android:name="org.khronos.openxr.OpenXRApiLayerService" />
</intent>
</queries>
Expand Down
8 changes: 4 additions & 4 deletions src/loader/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,11 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
target_compile_definitions(openxr_loader PRIVATE EXTRASYSCONFDIR="/etc")
endif()

set_target_properties(openxr_loader PROPERTIES SOVERSION "${MAJOR}" VERSION "${MAJOR}.${MINOR}.${PATCH}")
set_target_properties(openxr_loader PROPERTIES SOVERSION "${MAJOR}" VERSION "${OPENXR_FULL_VERSION}")

add_custom_target(
libopenxr_loader.so.${MAJOR}.${MINOR} ALL
COMMAND ${CMAKE_COMMAND} -E create_symlink libopenxr_loader.so.${MAJOR}.${MINOR}.${PATCH}
COMMAND ${CMAKE_COMMAND} -E create_symlink libopenxr_loader.so.${OPENXR_FULL_VERSION}
libopenxr_loader.so.${MAJOR}.${MINOR}
)
elseif(WIN32)
Expand Down Expand Up @@ -338,7 +338,7 @@ configure_package_config_file(
)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/OpenXRConfigVersion.cmake
VERSION "${MAJOR}.${MINOR}.${PATCH}"
VERSION "${OPENXR_FULL_VERSION}"
COMPATIBILITY SameMajorVersion
)
install(
Expand Down Expand Up @@ -401,5 +401,5 @@ elseif(ANDROID AND INSTALL_TO_ARCHITECTURE_PREFIXES)

# This gets used directly by build-aar.sh
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/openxr_loader_for_android.pom
${CMAKE_CURRENT_BINARY_DIR}/openxr_loader_for_android-${MAJOR}.${MINOR}.${PATCH}${OPENXR_ANDROID_VERSION_SUFFIX}.pom)
${CMAKE_CURRENT_BINARY_DIR}/openxr_loader_for_android-${OPENXR_FULL_VERSION}${OPENXR_ANDROID_VERSION_SUFFIX}.pom)
endif()
11 changes: 6 additions & 5 deletions src/loader/openxr_loader_for_android.pom
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!--
Copyright (c) 2020 The Khronos Group Inc.
SPDX-License-Identifier: Apache-2.0
Copyright (c) 2020-2023, The Khronos Group Inc.
SPDX-License-Identifier: Apache-2.0 OR MIT
-->
<groupId>org.khronos.openxr</groupId>
<artifactId>openxr_loader_for_android</artifactId>
<version>@MAJOR@.@MINOR@.@PATCH@@OPENXR_ANDROID_VERSION_SUFFIX@</version>
<version>@MAJOR@.@MINOR@.@PATCH@@OPENXR_SDK_HOTFIX_VERSION_SUFFIX@@OPENXR_ANDROID_VERSION_SUFFIX@</version>
<packaging>aar</packaging>
<name>OpenXR Loader for Android</name>
<description>The AAR for the OpenXR Loader as used on Android.</description>
Expand Down
47 changes: 33 additions & 14 deletions src/version.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,45 @@
set(MAJOR "0")
set(MINOR "0")
set(PATCH "0")
set(OPENXR_SDK_HOTFIX_VERSION)

if(EXISTS "${PROJECT_SOURCE_DIR}/specification/registry/xr.xml")
file(STRINGS ${PROJECT_SOURCE_DIR}/specification/registry/xr.xml lines REGEX "#define <name>XR_CURRENT_API_VERSION")
file(STRINGS ${PROJECT_SOURCE_DIR}/specification/registry/xr.xml lines REGEX "#define <name>XR_CURRENT_API_VERSION")
else()
file(STRINGS ${PROJECT_SOURCE_DIR}/include/openxr/openxr.h lines REGEX "#define XR_CURRENT_API_VERSION")
file(STRINGS ${PROJECT_SOURCE_DIR}/include/openxr/openxr.h lines REGEX "#define XR_CURRENT_API_VERSION")
endif()

list(LENGTH lines len)
if(${len} EQUAL 1)
list(GET lines 0 cur_line)
# Erase everything up to the open parentheses
string(REGEX REPLACE "^[^\(]+" "" VERSION_BEFORE_ERASED ${cur_line})
# Erase everything after the close parentheses
string(REGEX REPLACE "[^\)]+$" "" VERSION_AFTER_ERASED ${VERSION_BEFORE_ERASED})
# Erase the parentheses
string(REPLACE "(" "" VERSION_AFTER_ERASED2 ${VERSION_AFTER_ERASED})
string(REPLACE ")" "" VERSION_AFTER_ERASED3 ${VERSION_AFTER_ERASED2})
string(REPLACE " " "" VERSION_AFTER_ERASED4 ${VERSION_AFTER_ERASED3})
string(REGEX REPLACE "^([0-9]+)\\,[0-9]+\\,[0-9]+" "\\1" MAJOR "${VERSION_AFTER_ERASED4}")
string(REGEX REPLACE "^[0-9]+\\,([0-9]+)\\,[0-9]+" "\\1" MINOR "${VERSION_AFTER_ERASED4}")
string(REGEX REPLACE "^[0-9]+\\,[0-9]+\\,([0-9]+)" "\\1" PATCH "${VERSION_AFTER_ERASED4}")

# Grab just the stuff in the parentheses of XR_MAKE_VERSION( ),
# by replacing the whole line with the stuff in the parentheses
string(REGEX REPLACE "^.+\\(([^\)]+)\\).+$" "\\1" VERSION_WITH_WHITESPACE ${cur_line})

# Remove whitespace
string(REPLACE " " "" VERSION_NO_WHITESPACE ${VERSION_WITH_WHITESPACE})

# Grab components
string(REGEX REPLACE "^([0-9]+)\\,[0-9]+\\,[0-9]+" "\\1" MAJOR "${VERSION_NO_WHITESPACE}")
string(REGEX REPLACE "^[0-9]+\\,([0-9]+)\\,[0-9]+" "\\1" MINOR "${VERSION_NO_WHITESPACE}")
string(REGEX REPLACE "^[0-9]+\\,[0-9]+\\,([0-9]+)" "\\1" PATCH "${VERSION_NO_WHITESPACE}")
else()
message(FATAL_ERROR "Unable to fetch major/minor version from registry or header")
message(FATAL_ERROR "Unable to fetch major/minor/patch version from registry or header")
endif()

# Check for an SDK hotfix version indicator file.
if(EXISTS "${PROJECT_SOURCE_DIR}/HOTFIX")
file(STRINGS "${PROJECT_SOURCE_DIR}/HOTFIX" OPENXR_SDK_HOTFIX_VERSION)
endif()
if(OPENXR_SDK_HOTFIX_VERSION)
set(OPENXR_SDK_HOTFIX_VERSION_SUFFIX ".${OPENXR_SDK_HOTFIX_VERSION}")
endif()

set(OPENXR_VERSION "${MAJOR}.${MINOR}.${PATCH}")
set(OPENXR_FULL_VERSION "${OPENXR_VERSION}${OPENXR_SDK_HOTFIX_VERSION_SUFFIX}")

if(PROJECT_NAME STREQUAL "OPENXR")
# Only show the message if we aren't a subproject
message(STATUS "OpenXR ${OPENXR_FULL_VERSION}")
endif()
26 changes: 20 additions & 6 deletions src/version.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ class OpenXRVersion {
public int major;
public int minor;
public int patch;
public boolean hasHotfix;
public int hotfix;

/// Returns a version code for Android usage.
int getVersionCode() {
Expand All @@ -17,33 +19,45 @@ class OpenXRVersion {

@Override
String toString() {
"${major}.${minor}.${patch}"
if (hasHotfix) {
"${major}.${minor}.${patch}.${hotfix}"
} else {
"${major}.${minor}.${patch}"
}
}

/**
* Parses the registry (as a text file) or the openxr.h header to get the version.
* @param project Gradle project
* @param fn registry or header filename
* @param registryOrHeaderFile registry or header File
* @param hotfixFile HOTFIX File
* @return version parsed
*/
static def parseOpenXRVersionFile(Project project, def fn) {
def matches = project.file(fn).readLines().find {
static def parseOpenXRVersionFile(def registryOrHeaderFile, def hotfixFile) {
def matches = registryOrHeaderFile.readLines().find {
it.contains('XR_CURRENT_API_VERSION')
} =~ ~/\(([^\)]+)\)/
def components = matches[0][1].split(',').collect { it.replace(' ', '').trim() }
def version = new OpenXRVersion()
version.major = Integer.parseInt(components[0])
version.minor = Integer.parseInt(components[1])
version.patch = Integer.parseInt(components[2])

if (hotfixFile.exists()) {
version.hasHotfix = true
version.hotfix = Integer.parseInt(hotfixFile.text.trim())
}
version
}
}

class OpenXRVersionPlugin implements Plugin<Project> {

void apply(Project project) {
project.ext.versionOpenXR = OpenXRVersion.parseOpenXRVersionFile(project,
"${project.repoRoot}/specification/registry/xr.xml")
def registryFile = project.file("${project.repoRoot}/specification/registry/xr.xml")
def hotfixFile = project.file("${project.repoRoot}/HOTFIX")

project.ext.versionOpenXR = OpenXRVersion.parseOpenXRVersionFile(registryFile, hotfixFile)
project.group = "org.khronos.openxr"

if (project.file("${project.repoRoot}/SNAPSHOT").exists()) {
Expand Down

0 comments on commit ad7859d

Please sign in to comment.