From 47710e053247c1991dfefa090ee7a6dd70bddef8 Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Tue, 28 Apr 2020 13:49:11 -0500 Subject: [PATCH] t/openxr: Fix build without OpenGL --- CMakeLists.txt | 2 +- src/xrt/targets/openxr/CMakeLists.txt | 18 +++++++++++------- src/xrt/targets/openxr/oxr_sdl2_hack.c | 9 +++++---- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a779c6c6e..f82b0d3e7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -91,7 +91,7 @@ cmake_dependent_option(BUILD_WITH_RS "Enable RealSense device driver" ON "realse option(BUILD_WITH_DUMMY "Enable dummy driver" ON) cmake_dependent_option(BUILD_WITH_VIVE "Enable Vive driver" ON "ZLIB_FOUND" OFF) cmake_dependent_option(BUILD_WITH_OPENHMD "Enable OpenHMD driver" ON "OPENHMD_FOUND" OFF) -cmake_dependent_option(BUILD_WITH_SDL2 "Enable SDL2 based test application" ON "SDL2_FOUND" OFF) +cmake_dependent_option(BUILD_WITH_SDL2 "Enable SDL2 based test application" ON "SDL2_FOUND AND BUILD_WITH_OPENGL" OFF) cmake_dependent_option(BUILD_WITH_DAYDREAM "Enable Bluetooth LE via DBUS" ON "BUILD_WITH_DBUS" OFF) cmake_dependent_option(BUILD_WITH_ARDUINO "Enable Arduino input device with BLE via DBUS" ON "BUILD_WITH_DBUS" OFF) diff --git a/src/xrt/targets/openxr/CMakeLists.txt b/src/xrt/targets/openxr/CMakeLists.txt index 4d44ed663..acc326b2c 100644 --- a/src/xrt/targets/openxr/CMakeLists.txt +++ b/src/xrt/targets/openxr/CMakeLists.txt @@ -24,15 +24,23 @@ add_library(${RUNTIME_TARGET} MODULE ${SOURCE_FILES} ) -# Note: Order matters in this list! +# Note: Order may matter in these lists! target_link_libraries(${RUNTIME_TARGET} PUBLIC aux_vk aux_os - aux_ogl aux_util aux_math + ) + +if(BUILD_WITH_OPENGL) + target_link_libraries(${RUNTIME_TARGET} PUBLIC aux_ogl) +endif() +if(BUILD_WITH_SDL2) + target_link_libraries(${RUNTIME_TARGET} PUBLIC st_gui imgui_impl_sdl) +endif() + +target_link_libraries(${RUNTIME_TARGET} PUBLIC st_oxr - st_gui st_prober target_lists target_instance @@ -40,10 +48,6 @@ target_link_libraries(${RUNTIME_TARGET} PUBLIC comp_client ) -if(BUILD_WITH_SDL2) - target_link_libraries(${RUNTIME_TARGET} PUBLIC imgui_impl_sdl) -endif() - if(NOT MSVC) # Force the main "negotiate" symbol's inclusion # and use a version script to ensure that's the only one we expose. diff --git a/src/xrt/targets/openxr/oxr_sdl2_hack.c b/src/xrt/targets/openxr/oxr_sdl2_hack.c index 8fc393a43..f5371965d 100644 --- a/src/xrt/targets/openxr/oxr_sdl2_hack.c +++ b/src/xrt/targets/openxr/oxr_sdl2_hack.c @@ -14,10 +14,6 @@ #include "util/u_debug.h" #include "os/os_threading.h" -#include "ogl/ogl_api.h" - -#include "gui/gui_common.h" -#include "gui/gui_imgui.h" struct xrt_instance; @@ -40,6 +36,11 @@ oxr_sdl2_hack_stop(void **hack) #else +#include "ogl/ogl_api.h" + +#include "gui/gui_common.h" +#include "gui/gui_imgui.h" + #include DEBUG_GET_ONCE_BOOL_OPTION(gui, "OXR_DEBUG_GUI", false)