From 0f43bbe9249f8fc8e304d45f76987eb595bc1ea7 Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Tue, 8 Sep 2020 14:11:49 -0500 Subject: [PATCH] inc/xrt: Add Android config header to store package name. --- CMakeLists.txt | 11 +++++++++++ src/xrt/include/xrt/CMakeLists.txt | 6 ++++++ src/xrt/include/xrt/xrt_config_android.h.cmake_in | 12 ++++++++++++ 3 files changed, 29 insertions(+) create mode 100644 src/xrt/include/xrt/xrt_config_android.h.cmake_in diff --git a/CMakeLists.txt b/CMakeLists.txt index 93237f82a..e2b838152 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -178,6 +178,17 @@ cmake_dependent_option(XRT_BUILD_DRIVER_SURVIVE "Enable libsurvive driver" OFF " # 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 REMOTE SURVIVE) + +# 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 ### diff --git a/src/xrt/include/xrt/CMakeLists.txt b/src/xrt/include/xrt/CMakeLists.txt index b8403e1ad..309e80065 100644 --- a/src/xrt/include/xrt/CMakeLists.txt +++ b/src/xrt/include/xrt/CMakeLists.txt @@ -30,3 +30,9 @@ configure_file( ${CMAKE_CURRENT_BINARY_DIR}/xrt_config_vulkan.h @ONLY ) + +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/xrt_config_android.h.cmake_in + ${CMAKE_CURRENT_BINARY_DIR}/xrt_config_android.h + @ONLY + ) diff --git a/src/xrt/include/xrt/xrt_config_android.h.cmake_in b/src/xrt/include/xrt/xrt_config_android.h.cmake_in new file mode 100644 index 000000000..03289df5a --- /dev/null +++ b/src/xrt/include/xrt/xrt_config_android.h.cmake_in @@ -0,0 +1,12 @@ +// Copyright 2020, Collabora, Ltd. +// SPDX-License-Identifier: BSL-1.0 +/*! + * @file + * @brief Android defines. + * @author Ryan Pavlik + * @ingroup xrt_iface + */ + +#pragma once + +#cmakedefine XRT_ANDROID_PACKAGE "@XRT_ANDROID_PACKAGE@"