Commit 5cfa0907 authored by Ryan Pavlik's avatar Ryan Pavlik Committed by Jakob Bornecrantz
Browse files

build: Use and obey config options for driver selection.

We had BUILD_WITH_OPENHMD but it was unused,
while the HDK driver always built if the deps were found.
parent eec53ca3
......@@ -34,10 +34,15 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
endif()
cmake_dependent_option(BUILD_WITH_OPENHMD "Enable OpenHMD driver" ON "OPENHMD_FOUND" OFF)
cmake_dependent_option(BUILD_WITH_HIDAPI "Enable HIDAPI-based OSVR HDK driver" ON "HIDAPI_FOUND" OFF)
cmake_dependent_option(BUILD_WITH_WAYLAND "Enable Wayland support" ON "WAYLAND_FOUND" OFF)
cmake_dependent_option(BUILD_WITH_XLIB "Enable xlib support" ON "X11_FOUND" OFF)
cmake_dependent_option(BUILD_WITH_OPENGL "Enable OpenGL Graphics API support?" ON "OPENGL_FOUND" OFF)
if(NOT BUILD_WITH_OPENHMD AND NOT BUILD_WITH_HIDAPI)
message(FATAL_ERROR "You must enable at least one driver: either provide OpenHMD and enable BUILD_WITH_OPENHMD (for a variety of devices via OpenHMD), or provide HIDAPI and enable BUILD_WITH_HIDAPI (for the HDK driver)")
endif()
###
# Flags
......
......@@ -20,7 +20,7 @@ target_include_directories(drv_ohmd SYSTEM
PRIVATE ${OPENHMD_INCLUDE_DIRS}
)
if(HIDAPI_FOUND)
if(BUILD_WITH_HIDAPI)
set(HDK_SOURCE_FILES
hdk/hdk_device.cpp
hdk/hdk_device.h
......
......@@ -69,15 +69,19 @@ add_library(${RUNTIME_TARGET} SHARED
target_link_libraries(${RUNTIME_TARGET}
PUBLIC
OpenHMD::OpenHMD
${Vulkan_LIBRARIES}
${XCB_LIBRARIES}
OpenGL::GLX
)
target_compile_definitions(${RUNTIME_TARGET} PRIVATE XRT_HAVE_OHMD)
if(TARGET drv_hdk)
if(BUILD_WITH_OPENHMD)
target_sources(${RUNTIME_TARGET} PRIVATE $<TARGET_OBJECTS:drv_ohmd>)
target_compile_definitions(${RUNTIME_TARGET} PRIVATE XRT_HAVE_OHMD)
target_link_libraries(${RUNTIME_TARGET} INTERFACE OpenHMD::OpenHMD)
endif()
if(BUILD_WITH_HIDAPI)
target_sources(${RUNTIME_TARGET} PRIVATE $<TARGET_OBJECTS:drv_hdk>)
target_link_libraries(${RUNTIME_TARGET} PUBLIC ${HIDAPI_LIBRARIES})
target_compile_definitions(${RUNTIME_TARGET} PRIVATE XRT_HAVE_HDK)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment