Commit 0d75b465 authored by Ryan Pavlik's avatar Ryan Pavlik
Browse files

build: Move enabled-driver defines to a header, instead of compiler options for every target.

parent ec699368
......@@ -96,7 +96,6 @@ if(BUILD_WITH_OPENHMD)
add_definitions(-DXRT_HAVE_OPENHMD)
# Drivers enabled with OpenHMD.
add_definitions(-DXRT_BUILD_OHMD)
set(BUILD_DRIVER_OHMD TRUE)
endif()
......@@ -104,15 +103,12 @@ if(BUILD_WITH_HIDAPI)
add_definitions(-DXRT_HAVE_HIDAPI)
# Drivers enabled with hidapi.
add_definitions(-DXRT_BUILD_HDK)
set(BUILD_DRIVER_HDK TRUE)
add_definitions(-DXRT_BUILD_PSVR)
set(BUILD_DRIVER_PSVR TRUE)
endif()
if(TRUE)
# Uses the Monado internal hid wrapper.
add_definitions(-DXRT_BUILD_PSMV)
set(BUILD_DRIVER_PSMV TRUE)
endif()
......
......@@ -11,24 +11,31 @@ set(DRIVER_OBJECTS)
set(DRIVER_LIBRARIES)
if(BUILD_DRIVER_HDK)
set(XRT_BUILD_HDK TRUE)
list(APPEND DRIVER_OBJECTS $<TARGET_OBJECTS:drv_hdk>)
list(APPEND DRIVER_LIBRARIES ${HIDAPI_LIBRARIES})
endif()
if(BUILD_DRIVER_OHMD)
set(XRT_BUILD_OHMD TRUE)
list(APPEND DRIVER_OBJECTS $<TARGET_OBJECTS:drv_ohmd>)
list(APPEND DRIVER_LIBRARIES OpenHMD::OpenHMD)
endif()
if(BUILD_DRIVER_PSMV)
set(XRT_BUILD_PSMV TRUE)
list(APPEND DRIVER_OBJECTS $<TARGET_OBJECTS:drv_psmv>)
endif()
if(BUILD_DRIVER_PSVR)
set(XRT_BUILD_PSVR TRUE)
list(APPEND DRIVER_OBJECTS $<TARGET_OBJECTS:drv_psvr>)
list(APPEND DRIVER_LIBRARIES ${HIDAPI_LIBRARIES})
endif()
configure_file(targets_enabled_drivers.h.cmake_in ${CMAKE_CURRENT_BINARY_DIR}/targets_enabled_drivers.h)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
add_subdirectory(common)
add_subdirectory(openxr)
add_subdirectory(prober)
......@@ -6,6 +6,8 @@
* @author Jakob Bornecrantz <jakob@collabora.com>
*/
#include "targets_enabled_drivers.h"
#include "target_lists.h"
#ifdef XRT_BUILD_HDK
......
// Copyright 2019, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
/*!
* @file
* @brief Generated header listing the drivers available
*/
#pragma once
#cmakedefine XRT_BUILD_OHMD
#cmakedefine XRT_BUILD_HDK
#cmakedefine XRT_BUILD_PSMV
Markdown is supported
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