xrt: Move OpenXR platform defines to build system

This commit is contained in:
Ryan Pavlik 2019-12-03 17:40:38 -06:00
parent 130a649f92
commit f834d20300
3 changed files with 28 additions and 5 deletions

View file

@ -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

View file

@ -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})

View file

@ -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,
)