Merge tag 'v21.0.0' into debian/sid

v21.0.0
This commit is contained in:
Ryan Pavlik 2021-02-23 13:20:17 -06:00
commit 9fd66af16d
675 changed files with 86530 additions and 34322 deletions
.clang-tidy.gitignore.gitlab-ci.yml
.gitlab-ci
.reuse
CMakeLists.txt
LICENSES
README.mdbuild.gradle
cmake
doc
gradle.properties
gradle/wrapper
meson.buildmeson_options.txt
scripts
settings.gradle
src/external

View file

@ -2,7 +2,23 @@
# SPDX-License-Identifier: CC0-1.0
# SPDX-FileCopyrightText: 2018-2020 Collabora, Ltd. and the Monado contributors
# Ideally we'd turn back on a few of these that are disabled near the end
Checks: 'clang-diagnostic-*,clang-analyzer-*,performance-*,bugprone-*,cert-*,readability-*,misc-*,-modernize-*,-clang-analyzer-security.insecureAPI.strcpy,-bugprone-macro-parentheses,-readability-braces-around-statements,-misc-unused-parameters,-readability-implicit-bool-conversion,-clang-diagnostic-missing-field-initializers,-clang-diagnostic-missing-braces'
Checks: 'clang-diagnostic-*,
clang-analyzer-*,
performance-*,
bugprone-*,
cert-*,
readability-*,
misc-*,
-modernize-*,
-clang-analyzer-security.insecureAPI.strcpy,
-bugprone-macro-parentheses,
-readability-braces-around-statements,
-misc-unused-parameters,
-readability-implicit-bool-conversion,
-clang-diagnostic-missing-field-initializers,
-clang-diagnostic-missing-braces,
-readability-uppercase-literal-suffix,
-misc-non-private-member-variables-in-classes'
WarningsAsErrors: ''
HeaderFilterRegex: 'src/xrt/.*'
AnalyzeTemporaryDtors: false

35
.gitignore vendored
View file

