diff --git a/.reuse/dep5 b/.reuse/dep5 index 9091bf0b..cefd0765 100644 --- a/.reuse/dep5 +++ b/.reuse/dep5 @@ -4,6 +4,7 @@ Upstream-Contact: Ryan Pavlik Source: https://khronos.org/registry/OpenXR/ Files: changes/* + HOTFIX Copyright: 2019-2023, The Khronos Group Inc. License: CC-BY-4.0 diff --git a/HOTFIX b/HOTFIX new file mode 100644 index 00000000..0cfbf088 --- /dev/null +++ b/HOTFIX @@ -0,0 +1 @@ +2 diff --git a/changes/conformance/mr.2840.gl.md b/changes/conformance/mr.2840.gl.md new file mode 100644 index 00000000..9860ffb9 --- /dev/null +++ b/changes/conformance/mr.2840.gl.md @@ -0,0 +1,4 @@ +--- +- issue.2053.gl +--- +- Fix: Fix `` element contents in Android manifest. diff --git a/src/conformance/platform_specific/AndroidManifest.xml b/src/conformance/platform_specific/AndroidManifest.xml index 32f17c06..66737109 100644 --- a/src/conformance/platform_specific/AndroidManifest.xml +++ b/src/conformance/platform_specific/AndroidManifest.xml @@ -21,8 +21,10 @@ - + + + @@ -33,6 +35,8 @@ + + diff --git a/src/loader/AndroidManifest.xml b/src/loader/AndroidManifest.xml index c5f71935..2817b34a 100644 --- a/src/loader/AndroidManifest.xml +++ b/src/loader/AndroidManifest.xml @@ -14,8 +14,10 @@ - - + + + + diff --git a/src/loader/AndroidManifest.xml.in b/src/loader/AndroidManifest.xml.in index ac2a0693..9bd8a460 100644 --- a/src/loader/AndroidManifest.xml.in +++ b/src/loader/AndroidManifest.xml.in @@ -1,7 +1,7 @@ + android:versionName="${OPENXR_FULL_VERSION}${OPENXR_ANDROID_VERSION_SUFFIX}"> + + diff --git a/src/loader/CMakeLists.txt b/src/loader/CMakeLists.txt index 9225bba2..22047fbc 100644 --- a/src/loader/CMakeLists.txt +++ b/src/loader/CMakeLists.txt @@ -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) @@ -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( @@ -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() diff --git a/src/loader/openxr_loader_for_android.pom b/src/loader/openxr_loader_for_android.pom index 130efb86..1b696ecc 100644 --- a/src/loader/openxr_loader_for_android.pom +++ b/src/loader/openxr_loader_for_android.pom @@ -1,13 +1,14 @@ - + org.khronos.openxr openxr_loader_for_android - @MAJOR@.@MINOR@.@PATCH@@OPENXR_ANDROID_VERSION_SUFFIX@ + @MAJOR@.@MINOR@.@PATCH@@OPENXR_SDK_HOTFIX_VERSION_SUFFIX@@OPENXR_ANDROID_VERSION_SUFFIX@ aar OpenXR Loader for Android The AAR for the OpenXR Loader as used on Android. diff --git a/src/version.cmake b/src/version.cmake index d863918d..5e64c70d 100644 --- a/src/version.cmake +++ b/src/version.cmake @@ -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 XR_CURRENT_API_VERSION") + file(STRINGS ${PROJECT_SOURCE_DIR}/specification/registry/xr.xml lines REGEX "#define 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() diff --git a/src/version.gradle b/src/version.gradle index 32cf7bf3..bd2aa658 100644 --- a/src/version.gradle +++ b/src/version.gradle @@ -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() { @@ -17,17 +19,22 @@ 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() } @@ -35,6 +42,11 @@ class 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 } } @@ -42,8 +54,10 @@ class OpenXRVersion { class OpenXRVersionPlugin implements Plugin { 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()) {