diff --git a/src/xrt/include/xrt/xrt_openxr_includes.h b/src/xrt/include/xrt/xrt_openxr_includes.h index 6818ce8d2..f956fb3f9 100644 --- a/src/xrt/include/xrt/xrt_openxr_includes.h +++ b/src/xrt/include/xrt/xrt_openxr_includes.h @@ -9,12 +9,8 @@ #pragma once -// Move these to the build system instead. -#define XR_USE_GRAPHICS_API_OPENGL -#define XR_USE_GRAPHICS_API_OPENGL_ES +//! @todo Move these to the build system instead. #define XR_USE_GRAPHICS_API_VULKAN -#define XR_USE_PLATFORM_XLIB -#define XR_USE_PLATFORM_EGL #define XR_USE_TIMESPEC 1 #ifdef XR_USE_PLATFORM_XLIB diff --git a/src/xrt/state_trackers/oxr/CMakeLists.txt b/src/xrt/state_trackers/oxr/CMakeLists.txt index 4b85e447f..f7ad44390 100644 --- a/src/xrt/state_trackers/oxr/CMakeLists.txt +++ b/src/xrt/state_trackers/oxr/CMakeLists.txt @@ -43,6 +43,18 @@ set(OXR_SOURCE_FILES oxr_xdev.c ) +if(BUILD_WITH_OPENGL) + add_definitions(-DXR_USE_GRAPHICS_API_OPENGL -DXR_USE_GRAPHICS_API_OPENGL_ES) +endif() + +if(BUILD_WITH_XLIB) + add_definitions(-DXR_USE_PLATFORM_XLIB) +endif() + +if(BUILD_WITH_EGL) + add_definitions(-DXR_USE_PLATFORM_EGL) +endif() + # Use OBJECT to not create a archive, since it just gets in the way. add_library(st_oxr OBJECT ${OXR_SOURCE_FILES}) diff --git a/src/xrt/state_trackers/oxr/meson.build b/src/xrt/state_trackers/oxr/meson.build index 53189bd43..cfaeadd65 100644 --- a/src/xrt/state_trackers/oxr/meson.build +++ b/src/xrt/state_trackers/oxr/meson.build @@ -1,6 +1,19 @@ # Copyright 2019, Collabora, Ltd. # SPDX-License-Identifier: BSL-1.0 +compile_args = [] +if x11.found() + compile_args += ['-DXR_USE_GRAPHICS_API_OPENGL', '-DXR_USE_GRAPHICS_API_OPENGL_ES'] +endif + +if egl.found() + compile_args += ['-DXR_USE_PLATFORM_EGL'] +endif + +if opengl.found() + compile_args += ['-DXR_USE_PLATFORM_XLIB'] +endif + lib_st_oxr = static_library( 'st_oxr', files( @@ -43,4 +56,6 @@ lib_st_oxr = static_library( external_include, ], dependencies: [aux, vulkan], + c_args: compile_args, + cpp_args: compile_args, )