@ -23,13 +23,18 @@ src/xrt/targets/gui/monado-gui
src/xrt/targets/openxr/intermediate_manifest.json
src/xrt/targets/targets_enabled_drivers.h
# ignore build trees
# Ignore Python caches
__pycache__/
# Ignore build trees
build/
build*/
# Ignore local settings
.vscode
*.autosave
.vs
CMakeSettings.json
# Ignore merge-conflict resolution files
*.orig
@ -37,14 +42,36 @@ build*/
# Ignore patches generated by scripts
patches/
# Imgui settings
# Ignore Imgui settings
imgui.ini
# files from package building
# Ignore files from package building
obj-*/
.pc/
# Arduino toolchain files
# Ignore Arduino toolchain files
src/xrt/drivers/arduino/device/*.elf
src/xrt/drivers/arduino/device/*.bin
# Ignore VSCode files
.vscode-ctags
# Ignore gradle-related and android studio-related things
*.iml
.gradle/
local.properties
.idea/*
# .idea/caches
# .idea/libraries
# .idea/modules.xml
# .idea/workspace.xml
# .idea/navEditor.xml
# .idea/assetWizardSettings.xml
.externalNativeBuild
.cxx
.settings
.project
gradlew
gradlew.bat
gradle-wrapper.jar

View file

@ -12,21 +12,21 @@ variables:
.monado.variables.debian-based-packages:
variables:
CORE_REQUIRED_PACKAGES: "build-essential git wget unzip cmake meson ninja-build libeigen3-dev curl patch python3 pkg-config libx11-dev libx11-xcb-dev libxxf86vm-dev libxrandr-dev libxcb-randr0-dev libvulkan-dev glslang-tools libglvnd-dev libgl1-mesa-dev ca-certificates libusb-1.0-0-dev libudev-dev"
FEATURE_PACKAGES: "libhidapi-dev libwayland-dev libuvc-dev libavcodec-dev libopencv-dev libv4l-dev libcjson-dev libsdl2-dev libegl1-mesa-dev"
PACKAGING_PACKAGES: "devscripts debhelper osc osc-plugins-dput dput-ng gettext-base"
FEATURE_PACKAGES: "libhidapi-dev libwayland-dev libuvc-dev libavcodec-dev libopencv-dev libv4l-dev libcjson-dev libsdl2-dev libegl1-mesa-dev libdbus-1-dev"
PACKAGING_PACKAGES: "devscripts debhelper osc osc-plugins-dput dput-ng gettext-base markdown"
TOOLS_REQUIRED_PACKAGES: "clang-format-7 codespell doxygen graphviz python3-pip python3-click"
# Variables for build and usage of Debian 10 (Buster) image
.monado.variables.debian:buster:
variables:
FDO_DISTRIBUTION_VERSION: buster
FDO_DISTRIBUTION_TAG: "2020-05-11.0"
FDO_DISTRIBUTION_TAG: "2020-07-10.0"
# Variables for build and usage of Ubuntu 20.04 LTS (Focal) image
.monado.variables.ubuntu:focal:
variables:
FDO_DISTRIBUTION_VERSION: "20.04"
FDO_DISTRIBUTION_TAG: "2020-05-11.1"
FDO_DISTRIBUTION_TAG: "2020-07-10.0"
# Variables for build and usage of Debian 10 (Buster) + Android NDK image
.monado.variables.debian:buster-ndk:
@ -362,7 +362,7 @@ reprepro:package:
- .monado.variables.debian:buster-ndk
- .fdo.suffixed-image@debian # from ci-templates
variables:
ANDROID_PLATFORM: 24
ANDROID_PLATFORM: 26
script:
- mkdir build
- pushd build

View file

@ -1,4 +1,6 @@
#!/bin/sh
# Copyright 2018-2020, Collabora, Ltd. and the Monado contributors
# SPDX-License-Identifier: BSL-1.0
(
cd $(dirname $0)

View file

@ -1,4 +1,6 @@
#!/bin/sh
# Copyright 2018-2020, Collabora, Ltd. and the Monado contributors
# SPDX-License-Identifier: BSL-1.0
# Install the OpenXR SDK, whatever version, installed system-wide.
git clone https://github.com/KhronosGroup/OpenXR-SDK

View file

@ -1,4 +1,6 @@
#!/bin/bash
# Copyright 2018-2020, Collabora, Ltd. and the Monado contributors
# SPDX-License-Identifier: BSL-1.0
(
cd $(dirname $0)

View file

@ -0,0 +1,3 @@
Copyright 2020, Collabora, Ltd.
SPDX-License-Identifier: BSL-1.0

View file

@ -1,3 +1,6 @@
# SPDX-FileCopyrightText: 2018-2020, Collabora, Ltd. and the Monado contributors
# SPDX-License-Identifier: CC0-1.0
[binaries]
c = '/usr/bin/i686-linux-gnu-gcc'
cpp = '/usr/bin/i686-linux-gnu-g++'

View file

@ -1,4 +1,7 @@
#!/bin/bash
# Copyright 2019-2020, Mesa contributors
# Copyright 2020, Collabora, Ltd.
# SPDX-License-Identifier: MIT
# Based on https://gitlab.freedesktop.org/mesa/mesa/-/blob/master/.gitlab-ci/container/x86_build.sh

View file

@ -1,4 +1,6 @@
#!/bin/sh
# Copyright 2018-2020, Collabora, Ltd. and the Monado contributors
# SPDX-License-Identifier: BSL-1.0
VERSION=r21
FN=android-ndk-${VERSION}-linux-x86_64.zip
wget https://dl.google.com/android/repository/$FN

View file

@ -0,0 +1,3 @@
Copyright 2020, Collabora, Ltd.
SPDX-License-Identifier: BSL-1.0

View file

@ -1,4 +1,6 @@
#!/bin/bash
# Copyright 2018-2020, Collabora, Ltd. and the Monado contributors
# SPDX-License-Identifier: BSL-1.0
(
cd $(dirname $0)

View file

@ -1,5 +1,6 @@
#!/bin/bash
# Copyright 2018-2020, Collabora, Ltd. and the Monado contributors
# SPDX-License-Identifier: BSL-1.0
(
cd $(dirname $0)
bash ./build-openxr-openhmd.sh

View file

@ -6,12 +6,16 @@ Files: doc/changes/drivers/*
doc/changes/misc_features/*
doc/changes/misc_fixes/*
doc/changes/state_trackers/*
doc/changes/ipc/*
doc/changes/xrt/*
doc/changes/auxiliary/*
doc/changes/compositor/*
Copyright: 2020, Collabora, Ltd. and the Monado contributors
License: CC0-1.0
Comment: Prevents needing a license header per fragment between releases.
Files: src/external/flexkalman/.clang-format
src/external/flexkalman/README.md
src/external/flexkalman/flexkalman/README.md
Copyright: 2015, 2016, Sensics, Inc.
2019, Collabora, Ltd.
License: Apache-2.0
@ -20,17 +24,79 @@ Comment: Copyright statement and license identifier missing.
Files: src/external/cjson/*
Copyright: 2009-2017, Dave Gamble and cJSON contributors
License: MIT
Comment: SPDX-Licence-Identifier missing.
Comment: SPDX-License-Identifier missing.
Debian calls this "Expat" for clarity.
Files: src/external/openxr_includes/*
Copyright: 2017-2019, The Khronos Group Inc.
License: Apache-2.0
Comment: SPDX-Licence-Identifier missing.
Files: src/external/Catch2/catch/*
Copyright: 2020, Two Blue Cubes Ltd.
License: BSL-1.0
Comment: SPDX-License-Identifier missing.
Files: src/external/openxr_includes/loader_interfaces.h
Copyright: 2017, LunarG, Inc.
2017, Valve Corporation
2017-2019, The Khronos Group Inc.
License: Apache-2.0
Comment: SPDX-Licence-Identifier missing.
Comment: SPDX-License-Identifier missing.
Files: src/external/jnipp/*
Copyright: 2016-2020, Mitchell Dowd
2020, Collabora, Ltd.
License: MIT
Comment: SPDX-License-Identifier missing.
Debian calls this "Expat" for clarity.
Files: src/external/hungarian/*
Copyright: 2016, mcximing
License: BSD-2-Clause
Comment: SPDX-License-Identifier missing.
Files: src/external/imgui/imgui*
src/external/imgui/imconfig.h
Copyright: 2014-2020, Omar Cornut
License: MIT
Comment: Copyright statement and license identifier missing.
Debian calls this "Expat" for clarity.
Files: src/external/imgui/implot*
Copyright: 2020, Evan Pezent
License: MIT
Comment: SPDX-License-Identifier missing.
Debian calls this "Expat" for clarity.
Files: src/external/imgui/cim*
Copyright: 2015, Stephan Dilly
License: MIT
Comment: Copyright statement and license identifier missing.
Debian calls this "Expat" for clarity.
Files: src/external/imgui/imstb*
Copyright: 2017, Sean Barrett
License: MIT OR Unlicense
Comment: SPDX-License-Identifier missing.
Files: src/external/glad/include/EGL/eglplatform.h
Copyright: 2007-2016, The Khronos Group Inc.
License: LicenseRef-Khronos-Free-Use-License-for-Software-and-Documentation
Comment: SPDX-License-Identifier missing.
Files: src/external/glad/include/KHR/khrplatform.h
Copyright: 2008-2018, The Khronos Group Inc.
License: LicenseRef-Khronos-Free-Use-License-for-Software-and-Documentation
Comment: SPDX-License-Identifier missing.
Files: src/external/glad/include/glad/egl.h
Copyright: 2013-2020, The Khronos Group, Inc.
License: Apache-2.0
Comment: This is generated from the specification XML (licensed as above) by GLAD2.
Files: src/external/glad/include/glad/gl.h
Copyright: 2013-2020, The Khronos Group, Inc.
License: Apache-2.0
Comment: This is generated from the specification XML (licensed as above) by GLAD2.
Files: src/external/glad/src/*
Copyright: 2013-2020, David Herberth
License: MIT
Comment: SPDX-License-Identifier missing.

View file

@ -1,8 +1,8 @@
# Copyright 2018-2020, Collabora, Ltd.
# SPDX-License-Identifier: BSL-1.0
cmake_minimum_required(VERSION 3.13.0)
project(XRT VERSION 0.3.0)
cmake_minimum_required(VERSION 3.10.2)
project(XRT VERSION 21.0.0)
# CMake 3.11 introduced CMP0072 - Prefer GLVND
if(POLICY CMP0072)
@ -19,13 +19,17 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(CMakeDependentOption)
include(SPIR-V)
include(GNUInstallDirs)
include(GetGitRevisionDescription)
git_describe(GIT_DESC "--always")
if(NOT ${CMAKE_VERSION} VERSION_LESS 3.9)
include(CheckIPOSupported)
check_ipo_supported(RESULT HAS_IPO)
endif()
find_package(Eigen3 REQUIRED)
find_package(Vulkan REQUIRED)
# Redundant mention of version is required because module defaults to looking for 2.91-compatible,
# which the config file for a 3.x says it's not compatible with.
find_package(Eigen3 3 REQUIRED)
find_package(Vulkan)
find_package(EGL)
find_package(HIDAPI)
find_package(OpenHMD)
@ -34,19 +38,45 @@ find_package(Libusb1)
find_package(JPEG)
find_package(realsense2 CONFIG)
find_package(SDL2 CONFIG)
find_package(Threads)
find_package(ZLIB)
find_package(cJSON)
find_package(Systemd)
find_package(OpenGLES COMPONENTS V3)
# @TODO Turn into a find_package LIBUVC file.
pkg_check_modules(LIBUVC libuvc)
# Android SDK doesn't look for 3.8 and 3.9, which is what new distros ship with.
set(Python_ADDITIONAL_VERSIONS 3.8 3.9)
if(NOT CMAKE_VERSION VERSION_LESS 3.12)
find_package(Python3 REQUIRED Interpreter)
set(PYTHON_EXECUTABLE Python3::Interpreter)
else()
find_package(PythonInterp REQUIRED VERSION 3)
if(PYTHON_EXECUTABLE MATCHES "WindowsApps")
# If you hit this error, you will have to install Python 3 or try harder to tell CMake where it is.
message(FATAL_ERROR "Found WindowsApps alias for Python. Make sure Python3 is installed, then choose 'Manage App Execution Aliases' in Start and disable the aliases for Python.")
endif()
endif()
# @TODO Turn into a find_package FFMPEG file.
pkg_check_modules(FFMPEG libavcodec)
add_library(xrt-pthreads INTERFACE)
if(WIN32)
find_package(pthreads_windows REQUIRED)
target_link_libraries(xrt-pthreads INTERFACE PThreads4W::PThreads4W_CXXEXC)
else()
set(CMAKE_THREAD_PREFER_PTHREAD ON)
find_package(Threads)
target_link_libraries(xrt-pthreads INTERFACE Threads::Threads)
endif()
if(NOT ANDROID)
# @TODO Turn into a find_package LIBUVC file.
pkg_check_modules(LIBUVC libuvc)
# @TODO Turn into a find_package FFMPEG file.
pkg_check_modules(FFMPEG libavcodec)
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(XRT_HAVE_LINUX YES)
# Compositor backend
find_package(X11)
find_package(PkgConfig)
@ -54,6 +84,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
find_package(udev REQUIRED)
set(XRT_HAVE_V4L2 TRUE)
if(PKGCONFIG_FOUND)
pkg_check_modules(XRANDR xrandr)
pkg_check_modules(XCB xcb xcb-randr x11-xcb)
pkg_search_module(WAYLAND wayland-client)
@ -63,31 +95,70 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
find_package(OpenGL COMPONENTS GLX)
pkg_search_module(DBUS dbus-1)
pkg_check_modules(GST
gstreamer-1.0
gstreamer-app-1.0
gstreamer-video-1.0
)
pkg_check_modules(SURVIVE IMPORTED_TARGET survive)
else()
find_package(OpenGL)
endif()
find_library(RT_LIBRARY rt)
if(ANDROID)
find_library(ANDROID_LIBRARY android)
find_library(ANDROID_LOG_LIBRARY log)
endif()
# This one is named differently because that's what CTest uses
option(BUILD_TESTING "Enable building of the test suite?" ON)
option(XRT_FEATURE_COLOR_LOG "Enable logging in color on supported platforms" ON)
cmake_dependent_option(CMAKE_INTERPROCEDURAL_OPTIMIZATION "Enable inter-procedural (link-time) optimization" OFF "HAS_IPO" OFF)
cmake_dependent_option(XRT_HAVE_WAYLAND "Enable Wayland support" ON "WAYLAND_FOUND AND WAYLAND_SCANNER_FOUND AND WAYLAND_PROTOCOLS_FOUND" OFF)
cmake_dependent_option(XRT_HAVE_XLIB "Enable xlib support" ON "X11_FOUND" OFF)
cmake_dependent_option(XRT_HAVE_XRANDR "Enable xlib-xrandr support" ON "XRANDR_FOUND" OFF)
cmake_dependent_option(XRT_HAVE_XCB "Enable xcb support" ON "XCB_FOUND" OFF)
cmake_dependent_option(XRT_HAVE_VULKAN "Enable Vulkan Graphics API support (also needed for compositor)" ON "VULKAN_FOUND" OFF)
cmake_dependent_option(XRT_HAVE_OPENGL "Enable OpenGL Graphics API support" ON "OPENGL_FOUND" OFF)
cmake_dependent_option(XRT_HAVE_EGL "Enable OpenGL on EGL Graphics API support" ON "XRT_HAVE_OPENGL AND EGL_FOUND" OFF)
cmake_dependent_option(XRT_HAVE_OPENGLES "Enable OpenGL-ES Graphics API support" ON "OpenGLES_FOUND" OFF)
cmake_dependent_option(XRT_HAVE_EGL "Enable OpenGL on EGL Graphics API support" ON "EGL_FOUND; XRT_HAVE_OPENGL OR XRT_HAVE_OPENGLES" OFF)
cmake_dependent_option(XRT_HAVE_DBUS "Enable dbus support (for BLE support)" ON "DBUS_FOUND" OFF)
cmake_dependent_option(XRT_FEATURE_COMPOSITOR_MAIN "Build main compositor host functionality" ON "XRT_HAVE_WAYLAND OR XRT_HAVE_XCB" OFF)
cmake_dependent_option(XRT_HAVE_VF "Enable gstreamer support (for video file support)" ON "GST_FOUND" OFF)
cmake_dependent_option(XRT_FEATURE_COMPOSITOR_MAIN "Build main compositor host functionality" ON "XRT_HAVE_VULKAN; XRT_HAVE_WAYLAND OR XRT_HAVE_XCB OR ANDROID OR WIN32" OFF)
cmake_dependent_option(XRT_FEATURE_OPENXR "Build OpenXR runtime target" ON "XRT_FEATURE_COMPOSITOR_MAIN" OFF)
cmake_dependent_option(XRT_FEATURE_SERVICE "Enable separate service module for OpenXR runtime" ON "XRT_FEATURE_COMPOSITOR_MAIN AND XRT_FEATURE_OPENXR" OFF)
cmake_dependent_option(XRT_FEATURE_SERVICE "Enable separate service module for OpenXR runtime" ON "NOT WIN32" OFF)
cmake_dependent_option(XRT_HAVE_SYSTEMD "Enable systemd support (for socket activation of service)" ON "Systemd_FOUND AND XRT_FEATURE_SERVICE" OFF)
cmake_dependent_option(XRT_INSTALL_SYSTEMD_UNIT_FILES "Install user unit files for systemd socket activation on installation" ON "XRT_HAVE_SYSTEMD" OFF)
cmake_dependent_option(XRT_INSTALL_ABSOLUTE_SYSTEMD_UNIT_FILES "Use an absolute path to monado-system in installed user unit files for systemd socket activation" ON "XRT_INSTALL_SYSTEMD_UNIT_FILES" OFF)
cmake_dependent_option(XRT_FEATURE_STEAMVR_PLUGIN "Build SteamVR plugin" ON "NOT ANDROID" OFF)
if(NOT DEFINED XRT_FEATURE_OPENXR_LAYER_DEPTH)
set(XRT_FEATURE_OPENXR_LAYER_DEPTH ON)
endif()
if(NOT DEFINED XRT_FEATURE_OPENXR_LAYER_CUBE)
set(XRT_FEATURE_OPENXR_LAYER_CUBE OFF)
endif()
if(NOT DEFINED XRT_FEATURE_OPENXR_LAYER_CYLINDER)
set(XRT_FEATURE_OPENXR_LAYER_CYLINDER ON)
endif()
if(NOT DEFINED XRT_FEATURE_OPENXR_LAYER_EQUIRECT2)
set(XRT_FEATURE_OPENXR_LAYER_EQUIRECT2 ON)
endif()
if(NOT DEFINED XRT_FEATURE_OPENXR_LAYER_EQUIRECT1)
set(XRT_FEATURE_OPENXR_LAYER_EQUIRECT1 ON)
endif()
# Most users won't touch these.
mark_as_advanced(XRT_FEATURE_COMPOSITOR_MAIN XRT_FEATURE_OPENXR)
# ILLIXR
set(ILLIXR_PATH "" CACHE PATH "Path to ILLIXR headers")
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(XRT_HAVE_LIBUDEV ON)
set(XRT_HAVE_INTERNAL_HID ON)
@ -105,13 +176,15 @@ cmake_dependent_option(XRT_HAVE_SYSTEM_CJSON "Enable cJSON from system, instead
cmake_dependent_option(XRT_BUILD_DRIVER_PSVR "Enable PSVR HMD driver" ON "HIDAPI_FOUND" OFF)
cmake_dependent_option(XRT_BUILD_DRIVER_RS "Enable RealSense device driver" ON "realsense2_FOUND" OFF)
cmake_dependent_option(XRT_BUILD_DRIVER_VIVE "Enable driver for HTC Vive, Vive Pro, Valve Index, and their controllers" ON "ZLIB_FOUND" OFF)
cmake_dependent_option(XRT_BUILD_DRIVER_VIVE "Enable driver for HTC Vive, Vive Pro, Valve Index, and their controllers" ON "ZLIB_FOUND AND XRT_HAVE_LINUX" OFF)
cmake_dependent_option(XRT_BUILD_DRIVER_OHMD "Enable OpenHMD driver" ON "OPENHMD_FOUND" OFF)
cmake_dependent_option(XRT_BUILD_DRIVER_HANDTRACKING "Enable Camera Hand Tracking driver" ON "XRT_HAVE_V4L2" OFF)
cmake_dependent_option(XRT_BUILD_DRIVER_DAYDREAM "Enable the Google Daydream View controller driver (BLE, via D-Bus)" ON "XRT_HAVE_DBUS" OFF)
cmake_dependent_option(XRT_BUILD_DRIVER_ARDUINO "Enable Arduino input device with BLE via via D-Bus" ON "XRT_HAVE_DBUS" OFF)
cmake_dependent_option(XRT_BUILD_DRIVER_ILLIXR "Enable ILLIXR driver" ON "ILLIXR_PATH" OFF)
option(XRT_BUILD_DRIVER_DUMMY "Enable dummy driver" ON)
cmake_dependent_option(XRT_BUILD_DRIVER_REMOTE "Enable remote debugging driver" ON "XRT_HAVE_LINUX OR ANDROID" OFF)
# These all use the Monado internal hid wrapper.
cmake_dependent_option(XRT_BUILD_DRIVER_HDK "Enable HDK driver" ON "XRT_HAVE_INTERNAL_HID" OFF)
@ -120,20 +193,62 @@ cmake_dependent_option(XRT_BUILD_DRIVER_HYDRA "Enable Hydra driver" ON "XRT_HAVE
cmake_dependent_option(XRT_BUILD_DRIVER_NS "Enable North Star driver" ON "XRT_HAVE_INTERNAL_HID" OFF)
# This one defaults to off, even if we find the deps.
cmake_dependent_option(XRT_BUILD_DRIVER_SURVIVE "Enable libsurvive driver" OFF "SURVIVE_FOUND" OFF)
cmake_dependent_option(XRT_BUILD_DRIVER_SURVIVE "Enable libsurvive driver" ON "SURVIVE_FOUND" OFF)
cmake_dependent_option(XRT_BUILD_DRIVER_ANDROID "Enable Android sensors driver" ON "ANDROID" OFF)
# You can set this from a superproject to add a driver
# All drivers must be listed in here to be included in the generated header!
list(APPEND AVAILABLE_DRIVERS ARDUINO DUMMY HDK HYDRA NS OHMD PSMV PSVR RS V4L2 VIVE DAYDREAM SURVIVE)
list(APPEND AVAILABLE_DRIVERS
"ANDROID"
"ARDUINO"
"DAYDREAM"
"DUMMY"
"HANDTRACKING"
"HDK"
"HYDRA"
"ILLIXR"
"NS"
"OHMD"
"PSMV"
"PSVR"
"RS"
"REMOTE"
"SURVIVE"
"V4L2"
"VIVE"
)
# Package name needs to be known by the native code itself.
# Can be overridden from outside/command line
if(ANDROID AND NOT XRT_ANDROID_PACKAGE)
if(XRT_FEATURE_SERVICE)
set(XRT_ANDROID_PACKAGE "org.freedesktop.monado.openxr_runtime.out_of_process")
else()
set(XRT_ANDROID_PACKAGE "org.freedesktop.monado.openxr_runtime.in_process")
endif()
endif()
###
# Flags
###
if(XRT_HAVE_XLIB AND NOT XRT_HAVE_XRANDR)
message(WARNING "XRT_HAVE_XLIB requires XRT_HAVE_XRANDR but XRT_HAVE_XRANDR is disabled")
endif()
if(XRT_HAVE_OPENGLES AND NOT XRT_HAVE_EGL)
message(FATAL_ERROR "XRT_HAVE_OPENGLES requires XRT_HAVE_EGL but XRT_HAVE_EGL is disabled")
endif()
if(XRT_HAVE_SDL2)
# Arch work around
if(NOT DEFINED SDL2_LIBRARIES)
set(SDL2_LIBRARIES SDL2::SDL2)
if(TARGET SDL2::SDL2-static)
set(SDL2_LIBRARIES SDL2::SDL2-static)
elseif(TARGET SDL2::SDL2)
set(SDL2_LIBRARIES SDL2::SDL2)
endif()
endif()
endif()
@ -141,16 +256,26 @@ endif()
if(XRT_HAVE_XCB)
set(VK_USE_PLATFORM_XCB_KHR TRUE)
endif()
if(XRT_HAVE_XCB AND XRT_HAVE_XLIB)
if(XRT_HAVE_XCB AND XRT_HAVE_XLIB AND XRT_HAVE_XRANDR)
set(VK_USE_PLATFORM_XLIB_XRANDR_EXT TRUE)
endif()
if(XRT_HAVE_WAYLAND)
set(VK_USE_PLATFORM_WAYLAND_KHR TRUE)
endif()
if(ANDROID)
set(VK_USE_PLATFORM_ANDROID_KHR TRUE)
endif()
if(WIN32)
set(VK_USE_PLATFORM_WIN32_KHR TRUE)
endif()
if (XRT_HAVE_VULKAN AND NOT ANDROID)
set(VK_USE_PLATFORM_DISPLAY_KHR TRUE)
endif()
if(NOT MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wall -Wextra -Wno-unused-parameter")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror-implicit-function-declaration -Werror=incompatible-pointer-types")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=int-conversion")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Wno-unused-parameter")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined")
@ -176,3 +301,52 @@ if(BUILD_TESTING)
include(CTest)
add_subdirectory(tests)
endif()
message(STATUS "#####----- Config -----#####")
message(STATUS "# GIT_DESC: ${GIT_DESC}")
message(STATUS "#")
message(STATUS "# WAYLAND: ${XRT_HAVE_WAYLAND}")
message(STATUS "# XLIB: ${XRT_HAVE_XLIB}")
message(STATUS "# XRANDR: ${XRT_HAVE_XRANDR}")
message(STATUS "# XCB: ${XRT_HAVE_XCB}")
message(STATUS "# OPENGL: ${XRT_HAVE_OPENGL}")
message(STATUS "# OPENGLES: ${XRT_HAVE_OPENGLES}")
message(STATUS "# VULKAN: ${XRT_HAVE_VULKAN}")
message(STATUS "# EGL: ${XRT_HAVE_EGL}")
message(STATUS "# DBUS: ${XRT_HAVE_DBUS}")
message(STATUS "# VF: ${XRT_HAVE_VF}")
message(STATUS "# LIBUSB: ${XRT_HAVE_LIBUSB}")
message(STATUS "# JPEG: ${XRT_HAVE_JPEG}")
message(STATUS "# OPENCV: ${XRT_HAVE_OPENCV}")
message(STATUS "# LIBUVC: ${XRT_HAVE_LIBUVC}")
message(STATUS "# FFMPEG: ${XRT_HAVE_FFMPEG}")
message(STATUS "# SDL2: ${XRT_HAVE_SDL2}")
message(STATUS "# SYSTEM_CJSON: ${XRT_HAVE_SYSTEM_CJSON}")
message(STATUS "#")
message(STATUS "# FEATURE_COMPOSITOR_MAIN: ${XRT_FEATURE_COMPOSITOR_MAIN}")
message(STATUS "# FEATURE_SERVICE: ${XRT_FEATURE_SERVICE}")
message(STATUS "# FEATURE_OPENXR: ${XRT_FEATURE_OPENXR}")
message(STATUS "# FEATURE_OPENXR_LAYER_DEPTH: ${XRT_FEATURE_OPENXR_LAYER_DEPTH}")
message(STATUS "# FEATURE_OPENXR_LAYER_CUBE: ${XRT_FEATURE_OPENXR_LAYER_CUBE}")
message(STATUS "# FEATURE_OPENXR_LAYER_CYLINDER: ${XRT_FEATURE_OPENXR_LAYER_CYLINDER}")
message(STATUS "# FEATURE_OPENXR_LAYER_EQUIRECT2: ${XRT_FEATURE_OPENXR_LAYER_EQUIRECT2}")
message(STATUS "# FEATURE_OPENXR_LAYER_EQUIRECT1: ${XRT_FEATURE_OPENXR_LAYER_EQUIRECT1}")
message(STATUS "# FEATURE_STEAMVR_PLUGIN: ${XRT_FEATURE_STEAMVR_PLUGIN}")
message(STATUS "#")
message(STATUS "# DRIVER_ANDROID: ${XRT_BUILD_DRIVER_ANDROID}")
message(STATUS "# DRIVER_ARDUINO: ${XRT_BUILD_DRIVER_ARDUINO}")
message(STATUS "# DRIVER_DAYDREAM: ${XRT_BUILD_DRIVER_DAYDREAM}")
message(STATUS "# DRIVER_DUMMY: ${XRT_BUILD_DRIVER_DUMMY}")
message(STATUS "# DRIVER_HANDTRACKING: ${XRT_BUILD_DRIVER_HANDTRACKING}")
message(STATUS "# DRIVER_HDK: ${XRT_BUILD_DRIVER_HDK}")
message(STATUS "# DRIVER_HYDRA: ${XRT_BUILD_DRIVER_HYDRA}")
message(STATUS "# DRIVER_ILLIXR: ${XRT_BUILD_DRIVER_ILLIXR}")
message(STATUS "# DRIVER_NS: ${XRT_BUILD_DRIVER_NS}")
message(STATUS "# DRIVER_OHMD: ${XRT_BUILD_DRIVER_OHMD}")
message(STATUS "# DRIVER_PSMV: ${XRT_BUILD_DRIVER_PSMV}")
message(STATUS "# DRIVER_PSVR: ${XRT_BUILD_DRIVER_PSVR}")
message(STATUS "# DRIVER_RS: ${XRT_BUILD_DRIVER_RS}")
message(STATUS "# DRIVER_REMOTE: ${XRT_BUILD_DRIVER_REMOTE}")
message(STATUS "# DRIVER_SURVIVE: ${XRT_BUILD_DRIVER_SURVIVE}")
message(STATUS "# DRIVER_VIVE: ${XRT_BUILD_DRIVER_VIVE}")
message(STATUS "#####----- Config -----#####")

22
LICENSES/BSD-2-Clause.txt Normal file
View file

@ -0,0 +1,22 @@
Copyright (c) <year> <owner>. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View file

@ -0,0 +1,18 @@
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and/or associated documentation files (the
"Materials"), to deal in the Materials without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Materials, and to
permit persons to whom the Materials are 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 Materials.
THE MATERIALS ARE 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
MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.

120
README.md
View file

@ -1,8 +1,18 @@
# Monado - XR Runtime (XRT)
<!--
Copyright 2018-2020, Collabora, Ltd.
SPDX-License-Identifier: CC-BY-4.0
This must stay in sync with the last section!
-->
> * Main homepage and documentation: <https://monado.freedesktop.org/>
> * Promotional homepage: <https://monado.dev>
> * Maintained at <https://gitlab.freedesktop.org/monado/monado>
> * Latest API documentation: <https://monado.pages.freedesktop.org/monado>
> * Continuously-updated changelog of the default branch:
> <https://monado.pages.freedesktop.org/monado/md__c_h_a_n_g_e_l_o_g.html>
Monado is an open source XR runtime delivering immersive experiences such as VR
and AR on mobile, PC/desktop, and any other device
@ -28,13 +38,13 @@ and aims to support other operating systems in the near future.
Dependencies include:
* [CMake][] 3.13 or newer (Note Ubuntu 18.04 only has 3.10)
* Vulkan headers
* [CMake][] 3.13 or newer (Note Ubuntu 18.04 only has 3.10) or meson >= 0.49
* Vulkan headers and loader - Fedora package `vulkan-loader-devel`
* OpenGL headers
* Eigen3
* glslangValidator - Debian/Ubuntu package `glslang-tools`.
* glslangValidator - Debian/Ubuntu package `glslang-tools`, Fedora package `glslang`.
* libusb
* libudev
* libudev - Fedora package `systemd-devel`
* Video 4 Linux - Debian/Ubuntu package `libv4l-dev`.
Optional (but recommended) dependencies:
@ -53,6 +63,11 @@ Truly optional dependencies, useful for some drivers, app support, etc.:
* ffmpeg
* libjpeg
Experimental Windows support requires the Vulkan SDK and also needs or works
best with the following vcpkg packages installed:
* pthreads eigen3 libusb hidapi zlib doxygen
Tested distributions that are fully compatible,
on Intel (Vulkan only) and AMD graphics (Vulkan and OpenGL):
@ -60,6 +75,7 @@ on Intel (Vulkan only) and AMD graphics (Vulkan and OpenGL):
* Debian 10 `buster`
* Up-to-date package lists can be found in our CI config file,
`.gitlab-ci.yml`
* Archlinux
These distributions include recent-enough versions of all the
software to use direct mode,
@ -69,11 +85,14 @@ package sources.
See also [Status of DRM Leases][drm-lease]
for more details on specific packages, versions, and commits.
Due to the lack of a OpenGL extension: GL_EXT_memory_object_fd, only the AMD
Due to the lack of a OpenGL extension: GL_EXT_memory_object_fd on Intel's
OpenGL driver, only the AMD
radeonsi driver and the proprietary NVIDIA driver will work for OpenGL OpenXR
clients. This is due to a requirement of the Compositor. Support status of the
extension can be found on the [mesamatrix website][mesamatrix-ext].
### CMake
Build process is similar to other CMake builds,
so something like the following will build it.
@ -117,18 +136,38 @@ make install
Documentation can be browsed by opening `doc/html/index.html` in the build directory in a web browser.
### Meson
The build process is similar to other Meson builds.
For a system wide installation requiring root privileges:
```bash
meson --prefix=/usr build
ninja -C build install
```
For a local installation in ~/.local:
```bash
meson --prefix=~/.local -Dinstall-active-runtime=false build
ninja -C build install
```
Note that the installation of the `active_runtime.json` file should be disabled for installations without
root privileges because this file is always installed in meson's syconfdir (usually /etc).
## Getting started using OpenXR with Monado
This implements the [OpenXR][] API,
so to do anything with it, you'll need an application
that uses OpenXR, along with the OpenXR loader.
The OpenXR loader is a glue library that connects OpenXR applications to OpenXR runtimes such as Monado
It determines which runtime to use by reading config file default `/usr/local/share/openxr/0/active_runtime.json`
It determines which runtime to use by looking for the config file `active_runtime.json` (either a symlink to
or a copy of a runtime manifest) in the usual XDG config paths
and processes environment variables such as `XR_RUNTIME_JSON=/usr/share/openxr/0/openxr_monado.json`.
It can also insert OpenXR API Layers without the application or the runtime having to do it.
You can use the `hello_xr` sample provided with the
OpenXR loader and API layers.
You can use the `hello_xr` sample provided with the OpenXR SDK.
The OpenXR loader can be pointed to a runtime json file in a nonstandard location with the environment variable `XR_RUNTIME_JSON`. Example:
@ -136,33 +175,25 @@ The OpenXR loader can be pointed to a runtime json file in a nonstandard locatio
XR_RUNTIME_JSON=~/monado/build/openxr_monado-dev.json ./openxr-example
```
For this reason this runtime creates two manifest files within the build directory:
* `openxr_monado.json` uses a relative path to the runtime, and is intended to be installed with `make install`.
* `openxr_monado_dev.json` uses an absolute path to the runtime in its build directory,
and is intended to be used for development without installing the runtime.
If Monado has been installed through a distribution package
and provides the "active runtime" file /usr/local/share/openxr/0/active_runtime.json,
then the loader will automatically use Monado when starting any OpenXR application.
If Monado has been compiled in a custom directory like ~/monado/build,
the OpenXR loader can be pointed to the runtime when starting an OpenXR application
by setting the environment variable XR_RUNTIME_JSON to the `openxr_monado_dev.json` manifest
that was generated by the build: see above.
For ease of development Monado creates a runtime manifest file in its build directory using an absolute path to the
Monado runtime in the build directory called `openxr_monado-dev.json`. Pointing `XR_RUNTIME_JSON` to this
file allows using Monado after building, without installing.
Note that the loader can always find and load the runtime
if the path to the runtime library given in the json manifest is an absolute path,
but if a relative path like `libopenxr_monado.so.0` is given,
then `LD_LIBRARY_PATH` must include the directory that contains `libopenxr_monado.so.0`.
The absolute path in `openxr_monado_dev.json` takes care of this for you.
The absolute path in `openxr_monado-dev.json` takes care of this for you.
Distribution packages for monado may provide the "active runtime" file `/etc/xdg/openxr/1/active_runtime.json`.
In this case the loader will automatically use Monado when starting an OpenXR application. This global configuration
can be overridden on a per user basis by creating `~/.config/openxr/1/active_runtime.json`.
## Direct mode
Our direct mode code requires a connected HMD to have the `non-desktop` xrandr
property set to 1.
On AMD and Intel GPUs our direct mode code requires a connected HMD to have
the `non-desktop` xrandr property set to 1.
Only the most common HMDs have the needed quirks added to the linux kernel.
Just keep on reading for more info on how to work around that.
If you know that your HMD lacks the quirk you can run this command **before** or
after connecting the HMD and it will have it. Where `HDMI-A-0` is the xrandr
@ -194,32 +225,6 @@ khronos_validation.report_flags = error,warn
khronos_validation.log_filename = stdout
```
## Using libsurvive
To enable the libsurvive driver, libsurvive has to be installed as a library with a pkgconfig file
(https://github.com/cntools/libsurvive/pull/187).
When starting any libsrvive or OpenXR application, libsurvive will run calibration and save
configuration and calibration data in the current working directory.
Make sure the HMD can see both basestations and is not moved during calibration.
To remove libsurvive's calibration data (e.g. to force recalibration) delete the following
files/directories:
rm -r *config.json calinfo
Though working and somewhat usable, support for the libsurvive driver is **experimental**.
Therefore with both meson and cmake, the survive driver has to be explicitly enabled with
```
#cmake
-DBUILD_WITH_LIBSURVIVE=On
#meson
-Ddrivers=auto,survive
```
## Coding style and formatting
[clang-format][] is used,
@ -250,7 +255,12 @@ to just re-format your changes, in case version differences in tools result in o
## Contributing, Code of Conduct
See `CONTRIBUTING.md` for details of contribution guidelines.
See `CONTRIBUTING.md` for details of contribution guidelines. GitLab Issues and
Merge Requests are the preferred wait to discuss problems, suggest enhancements,
or submit changes for review. **In case of a security issue**, you should choose
the "confidential" option when using the GitLab issues page. For highest
security, you can send encrypted email (using GPG/OpenPGP) to Ryan Pavlik, with
the address below and the associated key on <https://keys.openpgp.org>.
Please note that this project is released with a Contributor Code of Conduct.
By participating in this project you agree to abide by its terms.
@ -271,7 +281,7 @@ reported by contacting:
For this file only:
> Copyright 2018-2019 Collabora, Ltd.
> Copyright 2018-2020, Collabora, Ltd.
> Code of Conduct section: excerpt adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 1.4.1,
> available at <https://www.contributor-covenant.org/version/1/4/code-of-conduct.html>,
> and from the freedesktop.org-specific version of that code,
@ -279,3 +289,5 @@ For this file only:
>
>
> SPDX-License-Identifier: CC-BY-4.0
<!-- This must stay in sync with the comment at the start! -->

64
build.gradle Normal file
View file

@ -0,0 +1,64 @@
// Copyright 2020, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
buildscript {
ext {
kotlinVersion = '1.4.10'
latestAboutLibsRelease = "8.5.0"
androidxCoreVersion = "1.3.2"
androidxAnnotationVersion = "1.1.0"
androidxAppCompatVersion = "1.2.0"
androidxLifecycleVersion = "2.2.0"
androidxConstraintLayoutVersion = '2.0.4'
hiltVersion = "2.29.1-alpha"
// Saw some breakage when updating to 1.2?
materialVersion = "1.1.0"
}
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "com.mikepenz.aboutlibraries.plugin:aboutlibraries-plugin:${latestAboutLibsRelease}"
classpath 'com.quittle:svg-2-android-vector:0.0.5'
classpath "com.google.dagger:hilt-android-gradle-plugin:$hiltVersion"
}
}
plugins {
// Used for getting the eigen dir, explicit python binary, etc. from local.properties
id 'com.github.b3er.local.properties' version '1.1'
// For getting git describe data and formatting it how Android wants.
id "com.gladed.androidgitversion" version "0.4.13"
// For downloading e.g. the CDDL (for transitive dependencies of hilt)
id "de.undercouch.download" version "4.1.1"
}
ext {
ndk_version = '21.3.6528147'
sharedTargetSdk = 30
sharedMinSdk = 26
// If you are building on Windows, you will need to explicitly set eigenIncludeDir in your
// local.properties file since the default value provided below only makes sense on *nix
eigenIncludeDir = project.findProperty('eigenIncludeDir') ?: '/usr/include/eigen3'
// If you're having trouble with a "can't find python" CMake error, you can specify the path to
// Python 3 explicitly in local.properties with a property named "pythonBinary"
pythonBinary = project.findProperty('pythonBinary')
}
allprojects {
repositories {
google()
jcenter()
}
}

10
cmake/.cmake-format.json Normal file
View file

@ -0,0 +1,10 @@
{
"tab_size": 4,
"dangle_parens": false,
"line_ending": "unix",
"command_case": "canonical",
"keyword_case": "upper",
"first_comment_is_literal": true,
"literal_comment_pattern": "(^[.]rst)|(#+)",
"enable_markup": false
}

View file

@ -0,0 +1,3 @@
Copyright 2019-2020, Collabora, Ltd.
SPDX-License-Identifier: BSL-1.0

View file

@ -13,6 +13,7 @@
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
# SPDX-License-Identifier: BSL-1.0
if(__clean_directory_list)
return()

108
cmake/FindEigen3.cmake Normal file
View file

@ -0,0 +1,108 @@
# - Try to find Eigen3 lib
#
# This module supports requiring a minimum version, e.g. you can do
# find_package(Eigen3 3.1.2)
# to require version 3.1.2 or newer of Eigen3.
#
# Once done this will define
#
# EIGEN3_FOUND - system has eigen lib with correct version
# EIGEN3_INCLUDE_DIR - the eigen include directory
# EIGEN3_VERSION - eigen version
#
# and the following imported target:
#
# Eigen3::Eigen - The header-only Eigen library
#
# This module reads hints about search locations from
# the following environment variables:
#
# EIGEN3_ROOT
# EIGEN3_ROOT_DIR
# Copyright (c) 2006, 2007 Montel Laurent, <montel@kde.org>
# Copyright (c) 2008, 2009 Gael Guennebaud, <g.gael@free.fr>
# Copyright (c) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>
# Redistribution and use is allowed according to the terms of the 2-clause BSD license.
# SPDX-License-Identifier: BSD-2-Clause
if(NOT Eigen3_FIND_VERSION)
if(NOT Eigen3_FIND_VERSION_MAJOR)
set(Eigen3_FIND_VERSION_MAJOR 2)
endif()
if(NOT Eigen3_FIND_VERSION_MINOR)
set(Eigen3_FIND_VERSION_MINOR 91)
endif()
if(NOT Eigen3_FIND_VERSION_PATCH)
set(Eigen3_FIND_VERSION_PATCH 0)
endif()
set(Eigen3_FIND_VERSION "${Eigen3_FIND_VERSION_MAJOR}.${Eigen3_FIND_VERSION_MINOR}.${Eigen3_FIND_VERSION_PATCH}")
endif()
macro(_eigen3_check_version)
file(READ "${EIGEN3_INCLUDE_DIR}/Eigen/src/Core/util/Macros.h" _eigen3_version_header)
string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen3_world_version_match "${_eigen3_version_header}")
set(EIGEN3_WORLD_VERSION "${CMAKE_MATCH_1}")
string(REGEX MATCH "define[ \t]+EIGEN_MAJOR_VERSION[ \t]+([0-9]+)" _eigen3_major_version_match "${_eigen3_version_header}")
set(EIGEN3_MAJOR_VERSION "${CMAKE_MATCH_1}")
string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen3_minor_version_match "${_eigen3_version_header}")
set(EIGEN3_MINOR_VERSION "${CMAKE_MATCH_1}")
set(EIGEN3_VERSION ${EIGEN3_WORLD_VERSION}.${EIGEN3_MAJOR_VERSION}.${EIGEN3_MINOR_VERSION})
if(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
set(EIGEN3_VERSION_OK FALSE)
else()
set(EIGEN3_VERSION_OK TRUE)
endif()
if(NOT EIGEN3_VERSION_OK)
message(STATUS "Eigen3 version ${EIGEN3_VERSION} found in ${EIGEN3_INCLUDE_DIR}, "
"but at least version ${Eigen3_FIND_VERSION} is required")
endif()
endmacro()
if (EIGEN3_INCLUDE_DIR)
# in cache already
_eigen3_check_version()
set(EIGEN3_FOUND ${EIGEN3_VERSION_OK})
set(Eigen3_FOUND ${EIGEN3_VERSION_OK})
else ()
# search first if an Eigen3Config.cmake is available in the system,
# if successful this would set EIGEN3_INCLUDE_DIR and the rest of
# the script will work as usual
find_package(Eigen3 ${Eigen3_FIND_VERSION} NO_MODULE QUIET)
if(NOT EIGEN3_INCLUDE_DIR)
find_path(EIGEN3_INCLUDE_DIR NAMES signature_of_eigen3_matrix_library
HINTS
ENV EIGEN3_ROOT
ENV EIGEN3_ROOT_DIR
PATHS
${CMAKE_INSTALL_PREFIX}/include
${KDE4_INCLUDE_DIR}
PATH_SUFFIXES eigen3 eigen
)
endif()
if(EIGEN3_INCLUDE_DIR)
_eigen3_check_version()
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Eigen3 DEFAULT_MSG EIGEN3_INCLUDE_DIR EIGEN3_VERSION_OK)
mark_as_advanced(EIGEN3_INCLUDE_DIR)
endif()
if(EIGEN3_FOUND AND NOT TARGET Eigen3::Eigen)
add_library(Eigen3::Eigen INTERFACE IMPORTED)
set_target_properties(Eigen3::Eigen PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${EIGEN3_INCLUDE_DIR}")
endif()

View file

@ -1,7 +1,7 @@
#.rst:
# FindHIDAPI
# ----------
#
#
# Try to find HIDAPI library, from http://www.signal11.us/oss/hidapi/
#
# Cache Variables: (probably not for direct use in your scripts)
@ -23,7 +23,7 @@
#
# IMPORTED Targets
# ^^^^^^^^^^^^^^^^
#
# This module defines :prop_tgt:`IMPORTED` target ``HIDAPI::hidapi`` (in all cases or
# if no components specified), ``HIDAPI::hidapi-libusb`` (if you requested the libusb component),
# and ``HIDAPI::hidapi-hidraw`` (if you requested the hidraw component),
@ -50,74 +50,68 @@
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
set(HIDAPI_ROOT_DIR "${HIDAPI_ROOT_DIR}" CACHE PATH "Root to search for HIDAPI")
set(HIDAPI_ROOT_DIR
"${HIDAPI_ROOT_DIR}"
CACHE PATH "Root to search for HIDAPI")
# Clean up components
if(HIDAPI_FIND_COMPONENTS)
if(WIN32 OR APPLE)
# This makes no sense on Windows or Mac, which have native APIs
list(REMOVE HIDAPI_FIND_COMPONENTS libusb)
endif()
if(WIN32 OR APPLE)
# This makes no sense on Windows or Mac, which have native APIs
list(REMOVE HIDAPI_FIND_COMPONENTS libusb)
endif()
if(NOT ${CMAKE_SYSTEM} MATCHES "Linux")
# hidraw is only on linux
list(REMOVE HIDAPI_FIND_COMPONENTS hidraw)
endif()
if(NOT ${CMAKE_SYSTEM} MATCHES "Linux")
# hidraw is only on linux
list(REMOVE HIDAPI_FIND_COMPONENTS hidraw)
endif()
endif()
if(NOT HIDAPI_FIND_COMPONENTS)
# Default to any
set(HIDAPI_FIND_COMPONENTS any)
# Default to any
set(HIDAPI_FIND_COMPONENTS any)
endif()
# Ask pkg-config for hints
find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND)
set(_old_prefix_path "${CMAKE_PREFIX_PATH}")
# So pkg-config uses HIDAPI_ROOT_DIR too.
if(HIDAPI_ROOT_DIR)
list(APPEND CMAKE_PREFIX_PATH ${HIDAPI_ROOT_DIR})
endif()
pkg_check_modules(PC_HIDAPI_LIBUSB QUIET hidapi-libusb)
pkg_check_modules(PC_HIDAPI_HIDRAW QUIET hidapi-hidraw)
set(_old_prefix_path "${CMAKE_PREFIX_PATH}")
# So pkg-config uses HIDAPI_ROOT_DIR too.
if(HIDAPI_ROOT_DIR)
list(APPEND CMAKE_PREFIX_PATH ${HIDAPI_ROOT_DIR})
endif()
pkg_check_modules(PC_HIDAPI_LIBUSB QUIET hidapi-libusb)
pkg_check_modules(PC_HIDAPI_HIDRAW QUIET hidapi-hidraw)
# Restore
set(CMAKE_PREFIX_PATH "${_old_prefix_path}")
endif()
# Actually search
find_library(HIDAPI_UNDECORATED_LIBRARY
NAMES hidapi
PATHS
"${HIDAPI_ROOT_DIR}"
PATH_SUFFIXES
lib)
find_library(
HIDAPI_UNDECORATED_LIBRARY
NAMES hidapi
PATHS "${HIDAPI_ROOT_DIR}"
PATH_SUFFIXES lib)
find_library(HIDAPI_LIBUSB_LIBRARY
NAMES hidapi hidapi-libusb
PATHS
"${HIDAPI_ROOT_DIR}"
PATH_SUFFIXES
lib
HINTS
${PC_HIDAPI_LIBUSB_LIBRARY_DIRS})
find_library(
HIDAPI_LIBUSB_LIBRARY
NAMES hidapi hidapi-libusb
PATHS "${HIDAPI_ROOT_DIR}"
PATH_SUFFIXES lib
HINTS ${PC_HIDAPI_LIBUSB_LIBRARY_DIRS})
if(CMAKE_SYSTEM MATCHES "Linux")
find_library(HIDAPI_HIDRAW_LIBRARY
NAMES hidapi-hidraw
HINTS
${PC_HIDAPI_HIDRAW_LIBRARY_DIRS})
find_library(
HIDAPI_HIDRAW_LIBRARY
NAMES hidapi-hidraw
HINTS ${PC_HIDAPI_HIDRAW_LIBRARY_DIRS})
endif()
find_path(HIDAPI_INCLUDE_DIR
NAMES hidapi.h
PATHS
"${HIDAPI_ROOT_DIR}"
PATH_SUFFIXES
hidapi
include
include/hidapi
HINTS
${PC_HIDAPI_HIDRAW_INCLUDE_DIRS}
${PC_HIDAPI_LIBUSB_INCLUDE_DIRS})
find_path(
HIDAPI_INCLUDE_DIR
NAMES hidapi.h
PATHS "${HIDAPI_ROOT_DIR}"
PATH_SUFFIXES hidapi include include/hidapi
HINTS ${PC_HIDAPI_HIDRAW_INCLUDE_DIRS} ${PC_HIDAPI_LIBUSB_INCLUDE_DIRS})
find_package(Threads QUIET)
@ -127,62 +121,68 @@ find_package(Threads QUIET)
set(HIDAPI_LIBRARY)
# First, try to use a preferred backend if supplied
if("${HIDAPI_FIND_COMPONENTS}" MATCHES "libusb" AND HIDAPI_LIBUSB_LIBRARY AND NOT HIDAPI_LIBRARY)
set(HIDAPI_LIBRARY ${HIDAPI_LIBUSB_LIBRARY})
if("${HIDAPI_FIND_COMPONENTS}" MATCHES "libusb"
AND HIDAPI_LIBUSB_LIBRARY
AND NOT HIDAPI_LIBRARY)
set(HIDAPI_LIBRARY ${HIDAPI_LIBUSB_LIBRARY})
endif()
if("${HIDAPI_FIND_COMPONENTS}" MATCHES "hidraw" AND HIDAPI_HIDRAW_LIBRARY AND NOT HIDAPI_LIBRARY)
set(HIDAPI_LIBRARY ${HIDAPI_HIDRAW_LIBRARY})
if("${HIDAPI_FIND_COMPONENTS}" MATCHES "hidraw"
AND HIDAPI_HIDRAW_LIBRARY
AND NOT HIDAPI_LIBRARY)
set(HIDAPI_LIBRARY ${HIDAPI_HIDRAW_LIBRARY})
endif()
# Then, if we don't have a preferred one, settle for anything.
if(NOT HIDAPI_LIBRARY)
if(HIDAPI_LIBUSB_LIBRARY)
set(HIDAPI_LIBRARY ${HIDAPI_LIBUSB_LIBRARY})
elseif(HIDAPI_HIDRAW_LIBRARY)
set(HIDAPI_LIBRARY ${HIDAPI_HIDRAW_LIBRARY})
elseif(HIDAPI_UNDECORATED_LIBRARY)
set(HIDAPI_LIBRARY ${HIDAPI_UNDECORATED_LIBRARY})
endif()
if(HIDAPI_LIBUSB_LIBRARY)
set(HIDAPI_LIBRARY ${HIDAPI_LIBUSB_LIBRARY})
elseif(HIDAPI_HIDRAW_LIBRARY)
set(HIDAPI_LIBRARY ${HIDAPI_HIDRAW_LIBRARY})
elseif(HIDAPI_UNDECORATED_LIBRARY)
set(HIDAPI_LIBRARY ${HIDAPI_UNDECORATED_LIBRARY})
endif()
endif()
###
# Determine if the various requested components are found.
###
set(_hidapi_component_required_vars)
foreach(_comp IN LISTS HIDAPI_FIND_COMPONENTS)
if("${_comp}" STREQUAL "any")
list(APPEND _hidapi_component_required_vars
HIDAPI_INCLUDE_DIR
HIDAPI_LIBRARY)
if(HIDAPI_INCLUDE_DIR AND EXISTS "${HIDAPI_LIBRARY}")
set(HIDAPI_any_FOUND TRUE)
mark_as_advanced(HIDAPI_INCLUDE_DIR)
else()
set(HIDAPI_any_FOUND FALSE)
endif()
if("${_comp}" STREQUAL "any")
list(APPEND _hidapi_component_required_vars HIDAPI_INCLUDE_DIR
HIDAPI_LIBRARY)
if(HIDAPI_INCLUDE_DIR AND EXISTS "${HIDAPI_LIBRARY}")
set(HIDAPI_any_FOUND TRUE)
mark_as_advanced(HIDAPI_INCLUDE_DIR)
else()
set(HIDAPI_any_FOUND FALSE)
endif()
elseif("${_comp}" STREQUAL "libusb")
list(APPEND _hidapi_component_required_vars HIDAPI_INCLUDE_DIR HIDAPI_LIBUSB_LIBRARY)
if(HIDAPI_INCLUDE_DIR AND EXISTS "${HIDAPI_LIBUSB_LIBRARY}")
set(HIDAPI_libusb_FOUND TRUE)
mark_as_advanced(HIDAPI_INCLUDE_DIR HIDAPI_LIBUSB_LIBRARY)
else()
set(HIDAPI_libusb_FOUND FALSE)
endif()
elseif("${_comp}" STREQUAL "libusb")
list(APPEND _hidapi_component_required_vars HIDAPI_INCLUDE_DIR
HIDAPI_LIBUSB_LIBRARY)
if(HIDAPI_INCLUDE_DIR AND EXISTS "${HIDAPI_LIBUSB_LIBRARY}")
set(HIDAPI_libusb_FOUND TRUE)
mark_as_advanced(HIDAPI_INCLUDE_DIR HIDAPI_LIBUSB_LIBRARY)
else()
set(HIDAPI_libusb_FOUND FALSE)
endif()
elseif("${_comp}" STREQUAL "hidraw")
list(APPEND _hidapi_component_required_vars HIDAPI_INCLUDE_DIR HIDAPI_HIDRAW_LIBRARY)
if(HIDAPI_INCLUDE_DIR AND EXISTS "${HIDAPI_HIDRAW_LIBRARY}")
set(HIDAPI_hidraw_FOUND TRUE)
mark_as_advanced(HIDAPI_INCLUDE_DIR HIDAPI_HIDRAW_LIBRARY)
else()
set(HIDAPI_hidraw_FOUND FALSE)
endif()
elseif("${_comp}" STREQUAL "hidraw")
list(APPEND _hidapi_component_required_vars HIDAPI_INCLUDE_DIR
HIDAPI_HIDRAW_LIBRARY)
if(HIDAPI_INCLUDE_DIR AND EXISTS "${HIDAPI_HIDRAW_LIBRARY}")
set(HIDAPI_hidraw_FOUND TRUE)
mark_as_advanced(HIDAPI_INCLUDE_DIR HIDAPI_HIDRAW_LIBRARY)
else()
set(HIDAPI_hidraw_FOUND FALSE)
endif()
else()
message(WARNING "${_comp} is not a recognized HIDAPI component")
set(HIDAPI_${_comp}_FOUND FALSE)
endif()
else()
message(WARNING "${_comp} is not a recognized HIDAPI component")
set(HIDAPI_${_comp}_FOUND FALSE)
endif()
endforeach()
unset(_comp)
@ -190,38 +190,40 @@ unset(_comp)
# FPHSA call
###
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(HIDAPI
REQUIRED_VARS
${_hidapi_component_required_vars}
THREADS_FOUND
HANDLE_COMPONENTS)
find_package_handle_standard_args(
HIDAPI
REQUIRED_VARS ${_hidapi_component_required_vars} THREADS_FOUND
HANDLE_COMPONENTS)
if(HIDAPI_FOUND)
set(HIDAPI_LIBRARIES "${HIDAPI_LIBRARY}")
set(HIDAPI_INCLUDE_DIRS "${HIDAPI_INCLUDE_DIR}")
if(NOT TARGET HIDAPI::hidapi)
add_library(HIDAPI::hidapi UNKNOWN IMPORTED)
set_target_properties(HIDAPI::hidapi PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION ${HIDAPI_LIBRARY})
set_property(TARGET HIDAPI::hidapi PROPERTY
IMPORTED_LINK_INTERFACE_LIBRARIES Threads::Threads)
endif()
set(HIDAPI_LIBRARIES "${HIDAPI_LIBRARY}")
set(HIDAPI_INCLUDE_DIRS "${HIDAPI_INCLUDE_DIR}")
if(NOT TARGET HIDAPI::hidapi)
add_library(HIDAPI::hidapi UNKNOWN IMPORTED)
set_target_properties(
HIDAPI::hidapi
PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${HIDAPI_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${HIDAPI_INCLUDE_DIR}"
IMPORTED_LINK_INTERFACE_LIBRARIES Threads::Threads)
endif()
endif()
if(HIDAPI_libusb_FOUND AND NOT TARGET HIDAPI::hidapi-libusb)
add_library(HIDAPI::hidapi-libusb UNKNOWN IMPORTED)
set_target_properties(HIDAPI::hidapi-libusb PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION ${HIDAPI_LIBUSB_LIBRARY})
set_property(TARGET HIDAPI::hidapi-libusb PROPERTY
IMPORTED_LINK_INTERFACE_LIBRARIES Threads::Threads)
add_library(HIDAPI::hidapi-libusb UNKNOWN IMPORTED)
set_target_properties(
HIDAPI::hidapi-libusb
PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${HIDAPI_LIBUSB_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${HIDAPI_INCLUDE_DIR}"
IMPORTED_LINK_INTERFACE_LIBRARIES Threads::Threads)
endif()
if(HIDAPI_hidraw_FOUND AND NOT TARGET HIDAPI::hidapi-hidraw)
add_library(HIDAPI::hidapi-hidraw UNKNOWN IMPORTED)
set_target_properties(HIDAPI::hidapi-hidraw PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION ${HIDAPI_HIDRAW_LIBRARY})
set_property(TARGET HIDAPI::hidapi-hidraw PROPERTY
IMPORTED_LINK_INTERFACE_LIBRARIES Threads::Threads)
add_library(HIDAPI::hidapi-hidraw UNKNOWN IMPORTED)
set_target_properties(
HIDAPI::hidapi-hidraw
PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${HIDAPI_HIDRAW_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${HIDAPI_INCLUDE_DIR}"
IMPORTED_LINK_INTERFACE_LIBRARIES Threads::Threads)
endif()

View file

@ -32,7 +32,9 @@
# ``LIBCHECK_ROOT_DIR``
# The root to search for libcheck.
set(LIBCHECK_ROOT_DIR "${LIBCHECK_ROOT_DIR}" CACHE PATH "Root to search for libcheck")
set(LIBCHECK_ROOT_DIR
"${LIBCHECK_ROOT_DIR}"
CACHE PATH "Root to search for libcheck")
find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND)
@ -45,37 +47,24 @@ if(PKG_CONFIG_FOUND)
# Restore
set(CMAKE_PREFIX_PATH "${_old_prefix_path}")
endif()
find_path(LIBCHECK_INCLUDE_DIR
NAMES
check.h
PATHS
${LIBCHECK_ROOT_DIR}
HINTS
${PC_LIBCHECK_INCLUDE_DIRS}
PATH_SUFFIXES
include
)
find_library(LIBCHECK_LIBRARY
NAMES
check_pic
check
PATHS
${LIBCHECK_ROOT_DIR}
HINTS
${PC_LIBCHECK_LIBRARY_DIRS}
PATH_SUFFIXES
lib
)
find_library(LIBCHECK_SUBUNIT_LIBRARY
NAMES
subunit
PATHS
${LIBCHECK_ROOT_DIR}
HINTS
${PC_LIBCHECK_LIBRARY_DIRS}
PATH_SUFFIXES
lib
)
find_path(
LIBCHECK_INCLUDE_DIR
NAMES check.h
PATHS ${LIBCHECK_ROOT_DIR}
HINTS ${PC_LIBCHECK_INCLUDE_DIRS}
PATH_SUFFIXES include)
find_library(
LIBCHECK_LIBRARY
NAMES check_pic check
PATHS ${LIBCHECK_ROOT_DIR}
HINTS ${PC_LIBCHECK_LIBRARY_DIRS}
PATH_SUFFIXES lib)
find_library(
LIBCHECK_SUBUNIT_LIBRARY
NAMES subunit
PATHS ${LIBCHECK_ROOT_DIR}
HINTS ${PC_LIBCHECK_LIBRARY_DIRS}
PATH_SUFFIXES lib)
find_library(LIBCHECK_LIBRT rt)
find_library(LIBCHECK_LIBM m)
@ -87,39 +76,42 @@ if(PC_LIBCHECK_FOUND AND "${PC_LIBCHECK_LIBRARIES}" MATCHES "subunit")
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Libcheck
REQUIRED_VARS
LIBCHECK_INCLUDE_DIR
LIBCHECK_LIBRARY
THREADS_FOUND
)
find_package_handle_standard_args(
Libcheck REQUIRED_VARS LIBCHECK_INCLUDE_DIR LIBCHECK_LIBRARY THREADS_FOUND)
if(LIBCHECK_FOUND)
if(NOT TARGET libcheck::check)
add_library(libcheck::check UNKNOWN IMPORTED)
set_target_properties(libcheck::check PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${LIBCHECK_INCLUDE_DIR}")
set_target_properties(libcheck::check PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION ${LIBCHECK_LIBRARY})
set_property(TARGET libcheck::check PROPERTY
IMPORTED_LINK_INTERFACE_LIBRARIES Threads::Threads)
set_target_properties(
libcheck::check
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${LIBCHECK_INCLUDE_DIR}"
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION ${LIBCHECK_LIBRARY}
IMPORTED_LINK_INTERFACE_LIBRARIES Threads::Threads)
# if we found librt or libm, link them.
if(LIBCHECK_LIBRT)
set_property(TARGET libcheck::check APPEND PROPERTY
IMPORTED_LINK_INTERFACE_LIBRARIES "${LIBCHECK_LIBRT}")
set_property(
TARGET libcheck::check
APPEND
PROPERTY IMPORTED_LINK_INTERFACE_LIBRARIES "${LIBCHECK_LIBRT}")
endif()
if(LIBCHECK_LIBM)
set_property(TARGET libcheck::check APPEND PROPERTY
IMPORTED_LINK_INTERFACE_LIBRARIES "${LIBCHECK_LIBM}")
set_property(
TARGET libcheck::check
APPEND
PROPERTY IMPORTED_LINK_INTERFACE_LIBRARIES "${LIBCHECK_LIBM}")
endif()
if(LIBCHECK_SUBUNIT_LIBRARY)
set_property(TARGET libcheck::check APPEND PROPERTY
IMPORTED_LINK_INTERFACE_LIBRARIES "${LIBCHECK_SUBUNIT_LIBRARY}")
set_property(
TARGET libcheck::check
APPEND
PROPERTY IMPORTED_LINK_INTERFACE_LIBRARIES
"${LIBCHECK_SUBUNIT_LIBRARY}")
endif()
endif()
mark_as_advanced(LIBCHECK_INCLUDE_DIR LIBCHECK_LIBRARY LIBCHECK_SUBUNIT_LIBRARY)
mark_as_advanced(LIBCHECK_INCLUDE_DIR LIBCHECK_LIBRARY
LIBCHECK_SUBUNIT_LIBRARY)
endif()
mark_as_advanced(LIBCHECK_ROOT_DIR LIBCHECK_LIBRT LIBCHECK_LIBM)

256
cmake/FindOpenGLES.cmake Normal file
View file

@ -0,0 +1,256 @@
# Copyright 2020 Collabora, Ltd.
# SPDX-License-Identifier: BSL-1.0
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
#
# Original Author:
# 2020 Ryan Pavlik <ryan.pavlik@collabora.com>
#[[.rst:
FindOpenGLES
---------------
Find the OpenGL ES graphics API.
Components
^^^^^^^^^^
The following components are supported:
* ``V1`` - OpenGL ES 1 (including emulation on OpenGL ES 2)
* ``V2`` - OpenGL ES 2
* ``V3`` - OpenGL ES 3
* ``V31` - OpenGL ES 3.1 - same as 3 but checking also for gl31.h
* ``V32` - OpenGL ES 3.2 - same as 3 but checking also for gl32.h
If none are specified, the default is ``V2``.
Targets
^^^^^^^
If successful, some subset of the following imported targets are created.
* ``OpenGLES::OpenGLESv1``
* ``OpenGLES::OpenGLESv2``
* ``OpenGLES::OpenGLESv3``
* ``OpenGLES::OpenGLESv31``
* ``OpenGLES::OpenGLESv32``
Cache variables
^^^^^^^^^^^^^^^
The following cache variable may also be set to assist/control the operation of this module:
``OpenGLES_ROOT_DIR``
The root to search for OpenGLES.
#]]
set(OpenGLES_ROOT_DIR
"${OpenGLES_ROOT_DIR}"
CACHE PATH "Root to search for OpenGLES")
if(NOT OpenGLES_FIND_COMPONENTS)
set(OpenGLES_FIND_COMPONENTS V2)
endif()
find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND)
set(_old_prefix_path "${CMAKE_PREFIX_PATH}")
# So pkg-config uses OpenGLES_ROOT_DIR too.
if(OpenGLES_ROOT_DIR)
list(APPEND CMAKE_PREFIX_PATH ${OpenGLES_ROOT_DIR})
endif()
pkg_check_modules(PC_glesv1_cm QUIET glesv1_cm)
pkg_check_modules(PC_glesv2 QUIET glesv2)
# Restore
set(CMAKE_PREFIX_PATH "${_old_prefix_path}")
endif()
find_path(
OpenGLES_V1_INCLUDE_DIR
NAMES GLES/gl.h
PATHS ${OpenGLES_ROOT_DIR}
HINTS ${PC_glesv2_INCLUDE_DIRS} ${PC_glesv1_cm_INCLUDE_DIRS}
PATH_SUFFIXES include)
find_path(
OpenGLES_V2_INCLUDE_DIR
NAMES GLES2/gl2.h
PATHS ${OpenGLES_ROOT_DIR}
HINTS ${PC_glesv2_INCLUDE_DIRS} ${PC_glesv1_cm_INCLUDE_DIRS}
PATH_SUFFIXES include)
find_path(
OpenGLES_V3_INCLUDE_DIR
NAMES GLES3/gl3.h
PATHS ${OpenGLES_ROOT_DIR}
HINTS ${OpenGLES_V1_INCLUDE_DIR} ${OpenGLES_V2_INCLUDE_DIR}
${PC_glesv2_INCLUDE_DIRS} ${PC_glesv1_cm_INCLUDE_DIRS}
PATH_SUFFIXES include)
find_path(
OpenGLES_V31_INCLUDE_DIR
NAMES GLES3/gl31.h
PATHS ${OpenGLES_ROOT_DIR}
HINTS ${OpenGLES_V1_INCLUDE_DIR} ${OpenGLES_V2_INCLUDE_DIR}
${OpenGLES_V3_INCLUDE_DIR} ${PC_glesv2_INCLUDE_DIRS}
${PC_glesv1_cm_INCLUDE_DIRS}
PATH_SUFFIXES include)
find_path(
OpenGLES_V32_INCLUDE_DIR
NAMES GLES3/gl32.h
PATHS ${OpenGLES_ROOT_DIR}
HINTS ${OpenGLES_V1_INCLUDE_DIR} ${OpenGLES_V2_INCLUDE_DIR}
${OpenGLES_V3_INCLUDE_DIR} ${OpenGLES_V31_INCLUDE_DIR}
${PC_glesv2_INCLUDE_DIRS} ${PC_glesv1_cm_INCLUDE_DIRS}
PATH_SUFFIXES include)
find_library(
OpenGLES_V1_LIBRARY
NAMES GLES GLESv1_CM
PATHS ${OpenGLES_ROOT_DIR}
HINTS ${PC_glesv1_cm_LIBRARY_DIRS}
PATH_SUFFIXES lib)
find_library(
OpenGLES_V2_LIBRARY
NAMES GLESv2 OpenGLES # for Apple framework
PATHS ${OpenGLES_ROOT_DIR}
HINTS ${PC_glesv2_LIBRARY_DIRS}
PATH_SUFFIXES lib)
find_library(
OpenGLES_V3_LIBRARY
NAMES GLESv3
PATHS ${OpenGLES_ROOT_DIR}
HINTS ${PC_glesv2_LIBRARY_DIRS}
PATH_SUFFIXES lib)
if(OpenGLES_V2_LIBRARY AND NOT OpenGLES_V3_LIBRARY)
set(OpenGLES_V3_LIBRARY ${OpenGLES_V2_LIBRARY})
endif()
set(_gles_required_vars)
foreach(_comp IN LISTS OpenGLES_FIND_COMPONENTS)
if(_comp STREQUAL "V1")
list(APPEND _gles_required_vars OpenGLES_V1_LIBRARY
OpenGLES_V1_INCLUDE_DIR)
if(OpenGLES_V1_INCLUDE_DIR AND OpenGLES_V1_LIBRARY)
set(OpenGLES_${_comp}_FOUND TRUE)
else()
set(OpenGLES_${_comp}_FOUND FALSE)
endif()
elseif(_comp STREQUAL "V2")
list(APPEND _gles_required_vars OpenGLES_V2_LIBRARY
OpenGLES_V2_INCLUDE_DIR)
if(OpenGLES_V2_INCLUDE_DIR AND OpenGLES_V2_LIBRARY)
set(OpenGLES_${_comp}_FOUND TRUE)
else()
set(OpenGLES_${_comp}_FOUND FALSE)
endif()
elseif(_comp STREQUAL "V3")
list(APPEND _gles_required_vars OpenGLES_V3_LIBRARY
OpenGLES_V3_INCLUDE_DIR)
if(OpenGLES_V3_INCLUDE_DIR AND OpenGLES_V3_LIBRARY)
set(OpenGLES_${_comp}_FOUND TRUE)
else()
set(OpenGLES_${_comp}_FOUND FALSE)
endif()
elseif(_comp STREQUAL "V31")
list(APPEND _gles_required_vars OpenGLES_V3_LIBRARY
OpenGLES_V31_INCLUDE_DIR)
if(OpenGLES_V31_INCLUDE_DIR AND OpenGLES_V3_LIBRARY)
set(OpenGLES_${_comp}_FOUND TRUE)
else()
set(OpenGLES_${_comp}_FOUND FALSE)
endif()
elseif(_comp STREQUAL "V32")
list(APPEND _gles_required_vars OpenGLES_V3_LIBRARY
OpenGLES_V32_INCLUDE_DIR)
if(OpenGLES_V32_INCLUDE_DIR AND OpenGLES_V3_LIBRARY)
set(OpenGLES_${_comp}_FOUND TRUE)
else()
set(OpenGLES_${_comp}_FOUND FALSE)
endif()
else()
message(
WARNING "${_comp} is not a recognized OpenGL-ES component/version")
set(OpenGLES_${_comp}_FOUND FALSE)
endif()
endforeach()
if(_gles_required_vars)
list(REMOVE_DUPLICATES _gles_required_vars)
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
OpenGLES
REQUIRED_VARS ${_gles_required_vars}
HANDLE_COMPONENTS)
if(OpenGLES_FOUND)
if(OpenGLES_V1_FOUND AND NOT TARGET OpenGLES::OpenGLESv1)
add_library(OpenGLES::OpenGLESv1 SHARED IMPORTED)
set_target_properties(
OpenGLES::OpenGLESv1
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
"${OpenGLES_V1_INCLUDE_DIR}"
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION ${OpenGLES_V1_LIBRARY})
endif()
if(OpenGLES_V2_FOUND AND NOT TARGET OpenGLES::OpenGLESv2)
add_library(OpenGLES::OpenGLESv2 SHARED IMPORTED)
set_target_properties(
OpenGLES::OpenGLESv2
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
"${OpenGLES_V2_INCLUDE_DIR}"
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION ${OpenGLES_V2_LIBRARY})
endif()
if(OpenGLES_V3_FOUND)
if(NOT TARGET OpenGLES::OpenGLESv3)
add_library(OpenGLES::OpenGLESv3 SHARED IMPORTED)
set_target_properties(
OpenGLES::OpenGLESv3
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
"${OpenGLES_V3_INCLUDE_DIR}"
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION ${OpenGLES_V3_LIBRARY})
endif()
if(OpenGLES_V31_FOUND AND NOT TARGET OpenGLES::OpenGLESv31)
add_library(OpenGLES::OpenGLESv31 SHARED IMPORTED)
set_target_properties(
OpenGLES::OpenGLESv31
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
"${OpenGLES_V31_INCLUDE_DIR}"
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION ${OpenGLES_V3_LIBRARY})
endif()
if(OpenGLES_V32_FOUND AND NOT TARGET OpenGLES::OpenGLESv32)
add_library(OpenGLES::OpenGLESv32 SHARED IMPORTED)
set_target_properties(
OpenGLES::OpenGLESv32
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
"${OpenGLES_V32_INCLUDE_DIR}"
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION ${OpenGLES_V3_LIBRARY})
endif()
endif()
mark_as_advanced(
OpenGLES_V1_LIBRARY
OpenGLES_V1_INCLUDE_DIR
OpenGLES_V2_LIBRARY
OpenGLES_V2_INCLUDE_DIR
OpenGLES_V3_LIBRARY
OpenGLES_V3_INCLUDE_DIR
OpenGLES_V31_INCLUDE_DIR
OpenGLES_V32_INCLUDE_DIR)
endif()
mark_as_advanced(OpenGLES_ROOT_DIR)
include(FeatureSummary)
set_package_properties(
OpenGLES PROPERTIES
URL "https://www.khronos.org/opengles/"
DESCRIPTION
"A cross-platform graphics API, specialized for mobile and embedded, defined as a subset of desktop OpenGL."
)

View file

@ -30,7 +30,9 @@
# ``OPENHMD_ROOT_DIR``
# The root to search for OpenHMD.
set(OPENHMD_ROOT_DIR "${OPENHMD_ROOT_DIR}" CACHE PATH "Root to search for OpenHMD")
set(OPENHMD_ROOT_DIR
"${OPENHMD_ROOT_DIR}"
CACHE PATH "Root to search for OpenHMD")
find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND)
@ -44,97 +46,83 @@ if(PKG_CONFIG_FOUND)
set(CMAKE_PREFIX_PATH "${_old_prefix_path}")
endif()
find_path(OPENHMD_INCLUDE_DIR
NAMES
openhmd.h
PATHS
${OPENHMD_ROOT_DIR}
HINTS
${PC_OPENHMD_INCLUDE_DIRS}
PATH_SUFFIXES
include
openhmd
include/openhmd
)
find_library(OPENHMD_LIBRARY
NAMES
openhmd
PATHS
${OPENHMD_ROOT_DIR}
${OPENHMD_ROOT_DIR}/build
HINTS
${PC_OPENHMD_LIBRARY_DIRS}
PATH_SUFFIXES
lib
)
if(NOT WIN32)
find_library(OPENHMD_LIBRT rt)
find_library(OPENHMD_LIBM m)
endif()
find_path(
OPENHMD_INCLUDE_DIR
NAMES openhmd.h
PATHS ${OPENHMD_ROOT_DIR}
HINTS ${PC_OPENHMD_INCLUDE_DIRS}
PATH_SUFFIXES include openhmd include/openhmd)
find_library(
OPENHMD_LIBRARY
NAMES openhmd
PATHS ${OPENHMD_ROOT_DIR} ${OPENHMD_ROOT_DIR}/build
HINTS ${PC_OPENHMD_LIBRARY_DIRS}
PATH_SUFFIXES lib)
find_library(OPENHMD_LIBRT rt)
find_library(OPENHMD_LIBM m)
find_package(Threads QUIET)
set(_ohmd_extra_deps)
set(OPENHMD_HIDAPI_TYPE)
if(OPENHMD_LIBRARY AND "${OPENHMD_LIBRARY}" MATCHES "${CMAKE_STATIC_LIBRARY_SUFFIX}")
# Looks like a static library
if(PC_OPENHMD_FOUND)
# See if we need a particular hidapi.
list(REMOVE_ITEM PC_OPENHMD_LIBRARIES openhmd)
if("${PC_OPENHMD_LIBRARIES}" MATCHES hidapi-libusb)
set(OPENHMD_HIDAPI_TYPE libusb)
find_package(HIDAPI QUIET COMPONENTS libusb)
list(APPEND _ohmd_extra_deps HIDAPI_libusb_FOUND)
elseif("${PC_OPENHMD_LIBRARIES}" MATCHES hidapi-hidraw)
set(OPENHMD_HIDAPI_TYPE hidraw)
find_package(HIDAPI QUIET COMPONENTS hidraw)
list(APPEND _ohmd_extra_deps HIDAPI_hidraw_FOUND)
endif()
endif()
if(NOT PC_OPENHMD_FOUND OR NOT OPENHMD_HIDAPI_TYPE)
# Undifferentiated
set(OPENHMD_HIDAPI_TYPE undifferentiated)
find_package(HIDAPI QUIET)
list(APPEND _ohmd_extra_deps HIDAPI_FOUND)
if(OPENHMD_LIBRARY AND "${OPENHMD_LIBRARY}" MATCHES
"${CMAKE_STATIC_LIBRARY_SUFFIX}")
# Looks like a static library
if(PC_OPENHMD_FOUND)
# See if we need a particular hidapi.
list(REMOVE_ITEM PC_OPENHMD_LIBRARIES openhmd)
if("${PC_OPENHMD_LIBRARIES}" MATCHES hidapi-libusb)
set(OPENHMD_HIDAPI_TYPE libusb)
find_package(HIDAPI QUIET COMPONENTS libusb)
list(APPEND _ohmd_extra_deps HIDAPI_libusb_FOUND)
elseif("${PC_OPENHMD_LIBRARIES}" MATCHES hidapi-hidraw)
set(OPENHMD_HIDAPI_TYPE hidraw)
find_package(HIDAPI QUIET COMPONENTS hidraw)
list(APPEND _ohmd_extra_deps HIDAPI_hidraw_FOUND)
endif()
endif()
if(NOT PC_OPENHMD_FOUND OR NOT OPENHMD_HIDAPI_TYPE)
# Undifferentiated
set(OPENHMD_HIDAPI_TYPE undifferentiated)
find_package(HIDAPI QUIET)
list(APPEND _ohmd_extra_deps HIDAPI_FOUND)
endif()
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(OpenHMD
REQUIRED_VARS
OPENHMD_INCLUDE_DIR
OPENHMD_LIBRARY
THREADS_FOUND
)
find_package_handle_standard_args(
OpenHMD REQUIRED_VARS OPENHMD_INCLUDE_DIR OPENHMD_LIBRARY THREADS_FOUND)
if(OPENHMD_FOUND)
set(OPENHMD_INCLUDE_DIRS "${OPENHMD_INCLUDE_DIR}")
set(OPENHMD_LIBRARIES "${OPENHMD_LIBRARY}")
if(NOT TARGET OpenHMD::OpenHMD)
add_library(OpenHMD::OpenHMD UNKNOWN IMPORTED)
endif()
set_target_properties(OpenHMD::OpenHMD PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${OPENHMD_INCLUDE_DIR}")
set_target_properties(OpenHMD::OpenHMD PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${OPENHMD_LIBRARY}")
set_property(TARGET OpenHMD::OpenHMD PROPERTY
IMPORTED_LINK_INTERFACE_LIBRARIES Threads::Threads)
set_target_properties(
OpenHMD::OpenHMD
PROPERTIES IMPORTED_LOCATION "${OPENHMD_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${OPENHMD_INCLUDE_DIR}"
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LINK_INTERFACE_LIBRARIES Threads::Threads)
if("${OPENHMD_HIDAPI_TYPE}" STREQUAL libusb)
set_property(TARGET OpenHMD::OpenHMD APPEND PROPERTY
IMPORTED_LINK_INTERFACE_LIBRARIES HIDAPI::hidapi-libusb)
set_property(
TARGET OpenHMD::OpenHMD
APPEND
PROPERTY IMPORTED_LINK_INTERFACE_LIBRARIES HIDAPI::hidapi-libusb)
list(APPEND OPENHMD_LIBRARIES HIDAPI::hidapi-libusb)
elseif("${OPENHMD_HIDAPI_TYPE}" STREQUAL hidraw)
set_property(TARGET OpenHMD::OpenHMD APPEND PROPERTY
IMPORTED_LINK_INTERFACE_LIBRARIES HIDAPI::hidapi-hidraw)
set_property(
TARGET OpenHMD::OpenHMD
APPEND
PROPERTY IMPORTED_LINK_INTERFACE_LIBRARIES HIDAPI::hidapi-hidraw)
list(APPEND OPENHMD_LIBRARIES HIDAPI::hidapi-hidraw)
elseif("${OPENHMD_HIDAPI_TYPE}" STREQUAL undifferentiated)
set_property(TARGET OpenHMD::OpenHMD APPEND PROPERTY
IMPORTED_LINK_INTERFACE_LIBRARIES HIDAPI::hidapi)
set_property(
TARGET OpenHMD::OpenHMD
APPEND
PROPERTY IMPORTED_LINK_INTERFACE_LIBRARIES HIDAPI::hidapi)
list(APPEND OPENHMD_LIBRARIES HIDAPI::hidapi)
endif()
mark_as_advanced(OPENHMD_INCLUDE_DIR OPENHMD_LIBRARY)

View file

@ -23,6 +23,7 @@
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# SPDX-License-Identifier: BSD-3-Clause
include(FeatureSummary)
set_package_properties(

View file

@ -28,42 +28,35 @@
# ``CJSON_ROOT_DIR``
# The root to search for cJSON.
set(CJSON_ROOT_DIR "${CJSON_ROOT_DIR}" CACHE PATH "Root to search for cJSON")
set(CJSON_ROOT_DIR
"${CJSON_ROOT_DIR}"
CACHE PATH "Root to search for cJSON")
find_path(CJSON_INCLUDE_DIR
NAMES
cjson/cJSON.h
PATHS
${CJSON_ROOT_DIR}
PATH_SUFFIXES
include
)
find_library(CJSON_LIBRARY
NAMES
cjson
PATHS
${CJSON_ROOT_DIR}
PATH_SUFFIXES
lib
)
find_path(
CJSON_INCLUDE_DIR
NAMES cjson/cJSON.h
PATHS ${CJSON_ROOT_DIR}
PATH_SUFFIXES include)
find_library(
CJSON_LIBRARY
NAMES cjson
PATHS ${CJSON_ROOT_DIR}
PATH_SUFFIXES lib)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(cJSON
REQUIRED_VARS
CJSON_INCLUDE_DIR
CJSON_LIBRARY
)
find_package_handle_standard_args(cJSON REQUIRED_VARS CJSON_INCLUDE_DIR
CJSON_LIBRARY)
if(CJSON_FOUND)
set(CJSON_INCLUDE_DIRS "${CJSON_INCLUDE_DIR}")
set(CJSON_LIBRARIES "${CJSON_LIBRARY}")
if(NOT TARGET cJSON::cJSON)
add_library(cJSON::cJSON UNKNOWN IMPORTED)
endif()
set_target_properties(cJSON::cJSON PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${CJSON_INCLUDE_DIR}")
set_target_properties(cJSON::cJSON PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${CJSON_LIBRARY}")
set_target_properties(cJSON::cJSON PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
"${CJSON_INCLUDE_DIR}")
set_target_properties(
cJSON::cJSON PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${CJSON_LIBRARY}")
mark_as_advanced(CJSON_INCLUDE_DIR CJSON_LIBRARY)
endif()
mark_as_advanced(CJSON_ROOT_DIR)

View file

@ -61,7 +61,7 @@ find_path(UDEV_INCLUDE_DIR
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(UDEV
find_package_handle_standard_args(udev
DEFAULT_MSG
UDEV_LIBRARY
UDEV_INCLUDE_DIR

View file

@ -0,0 +1,279 @@
# - Returns a version string from Git
#
# These functions force a re-configure on each git commit so that you can
# trust the values of the variables in your build system.
#
# get_git_head_revision(<refspecvar> <hashvar> [<additional arguments to git describe> ...])
#
# Returns the refspec and sha hash of the current head revision
#
# git_describe(<var> [<additional arguments to git describe> ...])
#
# Returns the results of git describe on the source tree, and adjusting
# the output so that it tests false if an error occurs.
#
# git_describe_working_tree(<var> [<additional arguments to git describe> ...])
#
# Returns the results of git describe on the working tree (--dirty option),
# and adjusting the output so that it tests false if an error occurs.
#
# git_get_exact_tag(<var> [<additional arguments to git describe> ...])
#
# Returns the results of git describe --exact-match on the source tree,
# and adjusting the output so that it tests false if there was no exact
# matching tag.
#
# git_local_changes(<var>)
#
# Returns either "CLEAN" or "DIRTY" with respect to uncommitted changes.
# Uses the return code of "git diff-index --quiet HEAD --".
# Does not regard untracked files.
#
# Requires CMake 2.6 or newer (uses the 'function' command)
#
# Original Author:
# 2009-2020 Ryan Pavlik <ryan.pavlik@gmail.com> <abiryan@ryand.net>
# http://academic.cleardefinition.com
#
# Copyright 2009-2013, Iowa State University.
# Copyright 2013-2020, Ryan Pavlik
# Copyright 2013-2020, Contributors
# SPDX-License-Identifier: BSL-1.0
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
if(__get_git_revision_description)
return()
endif()
set(__get_git_revision_description YES)
# We must run the following at "include" time, not at function call time,
# to find the path to this module rather than the path to a calling list file
get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH)
# Function _git_find_closest_git_dir finds the next closest .git directory
# that is part of any directory in the path defined by _start_dir.
# The result is returned in the parent scope variable whose name is passed
# as variable _git_dir_var. If no .git directory can be found, the
# function returns an empty string via _git_dir_var.
#
# Example: Given a path C:/bla/foo/bar and assuming C:/bla/.git exists and
# neither foo nor bar contain a file/directory .git. This wil return
# C:/bla/.git
#
function(_git_find_closest_git_dir _start_dir _git_dir_var)
set(cur_dir "${_start_dir}")
set(git_dir "${_start_dir}/.git")
while(NOT EXISTS "${git_dir}")
# .git dir not found, search parent directories
set(git_previous_parent "${cur_dir}")
get_filename_component(cur_dir ${cur_dir} DIRECTORY)
if(cur_dir STREQUAL git_previous_parent)
# We have reached the root directory, we are not in git
set(${_git_dir_var}
""
PARENT_SCOPE)
return()
endif()
set(git_dir "${cur_dir}/.git")
endwhile()
set(${_git_dir_var}
"${git_dir}"
PARENT_SCOPE)
endfunction()
function(get_git_head_revision _refspecvar _hashvar)
_git_find_closest_git_dir("${CMAKE_CURRENT_SOURCE_DIR}" GIT_DIR)
if(NOT "${GIT_DIR}" STREQUAL "")
file(RELATIVE_PATH _relative_to_source_dir "${CMAKE_SOURCE_DIR}"
"${GIT_DIR}")
if("${_relative_to_source_dir}" MATCHES "[.][.]")
# We've gone above the CMake root dir.
set(GIT_DIR "")
endif()
endif()
if("${GIT_DIR}" STREQUAL "")
set(${_refspecvar}
"GITDIR-NOTFOUND"
PARENT_SCOPE)
set(${_hashvar}
"GITDIR-NOTFOUND"
PARENT_SCOPE)
return()
endif()
# Check if the current source dir is a git submodule or a worktree.
# In both cases .git is a file instead of a directory.
#
if(NOT IS_DIRECTORY ${GIT_DIR})
# The following git command will return a non empty string that
# points to the super project working tree if the current
# source dir is inside a git submodule.
# Otherwise the command will return an empty string.
#
execute_process(
COMMAND "${GIT_EXECUTABLE}" rev-parse
--show-superproject-working-tree
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
OUTPUT_VARIABLE out
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT "${out}" STREQUAL "")
# If out is empty, GIT_DIR/CMAKE_CURRENT_SOURCE_DIR is in a submodule
file(READ ${GIT_DIR} submodule)
string(REGEX REPLACE "gitdir: (.*)$" "\\1" GIT_DIR_RELATIVE
${submodule})
string(STRIP ${GIT_DIR_RELATIVE} GIT_DIR_RELATIVE)
get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH)
get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE}
ABSOLUTE)
set(HEAD_SOURCE_FILE "${GIT_DIR}/HEAD")
else()
# GIT_DIR/CMAKE_CURRENT_SOURCE_DIR is in a worktree
file(READ ${GIT_DIR} worktree_ref)
# The .git directory contains a path to the worktree information directory
# inside the parent git repo of the worktree.
#
string(REGEX REPLACE "gitdir: (.*)$" "\\1" git_worktree_dir
${worktree_ref})
string(STRIP ${git_worktree_dir} git_worktree_dir)
_git_find_closest_git_dir("${git_worktree_dir}" GIT_DIR)
set(HEAD_SOURCE_FILE "${git_worktree_dir}/HEAD")
endif()
else()
set(HEAD_SOURCE_FILE "${GIT_DIR}/HEAD")
endif()
set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data")
if(NOT EXISTS "${GIT_DATA}")
file(MAKE_DIRECTORY "${GIT_DATA}")
endif()
if(NOT EXISTS "${HEAD_SOURCE_FILE}")
return()
endif()
set(HEAD_FILE "${GIT_DATA}/HEAD")
configure_file("${HEAD_SOURCE_FILE}" "${HEAD_FILE}" COPYONLY)
configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in"
"${GIT_DATA}/grabRef.cmake" @ONLY)
include("${GIT_DATA}/grabRef.cmake")
set(${_refspecvar}
"${HEAD_REF}"
PARENT_SCOPE)
set(${_hashvar}
"${HEAD_HASH}"
PARENT_SCOPE)
endfunction()
function(git_describe _var)
if(NOT GIT_FOUND)
find_package(Git QUIET)
endif()
get_git_head_revision(refspec hash)
if(NOT GIT_FOUND)
set(${_var}
"GIT-NOTFOUND"
PARENT_SCOPE)
return()
endif()
if(NOT hash)
set(${_var}
"HEAD-HASH-NOTFOUND"
PARENT_SCOPE)
return()
endif()
# TODO sanitize
#if((${ARGN}" MATCHES "&&") OR
# (ARGN MATCHES "||") OR
# (ARGN MATCHES "\\;"))
# message("Please report the following error to the project!")
# message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}")
#endif()
#message(STATUS "Arguments to execute_process: ${ARGN}")
execute_process(
COMMAND "${GIT_EXECUTABLE}" describe --tags --always ${hash} ${ARGN}
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
RESULT_VARIABLE res
OUTPUT_VARIABLE out
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT res EQUAL 0)
set(out "${out}-${res}-NOTFOUND")
endif()
set(${_var}
"${out}"
PARENT_SCOPE)
endfunction()
function(git_describe_working_tree _var)
if(NOT GIT_FOUND)
find_package(Git QUIET)
endif()
if(NOT GIT_FOUND)
set(${_var}
"GIT-NOTFOUND"
PARENT_SCOPE)
return()
endif()
execute_process(
COMMAND "${GIT_EXECUTABLE}" describe --dirty ${ARGN}
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
RESULT_VARIABLE res
OUTPUT_VARIABLE out
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT res EQUAL 0)
set(out "${out}-${res}-NOTFOUND")
endif()
set(${_var}
"${out}"
PARENT_SCOPE)
endfunction()
function(git_get_exact_tag _var)
git_describe(out --exact-match ${ARGN})
set(${_var}
"${out}"
PARENT_SCOPE)
endfunction()
function(git_local_changes _var)
if(NOT GIT_FOUND)
find_package(Git QUIET)
endif()
get_git_head_revision(refspec hash)
if(NOT GIT_FOUND)
set(${_var}
"GIT-NOTFOUND"
PARENT_SCOPE)
return()
endif()
if(NOT hash)
set(${_var}
"HEAD-HASH-NOTFOUND"
PARENT_SCOPE)
return()
endif()
execute_process(
COMMAND "${GIT_EXECUTABLE}" diff-index --quiet HEAD --
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
RESULT_VARIABLE res
OUTPUT_VARIABLE out
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
if(res EQUAL 0)
set(${_var}
"CLEAN"
PARENT_SCOPE)
else()
set(${_var}
"DIRTY"
PARENT_SCOPE)
endif()
endfunction()

View file

@ -0,0 +1,42 @@
#
# Internal file for GetGitRevisionDescription.cmake
#
# Requires CMake 2.6 or newer (uses the 'function' command)
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
# SPDX-License-Identifier: BSL-1.0
set(HEAD_HASH)
file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024)
string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS)
if(HEAD_CONTENTS MATCHES "ref")
# named branch
string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}")
if(EXISTS "@GIT_DIR@/${HEAD_REF}")
configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
else()
configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs" COPYONLY)
file(READ "@GIT_DATA@/packed-refs" PACKED_REFS)
if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}")
set(HEAD_HASH "${CMAKE_MATCH_1}")
endif()
endif()
else()
# detached HEAD
configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY)
endif()
if(NOT HEAD_HASH)
file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024)
string(STRIP "${HEAD_HASH}" HEAD_HASH)
endif()

View file

@ -10,6 +10,7 @@
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
# SPDX-License-Identifier: BSL-1.0
if(__prefix_list_glob)
return()

View file

@ -13,6 +13,7 @@
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
# SPDX-License-Identifier: BSL-1.0
include(PrefixListGlob)
include(CleanDirectoryList)

View file

@ -5,6 +5,435 @@ SPDX-License-Identifier: CC0-1.0
SPDX-FileCopyrightText: 2020 Collabora, Ltd. and the Monado contributors
```
## Monado 21.0.0 (2021-01-28)
- Major changes
- Adds a initial SteamVR driver state tracker and target that produces a SteamVR
plugin that enables any Monado hardware driver to be used in SteamVR. This is
the initial upstreaming of this code and has some limitations, like only having
working input when emulating a Index controller.
([!583](https://gitlab.freedesktop.org/monado/monado/merge_requests/583))
- XRT Interface
- Add `xrt_binding_profile` struct, related pair structs and fields on
`xrt_device` to allow to move the static rebinding of inputs and outputs into
device drivers. This makes it easier to get a overview in the driver itself
which bindings it can bind to.
([!587](https://gitlab.freedesktop.org/monado/monado/merge_requests/587))
- xrt: Generate bindings for Monado and SteamVR from json.
([!638](https://gitlab.freedesktop.org/monado/monado/merge_requests/638))
- xrt: Introduce `xrt_system_compositor`, it is basically a analogous to
`XrSystemID` but instead of being a fully fledged xrt_system this is only the
compositor part of it. Also fold the `prepare_session` function into the create
native compositor function to simplify the interface.
([!652](https://gitlab.freedesktop.org/monado/monado/merge_requests/652))
- Expose more information on the frameservers, like product, manufacturer and
serial.
([!665](https://gitlab.freedesktop.org/monado/monado/merge_requests/665))
- Add `XRT_FORMAT_BAYER_GR8` format.
([!665](https://gitlab.freedesktop.org/monado/monado/merge_requests/665))
- State Trackers
- st/oxr: Add OXR_FRAME_TIMING_SPEW for basic frame timing debug output.
([!591](https://gitlab.freedesktop.org/monado/monado/merge_requests/591))
- OpenXR: Make sure to restore old EGL display/context/drawables when creating a
client EGL compositor.
([!602](https://gitlab.freedesktop.org/monado/monado/merge_requests/602))
- GUI: Expand with support for controlling the remote driver hand tracking.
([!604](https://gitlab.freedesktop.org/monado/monado/merge_requests/604))
- st/oxr: Implement XR_KHR_vulkan_enable2
([!633](https://gitlab.freedesktop.org/monado/monado/merge_requests/633))
- st/oxr: Add OXR_TRACKING_ORIGIN_OFFSET_{X,Y,Z} env variables as a quick way to
tweak 6dof tracking origins.
([!634](https://gitlab.freedesktop.org/monado/monado/merge_requests/634))
- OpenXR: Be more relaxed with Quat validation, spec says within 1% of unit
length, normalize if not within float epsilon.
([!659](https://gitlab.freedesktop.org/monado/monado/merge_requests/659))
- Drivers
- North Star: Fix memory leak in math code.
([!564](https://gitlab.freedesktop.org/monado/monado/merge_requests/564))
- psvr: Rename some variables for better readability.
([!597](https://gitlab.freedesktop.org/monado/monado/merge_requests/597))
- openhmd: Fix viewport calculation of rotated displays.
([!600](https://gitlab.freedesktop.org/monado/monado/merge_requests/600))
- remote: Add support for simulated hand tracking, this is based on the curl
model
that is used by the Valve Index Controller.
([!604](https://gitlab.freedesktop.org/monado/monado/merge_requests/604))
- android: Acquire device display metrics from system.
([!611](https://gitlab.freedesktop.org/monado/monado/merge_requests/611))
- openhmd: Rotate DK2 display correctly.
([!628](https://gitlab.freedesktop.org/monado/monado/merge_requests/628))
- d/psmv: The motor on zcmv1 does not rumble at amplitudes < 0.25. Linear rescale
amplitude into [0.25, 1] range.
([!636](https://gitlab.freedesktop.org/monado/monado/merge_requests/636))
- v4l2: Expose more information through new fields in XRT interface.
([!665](https://gitlab.freedesktop.org/monado/monado/merge_requests/665))
- v4l2: Allocate more buffers when streaming data.
([!665](https://gitlab.freedesktop.org/monado/monado/merge_requests/665))
- IPC
- ipc: Port IPC to u_logging.
([!601](https://gitlab.freedesktop.org/monado/monado/merge_requests/601))
- ipc: Make OXR_DEBUG_GUI work with monado-service.
([!622](https://gitlab.freedesktop.org/monado/monado/merge_requests/622))
- Compositor
- comp: Add basic frame timing information to XRT_COMPOSITOR_LOG=trace.
([!591](https://gitlab.freedesktop.org/monado/monado/merge_requests/591))
- main: Refactor how the compositor interacts with targets, the goal is to enable
the compositor to render to destinations that isn't backed by a `VkSwapchain`.
Introduce `comp_target` and remove `comp_window`, also refactor `vk_swapchain`
to be a sub-class of `comp_target` named `comp_target_swapchain`, the window
backends now sub class `comp_target_swapchain`.
([!599](https://gitlab.freedesktop.org/monado/monado/merge_requests/599))
- Implement support for XR_KHR_composition_layer_equirect (equirect1).
([!620](https://gitlab.freedesktop.org/monado/monado/merge_requests/620),
[!624](https://gitlab.freedesktop.org/monado/monado/merge_requests/624))
- comp: Improve thread safety. Resolve issues in mutlithreading CTS.
([!645](https://gitlab.freedesktop.org/monado/monado/merge_requests/645))
- main: Lower priority on sRGB format. This works around a bug in the OpenXR CTS
and mirrors better what at least on other OpenXR runtime does.
([!671](https://gitlab.freedesktop.org/monado/monado/merge_requests/671))
- Helper Libraries
- os/time: Make timespec argument const.
([!597](https://gitlab.freedesktop.org/monado/monado/merge_requests/597))
- os/time: Add a Linux specific way to get the realtime clock (for RealSense).
([!597](https://gitlab.freedesktop.org/monado/monado/merge_requests/597))
- math: Make sure that we do not drop and positions in poses when the other pose
has a non-valid position.
([!603](https://gitlab.freedesktop.org/monado/monado/merge_requests/603))
- aux/vk: `vk_create_device` now takes in a list of Vulkan device extensions.
([!605](https://gitlab.freedesktop.org/monado/monado/merge_requests/605))
- Port everything to u_logging.
([!627](https://gitlab.freedesktop.org/monado/monado/merge_requests/627))
- u/hand_tracking: Tweak finger curl model making it easier to grip ingame
objects.
([!635](https://gitlab.freedesktop.org/monado/monado/merge_requests/635))
- math: Add math_quat_validate_within_1_percent function.
([!659](https://gitlab.freedesktop.org/monado/monado/merge_requests/659))
- u/sink: Add Bayer format converter.
([!665](https://gitlab.freedesktop.org/monado/monado/merge_requests/665))
- u/distortion: Improve both Vive and Index distortion by fixing polynomial math.
([!666](https://gitlab.freedesktop.org/monado/monado/merge_requests/666))
- u/distortion: Improve Index distortion and tidy code. While this touches the
Vive distortion code all Vive headsets seems to have the center set to the same
for each channel so doesn't help them. And Vive doesn't have the extra
coefficient that the Index does so no help there either.
([!667](https://gitlab.freedesktop.org/monado/monado/merge_requests/667))
- Misc. Features
- Work toward a Win32 port.
([!551](https://gitlab.freedesktop.org/monado/monado/merge_requests/551),
[!605](https://gitlab.freedesktop.org/monado/monado/merge_requests/605),
[!607](https://gitlab.freedesktop.org/monado/monado/merge_requests/607))
- Additional improvements to the Android port.
([!592](https://gitlab.freedesktop.org/monado/monado/merge_requests/592),
[!595](https://gitlab.freedesktop.org/monado/monado/merge_requests/595),
[#105](https://gitlab.freedesktop.org/monado/monado/issues/105))
- Misc. Fixes
- steamvr: Support HMDs with rotated displays
([!600](https://gitlab.freedesktop.org/monado/monado/merge_requests/600))
## Monado 0.4.1 (2020-11-04)
- State Trackers
- st/oxr: Fix for new conformance tests for xrWaitFrame, xrBeginFrame,
xrEndFrame call order. Also fix OpenXR state transition logic depending on a
synchronized frame loop.
([!589](https://gitlab.freedesktop.org/monado/monado/merge_requests/589),
[!590](https://gitlab.freedesktop.org/monado/monado/merge_requests/590))
## Monado 0.4.0 (2020-11-02)
- XRT Interface
- add `xrt_device_type` to `xrt_device` to differentiate handed controllers
from
controllers that can be held in either hand.
([!412](https://gitlab.freedesktop.org/monado/monado/merge_requests/412))
- Rename functions and types that assumed the native graphics buffer handle type
was an FD: in `auxiliary/vk/vk_helpers.{h,c}` `vk_create_image_from_fd` ->
`vk_create_image_from_native`, in the XRT headers `struct xrt_compositor_fd` ->
`xrt_compositor_native` (and method name changes from `xrt_comp_fd_...` ->
`xrt_comp_native_...`), `struct xrt_swapchain_fd` -> `struct
xrt_swapchain_native`, `struct xrt_image_fd` -> `struct xrt_image_native`, and
corresponding parameter/member/variable name changes (e.g. `struct
xrt_swapchain_fd *xscfd` becomes `struct xrt_swapchain_native *xscn`).
([!426](https://gitlab.freedesktop.org/monado/monado/merge_requests/426),
[!428](https://gitlab.freedesktop.org/monado/monado/merge_requests/428))
- Make some fields on `xrt_gl_swapchain` and `xrt_vk_swapchain` private moving
them into the client compositor code instead of exposing them.
([!444](https://gitlab.freedesktop.org/monado/monado/merge_requests/444))
- Make `xrt_compositor::create_swapchain` return xrt_result_t instead of the
swapchain, this makes the methods on `xrt_compositor` more uniform.
([!444](https://gitlab.freedesktop.org/monado/monado/merge_requests/444))
- Add the method `xrt_compositor::import_swapchain` allowing a state tracker to
create a swapchain from a set of pre-allocated images. Uses the same
`xrt_swapchain_create_info` as `xrt_compositor::create_swapchain`.
([!444](https://gitlab.freedesktop.org/monado/monado/merge_requests/444))
- Make `xrt_swapchain_create_flags` swapchain static image bit match OpenXR.
([!454](https://gitlab.freedesktop.org/monado/monado/merge_requests/454))
- Add `XRT_SWAPCHAIN_USAGE_INPUT_ATTACHMENT` flag to `xrt_swapchain_usage_bits`
so that a client can create a Vulkan swapchain that can be used as input
attachment.
([!459](https://gitlab.freedesktop.org/monado/monado/merge_requests/459))
- Remove the `flip_y` parameter to the creation of the native compositor, this
is
now a per layer thing.
([!461](https://gitlab.freedesktop.org/monado/monado/merge_requests/461))
- Add `xrt_compositor_info` struct that allows the compositor carry information
to about it's capbilities and it's recommended values. Not everything is hooked
up at the moment.
([!461](https://gitlab.freedesktop.org/monado/monado/merge_requests/461))
- Add defines for underlying handle types.
([!469](https://gitlab.freedesktop.org/monado/monado/merge_requests/469))
- Add a native handle type for graphics sync primitives (currently file
descriptors on all platforms).
([!469](https://gitlab.freedesktop.org/monado/monado/merge_requests/469))
- Add a whole bunch of structs and functions for all of the different layers
in
OpenXR. The depth layer information only applies to the stereo projection
so
make a special stereo projection with depth layer.
([!476](https://gitlab.freedesktop.org/monado/monado/merge_requests/476))
- Add `xrt_image_native_allocator` as a friend to the compositor interface. This
simple interface is intended to be used by the IPC interface to allocate
`xrt_image_native` on the client side and send those to the service.
([!478](https://gitlab.freedesktop.org/monado/monado/merge_requests/478))
- Re-arrange and document `xrt_image_native`, making the `size` field optional.
([!493](https://gitlab.freedesktop.org/monado/monado/merge_requests/493))
- Add const to all compositor arguments that are info structs, making the
interface safer and
more clear. Also add `max_layers` field to the
`xrt_compositor_info` struct.
([!501](https://gitlab.freedesktop.org/monado/monado/merge_requests/501))
- Add `xrt_space_graph` struct for calculating space relations. This struct and
accompanying makes it easier to reason about space relations than just
functions
operating directly on `xrt_space_relation`. The code base is changed
to use
these new functions.
([!519](https://gitlab.freedesktop.org/monado/monado/merge_requests/519))
- Remove the `linear_acceleration` and `angular_acceleration` fields from the
`xrt_space_relation` struct, these were not used in the codebase and are not
exposed in the OpenXR API. They can easily be added back should they be
required again by code or a future feature. Drivers are free to retain this
information internally, but no longer expose it.
([!519](https://gitlab.freedesktop.org/monado/monado/merge_requests/519))
- Remove the `out_timestamp` argument to the `xrt_device::get_tracked_pose`
function, it's not needed anymore and the devices can do prediction better
as
it knows more about it's tracking system the the state tracker.
([!521](https://gitlab.freedesktop.org/monado/monado/merge_requests/521))
- Replace mesh generator with `compute_distortion` function on `xrt_device`. This
is used to both make it possible to use mesh shaders for devices and to provide
compatibility with SteamVR which requires a `compute_distortion` function as
well.
The compositor uses this function automatically to create a mesh and
uses mesh
distortion for all drivers. The function `compute_distortion` default
implementations for `none`, `panotools` and `vive` distortion models are
provided in util.
([!536](https://gitlab.freedesktop.org/monado/monado/merge_requests/536))
- Add a simple curl value based finger tracking model and use it for vive and
survive controllers.
([!555](https://gitlab.freedesktop.org/monado/monado/merge_requests/555))
- State Trackers
- OpenXR: Add support for attaching Quad layers to action sapces.
([!437](https://gitlab.freedesktop.org/monado/monado/merge_requests/437))
- OpenXR: Use initial head pose as origin for local space.
([!443](https://gitlab.freedesktop.org/monado/monado/merge_requests/443))
- OpenXR: Minor fixes for various bits of code: copy-typo in device assignment
code; better stub for the unimplemented function
`xrEnumerateBoundSourcesForAction`; better error message on internal error in
`xrGetCurrentInteractionProfile`.
([!448](https://gitlab.freedesktop.org/monado/monado/merge_requests/448))
- OpenXR: Make the `xrGetCurrentInteractionProfile` conformance tests pass,
needed
to implement better error checking as well as generating
`XrEventDataInteractionProfileChanged` events to the client.
([!448](https://gitlab.freedesktop.org/monado/monado/merge_requests/448))
- OpenXR: Centralize all sub-action path iteration in some x-macros.
([!449](https://gitlab.freedesktop.org/monado/monado/merge_requests/449),
[!456](https://gitlab.freedesktop.org/monado/monado/merge_requests/456))
- OpenXR: Improve the validation in the API function for
`xrGetInputSourceLocalizedName`.
([!451](https://gitlab.freedesktop.org/monado/monado/merge_requests/451))
- OpenXR: Implement the function `xrEnumerateBoundSourcesForAction`, currently we
only bind one input per top level user path and it's easy to track this.
([!451](https://gitlab.freedesktop.org/monado/monado/merge_requests/451))
- OpenXR: Properly handle more than one input source being bound to the same
action
according to the combination rules of the specification.
([!452](https://gitlab.freedesktop.org/monado/monado/merge_requests/452))
- OpenXR: Fix multiplicity of bounds paths per action - there's one per
input/output.
([!456](https://gitlab.freedesktop.org/monado/monado/merge_requests/456))
- OpenXR: Implement the MND_swapchain_usage_input_attachment_bit extension.
([!459](https://gitlab.freedesktop.org/monado/monado/merge_requests/459))
- OpenXR: Refactor the native compositor handling a bit, this creates the
compositor earlier then before. This allows us to get the viewport information
from it.
([!461](https://gitlab.freedesktop.org/monado/monado/merge_requests/461))
- OpenXR: Implement action set priorities and fix remaining action conformance
tests.
([!462](https://gitlab.freedesktop.org/monado/monado/merge_requests/462))
- st/oxr: Fix crash when calling `xrPollEvents` when headless mode is selected.
([!475](https://gitlab.freedesktop.org/monado/monado/merge_requests/475))
- OpenXR: Add stub functions and support plumbing for a lot of layer extensions.
([!476](https://gitlab.freedesktop.org/monado/monado/merge_requests/476))
- OpenXR: Be sure to return `XR_ERROR_FEATURE_UNSUPPORTED` if the protected
content bit is set and the compositor does not support it.
([!481](https://gitlab.freedesktop.org/monado/monado/merge_requests/481))
- OpenXR: Update to 1.0.11 and start returning the new
`XR_ERROR_GRAPHICS_REQUIREMENTS_CALL_MISSING` code added in this release.
([!482](https://gitlab.freedesktop.org/monado/monado/merge_requests/482))
- OpenXR: Enable the `XR_KHR_android_create_instance` extension.
([!492](https://gitlab.freedesktop.org/monado/monado/merge_requests/492))
- OpenXR: Add support for creating swapchains with depth formats and submitting
depth layers. The depth layers are passed through to the compositor, but are
not used yet.
([!498](https://gitlab.freedesktop.org/monado/monado/merge_requests/498))
- OpenXR: For pose actions the any path (`XR_NULL_PATH`) needs to be special
cased, essentially turning into a separate action sub path, that is assigned
at
binding time.
([!510](https://gitlab.freedesktop.org/monado/monado/merge_requests/510))
- OpenXR: More correctly implement `xrGetInputSourceLocalizedName` allowing apps
to more accurently tell the user which input to use.
([!532](https://gitlab.freedesktop.org/monado/monado/merge_requests/532))
- OpenXR: Pass through equirect layer data to the compositor.
([!566](https://gitlab.freedesktop.org/monado/monado/merge_requests/566))
- Drivers
- psvr: We were sending in the wrong type of time to the 3DOF fusion code,
switch
to nanoseconds instead of fractions of seconds.
([!474](https://gitlab.freedesktop.org/monado/monado/merge_requests/474))
- rs: Make the pose getting from the T265 be threaded. Before we where getting
the
pose from the update input function, this would cause some the main thread
to
block and would therefore cause jitter in the rendering.
([!486](https://gitlab.freedesktop.org/monado/monado/merge_requests/486))
- survive: Add lighthouse tracking system type
hydra: Add lighthouse tracking
system type
([!489](https://gitlab.freedesktop.org/monado/monado/merge_requests/489))
- rs: Add slam tracking system type
northstar: Use tracking system from tracker
(e.g. rs) if available.
([!494](https://gitlab.freedesktop.org/monado/monado/merge_requests/494))
- psmv: Introduce proper grip and aim poses, correctly rotate the grip pose to
follow the spec more closely. The aim poses replaces the previous ball tip pose
that was used before for aim.
([!509](https://gitlab.freedesktop.org/monado/monado/merge_requests/509))
- survive: Implement haptic feedback.
([!557](https://gitlab.freedesktop.org/monado/monado/merge_requests/557))
- dummy: Tidy the code a bit and switch over to the new
logging API.
([!572](https://gitlab.freedesktop.org/monado/monado/merge_requests/572),
[!573](https://gitlab.freedesktop.org/monado/monado/merge_requests/573))
- psvr: Switch to the new logging API.
([!573](https://gitlab.freedesktop.org/monado/monado/merge_requests/573))
- Add initial "Cardboard" phone-holder driver for Android.
([!581](https://gitlab.freedesktop.org/monado/monado/merge_requests/581))
- IPC
- Generalize handling of native-platform handles in IPC code, allow bi-
directional handle transfer, and de-duplicate code between server and client.
([!413](https://gitlab.freedesktop.org/monado/monado/merge_requests/413),
[!427](https://gitlab.freedesktop.org/monado/monado/merge_requests/427))
- generation: Fix handling 'in_handle' by adding a extra sync round-trip, this
might be solvable by using `SOCK_SEQPACKET`.
([!444](https://gitlab.freedesktop.org/monado/monado/merge_requests/444))
- Implement the `xrt_compositor::import_swapchain` function, uses the earlier
`in_handle` work.
([!444](https://gitlab.freedesktop.org/monado/monado/merge_requests/444))
- proto: Transport the `xrt_compositor_info` over the wire so that the client can
get the needed information.
([!461](https://gitlab.freedesktop.org/monado/monado/merge_requests/461))
- client: Implement the usage of the `xrt_image_native_allocator`, currently not
used. But it is needed for platforms where for various reasons the allocation
must happen on the client side.
([!478](https://gitlab.freedesktop.org/monado/monado/merge_requests/478))
- client: Add a "loopback" image allocator, this code allocates a swapchain from
the service then imports that back to the service as if it was imported. This
tests both the import code and the image allocator code.
([!478](https://gitlab.freedesktop.org/monado/monado/merge_requests/478))
- ipc: Allow sending zero handles as a reply, at least the Linux fd handling code
allows this.
([!491](https://gitlab.freedesktop.org/monado/monado/merge_requests/491))
- Use a native AHardwareBuffer allocator on the client side when building for
recent-enough Android.
([!493](https://gitlab.freedesktop.org/monado/monado/merge_requests/493))
- ipc: Add functionality to disable a device input via the `monado-ctl` utility,
this allows us to pass the conformance tests that requires the runtime to turn
off a device.
([!511](https://gitlab.freedesktop.org/monado/monado/merge_requests/511))
- Compositor
- compositor: Add support for alpha blending with premultiplied alpha.
([!425](https://gitlab.freedesktop.org/monado/monado/merge_requests/425))
- compositor: Implement subimage rectangle rendering for quad layers.
([!433](https://gitlab.freedesktop.org/monado/monado/merge_requests/433))
- compositor: Enable subimage rectangle rendering for projection layers.
([!436](https://gitlab.freedesktop.org/monado/monado/merge_requests/436))
- compositor: Fix printing of current connected displays on nvidia when no
whitelisted display is found.
([!477](https://gitlab.freedesktop.org/monado/monado/merge_requests/477))
- compositor: Add env var to temporarily add display string to nvidia whitelist.
([!477](https://gitlab.freedesktop.org/monado/monado/merge_requests/477))
- compositor and clients: Use a generic typedef to represent the platform-
specific graphics buffer, allowing use of `AHardwareBuffer` on recent Android.
([!479](https://gitlab.freedesktop.org/monado/monado/merge_requests/479))
- compositor: Check the protected content bit, and return a non-success code if
it's set. Supporting this is optional in OpenXR, but lack of support must be
reported to the application.
([!481](https://gitlab.freedesktop.org/monado/monado/merge_requests/481))
- compositor: Implement cylinder layers.
([!495](https://gitlab.freedesktop.org/monado/monado/merge_requests/495))
- main: Set the maximum layers supported to 16, we technically support more than
16, but things get out of hand if multiple clients are running and all are
using
max layers.
([!501](https://gitlab.freedesktop.org/monado/monado/merge_requests/501))
- main: Add code to check that a format is supported by the GPU before exposing.
([!502](https://gitlab.freedesktop.org/monado/monado/merge_requests/502))
- compositor: Remove panotools and vive shaders from compositor.
([!538](https://gitlab.freedesktop.org/monado/monado/merge_requests/538))
- Initial work on a port of the compositor to Android.
([!547](https://gitlab.freedesktop.org/monado/monado/merge_requests/547))
- render: Implement equirect layer rendering.
([!566](https://gitlab.freedesktop.org/monado/monado/merge_requests/566))
- main: Fix leaks of sampler objects that was introduced in !566.
([!571](https://gitlab.freedesktop.org/monado/monado/merge_requests/571))
- Helper Libraries
- u/vk: Remove unused vk_image struct, this is later recreated for the image
allocator code.
([!444](https://gitlab.freedesktop.org/monado/monado/merge_requests/444))
- u/vk: Add a new image allocate helper, this is used by the main compositor to
create, export and import swapchain images.
([!444](https://gitlab.freedesktop.org/monado/monado/merge_requests/444))
- u/vk: Rename `vk_create_semaphore_from_fd` to `vk_create_semaphore_from_native`
([!469](https://gitlab.freedesktop.org/monado/monado/merge_requests/469))
- aux/android: New Android utility library added.
([!493](https://gitlab.freedesktop.org/monado/monado/merge_requests/493),
[!547](https://gitlab.freedesktop.org/monado/monado/merge_requests/547),
[!581](https://gitlab.freedesktop.org/monado/monado/merge_requests/581))
- aux/ogl: Add a function to compute the texture target and binding enum for a
given swapchain image creation info.
([!493](https://gitlab.freedesktop.org/monado/monado/merge_requests/493))
- util: Tidy hand tracking header.
([!574](https://gitlab.freedesktop.org/monado/monado/merge_requests/574))
- math: Fix doxygen warnings in vector headers.
([!574](https://gitlab.freedesktop.org/monado/monado/merge_requests/574))
- Misc. Features
- Support building in-process Monado with meson.
([!421](https://gitlab.freedesktop.org/monado/monado/merge_requests/421))
- Allow building some components without Vulkan. Vulkan is still required for the
compositor and therefore the OpenXR runtime target.
([!429](https://gitlab.freedesktop.org/monado/monado/merge_requests/429))
- Add an OpenXR Android target: an APK which provides an "About" activity and
eventually, an OpenXR runtime.
([!574](https://gitlab.freedesktop.org/monado/monado/merge_requests/574),
[!581](https://gitlab.freedesktop.org/monado/monado/merge_requests/581))
- Misc. Fixes
- No significant changes
## Monado 0.3.0 (2020-07-10)
- Major changes

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,5 @@
{
"$schema": "https://ryanpavlik.gitlab.io/proclamation/proclamation.schema.json",
"#": "This is a config file for Proclamation, the changelog combiner: https://gitlab.com/ryanpavlik/proclamation",
"SPDX-License-Identifier: CC0-1.0": "",
"SPDX-FileCopyrightText: 2020 Collabora, Ltd. and the Proclamation contributors": "",
@ -13,10 +14,12 @@
"directory": "xrt"
},
"State Trackers": {
"directory": "state_trackers"
"directory": "state_trackers",
"sort_by_prefix": true
},
"Drivers": {
"directory": "drivers"
"directory": "drivers",
"sort_by_prefix": true
},
"IPC": {
"directory": "ipc"
@ -25,7 +28,8 @@
"directory": "compositor"
},
"Helper Libraries": {
"directory": "auxiliary"
"directory": "auxiliary",
"sort_by_prefix": true
},
"Misc. Features": {
"directory": "misc_features"

48
doc/howto-release.md Normal file
View file

@ -0,0 +1,48 @@
# How to release
These instructions assumes that the version you are making is `21.0.0`.
## Generate changelog
Run proclamation in the `doc/changes`.
```sh
proclamation build 21.0.0 --delete-fragments --overwrite
```
Commit changes, split in two commits to help unrolling or editing changes.
```sh
git commit -m"doc: Update CHANGELOG.md" doc/CHANGELOG.md
git commit -m"doc: Remove old changelog fragments" doc/changes
```
## Update versions
Edit the files
* `CMakelists.txt`
* `meson.build`
* `src/xrt/state_trackers/oxr/oxr_instance.c`
See previous commits for exact places.
```sh
git commit -a -m"monado: Update version"
```
## Tag the code
Do the tagging from git, do **not** do it from gitlab, also make sure to prefix
the version with `v` so that `21.0.0` becomes `v21.0.0`.
```sh
git tag v21.0.0 -m"v21.0.0"
```
## Do gitlab release
The Gitlab UI has a friendly interface, just follow the guide there.

View file

@ -1 +0,0 @@
<mxfile host="Electron" modified="2020-05-26T22:13:46.682Z" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/12.4.2 Chrome/78.0.3904.130 Electron/7.1.4 Safari/537.36" etag="iaisVdC_bzB5dWKzDBA1" version="12.4.2" type="device" pages="1"><diagram id="i7RjRSwkiHJf6eIeykeo" name="Page-1">7VltU9s4EP41mel9KOPYTggfSQgcc5TrAHelnzKKrcRqZcuVFZL019+uLPk9hLZJuQ/MMGCtVm+7zz67Ej1vEm+uJEmjDyKkvOc64abnXfRct993XPiDkq2ROI6TS5aShUZWCu7Zd2oVjXTFQprVFJUQXLG0LgxEktBA1WRESrGuqy0Er6+akiVtCe4DwtvSTyxUUXEwp+z4k7JlZJYeDUxHTKyyEWQRCcW6IvKmPW8ihVD5V7yZUI7Ws3bJx13u6C02JmmiXjLg8erevb16r85uH26Ha/bXt/TLzftBPssT4Stz4EBSosDi+Z7V1hqChmAX0xRSRWIpEsKnpXQsxSoJKa7mQCsQMQvMd6l/I0QKwj4Iv1CltsbhZKUEiCIVc9PbPp05cCZWMqDPHMkgThG5pOo5PS9XxINVVjDGu6IipkpuQUFSThR7qgOCGFwtC73S9PBhrP8DnnBbnui5Qw4HGC8EmACgS8yxh99WiJnxBCzBqISuW7ouxfC1xL8bqWYsyRRJAjrLvWpnnEurZCWw5XyZXPxuscp3HKecxuACMIBIUJAUpgWIXIKTY5Rf5qJivZPgjzaAOIegRaCsI6bofZqfZw3E8ULXP1Gp6OZZX5le3zPANrTjWTpZlzFcBGZUCd8z51judVr+/cRgK67zePcwu5yeP/xzN53dT+/+vZ5MkTBZRuYcoqlpRrAAeihTUnylE8GFBHkiEjTsgnHeEFXsig428eb6tm0mxn40LwPmO+dsmYAsZmGoA5sYQQAOAbwdxEMDS6DGQ27bQQXHVh3kH81B/ZaDbHBEfRsXGv6czUVKk42cAfaB008yUQmjUvkhYlmuLok+et4UBEnSdeYoUhEEpfM3TPd4ZzsxokmCKqkUTzr9WUWwt54pFSzBAIR8JnUnQYY4/3h9AouTGAMqmWdpJcCzlCTlxsxcTOKHXMFXrEUblulp8zBv7H+i3QPSpNgPbDCgGWplOpxdRyyKTpKmHPCEzAHbcsYrxpWdG8ipYA0kktygFTNW97srBirYfmk44DZZsgTBoGw96JyEIdrNTQJgveA6d0cQEzRpJbsDBIQ3qlPWaTsgvC7G6vePFRG7A+KnM9JEp6FrkyV2JJ92lnqnMQODFJ0pSYKvVGrQIGLw9/827/RHL8w7o2M58bRd4BHOX72800T2iONPBrb52UynGxebWmu7L9D2loX28rC3LDx0VWiGfkTKruQ/v1GhOA0E5Bs1oxogKLbxC+nO2xndIXtqhuJPBnxZEO4JdRB3rFoRQegGUbUgxZxzwAJ55/50xsPJV0mAmSwr0y0JTO6LiAzXBHMppshVhgkGuvP8ONcbyOvvsJyPaBcZNGKS1Ym32xqNUK0H4h5SO0bt5jt17PpnHSw3+p0s5/dbVvrNhAYwkuocHxzQ2JxkGQsesFQyXZcMT2QYLbSKpioBSaU/JFmkt6WJcsPUY+X7c8mZ0CpZEhu/TpLu6IUs6Z3+Hpo8c/wa1EYWenaK/EjHo0m/RZNV0mhgLluzmJO89qxcrjS8IsbDG7IVKzQrjA++2tY4EpJ9B31SA5O9qg13XOyKQfc4mVlG0gyGfbSu7zdEH8impnhDMlXgn3OSZmxe3AdjAAFLxkIpER+wzvXqF7+h1yYP3+sqdL1n2MMsd0cD8MyS0wpZjerrnXasd9axHNi9thrhwJ8JkPgYaSM7CthGLbBllOOrJl5NLjAuyxcd2/NrzwM2PXC6UB1PAArZz16TbrTOhV9K7oy5/J2XJCjZybwIAnNthY0OxvADVp8glw0uMHMOxv2yDT+oLtUEUi6U/EzjjQJc1zRTnUh8Pn7343Nb9/s+ODbxcbiHiF1vsrNFOIMslYqMKX3tx86J2zt3Wg99TdU3kBwWJAP3tUEybIEE31+LerNFF9XeNzQcFg2no9dGQ/uWH1L057YLCkXXGw4Oi4O+LVZfDQheGwg6Q4wZ3v70BRma444ntkKy53Y833ktPexL2qjxPjL027btd72kDX78jgnN8t+weTFX/jfbm/4H</diagram></mxfile>

View file

@ -0,0 +1,223 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="642px" height="744px" viewBox="-0.5 -0.5 642 744" content="&lt;mxfile host=&quot;10460dd4-3a9b-49be-9dda-67c5da313243&quot; modified=&quot;2020-07-16T15:05:24.044Z&quot; agent=&quot;5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Code-Insiders/1.48.0-insider Chrome/80.0.3987.165 Electron/8.3.3 Safari/537.36&quot; etag=&quot;-56zt3ZJ8HD56Lm9mq8x&quot; version=&quot;13.1.3&quot;&gt;&lt;diagram id=&quot;i7RjRSwkiHJf6eIeykeo&quot; name=&quot;Page-1&quot;&gt;7VltU9s4EP41mel9KOO3hPCRhMAxR7kOcFf6KaPYSqxWtlxZIUl//e3Kkl9ih9A2KfeBGQas1ept99lnV6Lnj5P1lSRZ/EFElPc8J1r3/Iue57luMIQ/KNkUkv7wtBAsJIuMUiW4Z9+pETpGumQRzRuKSgiuWNYUhiJNaagaMiKlWDXV5oI3V83IgrYE9yHhbeknFqnYnstxqo4/KVvEZulh33QkxCobQR6TSKxqIn/S88dSCFV8Jesx5Wg8a5di3OWO3nJjkqbqJQMer+6926v36uz24XawYn99y77cvO8XszwRvjQHDiUlCixe7FltrCFoBHYxTSFVLBYiJXxSSUdSLNOI4moOtEKRsNB8V/o3QmQgdEH4hSq1MQ4nSyVAFKuEm9726cyBc7GUIX3mSJ5BCZELqp7T8wtFPFhtBWO8KyoSquQGFCTlRLGnJiCIwdWi1KtMDx/G+j/gCa/liZ434HCA0VyACQC6xBx78G2JmBmNwRKMSui6patKDF8L/LuWasrSXJE0pNPCq3bGmbRKVgJbLpYpxO/my2LHScZpAi4AA4gUBWlpWoDIJTg5QfllISrXOwn/aAOIcwhaBMoqZoreZ8V5VsAbL3T9E5WKrp/1lekNfANswzq+pZNVFcNlYMa18D1zjuVep+XfTwy24jmPdw/Ty8n5wz93k+n95O7f6/EE+ZLlZMYhmrbNCBZAD+VKiq90LLiQIE9FioadM863RDW7ooNNvHmBbZuJsR/Ny4D5zjlbpCBLWBTpwCZGEIJDAG8H8VDfEqjxkNd2UMmxdQcFR3OQ23KQDY7YtXGh4c/ZTGQ0XcspYB84/SQXtTCqlB9ilhfqkuijF01BkCQ9Z4YiFUNQOn/DdI93thMjmqSokknxpNOfVQR765kywVIMQMhnUncSZIjzj9cnsDhJMKDSWZ7VAjzPSFptzMzFJH7IJXwlWrRmuZ62CPOt/Y+1e0CalvuBDYY0R61ch7PniHnZSbKMA56QOWBbzmjJuLJzAzmVrIFEUhi0Zsb6fnfFQA3bLw0H3CZLFyDoV60HnZMwRLu5SQCs51zn7hhigqatZHeAgPCHTco6bQeE38VYrnusiNgdED+dkcY6DV2bLLEj+bSz1DuNGRik6FRJEn6lUoMGEYO//7d5xx2+MO8Mj+XE03aBRzh/9fJOE9kjjj/p2+ZnM51uXKwbrc2+QNtbFtrLw96y8NBVoRn6ESm7lv+CrQrF2UJAsVEzagsE5TZ+Id35O6M7Yk/bofiTAV8VhHtCHcQdq9ZEELphXC9IMeccsEDeuT+d8XDyZRpiJsurdEtCk/tiIqMVwVyKKXKZY4KB7iI/zvQGivo7quYj2kUGjZhkdeLttsZWqDYDcQ+pHaN2C5wmdoOzDpYb/k6WC9yWlX4zoQGMpDrHBwc0Nid5zsIHLJVM1yXDExlGi6yiqUpAUuuPSB7rbWmiXDP1WPv+XHEmtCqWxMavk6Q3fCFL+qe/hybPnKABtaGFnp2iONLxaDJo0WSdNLYwl69YwklRe9YuVxpeMePRDdmIJZoVxodfbWsUC8m+gz5pgMle1QY7LnbloHuczCwjaQ7DPlrXu1uiD2TdULwhuSrxzznJcjYr74MJgIClI6GUSA5Y5/rNi9/Ab5NH4HcVuv4z7GGWu6MheGbBaY2shs31TjvWO+tYDuzeWI1w4M8USHyEtJEfBWzDFthyyvFVE68mFxiX1YuO7fm15wGbHjidq44nAIXsZ69JN1rnIqgkd8Zcwc5LEpTsZFYGgbm2wkb7I/gBq4+Ry/oXmDn7I7dqww+qSzWGlAslP9N4owDXFc1VJxKfj9/9+Nw0/b4Pjtv4ONxDxK432WmqmXQKmSoTOVP66o8KY6937rQe+7rU38ByWLD0vdcGy6AFFnyHLevOFm3Ue9/QcFg0nA5fGw3t235E0Z+bLiiUXW84OCwOXFu0vhoQ/DYQdJYYMbwF6osyNEcdT22lZM8tebbzenrYF7Xh1jvJIGjb1u16Uev/+F0TmtW/Y4uirvqntj/5Dw==&lt;/diagram&gt;&lt;/mxfile&gt;">
<defs>
<clipPath id="mx-clip-10-641-422-26-0">
<rect x="10" y="641" width="422" height="26"/>
</clipPath>
<clipPath id="mx-clip-10-667-422-26-0">
<rect x="10" y="667" width="422" height="26"/>
</clipPath>
<clipPath id="mx-clip-10-693-422-26-0">
<rect x="10" y="693" width="422" height="26"/>
</clipPath>
<clipPath id="mx-clip-10-719-422-26-0">
<rect x="10" y="719" width="422" height="26"/>
</clipPath>
</defs>
<g>
<path d="M 221 380 L 221 463.63" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="stroke"/>
<path d="M 221 468.88 L 217.5 461.88 L 221 463.63 L 224.5 461.88 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="all"/>
<g transform="translate(-0.5 -0.5)">
<switch>
<foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 425px; margin-left: 221px;">
<div style="box-sizing: border-box; font-size: 0; text-align: center; ">
<div style="display: inline-block; font-size: 11px; font-family: Helvetica; color: #000000; line-height: 1.2; pointer-events: all; background-color: #ffffff; white-space: nowrap; ">
creates
</div>
</div>
</div>
</foreignObject>
<text x="221" y="428" fill="#000000" font-family="Helvetica" font-size="11px" text-anchor="middle">
creates
</text>
</switch>
</g>
<ellipse cx="221" cy="335" rx="110" ry="45" fill="#ffffff" stroke="#000000" pointer-events="all"/>
<g transform="translate(-0.5 -0.5)">
<switch>
<foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 218px; height: 1px; padding-top: 335px; margin-left: 112px;">
<div style="box-sizing: border-box; font-size: 0; text-align: center; ">
<div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: #000000; line-height: 1.2; pointer-events: all; white-space: normal; word-wrap: normal; ">
<font face="Courier New">
xrt_instance_create
<br/>
</font>
(full implementation in targets/common/target_instance.c)
</div>
</div>
</div>
</foreignObject>
<text x="221" y="339" fill="#000000" font-family="Helvetica" font-size="12px" text-anchor="middle">
xrt_instance_create...
</text>
</switch>
</g>
<rect x="176" y="0" width="100" height="40" fill="none" stroke="none" pointer-events="all"/>
<g transform="translate(-0.5 -0.5)">
<switch>
<foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 20px; margin-left: 226px;">
<div style="box-sizing: border-box; font-size: 0; text-align: center; ">
<div style="display: inline-block; font-size: 24px; font-family: Helvetica; color: #000000; line-height: 1.2; pointer-events: all; font-weight: bold; white-space: nowrap; ">
With XRT_FEATURE_SERVICE disabled
</div>
</div>
</div>
</foreignObject>
<text x="226" y="27" fill="#000000" font-family="Helvetica" font-size="24px" text-anchor="middle" font-weight="bold">
With XRT...
</text>
</switch>
</g>
<rect x="61" y="50" width="320" height="110" fill="none" stroke="none" pointer-events="all"/>
<g transform="translate(-0.5 -0.5)">
<switch>
<foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe flex-start; justify-content: unsafe flex-start; width: 312px; height: 1px; padding-top: 40px; margin-left: 66px;">
<div style="box-sizing: border-box; font-size: 0; text-align: left; max-height: 120px; overflow: hidden; ">
<div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: #000000; line-height: 1.2; pointer-events: all; white-space: normal; word-wrap: normal; ">
<h1>
in libopenxr_monado.so
</h1>
This library is loaded by the OpenXR loader and provides the entry points for that API. 
<span>
The entire runtime exists in this library, within the process space of the application. Built in xrt/targets/openxr
</span>
</div>
</div>
</div>
</foreignObject>
<text x="66" y="52" fill="#000000" font-family="Helvetica" font-size="12px">
in libopenxr_monado.soThis library is loaded by the...
</text>
</switch>
</g>
<ellipse cx="221" cy="200" rx="110" ry="40" fill="#ffffff" stroke="#000000" pointer-events="all"/>
<g transform="translate(-0.5 -0.5)">
<switch>
<foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 218px; height: 1px; padding-top: 200px; margin-left: 112px;">
<div style="box-sizing: border-box; font-size: 0; text-align: center; ">
<div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: #000000; line-height: 1.2; pointer-events: all; white-space: normal; word-wrap: normal; ">
<font face="Courier New">
xrCreateInstance
</font>
<br/>
(in state_trackers/oxr/oxr_instance.c)
</div>
</div>
</div>
</foreignObject>
<text x="221" y="204" fill="#000000" font-family="Helvetica" font-size="12px" text-anchor="middle">
xrCreateInstance...
</text>
</switch>
</g>
<path d="M 221 240 L 221 283.63" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="stroke"/>
<path d="M 221 288.88 L 217.5 281.88 L 221 283.63 L 224.5 281.88 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="all"/>
<g transform="translate(-0.5 -0.5)">
<switch>
<foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 265px; margin-left: 221px;">
<div style="box-sizing: border-box; font-size: 0; text-align: center; ">
<div style="display: inline-block; font-size: 11px; font-family: Helvetica; color: #000000; line-height: 1.2; pointer-events: all; background-color: #ffffff; white-space: nowrap; ">
calls
</div>
</div>
</div>
</foreignObject>
<text x="221" y="268" fill="#000000" font-family="Helvetica" font-size="11px" text-anchor="middle">
calls
</text>
</switch>
</g>
<rect x="81" y="470" width="280" height="80" fill="#ffffff" stroke="#000000" pointer-events="all"/>
<g transform="translate(-0.5 -0.5)">
<switch>
<foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 278px; height: 1px; padding-top: 510px; margin-left: 82px;">
<div style="box-sizing: border-box; font-size: 0; text-align: center; ">
<div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: #000000; line-height: 1.2; pointer-events: all; white-space: normal; word-wrap: normal; ">
<div>
<font face="Courier New">
t_instance
</font>
</div>
<div>
which implements
<font face="Courier New">
xrt_instance
</font>
with functions that access hardware, using a prober created with all target lists
</div>
</div>
</div>
</div>
</foreignObject>
<text x="221" y="514" fill="#000000" font-family="Helvetica" font-size="12px" text-anchor="middle">
t_instance...
</text>
</switch>
</g>
<path d="M 442.37 649 L 521 649" fill="none" stroke="#000000" stroke-miterlimit="10" stroke-dasharray="3 3" pointer-events="stroke"/>
<path d="M 437.12 649 L 444.12 646.67 L 442.37 649 L 444.12 651.33 Z" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="all"/>
<path d="M 6 636 L 6 610 L 436 610 L 436 636" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="all"/>
<path d="M 6 636 L 6 740 L 436 740 L 436 636" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
<path d="M 6 636 L 436 636" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
<g fill="#000000" font-family="Helvetica" text-anchor="middle" font-size="12px">
<text x="220.5" y="627.5">
t_instance
</text>
</g>
<g fill="#000000" font-family="Helvetica" clip-path="url(#mx-clip-10-641-422-26-0)" font-size="12px">
<text x="11.5" y="653.5">
select = t_instance_select
</text>
</g>
<g fill="#000000" font-family="Helvetica" clip-path="url(#mx-clip-10-667-422-26-0)" font-size="12px">
<text x="11.5" y="679.5">
create_native_compositor = t_instance_create_native_compositor
</text>
</g>
<g fill="#000000" font-family="Helvetica" clip-path="url(#mx-clip-10-693-422-26-0)" font-size="12px">
<text x="11.5" y="705.5">
get_prober = t_instance_get_prober
</text>
</g>
<g fill="#000000" font-family="Helvetica" clip-path="url(#mx-clip-10-719-422-26-0)" font-size="12px">
<text x="11.5" y="731.5">
destroy = t_instance_destroy
</text>
</g>
<rect x="521" y="624" width="120" height="50" fill="#ffffff" stroke="#000000" pointer-events="none"/>
<g transform="translate(-0.5 -0.5)">
<switch>
<foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 649px; margin-left: 581px;">
<div style="box-sizing: border-box; font-size: 0; text-align: center; ">
<div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: #000000; line-height: 1.2; pointer-events: none; white-space: nowrap; ">
«interface»
<br/>
<b>
xrt_instance
</b>
</div>
</div>
</div>
</foreignObject>
<text x="581" y="653" fill="#000000" font-family="Helvetica" font-size="12px" text-anchor="middle">
«interface»...
</text>
</switch>
</g>
</g>
<switch>
<g requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"/>
<a transform="translate(0,-5)" xlink:href="https://desk.draw.io/support/solutions/articles/16000042487" target="_blank">
<text text-anchor="middle" font-size="10px" x="50%" y="100%">
Viewer does not support full SVG 1.1
</text>
</a>
</switch>
</svg>

After

(image error) Size: 17 KiB

View file

@ -0,0 +1,3 @@
Copyright 2020, Collabora, Ltd.
SPDX-License-Identifier: BSL-1.0

File diff suppressed because one or more lines are too long

Before

(image error) Size: 12 KiB

File diff suppressed because one or more lines are too long

After

(image error) Size: 44 KiB

View file

@ -0,0 +1,3 @@
Copyright 2020, Collabora, Ltd.
SPDX-License-Identifier: BSL-1.0

View file

@ -1 +0,0 @@
<mxfile host="Electron" modified="2020-05-26T22:17:09.099Z" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/12.4.2 Chrome/78.0.3904.130 Electron/7.1.4 Safari/537.36" etag="UkJOf6hkk2mb1MZDNHC8" version="12.4.2" type="device" pages="1"><diagram id="i7RjRSwkiHJf6eIeykeo" name="Page-1">7VttU9s4EP41maMfYPwSh+QjCS/HHO0xwF3pp4ywRaIiW66skKS//lay5PeQAAlJe5lhWmslS9bu86y0K6XlDsLZBUfx+DMLMG05VjBruactx7Fty4H/pGSuJZZlpZIRJ4GW5YJb8hObhlo6IQFOSg0FY1SQuCz0WRRhX5RkiHM2LTd7ZLQ8aoxGuCa49RGtS7+SQIyziVl5xZ+YjMZ66K6nK0JkGmtBMkYBmxZE7lnLHXDGRPoUzgaYSu0ZvaTvnS+ozT6M40is8sL9xa3z5eJQ9L7cfelMyV8/4u9Xh17ayzOiEz1hn2MkQOPpN4u5UQQOQC+6yLgYsxGLED3LpX3OJlGA5WgWlHwWEl8/5+2vGItBaIPwOxZirg2OJoKBaCxCqmvrs9MTTtiE+/iFKWnECcRHWLzUzk0byokVRtDKu8AsxILPoQHHFAnyXAYE0rgaZe1y1cOD1v4rLOHULNFyOhQm0H9koAKALtLT7vyYSMz0B6AJgjlUfcHTXAxPI/n/jIshiRKBIh8PU6uaHh+4aWQk8MnpMKn44HGSfnEYUxyCCUABLJKCKFMtQOQcjBxK+XkqysY78j/VAUQpkFYCZTomAt/G6Xym4DhWNP0z5gLPXrSVrj12Nem023F6GujTnMMZMccF+vasTZnXqtn3K4FPcaz7m7vh+dnJ3T83Z8Pbs5t/LwdnEpUReqBApqoWQQHSQIng7AkPGGUc5BGLpF4fCaUVUUGt0r6abk7blHXHsl5ql4DjO6FkFIEsJEGgeI20wAd7ANzWYqB2t2wg4+4L9slcbNE+7Y3Zx67Zx3BjbBtaKPRT8sBiHM34EKAPLv0oYQUW5Y2NMDaCuzFJ0vc5UrpIiwxJp+lYD1IkxkBS62/o//7GVEqGo0g2iTl7VsuhaQgGUD3FjESSkLC+cVWJpMc4ub48kt6ByQWYcLk8gjYRD6ZgOtmp7+NEdYaeVKcxlZx0rIMIAzbVwGmHYGn4DhKN4DlSkgA/E9WWRPFEANutw7Q19J3Ohz2rDi6vB2rS0ZMaSX5Lgrl+OWTBhGL5kf0JocI4GHBdmU+RbibVd0HLca7kZn4UcL8qVRJwSHKG7qmXl+7UciXZ2+y25CQfqVrWx8AXHNXWwTWQpcKV4zpX3HYDV2x7Y2RZvFhVyJJS5DCz+Ct4EmOekERgtfjlkAExoCxMylAm0jUhX69SKVvwLGaJwvXjJFJV4MnEvApNBcmUTnwSCRLKp9u/i9RMVz3VBMXxH0lKRUmepdCtz/z/hd3OCuBtWogz77928C529G/eaA3U7upSb34W7Knqm68DhRh4SeChAPQ+AeKlt5OuTv67M9spu7Kdsrt1KzZup7qbMmLnA3fLy+0IxgtjBmscrm+RzdqlfcLWTdkpm9K1GnZenY805XHNlLAJpb9wAGrSFMsCUI3hHYk/u+tmFIn9tzNKkQh6gJayH58SMEPW3W5RqO2uSKHNrWm9341DnRU51N0pDtl1X2awHZDnKtzfwasKH5bwCsQNwxdEwBlfpiKydI/c4a5xQV34fUAZlQNJ55Nuq2fzwo49WTSHCrDLsF3iAzaR0LCdslPweg1bpKYo7Xhj+9z6RveXz+12V3QLhog74hdMqnmjfuE3cgcF9ptcVparyoN+GbxPkjQphVLf8aA+IIV5kPeHlIk0amQyKhG/jGM53jnH0rZrWvpgBwIw4uJEnu5JZVOUJMS/G5PIVJ0TOSPVO44C01DnSkBSqA9QMlafJfvFMyLuzYvw/E0+H9leW5dPZ4XK03mhcI05Ae1Ko+thQdOqq6Njz5S/mWFkIe9LlUxnb/eNTntF5+iu3TnqV69lFjpHrtfrlZDbtbxyF+mU9FsVUGaf8Q6v26553aIPqkA4mZKQojTBVjgZUWgdExpcoTmbSLXC+/6TKfXHjJOf0B6VsGnOWTqt5lOZ7KVb2ZkehuMEXrs2prcros9oVmp4hRKR0YlSFCfkITvMCQEEJOozIVi4DFmvSOY5XsminQZflEVDpcjHfcEZ6eFusA+WGVHcWnhKdNwQafUahnM65dEQBWZGsCb0pRdKNgK2evycYJoeuaiiVcgvmZrm/O+qSV+z2lD8KF+rnt8J6UxNLvhKtTlt55IbrS4pas4ECyTQQ0YCfcQEH+r14Q+0PrCOvJZ3Khdir2/nZfiTzbkYwAouOCIKbxjgOsWJaETiy/xdjs952e7L4FjFx/o2eovuUwwfgyEsejFLiFDnZ7Jy4LROrFrasdp0D5L1gsRztg2SevJa3p3Itq81d1Gs3aNhvWg47m4bDfWcUYClPedNUMiq9jhYLw5sq71lIJgYbnthlQl/zLMJfzovhz95qOO8KtTZZBRXjcfeHla5qx7nrD+sehec3Hr6rzFzvA+DXh0G7aOghaBzXo6C1I63AYb7iGilZc1dHaq7EhG59dT3soioCR/70Ogj0LL10Mitp+xqodFCjOzDpM0hY+thklvPrJTDpIWw2IdMG8LE9kMmt+G+hcRBX10HVkeUUOw3XDDKJEvOJx8WHgyu905RdY/ntet7PLvphqX3wpbyfeFo3RXvxJ2iQiioY8Z3hXdtveQt/7lYa5eiO/PZa7yuFxExBAMffHrzLT151x3zobkav+3fgHnlMM1uuHqeyd550xWK+Q8502Aq/z2se/Yf</diagram></mxfile>

View file

@ -0,0 +1,431 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="1031px" height="814px" viewBox="-0.5 -0.5 1031 814" content="&lt;mxfile host=&quot;33d46728-47ad-447a-847e-52de5af0104e&quot; modified=&quot;2020-07-16T15:05:54.211Z&quot; agent=&quot;5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Code-Insiders/1.48.0-insider Chrome/80.0.3987.165 Electron/8.3.3 Safari/537.36&quot; etag=&quot;dJD7QJZ0I1eWj79Hh-_4&quot; version=&quot;13.1.3&quot;&gt;&lt;diagram id=&quot;i7RjRSwkiHJf6eIeykeo&quot; name=&quot;Page-1&quot;&gt;7Vtbc9o4FP41zLYPyfiCgTwGctnOpt1Mkt22T4xiK6BGtlxZBOiv36ObL9gEkkChXWYyrXUkS9Y533ekcyRa/iCeXXKUjj+yCNOW50Szln/W8jzXbffgPymZa0nQ62rBiJPINCoEt+QHNkLHSCckwlmloWCMCpJWhSFLEhyKigxxzqbVZg+MVkdN0QjXBLchonXpZxKJsZ2X4xQVf2IyGpuhe4GpiJFtbATZGEVsWhL55y1/wBkT+imeDTCVyrN60e9dLKnNP4zjRKzzwpfLW+/T5ZE4+XT3qTMlf31Pv10dBbqXJ0QnZsIhx0iAxvU3i7lVBI5AL6bIuBizEUsQPS+kfc4mSYTlaA6UQhaT0DwX7a8YS0HogvAbFmJuDI4mgoFoLGJqauuzMxPO2ISH+JkpeQYliI+weK6drxvKiZVGMMq7xCzGgs+hAccUCfJUBQQyuBrl7QrVw4PR/gss4dUs0fI6FCbQf2CgAoAuMtPufJ9IzPQHoAmCOVR9wtNCDE8j+f+MiyFJMoGSEA+1VW2P99w2shL4ZD2MFr97mOgvjlOKYzABKIAlUpDkqgWIXICRYym/0KJ8vOPwfR1AlAJpJVCmYyLwbarnMwW/sabpnzAXePasrUxt1zekM17HOzFAnxYczok5LtH3xNmWeZ2afT8T+BTP+XJzN7w4P7375+Z8eHt+8++HwblEZYLuKZBpUYugAGmgTHD2iAeMMg7yhCVSrw+E0gVRSa3SvoZuXtuWTceyXmqXgOM7pWSUgCwmUaR4jYwgBHsA3DZioHavaiDr7kv2yV1s2T7trdnHrdnHcmPsWloo9FNyz1KczPgQoA8u/ThjJRYVja0wtYK7Mcn0+xwpXegiQ9Jpes69FIkxkNT5G/r/cmMrJcNRIpuknD2p5dA2BAOonlJGEklIWN+4qkTSY5xefziW3oHJ9ZdwuTyCNhGPpmA62WkY4kx1hh5VpymVnPScdwkGbKqBdYdgafgOkozgOVGSCD8R1ZYk6UQA250j3Rr61vNhT6qDD9cDNenkUY0kvyXD3Lwcs2hCsfzI/oRQYR0MuK7cp0g3o/Vd0nJaKLmZHyXcr0uVDBySnKF/FhSlO7VcSfY2uy05yQeqlvUx8AUntXVwA2RZ4Eq3zhW/3cAV190aWZYvVgtk0RQ5yi3+Ap6kmGckE1gtfgVkQAwoi7MqlIl0TSg0q5RmC56lLFO4fpgkqgo8mZgvQlNBUtOJTxJBYvl0+3eZmnrVU01Qmv6RaSpK8qyEbn3m/y/sdtYAb9NCnHv/jYN3uaN/9UZroHZXH8zmZ8meqr75eqcQAy8JPBSA3kdAvPR20tXJf/dmO+UubKfcXt2Kjdup3raM2PmJu+XVdgTjxSmDNQ7Xt8h27TI+Yeem7FRN6TsNO6/OzzRlt2ZK2ITSXzgAtWmKVQGowfCexJ+9TTOKpOHrGaVIBD1AS9lPSAmYIe9uvyjU9tek0PbWtJPfjUOdNTnU2ysOuXVfZrEdkadFuL+BVwt8WMErEDcMXxIBZ0KZisjTPXKHu8EFden3AWVUDkTPR2+rZ/PSjj1bNocFYFdhu8IHbCOh4XpVpxCcNGyRmqK07tb2ufWN7i+f2+2t6RYsEffEL9hU81b9wm/kDkrst7msPFdVBP0yeJ9kOimFtO+4Vx+gYR4V/SFlIoMamYzKxC/jWLp751jabk1LP9mBAIy4OJWne1LZFGUZCe/GJLFVF0TOSPWOk8g2NLkSkJTqI5SN1WfJfvGMiC/2RXj+Kp+P3aBtymezUuXZvFS4xpyAdqXRzbCgadXVcTew5a92GFko+lIl29nrfaPXXtM5+ht3jubVa5mFLpAbnJxUkNtzgmoXekrmrQVQ5p/xBq/brnndsg9agHA2JTFFOsFWOhlRaB0TGl2hOZtItcL74aMt9ceMkx/QHlWwac9ZOq3mU5n8pVvZmRmG4wxeu7amdxdEH9Gs0vAKZSKnE6Uozch9fpgTAwhI0mdCsHgVsl6QzPOCikU7Db4oj4YqkY//jDMyw93gECwzori19JSo2xBpnTQM53WqoyEKzExgTehLL5RtBWz1+DnDVB+5qKJTyi/Zmub877pJX7vaUPwgX1s8vxPSmdpc8JVqc9YuJDdGXVLUnAkWSKD7nATmiAk+NOjDH2h94BwHreBMLsRB3y3K8CebczGAFVxwRBTeMMB1ijPRiMTn+bsan/Oq3VfBcREfm9voLbtPMUyUJx3CwpeyjAh1hiYbDLzWqVNLPTY1P4Bls2AJvF2DpZ7Elnco8m1szW2Uaw9o2Cwaur1do6GeO4qwtOe8CQp51QEHm8WB67R3DAQby+0uvLJhkH22YVDn+TCoCHm8F4U824zmFuOy14dX/rrHOpsPr94EJ7+eBmzMIB/CoReHQ4doaCnovOejIbXrbYDhITJaa1nz14fqvkRGfj0Fvk5k1ISRQ4j0s1Cz8xDJr6fwaiHSUpwcwqXtIWPn4ZJfz7RUw6WlsDiETlvCxO5DJ7/h/oXEQV9dD1ZHllDsN1w4yiUrzivvlx4UbvaO0eJeL2jX93pu043L4Jmt5dvC0ror3os7RqWQ0MSObwrz2mbJW/3zsdY+RXn2szd4fS8hYggGfvf+1bf25N13zIf2qvyufxMWVMM1t+Eqei57481XKBY/7NRBVfHzWP/8Pw==&lt;/diagram&gt;&lt;/mxfile&gt;">
<defs>
<clipPath id="mx-clip-604-711-422-26-0">
<rect x="604" y="711" width="422" height="26"/>
</clipPath>
<clipPath id="mx-clip-604-737-422-26-0">
<rect x="604" y="737" width="422" height="26"/>
</clipPath>
<clipPath id="mx-clip-604-763-422-26-0">
<rect x="604" y="763" width="422" height="26"/>
</clipPath>
<clipPath id="mx-clip-604-789-422-26-0">
<rect x="604" y="789" width="422" height="26"/>
</clipPath>
<clipPath id="mx-clip-4-711-422-26-0">
<rect x="4" y="711" width="422" height="26"/>
</clipPath>
<clipPath id="mx-clip-4-737-422-26-0">
<rect x="4" y="737" width="422" height="26"/>
</clipPath>
<clipPath id="mx-clip-4-763-422-26-0">
<rect x="4" y="763" width="422" height="26"/>
</clipPath>
<clipPath id="mx-clip-4-789-422-26-0">
<rect x="4" y="789" width="422" height="26"/>
</clipPath>
</defs>
<g>
<path d="M 815 375 L 815 573.63" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="stroke"/>
<path d="M 815 578.88 L 811.5 571.88 L 815 573.63 L 818.5 571.88 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="all"/>
<g transform="translate(-0.5 -0.5)">
<switch>
<foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 478px; margin-left: 815px;">
<div style="box-sizing: border-box; font-size: 0; text-align: center; ">
<div style="display: inline-block; font-size: 11px; font-family: Helvetica; color: #000000; line-height: 1.2; pointer-events: all; background-color: #ffffff; white-space: nowrap; ">
creates
</div>
</div>
</div>
</foreignObject>
<text x="815" y="481" fill="#000000" font-family="Helvetica" font-size="11px" text-anchor="middle">
creates
</text>
</switch>
</g>
<ellipse cx="815" cy="330" rx="110" ry="45" fill="#ffffff" stroke="#000000" pointer-events="all"/>
<g transform="translate(-0.5 -0.5)">
<switch>
<foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 218px; height: 1px; padding-top: 330px; margin-left: 706px;">
<div style="box-sizing: border-box; font-size: 0; text-align: center; ">
<div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: #000000; line-height: 1.2; pointer-events: all; white-space: normal; word-wrap: normal; ">
<font face="Courier New">
xrt_instance_create
<br/>
</font>
(full implementation in targets/common/target_instance.c)
</div>
</div>
</div>
</foreignObject>
<text x="815" y="334" fill="#000000" font-family="Helvetica" font-size="12px" text-anchor="middle">
xrt_instance_create...
</text>
</switch>
</g>
<rect x="455" y="0" width="100" height="40" fill="none" stroke="none" pointer-events="all"/>
<g transform="translate(-0.5 -0.5)">
<switch>
<foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 20px; margin-left: 505px;">
<div style="box-sizing: border-box; font-size: 0; text-align: center; ">
<div style="display: inline-block; font-size: 24px; font-family: Helvetica; color: #000000; line-height: 1.2; pointer-events: all; font-weight: bold; white-space: nowrap; ">
With XRT_FEATURE_SERVICE enabled
</div>
</div>
</div>
</foreignObject>
<text x="505" y="27" fill="#000000" font-family="Helvetica" font-size="24px" text-anchor="middle" font-weight="bold">
With XRT...
</text>
</switch>
</g>
<rect x="55" y="60" width="340" height="110" fill="none" stroke="none" pointer-events="all"/>
<g transform="translate(-0.5 -0.5)">
<switch>
<foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe flex-start; justify-content: unsafe flex-start; width: 332px; height: 1px; padding-top: 50px; margin-left: 60px;">
<div style="box-sizing: border-box; font-size: 0; text-align: left; max-height: 120px; overflow: hidden; ">
<div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: #000000; line-height: 1.2; pointer-events: all; white-space: normal; word-wrap: normal; ">
<h1>
in libopenxr_monado.so
</h1>
<p>
This library is loaded by the OpenXR loader and provides the entry points for that API. No direct hardware access takes place (neither for rendering nor device input) - forwarded over IPC links to service module. Built in xrt/targets/openxr
</p>
</div>
</div>
</div>
</foreignObject>
<text x="60" y="62" fill="#000000" font-family="Helvetica" font-size="12px">
in libopenxr_monado.so...
</text>
</switch>
</g>
<rect x="655" y="60" width="320" height="100" fill="none" stroke="none" pointer-events="all"/>
<g transform="translate(-0.5 -0.5)">
<switch>
<foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe flex-start; justify-content: unsafe flex-start; width: 312px; height: 1px; padding-top: 50px; margin-left: 660px;">
<div style="box-sizing: border-box; font-size: 0; text-align: left; max-height: 110px; overflow: hidden; ">
<div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: #000000; line-height: 1.2; pointer-events: all; white-space: normal; word-wrap: normal; ">
<h1>
in monado-service
</h1>
<p>
This persistent service performs hardware interaction and exposes functionality over IPC to the runtime SO loaded in the app's process. Built in xrt/targets/service
</p>
</div>
</div>
</div>
</foreignObject>
<text x="660" y="62" fill="#000000" font-family="Helvetica" font-size="12px">
in monado-service...
</text>
</switch>
</g>
<ellipse cx="215" cy="210" rx="110" ry="40" fill="#ffffff" stroke="#000000" pointer-events="all"/>
<g transform="translate(-0.5 -0.5)">
<switch>
<foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 218px; height: 1px; padding-top: 210px; margin-left: 106px;">
<div style="box-sizing: border-box; font-size: 0; text-align: center; ">
<div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: #000000; line-height: 1.2; pointer-events: all; white-space: normal; word-wrap: normal; ">
<font face="Courier New">
xrCreateInstance
</font>
<br/>
(in state_trackers/oxr/oxr_instance.c)
</div>
</div>
</div>
</foreignObject>
<text x="215" y="214" fill="#000000" font-family="Helvetica" font-size="12px" text-anchor="middle">
xrCreateInstance...
</text>
</switch>
</g>
<ellipse cx="215" cy="330" rx="80" ry="40" fill="#ffffff" stroke="#000000" pointer-events="all"/>
<g transform="translate(-0.5 -0.5)">
<switch>
<foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 158px; height: 1px; padding-top: 330px; margin-left: 136px;">
<div style="box-sizing: border-box; font-size: 0; text-align: center; ">
<div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: #000000; line-height: 1.2; pointer-events: all; white-space: normal; word-wrap: normal; ">
<font face="Courier New">
xrt_instance_create
</font>
<br/>
(trampoline in targets/openxr/target.c)
</div>
</div>
</div>
</foreignObject>
<text x="215" y="334" fill="#000000" font-family="Helvetica" font-size="12px" text-anchor="middle">
xrt_instance_create...
</text>
</switch>
</g>
<path d="M 215 250 L 215 283.63" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="stroke"/>
<path d="M 215 288.88 L 211.5 281.88 L 215 283.63 L 218.5 281.88 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="all"/>
<g transform="translate(-0.5 -0.5)">
<switch>
<foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 270px; margin-left: 215px;">
<div style="box-sizing: border-box; font-size: 0; text-align: center; ">
<div style="display: inline-block; font-size: 11px; font-family: Helvetica; color: #000000; line-height: 1.2; pointer-events: all; background-color: #ffffff; white-space: nowrap; ">
calls
</div>
</div>
</div>
</foreignObject>
<text x="215" y="273" fill="#000000" font-family="Helvetica" font-size="11px" text-anchor="middle">
calls
</text>
</switch>
</g>
<ellipse cx="215" cy="470" rx="80" ry="50" fill="#ffffff" stroke="#000000" pointer-events="all"/>
<g transform="translate(-0.5 -0.5)">
<switch>
<foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 158px; height: 1px; padding-top: 470px; margin-left: 136px;">
<div style="box-sizing: border-box; font-size: 0; text-align: center; ">
<div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: #000000; line-height: 1.2; pointer-events: all; white-space: normal; word-wrap: normal; ">
<font face="Courier New">
ipc_instance_create
</font>
<br/>
(in ipc/ipc_client_instance)
</div>
</div>
</div>
</foreignObject>
<text x="215" y="474" fill="#000000" font-family="Helvetica" font-size="12px" text-anchor="middle">
ipc_instance_create...
</text>
</switch>
</g>
<path d="M 215 370 L 215 413.63" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="stroke"/>
<path d="M 215 418.88 L 211.5 411.88 L 215 413.63 L 218.5 411.88 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="all"/>
<g transform="translate(-0.5 -0.5)">
<switch>
<foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 395px; margin-left: 215px;">
<div style="box-sizing: border-box; font-size: 0; text-align: center; ">
<div style="display: inline-block; font-size: 11px; font-family: Helvetica; color: #000000; line-height: 1.2; pointer-events: all; background-color: #ffffff; white-space: nowrap; ">
calls
</div>
</div>
</div>
</foreignObject>
<text x="215" y="398" fill="#000000" font-family="Helvetica" font-size="11px" text-anchor="middle">
calls
</text>
</switch>
</g>
<rect x="95" y="580" width="240" height="70" fill="#ffffff" stroke="#000000" pointer-events="all"/>
<g transform="translate(-0.5 -0.5)">
<switch>
<foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 238px; height: 1px; padding-top: 615px; margin-left: 96px;">
<div style="box-sizing: border-box; font-size: 0; text-align: center; ">
<div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: #000000; line-height: 1.2; pointer-events: all; white-space: normal; word-wrap: normal; ">
<div>
<font face="Courier New">
ipc_client_instance
</font>
</div>
<div>
which implements
<font face="Courier New">
xrt_instance
</font>
with client proxy functions
</div>
</div>
</div>
</div>
</foreignObject>
<text x="215" y="619" fill="#000000" font-family="Helvetica" font-size="12px" text-anchor="middle">
ipc_client_instance...
</text>
</switch>
</g>
<path d="M 215 520 L 215 573.63" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="stroke"/>
<path d="M 215 578.88 L 211.5 571.88 L 215 573.63 L 218.5 571.88 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="all"/>
<g transform="translate(-0.5 -0.5)">
<switch>
<foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 550px; margin-left: 215px;">
<div style="box-sizing: border-box; font-size: 0; text-align: center; ">
<div style="display: inline-block; font-size: 11px; font-family: Helvetica; color: #000000; line-height: 1.2; pointer-events: all; background-color: #ffffff; white-space: nowrap; ">
creates
</div>
</div>
</div>
</foreignObject>
<text x="215" y="553" fill="#000000" font-family="Helvetica" font-size="11px" text-anchor="middle">
creates
</text>
</switch>
</g>
<rect x="695" y="580" width="240" height="70" fill="#ffffff" stroke="#000000" pointer-events="all"/>
<g transform="translate(-0.5 -0.5)">
<switch>
<foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 238px; height: 1px; padding-top: 615px; margin-left: 696px;">
<div style="box-sizing: border-box; font-size: 0; text-align: center; ">
<div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: #000000; line-height: 1.2; pointer-events: all; white-space: normal; word-wrap: normal; ">
<div>
<font face="Courier New">
t_instance
</font>
</div>
<div>
which implements
<font face="Courier New">
xrt_instance
</font>
with functions that access hardware, using a prober created with all target lists
</div>
</div>
</div>
</div>
</foreignObject>
<text x="815" y="619" fill="#000000" font-family="Helvetica" font-size="12px" text-anchor="middle">
t_instance...
</text>
</switch>
</g>
<path d="M 593.63 700.02 L 545 700 L 545 580" fill="none" stroke="#000000" stroke-miterlimit="10" stroke-dasharray="3 3" pointer-events="stroke"/>
<path d="M 598.88 700.02 L 591.88 702.35 L 593.63 700.02 L 591.88 697.68 Z" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="all"/>
<path d="M 600 706 L 600 680 L 1030 680 L 1030 706" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="all"/>
<path d="M 600 706 L 600 810 L 1030 810 L 1030 706" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
<path d="M 600 706 L 1030 706" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
<g fill="#000000" font-family="Helvetica" text-anchor="middle" font-size="12px">
<text x="814.5" y="697.5">
t_instance
</text>
</g>
<g fill="#000000" font-family="Helvetica" clip-path="url(#mx-clip-604-711-422-26-0)" font-size="12px">
<text x="605.5" y="723.5">
select = t_instance_select
</text>
</g>
<g fill="#000000" font-family="Helvetica" clip-path="url(#mx-clip-604-737-422-26-0)" font-size="12px">
<text x="605.5" y="749.5">
create_native_compositor = t_instance_create_native_compositor
</text>
</g>
<g fill="#000000" font-family="Helvetica" clip-path="url(#mx-clip-604-763-422-26-0)" font-size="12px">
<text x="605.5" y="775.5">
get_prober = t_instance_get_prober
</text>
</g>
<g fill="#000000" font-family="Helvetica" clip-path="url(#mx-clip-604-789-422-26-0)" font-size="12px">
<text x="605.5" y="801.5">
destroy = t_instance_destroy
</text>
</g>
<path d="M 436.37 700.28 L 485 700.3 L 485 580" fill="none" stroke="#000000" stroke-miterlimit="10" stroke-dasharray="3 3" pointer-events="none"/>
<path d="M 431.12 700.28 L 438.12 697.95 L 436.37 700.28 L 438.12 702.62 Z" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
<path d="M 0 706 L 0 680 L 430 680 L 430 706" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
<path d="M 0 706 L 0 810 L 430 810 L 430 706" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
<path d="M 0 706 L 430 706" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
<g fill="#000000" font-family="Helvetica" text-anchor="middle" font-size="12px">
<text x="214.5" y="697.5">
ipc_client_instance
</text>
</g>
<g fill="#000000" font-family="Helvetica" clip-path="url(#mx-clip-4-711-422-26-0)" font-size="12px">
<text x="5.5" y="723.5">
select = ipc_client_instance_select
</text>
</g>
<g fill="#000000" font-family="Helvetica" clip-path="url(#mx-clip-4-737-422-26-0)" font-size="12px">
<text x="5.5" y="749.5">
create_native_compositor = ipc_client_instance_create_native_compositor
</text>
</g>
<g fill="#000000" font-family="Helvetica" clip-path="url(#mx-clip-4-763-422-26-0)" font-size="12px">
<text x="5.5" y="775.5">
get_prober = ipc_client_instance_get_prober
</text>
</g>
<g fill="#000000" font-family="Helvetica" clip-path="url(#mx-clip-4-789-422-26-0)" font-size="12px">
<text x="5.5" y="801.5">
destroy = ipc_client_instance_destroy
</text>
</g>
<rect x="455" y="530" width="120" height="50" fill="#ffffff" stroke="#000000" pointer-events="none"/>
<g transform="translate(-0.5 -0.5)">
<switch>
<foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 555px; margin-left: 515px;">
<div style="box-sizing: border-box; font-size: 0; text-align: center; ">
<div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: #000000; line-height: 1.2; pointer-events: none; white-space: nowrap; ">
«interface»
<br/>
<b>
xrt_instance
</b>
</div>
</div>
</div>
</foreignObject>
<text x="515" y="559" fill="#000000" font-family="Helvetica" font-size="12px" text-anchor="middle">
«interface»...
</text>
</switch>
</g>
<path d="M 815 240 L 815 278.63" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
<path d="M 815 283.88 L 811.5 276.88 L 815 278.63 L 818.5 276.88 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
<g transform="translate(-0.5 -0.5)">
<switch>
<foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 263px; margin-left: 815px;">
<div style="box-sizing: border-box; font-size: 0; text-align: center; ">
<div style="display: inline-block; font-size: 11px; font-family: Helvetica; color: #000000; line-height: 1.2; pointer-events: none; background-color: #ffffff; white-space: nowrap; ">
calls
</div>
</div>
</div>
</foreignObject>
<text x="815" y="266" fill="#000000" font-family="Helvetica" font-size="11px" text-anchor="middle">
calls
</text>
</switch>
</g>
<ellipse cx="815" cy="200" rx="85" ry="40" fill="#ffffff" stroke="#000000" pointer-events="none"/>
<g transform="translate(-0.5 -0.5)">
<switch>
<foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 168px; height: 1px; padding-top: 200px; margin-left: 731px;">
<div style="box-sizing: border-box; font-size: 0; text-align: center; ">
<div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: #000000; line-height: 1.2; pointer-events: none; white-space: normal; word-wrap: normal; ">
<font face="Courier New">
init_all()
</font>
<br/>
(in ipc/ipc_server_process.c)
</div>
</div>
</div>
</foreignObject>
<text x="815" y="204" fill="#000000" font-family="Helvetica" font-size="12px" text-anchor="middle">
init_all()...
</text>
</switch>
</g>
</g>
<switch>
<g requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"/>
<a transform="translate(0,-5)" xlink:href="https://desk.draw.io/support/solutions/articles/16000042487" target="_blank">
<text text-anchor="middle" font-size="10px" x="50%" y="100%">
Viewer does not support full SVG 1.1
</text>
</a>
</switch>
</svg>

After

(image error) Size: 32 KiB

View file

@ -0,0 +1,3 @@
Copyright 2020, Collabora, Ltd.
SPDX-License-Identifier: BSL-1.0

File diff suppressed because one or more lines are too long

Before

(image error) Size: 22 KiB

View file

@ -1,5 +1,10 @@
# Monado
<!--
Copyright 2018-2020, Collabora, Ltd. and the Monado contributors
SPDX-License-Identifier: BSL-1.0
-->
This documentation is intended for developers wanting to dive into the code of
Monado. And assumes that you have read [README.md][], the file also holds
getting started information and general documentation.
@ -10,6 +15,7 @@ getting started information and general documentation.
also includes a section for changes that have not yet been in a tagged
release.
* @ref md_targets
* @ref vulkan-extensions
* @ref md_writing-a-new-driver (**not complete**)
## Source layout

View file

@ -1,14 +1,14 @@
# Roadmap
<!--
Copyright 2018-2020, Collabora, Ltd. and the Monado contributors
SPDX-License-Identifier: BSL-1.0
-->
## Short term
* **xrt**: Only use time_state struct in , all drivers use native
clock.
* **aux/log**: Add a common logging framework that can be used to pipe messages
up into **st/oxr** from things like drivers and the compositor.
* **cmake**: Make a proper FindXCB.cmake file.
* **@ref comp**: Do timing based of the display refresh-rate and display time.
* **@ref comp**: Support quads layers.
* **@ref comp**: Move into own thread.
* **@ref oxr**: Locking, maybe we just have a single lock for the session.
We will need to figure out how to do wait properly.
@ -17,7 +17,6 @@
## Long term
* **aux/beacon**: Complete and integrate Lighthouse tracking code.
* **@ref comp**: Moving the compositor into it's own process.
* **@ref comp**: Support other extensions layers.
* **@ref comp**: See-through support for Vive headset.
* **doc**: Group Related code.

View file

@ -1,5 +1,10 @@
# Understanding and Writing Targets
<!--
Copyright 2018-2020, Collabora, Ltd. and the Monado contributors
SPDX-License-Identifier: BSL-1.0
-->
Monado is designed to be a collection of related but independent modules. The
final build product that brings all the desired components together, potentially
with additional code, is called the "target". There are several targets included
@ -34,8 +39,8 @@ instantiates your implementation.
All methods of `xrt_instance` are required, though the `get_prober` method may
output a null pointer if the instance is not using a prober, and targets that do
not need compositing may stub out the `create_fd_compositor` method to always
return an error. A fully-featured implementation is in
not need compositing may stub out the `create_native_compositor` method to
always return an error. A fully-featured implementation is in
`src/targets/common/target_instance.c`, which calls
`xrt_prober_create_with_lists` passing the common `target_lists` variable to
include all supported devices.
@ -61,7 +66,7 @@ various extra targets like `monado-cli` even when building with
version, `target_instance_no_comp`, which stubs out the compositor creation
call, but are otherwise the same.)
![In-process OpenXR runtime diagram](images/in-process.svg)
![In-process OpenXR runtime diagram](images/in-process.drawio.svg)
### XRT_FEATURE_SERVICE enabled
@ -73,4 +78,4 @@ Note that in this case, there are two processes involved, which have different
- The service has a normal or complete instance implementation that actually
provides access to devices, etc.
![Out-of-process OpenXR runtime diagram](images/out-of-proc.svg)
![Out-of-process OpenXR runtime diagram](images/out-of-proc.drawio.svg)

133
doc/vulkan-extensions.md Normal file
View file

@ -0,0 +1,133 @@
# Vulkan extensions used by Monado {#vulkan-extensions}
<!--
Copyright 2020, Collabora, Ltd. and the Monado contributors
SPDX-License-Identifier: BSL-1.0
-->
<!--
adjacent vertical lines: for column spans. Aligning final vertical line
with last column's closing bar, to keep the text looking close to the rendered
version.
Using manual "footnotes" to keep table somewhat narrow.
Do not reflow this table!
Edit with word-wrap disabled and with a multiple-cursor capable editor to
minimize frustration.
-->
| | Client | XCB server (a) | Wayland server (a) | Xlib-xrandr server (b) | NVIDIA xrandr server (b) | Android server | Windows server |
| ---------------------------------------------------|--------|----------------|--------------------|------------------------|--------------------------|----------------|----------------|
| **Instance extensions** ||||||||
| [`VK_KHR_external_fence_capabilities`][] (8) | yes? |||||||
| [`VK_KHR_external_memory_capabilities`][] (8) | yes? |||||||
| [`VK_KHR_external_semaphore_capabilities`][] (8) | yes? |||||||
| [`VK_KHR_get_physical_device_properties2`][] (8) | yes |||||||
| [`VK_KHR_surface`][] | | yes ||||||
| [`VK_KHR_display`][] | | | | yes (2) (requires `VK_KHR_surface`) || | |
| **Platform-specific instance extensions** ||||||||
| [`VK_KHR_xcb_surface`][] | | yes (1, 4) | | | | | |
| [`VK_KHR_wayland_surface`][] | | | yes (1, 4) | | | | |
| [`VK_EXT_direct_mode_display`][] | | | | yes (1) | yes (2) | | |
| [`VK_EXT_acquire_xlib_display`][] | | | | yes (1) (in shared code) || | |
| [`VK_KHR_android_surface`][] | | | | | | yes (1, 4) | |
| [`VK_KHR_win32_surface`][] | | | | | | | yes (1, 4) |
| **Device Extensions** ||||||||
| [`VK_KHR_get_memory_requirements2`][] (8) | yes |||||||
| [`VK_KHR_dedicated_allocation`][] (8) | yes? (requires `VK_KHR_get_memory_requirements2`) |||||||
| [`VK_KHR_external_fence`][] (8) (+platform: 5) | yes (soon) |||||||
| [`VK_KHR_external_memory`][] (8) (+platform: 6) | yes |||||||
| [`VK_KHR_external_semaphore`][] (8) (+platform: 7) | yes (soon) |||||||
| [`VK_KHR_swapchain`][] | | yes ||||||
## Notes
Kept out of the table above to limit its width.
* Server type:
* a: Windowed
* b: Direct mode
* Usage details/reason:
* 1: Used directly
* 2: Dependency of `VK_EXT_direct_mode_display`
* 3: Dependency of `VK_EXT_acquire_xlib_display`
* 4: Platform extension building on `VK_KHR_surface`
* 5: Platform-specific extensions building on `VK_KHR_external_fence`:
* Linux and Android: [`VK_KHR_external_fence_fd`][]
* Windows: [`VK_KHR_external_fence_win32`][]
* Note: These platform-specific extensions were not promoted to Core in
Vulkan 1.1, only the platform-independent base extension.
* 6: Platform-specific extensions building on `VK_KHR_external_memory`:
* Linux: [`VK_KHR_external_memory_fd`][]
* Android: [`VK_ANDROID_external_memory_android_hardware_buffer`][] (`fd`
also usually available?)
* Windows: [`VK_KHR_external_memory_win32`][]
* Note: These platform-specific extensions were not promoted to Core in
Vulkan 1.1, only the platform-independent base extension.
* 7: Platform-specific extensions building on `VK_KHR_external_semaphore`:
* Linux and Android: [`VK_KHR_external_semaphore_fd`][]
* Windows: [`VK_KHR_external_semaphore_win32`][]
* Note: These platform-specific extensions were not promoted to Core in
Vulkan 1.1, only the platform-independent base extension.
* 8: Promoted to Vulkan 1.1 Core
<!-- links to the extension references, out of line to keep the table source readable -->
<!-- They don't show up like this in the formatted document. -->
[`VK_KHR_external_fence_capabilities`]: https://khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_KHR_external_fence_capabilities.html
[`VK_KHR_external_memory_capabilities`]: https://khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_KHR_external_memory_capabilities.html
[`VK_KHR_external_semaphore_capabilities`]: https://khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_KHR_external_semaphore_capabilities.html
[`VK_KHR_get_physical_device_properties2`]: https://khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_KHR_get_physical_device_properties2.html
[`VK_KHR_surface`]: https://khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_KHR_surface.html
[`VK_KHR_display`]: https://khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_KHR_display.html
[`VK_KHR_xcb_surface`]: https://khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_KHR_xcb_surface.html
[`VK_KHR_wayland_surface`]: https://khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_KHR_wayland_surface.html
[`VK_EXT_direct_mode_display`]: https://khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_EXT_direct_mode_display.html
[`VK_EXT_acquire_xlib_display`]: https://khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_EXT_acquire_xlib_display.html
[`VK_KHR_android_surface`]: https://khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_KHR_android_surface.html
[`VK_KHR_win32_surface`]: https://khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_KHR_win32_surface.html
[`VK_KHR_dedicated_allocation`]: https://khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_KHR_dedicated_allocation.html
[`VK_KHR_external_fence`]: https://khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_KHR_external_fence.html
[`VK_KHR_external_memory`]: https://khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_KHR_external_memory.html
[`VK_KHR_external_semaphore`]: https://khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_KHR_external_semaphore.html
[`VK_KHR_get_memory_requirements2`]: https://khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_KHR_get_memory_requirements2.html
[`VK_KHR_swapchain`]: https://khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_KHR_swapchain.html
[`VK_KHR_external_fence_fd`]: https://khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_KHR_external_fence_fd.html
[`VK_KHR_external_fence_win32`]: https://khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_KHR_external_fence_win32.html
[`VK_KHR_external_memory_fd`]: https://khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_KHR_external_memory_fd.html
[`VK_ANDROID_external_memory_android_hardware_buffer`]: https://khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_ANDROID_external_memory_android_hardware_buffer.html
[`VK_KHR_external_memory_win32`]: https://khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_KHR_external_memory_win32.html
[`VK_KHR_external_semaphore_fd`]: https://khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_KHR_external_semaphore_fd.html
[`VK_KHR_external_semaphore_win32`]: https://khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_KHR_external_semaphore_win32.html
## Reasons
* Instance extensions:
* `VK_KHR_surface` - for configuring output surface.
* `VK_KHR_get_physical_device_properties2` - for getting device UUID to share
between client compositor and main/native compositor.
* Device extensions:
* `VK_KHR_swapchain` - for displaying output on a display output.
## Code locations
* Client
* Instance extensions:
[xrt_gfx_vk_instance_extensions](@ref xrt_gfx_vk_instance_extensions)
* Device extensions:
[xrt_gfx_vk_device_extensions](@ref xrt_gfx_vk_device_extensions)
* Server
* All these are in [comp_compositor.c](@ref comp_compositor.c), with the
extensions required by all servers defined in
`COMP_INSTANCE_EXTENSIONS_COMMON`
* XCB (Windowed) Server: `instance_extensions_xcb`
* Wayland (Windowed) Server: `instance_extensions_wayland`
* Xlib-xrandr direct mode server and NVIDIA direct mode server:
`instance_extensions_direct_mode`
* Android server: `instance_extensions_android`
* Windows server: `instance_extensions_windows`

View file

@ -1,5 +1,10 @@
# Writing a new driver
<!--
Copyright 2018-2020, Collabora, Ltd. and the Monado contributors
SPDX-License-Identifier: BSL-1.0
-->
This document will tell you in broad strokes what you need to do to create a
driver in Monado. Like the many ones already in there @ref drv. It is not a step
by step guide to making a driver. Also what you need to do can vary a lot
@ -11,3 +16,10 @@ features you want.
The first components you will be interacting with is @ref st_prober find the
hardware devices and setup a working system, along with the @ref aux code that
provides various helpers. You can look at other @ref drv on how to start.
## Probing
When should I implement the @ref xrt_auto_prober interface? The answer is not
too hard: you use the auto prober interface when the basic USB VID/PID-based
interface is not sufficient for you to detect presence/absence of your device,
or if you don't want to use the built-in HID support for some reason.

5
gradle.properties Normal file
View file

@ -0,0 +1,5 @@
# Copyright 2020, Collabora, Ltd.
# SPDX-License-Identifier: BSL-1.0
android.useAndroidX = true

View file

@ -0,0 +1,6 @@
#Wed Nov 04 14:30:07 CST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip

View file

@ -0,0 +1,2 @@
SPDX-FileCopyrightText: Copyright 2010 the original author or authors.
SPDX-License-Identifier: Apache-2.0

View file

@ -4,7 +4,7 @@
project(
'xrt',
['c', 'cpp'],
version: '0.3.0',
version: '21.0.0',
license: 'BSL-1.0',
meson_version: '>=0.49.0',
default_options: [
@ -19,12 +19,15 @@ cpp = meson.get_compiler('cpp')
add_project_arguments(cc.get_supported_arguments([
'-D_XOPEN_SOURCE=700',
'-Wno-unused-parameter',
'-Werror-implicit-function-declaration',
'-Werror=incompatible-pointer-types'
]), language: 'c')
add_project_arguments(cpp.get_supported_arguments([
'-D_XOPEN_SOURCE=700',
'-Wno-unused-parameter',
'-Wno-deprecated-copy', # Eigen
'-Wno-c11-extensions' # clang OpenCV
]), language: 'cpp')
@ -52,20 +55,27 @@ glslangValidator = find_program('glslangValidator')
pthreads = cc.find_library('pthread', required: true)
rt = cc.find_library('rt', required: true)
avcodec = dependency('libavcodec', required: false)
egl = dependency('egl', required: get_option('egl'))
egl = egl.partial_dependency(includes: true)
eigen3 = dependency('eigen3')
libjpeg = dependency('libjpeg', required: false)
libusb = dependency('libusb-1.0', required: false)
opengl = dependency('gl', required: get_option('opengl'))
rs = dependency('realsense2', required: false)
sdl2 = dependency('sdl2', required: get_option('gui'))
udev = dependency('libudev', required: false)
libuvc = dependency('libuvc', required: false)
vulkan = dependency('vulkan', required: true)
zlib = dependency('zlib', required: false)
survive = dependency('survive', required: false)
avcodec = dependency('libavcodec', required: false)
egl = dependency('egl', required: get_option('egl'))
egl = egl.partial_dependency(includes: true)
eigen3 = dependency('eigen3')
libjpeg = dependency('libjpeg', required: false)
libusb = dependency('libusb-1.0', required: false)
opengl = dependency('gl', required: get_option('opengl'))
opengles = dependency('glesv2', required: get_option('opengles'))
rs = dependency('realsense2', required: false)
sdl2 = dependency('sdl2', required: get_option('gui'))
udev = dependency('libudev', required: false)
libuvc = dependency('libuvc', required: false)
vulkan = dependency('vulkan', required: true)
zlib = dependency('zlib', required: false)
survive = dependency('survive', required: false)
dbus = dependency('dbus-1', required: get_option('dbus'))
gst = dependency('gstreamer-1.0', required: false)
gst_app = dependency('gstreamer-app-1.0', required: false)
gst_video= dependency('gstreamer-video-1.0', required: false)
gst_found = gst.found() and gst_app.found() and gst_video.found()
opencv = dependency('opencv4', required: false)
if not opencv.found()
@ -98,6 +108,11 @@ if get_option('opengl').enabled() or get_option('opengl').auto()
build_opengl = opengl.found()
endif
build_opengles = false
if get_option('opengles').enabled() or get_option('opengles').auto()
build_opengles = opengles.found() and egl.found()
endif
build_egl = false
if get_option('egl').enabled() or get_option('egl').auto()
@ -116,6 +131,9 @@ endif
build_xcb_xrandr_direct = build_xcb and build_xlib and xcb_randr.found() and x11_xcb.found()
# requires only vulkan
build_vk_khr_display = true
build_wayland = false
if get_option('wayland').enabled() or get_option('wayland').auto()
build_wayland = wayland.found() and wayland_protos.found() and wayland_scanner.found()
@ -138,12 +156,13 @@ if 'v4l2' in drivers
endif
if 'auto' in drivers
drivers += ['dummy', 'hdk', 'hydra', 'ns', 'psmv']
drivers += ['dummy', 'hdk', 'hydra', 'ns', 'psmv', 'remote']
endif
openhmd = dependency('openhmd', required: openhmd_required)
hidapi = dependency('hidapi-libusb', required: hidapi_required)
v4l2 = dependency('libv4l2', required: v4l2_required)
has_v4l2_header = cc.has_header('linux/v4l2-common.h')
if openhmd.found() and ('auto' in drivers or 'ohmd' in drivers)
if 'ohmd' not in drivers
@ -151,6 +170,12 @@ if openhmd.found() and ('auto' in drivers or 'ohmd' in drivers)
endif
endif
if has_v4l2_header and ('auto' in drivers or 'handtracking' in drivers)
if 'handtracking' not in drivers
drivers += ['handtracking']
endif
endif
if hidapi.found() and ('auto' in drivers or 'psvr' in drivers or 'hdk' in drivers)
if 'psvr' not in drivers
drivers += ['psvr']
@ -169,16 +194,30 @@ if rs.found() and ('auto' in drivers or 'rs' in drivers)
endif
endif
if v4l2.found() and ('auto' in drivers or 'v4l2' in drivers)
if has_v4l2_header and ('auto' in drivers or 'v4l2' in drivers)
if 'v4l2' not in drivers
drivers += ['v4l2']
endif
endif
if survive.found() and ('survive' in drivers)
if 'survive' not in drivers
drivers += ['survive']
endif
if gst_found and ('auto' in drivers or 'vf' in drivers)
if 'vf' not in drivers
drivers += ['vf']
endif
endif
if survive.found() and ('auto' in drivers and 'survive' not in drivers)
drivers += ['survive']
endif
if not get_option('dbus').disabled() and dbus.found()
if 'daydream' not in drivers
drivers += ['daydream']
endif
if 'arduino' not in drivers
drivers += ['arduino']
endif
endif
if drivers.length() == 0 or drivers == ['auto']
@ -195,6 +234,9 @@ if build_docs
subdir('doc')
endif
if not get_option('tests').disabled()
subdir('tests')
endif
#
# Final bits
@ -225,3 +267,9 @@ if build_tracking
else
message(' tracking: no')
endif
if get_option('steamvr_plugin')
message('steamvr plugin: yes')
else
message('steamvr plugin: no')
endif

View file

@ -3,7 +3,7 @@
option('drivers',
type: 'array',
choices: ['auto', 'dummy', 'hdk', 'hydra', 'ns', 'ohmd', 'psmv', 'psvr', 'rs', 'v4l2', 'vive', 'survive'],
choices: ['auto', 'dummy', 'hdk', 'hydra', 'ns', 'ohmd', 'psmv', 'psvr', 'rs', 'v4l2', 'vf', 'vive', 'survive', 'daydream', 'arduino', 'remote', 'handtracking'],
value: ['auto'],
description: 'Set of drivers to build')
@ -12,6 +12,11 @@ option('docs',
value: 'auto',
description: 'Build the documentation')
option('tests',
type: 'feature',
value: 'auto',
description: 'Build the tests')
option('doxygen-warn-undocumented',
type: 'boolean',
value: false,
@ -40,7 +45,12 @@ option('install-active-runtime',
option('opengl',
type: 'feature',
value: 'auto',
description: 'Enable OpenGL/GLES application support.')
description: 'Enable OpenGL application support.')
option('opengles',
type: 'feature',
value: 'auto',
description: 'Enable OpenGL|ES application support.')
option('egl',
type: 'feature',
@ -61,3 +71,56 @@ option('wayland',
type: 'feature',
value: 'auto',
description: 'Enable support for Wayland rendering.')
option('dbus',
type: 'feature',
value: 'auto',
description: 'Enable support for dbus.')
option('service',
type: 'boolean',
value: true,
description: 'Enable separate service module for OpenXR runtime'
)
option('layer_depth',
type: 'boolean',
value: true,
description: 'Enable support for Depth Layers'
)
option('layer_cube',
type: 'boolean',
value: false,
description: 'Enable support for Cube Layers'
)
option('layer_cylinder',
type: 'boolean',
value: true,
description: 'Enable support for Cylinder Layers'
)
option('layer_equirect1',
type: 'boolean',
value: true,
description: 'Enable support for legacy Equirect Layers'
)
option('layer_equirect2',
type: 'boolean',
value: true,
description: 'Enable support for Equirect2 Layers'
)
option('steamvr_plugin',
type: 'boolean',
value: true,
description: 'Enable SteamVR Plugin'
)
option('color_log',
type: 'boolean',
value: true,
description: 'Log in color'
)

View file

@ -8,7 +8,7 @@
set -e
if [ ! "${CLANGFORMAT}" ]; then
for fn in clang-format-9 clang-format-8 clang-format-7 clang-format-6.0 clang-format; do
for fn in clang-format-11 clang-format-10 clang-format-9 clang-format-8 clang-format-7 clang-format-6.0 clang-format; do
if command -v $fn > /dev/null; then
CLANGFORMAT=$fn
break

View file

@ -10,15 +10,24 @@ from pathlib import Path
# the first one must be the name of the extension itself.
# Keep sorted.
EXTENSIONS = (
['XR_KHR_android_create_instance', 'XR_USE_PLATFORM_ANDROID'],
['XR_KHR_convert_timespec_time', 'XR_USE_TIMESPEC'],
['XR_KHR_opengl_enable', 'XR_USE_GRAPHICS_API_OPENGL'],
['XR_KHR_opengl_es_enable', 'XR_USE_GRAPHICS_API_OPENGL_ES'],
['XR_KHR_vulkan_enable', 'XR_USE_GRAPHICS_API_VULKAN'],
['XR_KHR_vulkan_enable2', 'XR_USE_GRAPHICS_API_VULKAN'],
['XR_KHR_composition_layer_depth', 'XRT_FEATURE_OPENXR_LAYER_DEPTH'],
['XR_KHR_composition_layer_cube', 'XRT_FEATURE_OPENXR_LAYER_CUBE'],
['XR_KHR_composition_layer_cylinder', 'XRT_FEATURE_OPENXR_LAYER_CYLINDER'],
['XR_KHR_composition_layer_equirect', 'XRT_FEATURE_OPENXR_LAYER_EQUIRECT1'],
['XR_KHR_composition_layer_equirect2', 'XRT_FEATURE_OPENXR_LAYER_EQUIRECT2'],
['XR_EXT_debug_utils'],
['XR_MND_headless'],
['XR_MND_swapchain_usage_input_attachment_bit'],
['XR_EXTX_overlay'],
['XR_MNDX_egl_enable', 'XR_USE_PLATFORM_EGL', 'XR_USE_GRAPHICS_API_OPENGL'],
['XR_MNDX_ball_on_a_stick_controller'],
['XR_EXT_hand_tracking']
)
ROOT = Path(__file__).resolve().parent.parent

View file

@ -1,2 +1,6 @@
# SPDX-FileCopyrightText: 2019-2020, Collabora, Ltd.
# SPDX-License-Identifier: CC0-1.0
* @author Simon Ser <contact@emersion.fr>
#include <asm/byteorder.h>
if (stream.parm.capture.capability & V4L2_CAP_TIMEPERFRAME) {

9
settings.gradle Normal file
View file

@ -0,0 +1,9 @@
// Copyright 2020, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
rootProject.name = 'monado'
include ':src:xrt:auxiliary:android'
include ':src:xrt:ipc:android'
include ':src:xrt:targets:android_common'
include ':src:xrt:targets:openxr_android'

View file

@ -1,21 +1,51 @@
# Copyright 2020, Collabora, Ltd.
# SPDX-License-Identifier: BSL-1.0
add_library(xrt-external-openxr INTERFACE)
target_include_directories(xrt-external-openxr INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/openxr_includes)
# Catch2
add_library(xrt-external-catch2 INTERFACE)
target_include_directories(xrt-external-catch2 INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/Catch2)
add_library(xrt-external-openvr INTERFACE)
target_include_directories(xrt-external-openvr INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/openvr_includes)
add_library(xrt-external-glad INTERFACE)
target_include_directories(xrt-external-glad INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/glad)
# cJSON
add_library(xrt-external-cjson INTERFACE)
if(XRT_HAVE_SYSTEM_CJSON)
target_link_libraries(xrt-external-cjson INTERFACE cJSON::cJSON)
else()
target_include_directories(xrt-external-cjson INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/cjson)
target_compile_definitions(xrt-external-cjson INTERFACE CJSON_HIDE_SYMBOLS)
endif()
# FlexKalman
add_library(xrt-external-flexkalman INTERFACE)
target_include_directories(xrt-external-flexkalman INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/flexkalman)
add_library(xrt-external-catch2 INTERFACE)
target_include_directories(xrt-external-catch2 INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/Catch2)
# Glad
add_library(xrt-external-glad INTERFACE)
target_include_directories(xrt-external-glad INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/glad/include)
# Hungarian graph algorithm
add_library(xrt-external-hungarian INTERFACE)
target_include_directories(xrt-external-hungarian INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/hungarian)
# JNIPP and Android JNI wrappers
if(ANDROID)
add_library(xrt-external-jnipp STATIC
jnipp/jnipp.cpp)
target_include_directories(xrt-external-jnipp PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/jnipp)
file(GLOB WRAP_SOURCES android-jni-wrap/wrap/*.cpp)
add_library(xrt-external-jni-wrap STATIC
${WRAP_SOURCES})
target_include_directories(xrt-external-jni-wrap PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/android-jni-wrap)
target_link_libraries(xrt-external-jni-wrap PUBLIC xrt-external-jnipp)
set_target_properties(xrt-external-jni-wrap
PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON)
endif()
# OpenXR
add_library(xrt-external-openxr INTERFACE)
target_include_directories(xrt-external-openxr INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/openxr_includes)

View file

@ -0,0 +1,336 @@
// Copyright 2020, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
#pragma once
#include <jni.h>
#include <jnipp.h>
namespace wrap {
/*!
* Base class for types wrapping Java types.
*
* Derived types are encouraged to have a nested `struct Meta`, inheriting
* publicly from MetaBaseDroppable or MetaBase, with a singleton accessor named
* `data()`, and a private constructor (implemented in a .cpp file, not the
* header) that populates jni::method_t, jni::field_t, etc. members for each
* method, etc. of interest.
*/
class ObjectWrapperBase {
public:
/*!
* Default constructor.
*/
ObjectWrapperBase() = default;
/*!
* Construct from a jni::Object.
*/
explicit ObjectWrapperBase(jni::Object obj) : obj_(std::move(obj)) {}
/*!
* Construct from a nullptr.
*/
explicit ObjectWrapperBase(std::nullptr_t const &) : obj_() {}
/*!
* Evaluate if this is non-null
*/
explicit operator bool() const noexcept { return !obj_.isNull(); }
/*!
* Is this object null?
*/
bool isNull() const noexcept { return obj_.isNull(); }
/*!
* Get the wrapped jni::Object
*/
jni::Object &object() noexcept { return obj_; }
/*!
* Get the wrapped jni::Object (const overload)
*/
jni::Object const &object() const noexcept { return obj_; }
private:
jni::Object obj_;
};
/*!
* Equality comparison for a wrapped Java object.
*/
static inline bool operator==(ObjectWrapperBase const &lhs,
ObjectWrapperBase const &rhs) noexcept {
return lhs.object() == rhs.object();
}
/*!
* Inequality comparison for a wrapped Java object.
*/
static inline bool operator!=(ObjectWrapperBase const &lhs,
ObjectWrapperBase const &rhs) noexcept {
return lhs.object() != rhs.object();
}
/*!
* Equality comparison between a wrapped Java object and @p nullptr.
*/
static inline bool operator==(ObjectWrapperBase const &obj,
std::nullptr_t) noexcept {
return obj.isNull();
}
/*!
* Equality comparison between a wrapped Java object and @p nullptr.
*/
static inline bool operator==(std::nullptr_t,
ObjectWrapperBase const &obj) noexcept {
return obj.isNull();
}
/*!
* Inequality comparison between a wrapped Java object and @p nullptr.
*/
static inline bool operator!=(ObjectWrapperBase const &obj,
std::nullptr_t) noexcept {
return !(obj == nullptr);
}
/*!
* Inequality comparison between a wrapped Java object and @p nullptr.
*/
static inline bool operator!=(std::nullptr_t,
ObjectWrapperBase const &obj) noexcept {
return !(obj == nullptr);
}
/*!
* Base class for Meta structs where you want the reference to the Class object
* to persist (indefinitely).
*
* Mostly for classes that would stick around anyway (e.g.
* @p java.lang.ClassLoader ) where many operations are on static
* methods/fields. Use of a non-static method or field does not require such a
* reference, use MetaBaseDroppable in those cases.
*/
class MetaBase {
public:
/*!
* Gets a reference to the class object.
*
* Unlike MetaBaseDroppable, here we know that the class object ref is
* alive.
*/
jni::Class const &clazz() const noexcept { return clazz_; }
/*!
* Gets a reference to the class object.
*
* Provided here for parallel API to MetaBaseDroppable, despite being
* synonymous with clazz() here.
*/
jni::Class const &classRef() const noexcept { return clazz_; }
/*!
* Get the class name, with namespaces delimited by `/`.
*/
const char *className() const noexcept { return classname_; }
protected:
/*!
* Construct.
*
* @param classname The class name, fully qualified, with namespaces
* delimited by `/`.
* @param clazz The jclass object for the class in question, if known.
*/
explicit MetaBase(const char *classname, jni::jclass clazz = nullptr)
: classname_(classname), clazz_() {
if (clazz != nullptr) {
// The 0 makes it a global ref.
clazz_ = jni::Class{clazz, 0};
} else {
clazz_ = jni::Class{classname};
}
}
private:
const char *classname_;
jni::Class clazz_;
};
/*!
* Base class for Meta structs where you don't need the reference to the Class
* object to persist. (This is most uses.)
*/
class MetaBaseDroppable {
public:
/*!
* Gets the class object.
*
* Works regardless of whether dropClassRef() has been called - it's just
* slower if it has.
*/
jni::Class clazz() const {
if (clazz_.isNull()) {
return {classname_};
}
return clazz_;
}
/*!
* Get the class name, with namespaces delimited by `/`.
*/
const char *className() const noexcept { return classname_; }
/*!
* May be called in/after the derived constructor, to drop the reference to
* the class object if it's no longer needed.
*/
void dropClassRef() { clazz_ = jni::Class{}; }
protected:
/*!
* Construct.
*
* Once you are done constructing your derived struct, you may call
* dropClassRef() and still safely use non-static method and field IDs
* retrieved.
*
* @param classname The class name, fully qualified, with namespaces
* delimited by `/`.
* @param clazz The jclass object for the class in question, if known.
*/
explicit MetaBaseDroppable(const char *classname,
jni::jclass clazz = nullptr)
: classname_(classname), clazz_() {
if (clazz != nullptr) {
// The 0 makes it a global ref.
clazz_ = jni::Class{clazz, 0};
} else {
clazz_ = jni::Class{classname};
}
}
/*!
* Gets a reference to the class object, but is non-null only if it's still
* cached.
*
* Only for used in derived constructors/initializers, where you know you
* haven't dropped this yet.
*/
jni::Class const &classRef() const { return clazz_; }
private:
const char *classname_;
jni::Class clazz_;
};
/*!
* Implementation namespace for these JNI wrappers.
*
* They can be ignored if you aren't adding/extending wrappers.
*/
namespace impl {
/*!
* Type-aware wrapper for a field ID.
*
* This is a smarter alternative to just using jni::field_t since it avoids
* having to repeat the type in the accessor, without using any more storage.
*
* @see StaticFieldId for the equivalent for static fields.
* @see WrappedFieldId for the equivalent for structures that we wrap.
*/
template <typename T> struct FieldId {
public:
FieldId(jni::Class const &clazz, const char *name)
: id(clazz.getField<T>(name)) {}
const jni::field_t id;
};
/*!
* Get the value of field @p field in Java object @p obj.
*
* This is found by argument-dependent lookup and can be used unqualified.
*
* @relates FieldId
*/
template <typename T>
static inline T get(FieldId<T> const &field, jni::Object const &obj) {
assert(!obj.isNull());
return obj.get<T>(field.id);
}
/*!
* Type-aware wrapper for a static field ID.
*
* This is a smarter alternative to just using jni::field_t since it avoids
* having to repeat the type in the accessor, without using any more storage.
*
* @see FieldId
*/
template <typename T> struct StaticFieldId {
public:
StaticFieldId(jni::Class const &clazz, const char *name)
: id(clazz.getStaticField<T>(name)) {}
const jni::field_t id;
};
/*!
* Get the value of static field @p field in Java type @p clazz.
*
* This is found by argument-dependent lookup and can be used unqualified.
*
* @relates FieldId
*/
template <typename T>
static inline T get(StaticFieldId<T> const &field, jni::Class const &clazz) {
assert(!clazz.isNull());
return clazz.get<T>(field.id);
}
/*!
* Type-aware wrapper for a field ID of a wrapped structure type.
*
* This is a smarter alternative to just using jni::field_t since it avoids
* having to repeat the type in the accessor, without using any more storage.
*
* Requires that the structure wrapper provides
* `static constexpr const char *getTypeName() noexcept;`
*
* @see FieldId
*/
template <typename T> struct WrappedFieldId {
public:
WrappedFieldId(jni::Class const &clazz, const char *name)
: id(lookupField(clazz, name)) {}
const jni::field_t id;
private:
/*!
* Helper for field ID lookup, mostly to avoid calling c_str() on a string
* temporary.
*/
static jni::field_t lookupField(jni::Class const &clazz, const char *name) {
std::string fullType = std::string("L") + T::getTypeName() + ";";
return clazz.getField(name, fullType.c_str());
}
};
/*!
* Get the value of field @p field in Java object @p obj.
*
* This is found by argument-dependent lookup and can be used unqualified.
*
* @relates WrappedFieldId
*/
template <typename T>
static inline T get(WrappedFieldId<T> const &field, jni::Object const &obj) {
assert(!obj.isNull());
return T{obj.get<jni::Object>(field.id)};
}
} // namespace impl
} // namespace wrap

View file

@ -0,0 +1,29 @@
# About these JNI Wrappers
<!--
Copyright 2020, Collabora, Ltd.
SPDX-License-Identifier: BSL-1.0
-->
These are fairly simple wrappers around Java classes, using JNI and JNIPP to allow relatively-painless use of Java classes from C++. They are populated as-needed: if you need a method/property that's missing, add it!
## Conventions
All classes derive from ObjectWrapperBase or one of its subclasses. (Yes, you
can directly mirror inheritance in Java with inheritance in these wrappers.)
All should have a public internal struct called `Meta` that derives publicly
from either `MetaBase` or `MetaBaseDroppable` (the more common option, when you
don't often need the class object itself), with a member for each method ID.
Only the `Meta()` constructor should be in the `.cpp` file for a given wrapper:
the rest lives in the header so it may be inlined and thus optimized away.
## Finding signatures
A command like the following can help you get the JNI signatures of methods:
```sh
javap -s -classpath ~/Android/Sdk/platforms/android-26/android.jar android.service.vr.VrListenerService
```
Adjust the location of the SDK and the class under investigation as needed.

View file

@ -0,0 +1,21 @@
// Copyright 2020, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
#include "android.app.h"
namespace wrap {
namespace android::app {
Service::Meta::Meta() : MetaBaseDroppable(Service::getTypeName()) {
MetaBaseDroppable::dropClassRef();
}
Activity::Meta::Meta()
: MetaBaseDroppable(Activity::getTypeName()),
getSystemService(classRef().getMethod(
"getSystemService", "(Ljava/lang/String;)Ljava/lang/Object;")),
setVrModeEnabled(classRef().getMethod(
"setVrModeEnabled", "(ZLandroid/content/ComponentName;)V")) {
MetaBaseDroppable::dropClassRef();
}
} // namespace android::app
} // namespace wrap

View file

@ -0,0 +1,100 @@
// Copyright 2020, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
#pragma once
#include "android.content.h"
namespace wrap {
namespace android::content {
class ComponentName;
} // namespace android::content
} // namespace wrap
namespace wrap {
namespace android::app {
/*!
* Wrapper for android.app.Service objects.
*/
class Service : public content::Context {
public:
using Context::Context;
static constexpr const char *getTypeName() noexcept {
return "android/app/Service";
}
/*!
* Class metadata
*/
struct Meta : public MetaBaseDroppable {
/*!
* Singleton accessor
*/
static Meta &data() {
static Meta instance;
return instance;
}
private:
Meta();
};
};
/*!
* Wrapper for android.app.Activity objects.
*/
class Activity : public content::Context {
public:
using Context::Context;
static constexpr const char *getTypeName() noexcept {
return "android/app/Activity";
}
/*!
* Wrapper for the getSystemService method
*
* Java prototype:
* `public java.lang.Object getSystemService(java.lang.String);`
*
* JNI signature: (Ljava/lang/String;)Ljava/lang/Object;
*
*/
jni::Object getSystemService(std::string const &name);
/*!
* Wrapper for the setVrModeEnabled method
*
* Java prototype:
* `public void setVrModeEnabled(boolean, android.content.ComponentName)
* throws android.content.pm.PackageManager$NameNotFoundException;`
*
* JNI signature: (ZLandroid/content/ComponentName;)V
*
*/
void setVrModeEnabled(bool enabled,
content::ComponentName const &requestedComponent);
/*!
* Class metadata
*/
struct Meta : public MetaBaseDroppable {
jni::method_t getSystemService;
jni::method_t setVrModeEnabled;
/*!
* Singleton accessor
*/
static Meta &data() {
static Meta instance;
return instance;
}
private:
Meta();
};
};
} // namespace android::app
} // namespace wrap
#include "android.app.impl.h"

View file

@ -0,0 +1,26 @@
// Copyright 2020, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
#pragma once
#include "android.content.h"
#include <string>
namespace wrap {
namespace android::app {
inline jni::Object Activity::getSystemService(std::string const &name) {
assert(!isNull());
return object().call<jni::Object>(Meta::data().getSystemService, name);
}
inline void
Activity::setVrModeEnabled(bool enabled,
content::ComponentName const &requestedComponent) {
assert(!isNull());
return object().call<void>(Meta::data().setVrModeEnabled, enabled,
requestedComponent.object());
}
} // namespace android::app
} // namespace wrap

View file

@ -0,0 +1,55 @@
// Copyright 2020, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
#include "android.content.h"
namespace wrap {
namespace android::content {
Context::Meta::Meta(bool deferDrop)
: MetaBaseDroppable(Context::getTypeName()),
DISPLAY_SERVICE(classRef(), "DISPLAY_SERVICE"),
WINDOW_SERVICE(classRef(), "WINDOW_SERVICE"),
getPackageManager(classRef().getMethod(
"getPackageManager", "()Landroid/content/pm/PackageManager;")),
getApplicationContext(classRef().getMethod(
"getApplicationContext", "()Landroid/content/Context;")),
getClassLoader(
classRef().getMethod("getClassLoader", "()Ljava/lang/ClassLoader;")),
startActivity(
classRef().getMethod("startActivity", "(Landroid/content/Intent;)V")),
startActivity1(classRef().getMethod(
"startActivity", "(Landroid/content/Intent;Landroid/os/Bundle;)V")),
createPackageContext(classRef().getMethod(
"createPackageContext",
"(Ljava/lang/String;I)Landroid/content/Context;")) {
if (!deferDrop) {
MetaBaseDroppable::dropClassRef();
}
}
ComponentName::Meta::Meta()
: MetaBase(ComponentName::getTypeName()),
init(classRef().getMethod("<init>",
"(Ljava/lang/String;Ljava/lang/String;)V")),
init1(classRef().getMethod(
"<init>", "(Landroid/content/Context;Ljava/lang/String;)V")),
init2(classRef().getMethod(
"<init>", "(Landroid/content/Context;Ljava/lang/Class;)V")),
init3(classRef().getMethod("<init>", "(Landroid/os/Parcel;)V")) {}
Intent::Meta::Meta()
: MetaBase(Intent::getTypeName()),
FLAG_ACTIVITY_NEW_TASK(classRef(), "FLAG_ACTIVITY_NEW_TASK"),
init(classRef().getMethod("<init>", "()V")),
init1(classRef().getMethod("<init>", "(Landroid/content/Intent;)V")),
init2(classRef().getMethod("<init>", "(Ljava/lang/String;)V")),
init3(classRef().getMethod("<init>",
"(Ljava/lang/String;Landroid/net/Uri;)V")),
init4(classRef().getMethod(
"<init>", "(Landroid/content/Context;Ljava/lang/Class;)V")),
init5(classRef().getMethod("<init>",
"(Ljava/lang/String;Landroid/net/Uri;Landroid/"
"content/Context;Ljava/lang/Class;)V")),
setFlags(
classRef().getMethod("setFlags", "(I)Landroid/content/Intent;")) {}
} // namespace android::content
} // namespace wrap

View file

@ -0,0 +1,379 @@
// Copyright 2020, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
#pragma once
#include "ObjectWrapperBase.h"
#include <string>
namespace wrap {
namespace android::content {
class ComponentName;
class Context;
class Intent;
} // namespace android::content
namespace android::content::pm {
class PackageManager;
} // namespace android::content::pm
namespace android::os {
class Bundle;
} // namespace android::os
namespace java::lang {
class Class;
class ClassLoader;
} // namespace java::lang
} // namespace wrap
namespace wrap {
namespace android::content {
/*!
* Wrapper for android.content.Context objects.
*/
class Context : public ObjectWrapperBase {
public:
using ObjectWrapperBase::ObjectWrapperBase;
static constexpr const char *getTypeName() noexcept {
return "android/content/Context";
}
/*!
* Getter for the DISPLAY_SERVICE static field value
*
* Java prototype:
* `public static final java.lang.String DISPLAY_SERVICE;`
*
* JNI signature: Ljava/lang/String;
*
*/
static std::string DISPLAY_SERVICE();
/*!
* Getter for the WINDOW_SERVICE static field value
*
* Java prototype:
* `public static final java.lang.String WINDOW_SERVICE;`
*
* JNI signature: Ljava/lang/String;
*
*/
static std::string WINDOW_SERVICE();
/*!
* Wrapper for the getPackageManager method
*
* Java prototype:
* `public abstract android.content.pm.PackageManager getPackageManager();`
*
* JNI signature: ()Landroid/content/pm/PackageManager;
*
*/
pm::PackageManager getPackageManager();
/*!
* Wrapper for the getApplicationContext method
*
* Java prototype:
* `public abstract android.content.Context getApplicationContext();`
*
* JNI signature: ()Landroid/content/Context;
*
*/
Context getApplicationContext();
/*!
* Wrapper for the getClassLoader method
*
* Java prototype:
* `public abstract java.lang.ClassLoader getClassLoader();`
*
* JNI signature: ()Ljava/lang/ClassLoader;
*
*/
java::lang::ClassLoader getClassLoader();
/*!
* Wrapper for the startActivity method
*
* Java prototype:
* `public abstract void startActivity(android.content.Intent);`
*
* JNI signature: (Landroid/content/Intent;)V
*
*/
void startActivity(Intent const &intent);
/*!
* Wrapper for the startActivity method
*
* Java prototype:
* `public abstract void startActivity(android.content.Intent,
* android.os.Bundle);`
*
* JNI signature: (Landroid/content/Intent;Landroid/os/Bundle;)V
*
*/
void startActivity(Intent const &intent, os::Bundle const &bundle);
/*!
* Wrapper for the createPackageContext method
*
* Java prototype:
* `public abstract android.content.Context
* createPackageContext(java.lang.String, int) throws
* android.content.pm.PackageManager$NameNotFoundException;`
*
* JNI signature: (Ljava/lang/String;I)Landroid/content/Context;
*
*/
Context createPackageContext(std::string const &packageName, int32_t flags);
enum {
CONTEXT_INCLUDE_CODE = 1,
CONTEXT_IGNORE_SECURITY = 2,
};
/*!
* Class metadata
*/
struct Meta : public MetaBaseDroppable {
impl::StaticFieldId<std::string> DISPLAY_SERVICE;
impl::StaticFieldId<std::string> WINDOW_SERVICE;
jni::method_t getPackageManager;
jni::method_t getApplicationContext;
jni::method_t getClassLoader;
jni::method_t startActivity;
jni::method_t startActivity1;
jni::method_t createPackageContext;
/*!
* Singleton accessor
*/
static Meta &data(bool deferDrop = false) {
static Meta instance{deferDrop};
return instance;
}
private:
explicit Meta(bool deferDrop);
};
};
/*!
* Wrapper for android.content.ComponentName objects.
*/
class ComponentName : public ObjectWrapperBase {
public:
using ObjectWrapperBase::ObjectWrapperBase;
static constexpr const char *getTypeName() noexcept {
return "android/content/ComponentName";
}
/*!
* Wrapper for a constructor
*
* Java prototype:
* `public android.content.ComponentName(java.lang.String,
* java.lang.String);`
*
* JNI signature: (Ljava/lang/String;Ljava/lang/String;)V
*
*/
static ComponentName construct(std::string const &pkg,
std::string const &cls);
/*!
* Wrapper for a constructor
*
* Java prototype:
* `public android.content.ComponentName(android.content.Context,
* java.lang.String);`
*
* JNI signature: (Landroid/content/Context;Ljava/lang/String;)V
*
*/
static ComponentName construct(Context const &pkg, std::string const &cls);
/*!
* Wrapper for a constructor
*
* Java prototype:
* `public android.content.ComponentName(android.content.Context,
* java.lang.Class<?>);`
*
* JNI signature: (Landroid/content/Context;Ljava/lang/Class;)V
*
*/
static ComponentName construct(Context const &pkg,
java::lang::Class const &cls);
/*!
* Wrapper for a constructor
*
* Java prototype:
* `public android.content.ComponentName(android.os.Parcel);`
*
* JNI signature: (Landroid/os/Parcel;)V
*
*/
static ComponentName construct(jni::Object const &parcel);
/*!
* Class metadata
*/
struct Meta : public MetaBase {
jni::method_t init;
jni::method_t init1;
jni::method_t init2;
jni::method_t init3;
/*!
* Singleton accessor
*/
static Meta &data() {
static Meta instance;
return instance;
}
private:
Meta();
};
};
/*!
* Wrapper for android.content.Intent objects.
*/
class Intent : public ObjectWrapperBase {
public:
using ObjectWrapperBase::ObjectWrapperBase;
static constexpr const char *getTypeName() noexcept {
return "android/content/Intent";
}
/*!
* Getter for the FLAG_ACTIVITY_NEW_TASK static field value
*
* Java prototype:
* `public static final int FLAG_ACTIVITY_NEW_TASK;`
*
* JNI signature: I
*
*/
static int32_t FLAG_ACTIVITY_NEW_TASK();
#if 0
// disabled because of zero-length array warning in jnipp
/*!
* Wrapper for a constructor
*
* Java prototype:
* `public android.content.Intent();`
*
* JNI signature: ()V
*
*/
static Intent construct();
#endif
/*!
* Wrapper for a constructor
*
* Java prototype:
* `public android.content.Intent(android.content.Intent);`
*
* JNI signature: (Landroid/content/Intent;)V
*
*/
static Intent construct(Intent &intent);
/*!
* Wrapper for a constructor
*
* Java prototype:
* `public android.content.Intent(java.lang.String);`
*
* JNI signature: (Ljava/lang/String;)V
*
*/
static Intent construct(std::string const &action);
/*!
* Wrapper for a constructor
*
* Java prototype:
* `public android.content.Intent(java.lang.String, android.net.Uri);`
*
* JNI signature: (Ljava/lang/String;Landroid/net/Uri;)V
*
*/
static Intent construct(std::string const &action, jni::Object const &uri);
/*!
* Wrapper for a constructor
*
* Java prototype:
* `public android.content.Intent(android.content.Context,
* java.lang.Class<?>);`
*
* JNI signature: (Landroid/content/Context;Ljava/lang/Class;)V
*
*/
static Intent construct(Context const &context,
java::lang::Class const &classParam);
/*!
* Wrapper for a constructor
*
* Java prototype:
* `public android.content.Intent(java.lang.String, android.net.Uri,
* android.content.Context, java.lang.Class<?>);`
*
* JNI signature:
* (Ljava/lang/String;Landroid/net/Uri;Landroid/content/Context;Ljava/lang/Class;)V
*
*/
static Intent construct(std::string const &action, jni::Object const &uri,
Context const &context,
java::lang::Class const &classParam);
/*!
* Wrapper for the setFlags method
*
* Java prototype:
* `public android.content.Intent setFlags(int);`
*
* JNI signature: (I)Landroid/content/Intent;
*
*/
Intent setFlags(int32_t flags);
/*!
* Class metadata
*/
struct Meta : public MetaBase {
impl::StaticFieldId<int32_t> FLAG_ACTIVITY_NEW_TASK;
jni::method_t init;
jni::method_t init1;
jni::method_t init2;
jni::method_t init3;
jni::method_t init4;
jni::method_t init5;
jni::method_t setFlags;
/*!
* Singleton accessor
*/
static Meta &data() {
static Meta instance;
return instance;
}
private:
Meta();
};
};
} // namespace android::content
} // namespace wrap
#include "android.content.impl.h"

View file

@ -0,0 +1,135 @@
// Copyright 2020, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
#pragma once
#include "android.content.pm.h"
#include "android.os.h"
#include "java.lang.h"
#include <string>
namespace wrap {
namespace android::content {
inline std::string Context::DISPLAY_SERVICE() {
// Defer dropping the class ref to avoid having to do two class lookups
// by name for this static field. Instead, drop it before we return.
auto &data = Meta::data(true);
auto ret = get(data.DISPLAY_SERVICE, data.clazz());
data.dropClassRef();
return ret;
}
inline std::string Context::WINDOW_SERVICE() {
// Defer dropping the class ref to avoid having to do two class lookups
// by name for this static field. Instead, drop it before we return.
auto &data = Meta::data(true);
auto ret = get(data.WINDOW_SERVICE, data.clazz());
data.dropClassRef();
return ret;
}
inline pm::PackageManager Context::getPackageManager() {
assert(!isNull());
return pm::PackageManager(
object().call<jni::Object>(Meta::data().getPackageManager));
}
inline Context Context::getApplicationContext() {
assert(!isNull());
return Context(
object().call<jni::Object>(Meta::data().getApplicationContext));
}
inline java::lang::ClassLoader Context::getClassLoader() {
assert(!isNull());
return java::lang::ClassLoader(
object().call<jni::Object>(Meta::data().getClassLoader));
}
inline void Context::startActivity(Intent const &intent) {
assert(!isNull());
return object().call<void>(Meta::data().startActivity, intent.object());
}
inline void Context::startActivity(Intent const &intent,
os::Bundle const &bundle) {
assert(!isNull());
return object().call<void>(Meta::data().startActivity1, intent.object(),
bundle.object());
}
inline Context Context::createPackageContext(std::string const &packageName,
int32_t flags) {
assert(!isNull());
return Context(object().call<jni::Object>(Meta::data().createPackageContext,
packageName, flags));
}
inline ComponentName ComponentName::construct(std::string const &pkg,
std::string const &cls) {
return ComponentName(
Meta::data().clazz().newInstance(Meta::data().init, pkg, cls));
}
inline ComponentName ComponentName::construct(Context const &pkg,
std::string const &cls) {
return ComponentName(Meta::data().clazz().newInstance(Meta::data().init1,
pkg.object(), cls));
}
inline ComponentName ComponentName::construct(Context const &pkg,
java::lang::Class const &cls) {
return ComponentName(Meta::data().clazz().newInstance(
Meta::data().init2, pkg.object(), cls.object()));
}
inline ComponentName ComponentName::construct(jni::Object const &parcel) {
return ComponentName(
Meta::data().clazz().newInstance(Meta::data().init3, parcel));
}
inline int32_t Intent::FLAG_ACTIVITY_NEW_TASK() {
return get(Meta::data().FLAG_ACTIVITY_NEW_TASK, Meta::data().clazz());
}
#if 0
// disabled because of zero-length array warning in jnipp
inline Intent Intent::construct() {
return Intent(Meta::data().clazz().newInstance(Meta::data().init));
}
#endif
inline Intent Intent::construct(Intent &intent) {
return Intent(
Meta::data().clazz().newInstance(Meta::data().init1, intent.object()));
}
inline Intent Intent::construct(std::string const &action) {
return Intent(Meta::data().clazz().newInstance(Meta::data().init2, action));
}
inline Intent Intent::construct(std::string const &action,
jni::Object const &uri) {
return Intent(
Meta::data().clazz().newInstance(Meta::data().init3, action, uri));
}
inline Intent Intent::construct(Context const &context,
java::lang::Class const &classParam) {
return Intent(Meta::data().clazz().newInstance(
Meta::data().init4, context.object(), classParam.object()));
}
inline Intent Intent::construct(std::string const &action,
jni::Object const &uri, Context const &context,
java::lang::Class const &classParam) {
return Intent(Meta::data().clazz().newInstance(Meta::data().init5, action,
uri, context.object(),
classParam.object()));
}
inline Intent Intent::setFlags(int32_t flags) {
assert(!isNull());
return Intent(object().call<jni::Object>(Meta::data().setFlags, flags));
}
} // namespace android::content
} // namespace wrap

View file

@ -0,0 +1,55 @@
// Copyright 2020, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
#include "android.content.pm.h"
namespace wrap {
namespace android::content::pm {
PackageItemInfo::Meta::Meta()
: MetaBaseDroppable(PackageItemInfo::getTypeName()),
metaData(classRef(), "metaData"), name(classRef(), "name"),
packageName(classRef(), "packageName") {
MetaBaseDroppable::dropClassRef();
}
ComponentInfo::Meta::Meta() : MetaBaseDroppable(ComponentInfo::getTypeName()) {
MetaBaseDroppable::dropClassRef();
}
ServiceInfo::Meta::Meta() : MetaBaseDroppable(ServiceInfo::getTypeName()) {
MetaBaseDroppable::dropClassRef();
}
ApplicationInfo::Meta::Meta()
: MetaBaseDroppable(ApplicationInfo::getTypeName()),
nativeLibraryDir(classRef(), "nativeLibraryDir"),
publicSourceDir(classRef(), "publicSourceDir") {
MetaBaseDroppable::dropClassRef();
}
PackageInfo::Meta::Meta()
: MetaBaseDroppable(PackageInfo::getTypeName()),
applicationInfo(classRef(), "applicationInfo"),
packageName(classRef(), "packageName") {
MetaBaseDroppable::dropClassRef();
}
ResolveInfo::Meta::Meta()
: MetaBaseDroppable(ResolveInfo::getTypeName()),
serviceInfo(classRef(), "serviceInfo") {
MetaBaseDroppable::dropClassRef();
}
PackageManager::Meta::Meta()
: MetaBaseDroppable(PackageManager::getTypeName()),
getPackageInfo(classRef().getMethod(
"getPackageInfo",
"(Ljava/lang/String;I)Landroid/content/pm/PackageInfo;")),
getPackageInfo1(classRef().getMethod(
"getPackageInfo", "(Landroid/content/pm/VersionedPackage;I)Landroid/"
"content/pm/PackageInfo;")),
getApplicationInfo(classRef().getMethod(
"getApplicationInfo",
"(Ljava/lang/String;I)Landroid/content/pm/ApplicationInfo;")),
queryIntentServices(
classRef().getMethod("queryIntentServices",
"(Landroid/content/Intent;I)Ljava/util/List;")) {
MetaBaseDroppable::dropClassRef();
}
} // namespace android::content::pm
} // namespace wrap

View file

@ -0,0 +1,387 @@
// Copyright 2020, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
#pragma once
#include "ObjectWrapperBase.h"
#include "android.os.h"
#include <string>
namespace wrap {
namespace android::content {
class Intent;
} // namespace android::content
namespace android::content::pm {
class ApplicationInfo;
class PackageInfo;
class ServiceInfo;
} // namespace android::content::pm
namespace android::os {
class Bundle;
} // namespace android::os
namespace java::util {
class List;
} // namespace java::util
} // namespace wrap
namespace wrap {
namespace android::content::pm {
/*!
* Wrapper for android.content.pm.PackageItemInfo objects.
*/
class PackageItemInfo : public ObjectWrapperBase {
public:
using ObjectWrapperBase::ObjectWrapperBase;
static constexpr const char *getTypeName() noexcept {
return "android/content/pm/PackageItemInfo";
}
/*!
* Getter for the metaData field value
*
* Java prototype:
* `public android.os.Bundle metaData;`
*
* JNI signature: Landroid/os/Bundle;
*
*/
os::Bundle getMetaData() const;
/*!
* Getter for the name field value
*
* Java prototype:
* `public java.lang.String name;`
*
* JNI signature: Ljava/lang/String;
*
*/
std::string getName() const;
/*!
* Getter for the packageName field value
*
* Java prototype:
* `public java.lang.String packageName;`
*
* JNI signature: Ljava/lang/String;
*
*/
std::string getPackageName() const;
/*!
* Class metadata
*/
struct Meta : public MetaBaseDroppable {
impl::WrappedFieldId<os::Bundle> metaData;
impl::FieldId<std::string> name;
impl::FieldId<std::string> packageName;
/*!
* Singleton accessor
*/
static Meta &data() {
static Meta instance;
return instance;
}
private:
Meta();
};
};
/*!
* Wrapper for android.content.pm.ComponentInfo objects.
*/
class ComponentInfo : public PackageItemInfo {
public:
using PackageItemInfo::PackageItemInfo;
static constexpr const char *getTypeName() noexcept {
return "android/content/pm/ComponentInfo";
}
/*!
* Class metadata
*/
struct Meta : public MetaBaseDroppable {
/*!
* Singleton accessor
*/
static Meta &data() {
static Meta instance;
return instance;
}
private:
Meta();
};
};
/*!
* Wrapper for android.content.pm.ServiceInfo objects.
*/
class ServiceInfo : public PackageItemInfo {
public:
using PackageItemInfo::PackageItemInfo;
static constexpr const char *getTypeName() noexcept {
return "android/content/pm/ServiceInfo";
}
/*!
* Class metadata
*/
struct Meta : public MetaBaseDroppable {
/*!
* Singleton accessor
*/
static Meta &data() {
static Meta instance;
return instance;
}
private:
Meta();
};
};
/*!
* Wrapper for android.content.pm.ApplicationInfo objects.
*/
class ApplicationInfo : public PackageItemInfo {
public:
using PackageItemInfo::PackageItemInfo;
static constexpr const char *getTypeName() noexcept {
return "android/content/pm/ApplicationInfo";
}
/*!
* Getter for the nativeLibraryDir field value
*
* Java prototype:
* `public java.lang.String nativeLibraryDir;`
*
* JNI signature: Ljava/lang/String;
*
*/
std::string getNativeLibraryDir() const;
/*!
* Getter for the publicSourceDir field value
*
* Java prototype:
* `public java.lang.String publicSourceDir;`
*
* JNI signature: Ljava/lang/String;
*
*/
std::string getPublicSourceDir() const;
/*!
* Class metadata
*/
struct Meta : public MetaBaseDroppable {
impl::FieldId<std::string> nativeLibraryDir;
impl::FieldId<std::string> publicSourceDir;
/*!
* Singleton accessor
*/
static Meta &data() {
static Meta instance;
return instance;
}
private:
Meta();
};
};
/*!
* Wrapper for android.content.pm.PackageInfo objects.
*/
class PackageInfo : public ObjectWrapperBase {
public:
using ObjectWrapperBase::ObjectWrapperBase;
static constexpr const char *getTypeName() noexcept {
return "android/content/pm/PackageInfo";
}
/*!
* Getter for the applicationInfo field value
*
* Java prototype:
* `public android.content.pm.ApplicationInfo applicationInfo;`
*
* JNI signature: Landroid/content/pm/ApplicationInfo;
*
*/
ApplicationInfo getApplicationInfo() const;
/*!
* Getter for the packageName field value
*
* Java prototype:
* `public java.lang.String packageName;`
*
* JNI signature: Ljava/lang/String;
*
*/
std::string getPackageName() const;
/*!
* Class metadata
*/
struct Meta : public MetaBaseDroppable {
impl::WrappedFieldId<ApplicationInfo> applicationInfo;
impl::FieldId<std::string> packageName;
/*!
* Singleton accessor
*/
static Meta &data() {
static Meta instance;
return instance;
}
private:
Meta();
};
};
/*!
* Wrapper for android.content.pm.ResolveInfo objects.
*/
class ResolveInfo : public ObjectWrapperBase {
public:
using ObjectWrapperBase::ObjectWrapperBase;
static constexpr const char *getTypeName() noexcept {
return "android/content/pm/ResolveInfo";
}
/*!
* Getter for the serviceInfo field value
*
* Java prototype:
* `public android.content.pm.ServiceInfo serviceInfo;`
*
* JNI signature: Landroid/content/pm/ServiceInfo;
*
*/
ServiceInfo getServiceInfo() const;
/*!
* Class metadata
*/
struct Meta : public MetaBaseDroppable {
impl::WrappedFieldId<ServiceInfo> serviceInfo;
/*!
* Singleton accessor
*/
static Meta &data() {
static Meta instance;
return instance;
}
private:
Meta();
};
};
/*!
* Wrapper for android.content.pm.PackageManager objects.
*/
class PackageManager : public ObjectWrapperBase {
public:
using ObjectWrapperBase::ObjectWrapperBase;
static constexpr const char *getTypeName() noexcept {
return "android/content/pm/PackageManager";
}
/*!
* Wrapper for the getPackageInfo method
*
* Java prototype:
* `public abstract android.content.pm.PackageInfo
* getPackageInfo(java.lang.String, int) throws
* android.content.pm.PackageManager$NameNotFoundException;`
*
* JNI signature: (Ljava/lang/String;I)Landroid/content/pm/PackageInfo;
*
*/
PackageInfo getPackageInfo(std::string const &name, int32_t flags);
#if 0
// Ambiguous overload until we wrap VersionedPackage
/*!
* Wrapper for the getPackageInfo method
*
* Java prototype:
* `public abstract android.content.pm.PackageInfo
* getPackageInfo(android.content.pm.VersionedPackage, int) throws
* android.content.pm.PackageManager$NameNotFoundException;`
*
* JNI signature:
* (Landroid/content/pm/VersionedPackage;I)Landroid/content/pm/PackageInfo;
*
*/
PackageInfo getPackageInfo(jni::Object &versionedPackage, int32_t flags);
#endif
/*!
* Wrapper for the getApplicationInfo method
*
* Java prototype:
* `public abstract android.content.pm.ApplicationInfo
* getApplicationInfo(java.lang.String, int) throws
* android.content.pm.PackageManager$NameNotFoundException;`
*
* JNI signature: (Ljava/lang/String;I)Landroid/content/pm/ApplicationInfo;
*
*/
ApplicationInfo getApplicationInfo(std::string const &packageName,
int32_t flags);
/*!
* Wrapper for the queryIntentServices method
*
* Java prototype:
* `public abstract java.util.List<android.content.pm.ResolveInfo>
* queryIntentServices(android.content.Intent, int);`
*
* JNI signature: (Landroid/content/Intent;I)Ljava/util/List;
*
*/
java::util::List queryIntentServices(Intent &intent, int32_t intParam);
enum {
GET_META_DATA = 128,
GET_SHARED_LIBRARY_FILES = 1024,
};
/*!
* Class metadata
*/
struct Meta : public MetaBaseDroppable {
jni::method_t getPackageInfo;
jni::method_t getPackageInfo1;
jni::method_t getApplicationInfo;
jni::method_t queryIntentServices;
/*!
* Singleton accessor
*/
static Meta &data() {
static Meta instance;
return instance;
}
private:
Meta();
};
};
} // namespace android::content::pm
} // namespace wrap
#include "android.content.pm.impl.h"

View file

@ -0,0 +1,83 @@
// Copyright 2020, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
#pragma once
#include "android.content.h"
#include "java.util.h"
#include <string>
namespace wrap {
namespace android::content::pm {
inline os::Bundle PackageItemInfo::getMetaData() const {
assert(!isNull());
return get(Meta::data().metaData, object());
}
inline std::string PackageItemInfo::getName() const {
assert(!isNull());
return get(Meta::data().name, object());
}
inline std::string PackageItemInfo::getPackageName() const {
assert(!isNull());
return get(Meta::data().packageName, object());
}
inline std::string ApplicationInfo::getNativeLibraryDir() const {
assert(!isNull());
return get(Meta::data().nativeLibraryDir, object());
}
inline std::string ApplicationInfo::getPublicSourceDir() const {
assert(!isNull());
return get(Meta::data().publicSourceDir, object());
}
inline ApplicationInfo PackageInfo::getApplicationInfo() const {
assert(!isNull());
return get(Meta::data().applicationInfo, object());
}
inline std::string PackageInfo::getPackageName() const {
assert(!isNull());
return get(Meta::data().packageName, object());
}
inline ServiceInfo ResolveInfo::getServiceInfo() const {
assert(!isNull());
return get(Meta::data().serviceInfo, object());
}
inline PackageInfo PackageManager::getPackageInfo(std::string const &name,
int32_t flags) {
assert(!isNull());
return PackageInfo(
object().call<jni::Object>(Meta::data().getPackageInfo, name, flags));
}
#if 0
// Ambiguous overload until we wrap VersionedPackage
inline PackageInfo
PackageManager::getPackageInfo(jni::Object const &versionedPackage,
int32_t flags) {
assert(!isNull());
return PackageInfo(object().call<jni::Object>(Meta::data().getPackageInfo1,
versionedPackage, flags));
}
#endif
inline ApplicationInfo
PackageManager::getApplicationInfo(std::string const &packageName,
int32_t flags) {
assert(!isNull());
return ApplicationInfo(object().call<jni::Object>(
Meta::data().getApplicationInfo, packageName, flags));
}
inline java::util::List PackageManager::queryIntentServices(Intent &intent,
int32_t intParam) {
assert(!isNull());
return java::util::List(object().call<jni::Object>(
Meta::data().queryIntentServices, intent.object(), intParam));
}
} // namespace android::content::pm
} // namespace wrap

View file

@ -0,0 +1,15 @@
// Copyright 2020, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
#include "android.graphics.h"
namespace wrap {
namespace android::graphics {
Point::Meta::Meta()
: MetaBaseDroppable(Point::getTypeName()), x(classRef(), "x"),
y(classRef(), "y") {
MetaBaseDroppable::dropClassRef();
}
} // namespace android::graphics
} // namespace wrap

View file

@ -0,0 +1,64 @@
// Copyright 2020, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
#pragma once
#include "ObjectWrapperBase.h"
namespace wrap {
namespace android::graphics {
/*!
* Wrapper for android.graphics.Point objects.
*/
class Point : public ObjectWrapperBase {
public:
using ObjectWrapperBase::ObjectWrapperBase;
static constexpr const char *getTypeName() noexcept {
return "android/graphics/Point";
}
/*!
* Getter for the x field value
*
* Java prototype:
* `public int x;`
*
* JNI signature: I
*
*/
int32_t getX() const;
/*!
* Getter for the y field value
*
* Java prototype:
* `public int y;`
*
* JNI signature: I
*
*/
int32_t getY() const;
/*!
* Class metadata
*/
struct Meta : public MetaBaseDroppable {
impl::FieldId<int32_t> x;
impl::FieldId<int32_t> y;
/*!
* Singleton accessor
*/
static Meta &data() {
static Meta instance;
return instance;
}
private:
Meta();
};
};
} // namespace android::graphics
} // namespace wrap
#include "android.graphics.impl.h"

View file

@ -0,0 +1,19 @@
// Copyright 2020, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
#pragma once
namespace wrap {
namespace android::graphics {
inline int32_t Point::getX() const {
assert(!isNull());
return get(Meta::data().x, object());
}
inline int32_t Point::getY() const {
assert(!isNull());
return get(Meta::data().y, object());
}
} // namespace android::graphics
} // namespace wrap

View file

@ -0,0 +1,33 @@
// Copyright 2020, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
#include "android.os.h"
namespace wrap {
namespace android::os {
BaseBundle::Meta::Meta()
: MetaBaseDroppable(BaseBundle::getTypeName()),
containsKey(classRef().getMethod("containsKey", "(Ljava/lang/String;)Z")),
getString(classRef().getMethod("getString",
"(Ljava/lang/String;)Ljava/lang/String;")),
getString1(classRef().getMethod(
"getString",
"(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;")) {
MetaBaseDroppable::dropClassRef();
}
Bundle::Meta::Meta() : MetaBaseDroppable(Bundle::getTypeName()) {
MetaBaseDroppable::dropClassRef();
}
ParcelFileDescriptor::Meta::Meta()
: MetaBaseDroppable(ParcelFileDescriptor::getTypeName()),
adoptFd(classRef().getStaticMethod(
"adoptFd", "(I)Landroid/os/ParcelFileDescriptor;")),
getFd(classRef().getMethod("getFd", "()I")),
detachFd(classRef().getMethod("detachFd", "()I")),
close(classRef().getMethod("close", "()V")),
checkError(classRef().getMethod("checkError", "()V")) {
MetaBaseDroppable::dropClassRef();
}
} // namespace android::os
} // namespace wrap

View file

@ -0,0 +1,199 @@
// Copyright 2020, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
#pragma once
#include "ObjectWrapperBase.h"
namespace wrap {
namespace android::os {
class ParcelFileDescriptor;
} // namespace android::os
} // namespace wrap
namespace wrap {
namespace android::os {
/*!
* Wrapper for android.os.BaseBundle objects.
*/
class BaseBundle : public ObjectWrapperBase {
public:
using ObjectWrapperBase::ObjectWrapperBase;
static constexpr const char *getTypeName() noexcept {
return "android/os/BaseBundle";
}
/*!
* Wrapper for the containsKey method
*
* Java prototype:
* `public boolean containsKey(java.lang.String);`
*
* JNI signature: (Ljava/lang/String;)Z
*
*/
bool containsKey(std::string const &key);
/*!
* Wrapper for the getString method
*
* Java prototype:
* `public java.lang.String getString(java.lang.String);`
*
* JNI signature: (Ljava/lang/String;)Ljava/lang/String;
*
*/
std::string getString(std::string const &key);
/*!
* Wrapper for the getString method
*
* Java prototype:
* `public java.lang.String getString(java.lang.String, java.lang.String);`
*
* JNI signature: (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
*
*/
std::string getString(std::string const &key,
std::string const &defaultValue);
/*!
* Class metadata
*/
struct Meta : public MetaBaseDroppable {
jni::method_t containsKey;
jni::method_t getString;
jni::method_t getString1;
/*!
* Singleton accessor
*/
static Meta &data() {
static Meta instance;
return instance;
}
private:
Meta();
};
};
/*!
* Wrapper for android.os.Bundle objects.
*/
class Bundle : public BaseBundle {
public:
using BaseBundle::BaseBundle;
static constexpr const char *getTypeName() noexcept {
return "android/os/Bundle";
}
/*!
* Class metadata
*/
struct Meta : public MetaBaseDroppable {
/*!
* Singleton accessor
*/
static Meta &data() {
static Meta instance;
return instance;
}
private:
Meta();
};
};
/*!
* Wrapper for android.os.ParcelFileDescriptor objects.
*/
class ParcelFileDescriptor : public ObjectWrapperBase {
public:
using ObjectWrapperBase::ObjectWrapperBase;
static constexpr const char *getTypeName() noexcept {
return "android/os/ParcelFileDescriptor";
}
/*!
* Wrapper for the adoptFd static method
*
* Java prototype:
* `public static android.os.ParcelFileDescriptor adoptFd(int);`
*
* JNI signature: (I)Landroid/os/ParcelFileDescriptor;
*
*/
static ParcelFileDescriptor adoptFd(int fd);
/*!
* Wrapper for the getFd method
*
* Java prototype:
* `public int getFd();`
*
* JNI signature: ()I
*
*/
int getFd() const;
/*!
* Wrapper for the detachFd method
*
* Java prototype:
* `public int detachFd();`
*
* JNI signature: ()I
*
*/
int detachFd();
/*!
* Wrapper for the close method
*
* Java prototype:
* `public void close() throws java.io.IOException;`
*
* JNI signature: ()V
*
*/
void close();
/*!
* Wrapper for the checkError method
*
* Java prototype:
* `public void checkError() throws java.io.IOException;`
*
* JNI signature: ()V
*
*/
void checkError() const;
/*!
* Class metadata
*/
struct Meta : public MetaBaseDroppable {
jni::method_t adoptFd;
jni::method_t getFd;
jni::method_t detachFd;
jni::method_t close;
jni::method_t checkError;
/*!
* Singleton accessor
*/
static Meta &data() {
static Meta instance;
return instance;
}
private:
Meta();
};
};
} // namespace android::os
} // namespace wrap
#include "android.os.impl.h"

View file

@ -0,0 +1,53 @@
// Copyright 2020, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
#pragma once
#include <string>
namespace wrap {
namespace android::os {
inline bool BaseBundle::containsKey(std::string const &key) {
assert(!isNull());
return object().call<bool>(Meta::data().containsKey, key);
}
inline std::string BaseBundle::getString(std::string const &key) {
assert(!isNull());
return object().call<std::string>(Meta::data().getString, key);
}
inline std::string BaseBundle::getString(std::string const &key,
std::string const &defaultValue) {
assert(!isNull());
return object().call<std::string>(Meta::data().getString1, key,
defaultValue);
}
inline ParcelFileDescriptor ParcelFileDescriptor::adoptFd(int fd) {
return ParcelFileDescriptor(
Meta::data().clazz().call<jni::Object>(Meta::data().adoptFd, fd));
}
inline int ParcelFileDescriptor::getFd() const {
assert(!isNull());
return object().call<int>(Meta::data().getFd);
}
inline int ParcelFileDescriptor::detachFd() {
assert(!isNull());
return object().call<int>(Meta::data().detachFd);
}
inline void ParcelFileDescriptor::close() {
assert(!isNull());
return object().call<void>(Meta::data().close);
}
inline void ParcelFileDescriptor::checkError() const {
assert(!isNull());
return object().call<void>(Meta::data().checkError);
}
} // namespace android::os
} // namespace wrap

View file

@ -0,0 +1,13 @@
// Copyright 2020, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
#include "android.provider.h"
namespace wrap {
namespace android::provider {
Settings::Meta::Meta()
: MetaBase(Settings::getTypeName()),
ACTION_VR_LISTENER_SETTINGS(classRef(), "ACTION_VR_LISTENER_SETTINGS") {}
} // namespace android::provider
} // namespace wrap

View file

@ -0,0 +1,53 @@
// Copyright 2020, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
#pragma once
#include "ObjectWrapperBase.h"
#include <string>
namespace wrap {
namespace android::provider {
/*!
* Wrapper for android.provider.Settings objects.
*/
class Settings : public ObjectWrapperBase {
public:
using ObjectWrapperBase::ObjectWrapperBase;
static constexpr const char *getTypeName() noexcept {
return "android/provider/Settings";
}
/*!
* Getter for the ACTION_VR_LISTENER_SETTINGS static field value
*
* Java prototype:
* `public static final java.lang.String ACTION_VR_LISTENER_SETTINGS;`
*
* JNI signature: Ljava/lang/String;
*
*/
static std::string ACTION_VR_LISTENER_SETTINGS();
/*!
* Class metadata
*/
struct Meta : public MetaBase {
impl::StaticFieldId<std::string> ACTION_VR_LISTENER_SETTINGS;
/*!
* Singleton accessor
*/
static Meta &data() {
static Meta instance;
return instance;
}
private:
Meta();
};
};
} // namespace android::provider
} // namespace wrap
#include "android.provider.impl.h"

View file

@ -0,0 +1,13 @@
// Copyright 2020, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
#pragma once
namespace wrap {
namespace android::provider {
inline std::string Settings::ACTION_VR_LISTENER_SETTINGS() {
return get(Meta::data().ACTION_VR_LISTENER_SETTINGS, Meta::data().clazz());
}
} // namespace android::provider
} // namespace wrap

View file

@ -0,0 +1,15 @@
// Copyright 2020, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
#include "android.service.vr.h"
namespace wrap {
namespace android::service::vr {
VrListenerService::Meta::Meta()
: MetaBase(VrListenerService::getTypeName()),
isVrModePackageEnabled(classRef().getStaticMethod(
"isVrModePackageEnabled",
"(Landroid/content/Context;Landroid/content/ComponentName;)Z")) {}
} // namespace android::service::vr
} // namespace wrap

View file

@ -0,0 +1,65 @@
// Copyright 2020, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
#pragma once
#include "android.app.h"
namespace wrap {
namespace android::content {
class ComponentName;
class Context;
} // namespace android::content
} // namespace wrap
namespace wrap {
namespace android::service::vr {
/*!
* Wrapper for android.service.vr.VrListenerService objects.
*/
class VrListenerService : public app::Service {
public:
using Service::Service;
static constexpr const char *getTypeName() noexcept {
return "android/service/vr/VrListenerService";
}
/*!
* Wrapper for the isVrModePackageEnabled static method
*
* Java prototype:
* `public static final boolean
* isVrModePackageEnabled(android.content.Context,
* android.content.ComponentName);`
*
* JNI signature:
* (Landroid/content/Context;Landroid/content/ComponentName;)Z
*
*/
static bool
isVrModePackageEnabled(content::Context const &context,
content::ComponentName const &componentName);
/*!
* Class metadata
*/
struct Meta : public MetaBase {
jni::method_t isVrModePackageEnabled;
/*!
* Singleton accessor
*/
static Meta &data() {
static Meta instance;
return instance;
}
private:
Meta();
};
};
} // namespace android::service::vr
} // namespace wrap
#include "android.service.vr.impl.h"

View file

@ -0,0 +1,19 @@
// Copyright 2020, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
#pragma once
#include "android.content.h"
namespace wrap {
namespace android::service::vr {
inline bool VrListenerService::isVrModePackageEnabled(
content::Context const &context,
content::ComponentName const &componentName) {
return Meta::data().clazz().call<bool>(Meta::data().isVrModePackageEnabled,
context.object(),
componentName.object());
}
} // namespace android::service::vr
} // namespace wrap

View file

@ -0,0 +1,16 @@
// Copyright 2020, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
#include "android.util.h"
namespace wrap {
namespace android::util {
DisplayMetrics::Meta::Meta()
: MetaBaseDroppable(DisplayMetrics::getTypeName()),
heightPixels(classRef(), "heightPixels"),
widthPixels(classRef(), "widthPixels") {
MetaBaseDroppable::dropClassRef();
}
} // namespace android::util
} // namespace wrap

View file

@ -0,0 +1,64 @@
// Copyright 2020, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
#pragma once
#include "ObjectWrapperBase.h"
namespace wrap {
namespace android::util {
/*!
* Wrapper for android.util.DisplayMetrics objects.
*/
class DisplayMetrics : public ObjectWrapperBase {
public:
using ObjectWrapperBase::ObjectWrapperBase;
static constexpr const char *getTypeName() noexcept {
return "android/util/DisplayMetrics";
}
/*!
* Getter for the heightPixels field value
*
* Java prototype:
* `public int heightPixels;`
*
* JNI signature: I
*
*/
int32_t getHeightPixels() const;
/*!
* Getter for the widthPixels field value
*
* Java prototype:
* `public int widthPixels;`
*
* JNI signature: I
*
*/
int32_t getWidthPixels() const;
/*!
* Class metadata
*/
struct Meta : public MetaBaseDroppable {
impl::FieldId<int32_t> heightPixels;
impl::FieldId<int32_t> widthPixels;
/*!
* Singleton accessor
*/
static Meta &data() {
static Meta instance;
return instance;
}
private:
Meta();
};
};
} // namespace android::util
} // namespace wrap
#include "android.util.impl.h"

View file

@ -0,0 +1,19 @@
// Copyright 2020, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
#pragma once
namespace wrap {
namespace android::util {
inline int32_t DisplayMetrics::getHeightPixels() const {
assert(!isNull());
return get(Meta::data().heightPixels, object());
}
inline int32_t DisplayMetrics::getWidthPixels() const {
assert(!isNull());
return get(Meta::data().widthPixels, object());
}
} // namespace android::util
} // namespace wrap

View file

@ -0,0 +1,29 @@
// Copyright 2020, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
#include "android.view.h"
namespace wrap {
namespace android::view {
Display::Meta::Meta()
: MetaBaseDroppable(Display::getTypeName()),
getRealSize(
classRef().getMethod("getRealSize", "(Landroid/graphics/Point;)V")),
getRealMetrics(classRef().getMethod("getRealMetrics",
"(Landroid/util/DisplayMetrics;)V")) {
MetaBaseDroppable::dropClassRef();
}
Surface::Meta::Meta()
: MetaBaseDroppable(Surface::getTypeName()),
isValid(classRef().getMethod("isValid", "()Z")) {
MetaBaseDroppable::dropClassRef();
}
SurfaceHolder::Meta::Meta()
: MetaBaseDroppable(SurfaceHolder::getTypeName()),
getSurface(
classRef().getMethod("getSurface", "()Landroid/view/Surface;")) {
MetaBaseDroppable::dropClassRef();
}
} // namespace android::view
} // namespace wrap

View file

@ -0,0 +1,157 @@
// Copyright 2020, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
#pragma once
#include "ObjectWrapperBase.h"
namespace wrap {
namespace android::graphics {
class Point;
} // namespace android::graphics
namespace android::util {
class DisplayMetrics;
} // namespace android::util
namespace android::view {
class Surface;
} // namespace android::view
} // namespace wrap
namespace wrap {
namespace android::view {
/*!
* Wrapper for android.view.Display objects.
*/
class Display : public ObjectWrapperBase {
public:
using ObjectWrapperBase::ObjectWrapperBase;
static constexpr const char *getTypeName() noexcept {
return "android/view/Display";
}
/*!
* Wrapper for the getRealSize method
*
* Java prototype:
* `public void getRealSize(android.graphics.Point);`
*
* JNI signature: (Landroid/graphics/Point;)V
*
*/
void getRealSize(graphics::Point &out_size);
/*!
* Wrapper for the getRealMetrics method
*
* Java prototype:
* `public void getRealMetrics(android.util.DisplayMetrics);`
*
* JNI signature: (Landroid/util/DisplayMetrics;)V
*
*/
void getRealMetrics(util::DisplayMetrics &out_displayMetrics);
/*!
* Class metadata
*/
struct Meta : public MetaBaseDroppable {
jni::method_t getRealSize;
jni::method_t getRealMetrics;
/*!
* Singleton accessor
*/
static Meta &data() {
static Meta instance;
return instance;
}
private:
Meta();
};
};
/*!
* Wrapper for android.view.Surface objects.
*/
class Surface : public ObjectWrapperBase {
public:
using ObjectWrapperBase::ObjectWrapperBase;
static constexpr const char *getTypeName() noexcept {
return "android/view/Surface";
}
/*!
* Wrapper for the isValid method
*
* Java prototype:
* `public boolean isValid();`
*
* JNI signature: ()Z
*
*/
bool isValid() const;
/*!
* Class metadata
*/
struct Meta : public MetaBaseDroppable {
jni::method_t isValid;
/*!
* Singleton accessor
*/
static Meta &data() {
static Meta instance;
return instance;
}
private:
Meta();
};
};
/*!
* Wrapper for android.view.SurfaceHolder objects.
*/
class SurfaceHolder : public ObjectWrapperBase {
public:
using ObjectWrapperBase::ObjectWrapperBase;
static constexpr const char *getTypeName() noexcept {
return "android/view/SurfaceHolder";
}
/*!
* Wrapper for the getSurface method
*
* Java prototype:
* `public abstract android.view.Surface getSurface();`
*
* JNI signature: ()Landroid/view/Surface;
*
*/
Surface getSurface();
/*!
* Class metadata
*/
struct Meta : public MetaBaseDroppable {
jni::method_t getSurface;
/*!
* Singleton accessor
*/
static Meta &data() {
static Meta instance;
return instance;
}
private:
Meta();
};
};
} // namespace android::view
} // namespace wrap
#include "android.view.impl.h"

View file

@ -0,0 +1,31 @@
// Copyright 2020, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
#pragma once
#include "android.graphics.h"
#include "android.util.h"
namespace wrap {
namespace android::view {
inline void Display::getRealSize(graphics::Point &out_size) {
assert(!isNull());
return object().call<void>(Meta::data().getRealSize, out_size.object());
}
inline void Display::getRealMetrics(util::DisplayMetrics &out_displayMetrics) {
assert(!isNull());
return object().call<void>(Meta::data().getRealMetrics,
out_displayMetrics.object());
}
inline bool Surface::isValid() const {
assert(!isNull());
return object().call<bool>(Meta::data().isValid);
}
inline Surface SurfaceHolder::getSurface() {
assert(!isNull());
return Surface(object().call<jni::Object>(Meta::data().getSurface));
}
} // namespace android::view
} // namespace wrap

View file

@ -0,0 +1,19 @@
// Copyright 2020, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
#include "android.widget.h"
namespace wrap {
namespace android::widget {
Toast::Meta::Meta()
: MetaBase(Toast::getTypeName()), LENGTH_LONG(classRef(), "LENGTH_LONG"),
LENGTH_SHORT(classRef(), "LENGTH_SHORT"),
show(classRef().getMethod("show", "()V")),
makeText(classRef().getStaticMethod(
"makeText", "(Landroid/content/Context;Ljava/lang/"
"CharSequence;I)Landroid/widget/Toast;")),
makeText1(classRef().getStaticMethod(
"makeText", "(Landroid/content/Context;II)Landroid/widget/Toast;")) {}
} // namespace android::widget
} // namespace wrap

View file

@ -0,0 +1,116 @@
// Copyright 2020, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
#pragma once
#include "ObjectWrapperBase.h"
namespace wrap {
namespace android::content {
class Context;
} // namespace android::content
namespace android::widget {
class Toast;
} // namespace android::widget
} // namespace wrap
namespace wrap {
namespace android::widget {
/*!
* Wrapper for android.widget.Toast objects.
*/
class Toast : public ObjectWrapperBase {
public:
using ObjectWrapperBase::ObjectWrapperBase;
static constexpr const char *getTypeName() noexcept {
return "android/widget/Toast";
}
/*!
* Getter for the LENGTH_LONG static field value
*
* Java prototype:
* `public static final int LENGTH_LONG;`
*
* JNI signature: I
*
*/
static int32_t LENGTH_LONG();
/*!
* Getter for the LENGTH_SHORT static field value
*
* Java prototype:
* `public static final int LENGTH_SHORT;`
*
* JNI signature: I
*
*/
static int32_t LENGTH_SHORT();
/*!
* Wrapper for the show method
*
* Java prototype:
* `public void show();`
*
* JNI signature: ()V
*
*/
void show() const;
/*!
* Wrapper for the makeText static method
*
* Java prototype:
* `public static android.widget.Toast makeText(android.content.Context,
* java.lang.CharSequence, int);`
*
* JNI signature:
* (Landroid/content/Context;Ljava/lang/CharSequence;I)Landroid/widget/Toast;
*
*/
static Toast makeText(content::Context const &context,
std::string const &stringParam, int32_t duration);
/*!
* Wrapper for the makeText static method
*
* Java prototype:
* `public static android.widget.Toast makeText(android.content.Context,
* int, int) throws android.content.res.Resources$NotFoundException;`
*
* JNI signature: (Landroid/content/Context;II)Landroid/widget/Toast;
*
*/
static Toast makeText(content::Context &context, int32_t resId,
int32_t duration);
/*!
* Class metadata
*/
struct Meta : public MetaBase {
impl::StaticFieldId<int32_t> LENGTH_LONG;
impl::StaticFieldId<int32_t> LENGTH_SHORT;
jni::method_t show;
jni::method_t makeText;
jni::method_t makeText1;
/*!
* Singleton accessor
*/
static Meta &data() {
static Meta instance;
return instance;
}
private:
Meta();
};
};
} // namespace android::widget
} // namespace wrap
#include "android.widget.impl.h"

View file

@ -0,0 +1,36 @@
// Copyright 2020, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
#pragma once
#include "android.content.h"
namespace wrap {
namespace android::widget {
inline int32_t Toast::LENGTH_LONG() {
return get(Meta::data().LENGTH_LONG, Meta::data().clazz());
}
inline int32_t Toast::LENGTH_SHORT() {
return get(Meta::data().LENGTH_SHORT, Meta::data().clazz());
}
inline void Toast::show() const {
assert(!isNull());
return object().call<void>(Meta::data().show);
}
inline Toast Toast::makeText(content::Context const &context,
std::string const &stringParam, int32_t duration) {
return Toast(Meta::data().clazz().call<jni::Object>(
Meta::data().makeText, context.object(), stringParam, duration));
}
inline Toast Toast::makeText(content::Context &context, int32_t resId,
int32_t duration) {
return Toast(Meta::data().clazz().call<jni::Object>(
Meta::data().makeText1, context.object(), resId, duration));
}
} // namespace android::widget
} // namespace wrap

View file

@ -0,0 +1,15 @@
// Copyright 2020, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
#include "dalvik.system.h"
namespace wrap {
namespace dalvik::system {
DexClassLoader::Meta::Meta()
: MetaBase(DexClassLoader::getTypeName()),
init(classRef().getMethod("<init>",
"(Ljava/lang/String;Ljava/lang/String;Ljava/"
"lang/String;Ljava/lang/ClassLoader;)V")) {}
} // namespace dalvik::system
} // namespace wrap

View file

@ -0,0 +1,67 @@
// Copyright 2020, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
#pragma once
#include "ObjectWrapperBase.h"
namespace wrap {
namespace dalvik::system {
class DexClassLoader;
} // namespace dalvik::system
namespace java::lang {
class ClassLoader;
} // namespace java::lang
} // namespace wrap
namespace wrap {
namespace dalvik::system {
/*!
* Wrapper for dalvik.system.DexClassLoader objects.
*/
class DexClassLoader : public ObjectWrapperBase {
public:
using ObjectWrapperBase::ObjectWrapperBase;
static constexpr const char *getTypeName() noexcept {
return "dalvik/system/DexClassLoader";
}
/*!
* Wrapper for a constructor
*
* Java prototype:
* `public dalvik.system.DexClassLoader(java.lang.String, java.lang.String,
* java.lang.String, java.lang.ClassLoader);`
*
* JNI signature:
* (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/ClassLoader;)V
*
*/
static DexClassLoader construct(std::string const &searchPath,
std::string const &nativeSearchPath,
jni::Object parentClassLoader);
/*!
* Class metadata
*/
struct Meta : public MetaBase {
jni::method_t init;
/*!
* Singleton accessor
*/
static Meta &data() {
static Meta instance;
return instance;
}
private:
Meta();
};
};
} // namespace dalvik::system
} // namespace wrap
#include "dalvik.system.impl.h"

View file

@ -0,0 +1,21 @@
// Copyright 2020, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
#pragma once
#include "java.lang.h"
#include <string>
namespace wrap {
namespace dalvik::system {
inline DexClassLoader
DexClassLoader::construct(std::string const &searchPath,
std::string const &nativeSearchPath,
jni::Object parentClassLoader) {
return DexClassLoader{
Meta::data().clazz().newInstance(Meta::data().init, searchPath, "",
nativeSearchPath, parentClassLoader)};
}
} // namespace dalvik::system
} // namespace wrap

View file

@ -0,0 +1,34 @@
// Copyright 2020, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
#include "java.lang.h"
namespace wrap {
namespace java::lang {
Class::Meta::Meta()
: MetaBase(Class::getTypeName()),
forName(classRef().getStaticMethod(
"forName", "(Ljava/lang/String;)Ljava/lang/Class;")),
forName1(classRef().getStaticMethod(
"forName",
"(Ljava/lang/String;ZLjava/lang/ClassLoader;)Ljava/lang/Class;")),
forName2(classRef().getStaticMethod(
"forName",
"(Ljava/lang/Module;Ljava/lang/String;)Ljava/lang/Class;")),
getCanonicalName(
classRef().getMethod("getCanonicalName", "()Ljava/lang/String;")) {}
ClassLoader::Meta::Meta()
: MetaBaseDroppable(ClassLoader::getTypeName()),
loadClass(classRef().getMethod("loadClass",
"(Ljava/lang/String;)Ljava/lang/Class;")),
findLibrary(classRef().getMethod(
"findLibrary", "(Ljava/lang/String;)Ljava/lang/String;")) {
MetaBaseDroppable::dropClassRef();
}
System::Meta::Meta()
: MetaBase(System::getTypeName()),
mapLibraryName(classRef().getStaticMethod(
"mapLibraryName", "(Ljava/lang/String;)Ljava/lang/String;")) {}
} // namespace java::lang
} // namespace wrap

View file

@ -0,0 +1,195 @@
// Copyright 2020, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
#pragma once
#include "ObjectWrapperBase.h"
namespace wrap {
namespace java::lang {
class Class;
class ClassLoader;
} // namespace java::lang
} // namespace wrap
namespace wrap {
namespace java::lang {
/*!
* Wrapper for java.lang.Class objects.
*/
class Class : public ObjectWrapperBase {
public:
using ObjectWrapperBase::ObjectWrapperBase;
static constexpr const char *getTypeName() noexcept {
return "java/lang/Class";
}
/*!
* Wrapper for the forName static method
*
* Java prototype:
* `public static java.lang.Class<?> forName(java.lang.String) throws
* java.lang.ClassNotFoundException;`
*
* JNI signature: (Ljava/lang/String;)Ljava/lang/Class;
*
*/
static Class forName(std::string &stringParam);
/*!
* Wrapper for the forName static method
*
* Java prototype:
* `public static java.lang.Class<?> forName(java.lang.String, boolean,
* java.lang.ClassLoader) throws java.lang.ClassNotFoundException;`
*
* JNI signature:
* (Ljava/lang/String;ZLjava/lang/ClassLoader;)Ljava/lang/Class;
*
*/
static Class forName(std::string const &name, bool initialize,
jni::Object classLoader);
//! @overload
static Class forName(jstring name, bool initialize,
jni::Object classLoader);
/*!
* Wrapper for the forName static method
*
* Java prototype:
* `public static java.lang.Class<?> forName(java.lang.Module,
* java.lang.String);`
*
* JNI signature: (Ljava/lang/Module;Ljava/lang/String;)Ljava/lang/Class;
*
*/
static Class forName(jni::Object const &module, std::string const &name);
/*!
* Wrapper for the getCanonicalName method
*
* Java prototype:
* `public java.lang.String getCanonicalName();`
*
* JNI signature: ()Ljava/lang/String;
*
*/
std::string getCanonicalName();
/*!
* Class metadata
*/
struct Meta : public MetaBase {
jni::method_t forName;
jni::method_t forName1;
jni::method_t forName2;
jni::method_t getCanonicalName;
/*!
* Singleton accessor
*/
static Meta &data() {
static Meta instance;
return instance;
}
private:
Meta();
};
};
/*!
* Wrapper for java.lang.ClassLoader objects.
*/
class ClassLoader : public ObjectWrapperBase {
public:
using ObjectWrapperBase::ObjectWrapperBase;
static constexpr const char *getTypeName() noexcept {
return "java/lang/ClassLoader";
}
/*!
* Wrapper for the loadClass method
*
* Java prototype:
* `public java.lang.Class<?> loadClass(java.lang.String) throws
* java.lang.ClassNotFoundException;`
*
* JNI signature: (Ljava/lang/String;)Ljava/lang/Class;
*
*/
Class loadClass(std::string const &name);
//! @overload
Class loadClass(jstring name);
/*!
* Wrapper for the findLibrary method
*
* JNI signature: (Ljava/lang/String;)Ljava/lang/String;
*
*/
std::string findLibrary(std::string const &name);
/*!
* Class metadata
*/
struct Meta : public MetaBaseDroppable {
jni::method_t loadClass;
jni::method_t findLibrary;
/*!
* Singleton accessor
*/
static Meta &data() {
static Meta instance;
return instance;
}
private:
Meta();
};
};
/*!
* Wrapper for java.lang.System objects.
*/
class System : public ObjectWrapperBase {
public:
using ObjectWrapperBase::ObjectWrapperBase;
static constexpr const char *getTypeName() noexcept {
return "java/lang/System";
}
/*!
* Wrapper for the mapLibraryName static method
*
* Java prototype:
* `public static native java.lang.String mapLibraryName(java.lang.String);`
*
* JNI signature: (Ljava/lang/String;)Ljava/lang/String;
*
*/
static std::string mapLibraryName(std::string const &name);
/*!
* Class metadata
*/
struct Meta : public MetaBase {
jni::method_t mapLibraryName;
/*!
* Singleton accessor
*/
static Meta &data() {
static Meta instance;
return instance;
}
private:
Meta();
};
};
} // namespace java::lang
} // namespace wrap
#include "java.lang.impl.h"

Some files were not shown because too many files have changed in this diff Show more