2019-03-18 05:52:32 +00:00
|
|
|
# Copyright 2019, Collabora, Ltd.
|
|
|
|
# SPDX-License-Identifier: BSL-1.0
|
|
|
|
|
|
|
|
######
|
|
|
|
# Create a loadable OpenXR driver.
|
|
|
|
|
|
|
|
# set(RUNTIME_BARE_PREFIX xrt)
|
|
|
|
# set(RUNTIME_PREFIX ${RUNTIME_BARE_PREFIX}_)
|
|
|
|
|
|
|
|
set(RUNTIME_BARE_SUFFIX monado)
|
|
|
|
set(RUNTIME_SUFFIX _${RUNTIME_BARE_SUFFIX})
|
|
|
|
|
|
|
|
set(RUNTIME_TARGET ${RUNTIME_PREFIX}openxr${RUNTIME_SUFFIX} CACHE INTERNAL "" FORCE)
|
|
|
|
|
2019-08-16 14:53:39 +00:00
|
|
|
# OpenXR 1.0
|
|
|
|
set(XR_API_MAJOR "1")
|
2019-03-18 05:52:32 +00:00
|
|
|
|
|
|
|
include_directories(
|
2019-10-10 14:36:05 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/../../../external
|
2019-04-30 13:41:50 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/../../targets/common
|
2019-04-15 08:51:40 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/../../auxiliary
|
2019-03-18 05:52:32 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/../../include
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/../../drivers
|
2019-10-10 14:36:05 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/../../state_trackers
|
2019-03-18 05:52:32 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
set(SOURCE_FILES
|
|
|
|
target.c
|
2019-10-10 14:36:05 +00:00
|
|
|
oxr_sdl2_hack.c
|
2019-03-18 05:52:32 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
# depends on above generated files
|
|
|
|
add_library(${RUNTIME_TARGET} SHARED
|
|
|
|
${MANIFEST_DEV_PATH}
|
|
|
|
${MANIFEST_PATH}
|
|
|
|
${SOURCE_FILES}
|
2019-05-03 14:47:45 +00:00
|
|
|
$<TARGET_OBJECTS:aux_os>
|
2019-10-09 15:39:38 +00:00
|
|
|
$<TARGET_OBJECTS:aux_ogl>
|
2019-03-18 05:52:32 +00:00
|
|
|
$<TARGET_OBJECTS:aux_util>
|
|
|
|
$<TARGET_OBJECTS:aux_math>
|
|
|
|
$<TARGET_OBJECTS:comp>
|
|
|
|
$<TARGET_OBJECTS:st_oxr>
|
2019-10-10 14:36:05 +00:00
|
|
|
$<TARGET_OBJECTS:st_gui>
|
2019-04-30 13:41:50 +00:00
|
|
|
$<TARGET_OBJECTS:st_prober>
|
|
|
|
$<TARGET_OBJECTS:target_lists>
|
2019-03-18 05:52:32 +00:00
|
|
|
)
|
|
|
|
|
2019-10-10 14:36:05 +00:00
|
|
|
target_link_libraries(${RUNTIME_TARGET} PUBLIC
|
2019-04-30 13:41:50 +00:00
|
|
|
${LIBUVC_LIBRARIES}
|
|
|
|
${LIBUSB_LIBRARIES}
|
2019-03-18 05:52:32 +00:00
|
|
|
${Vulkan_LIBRARIES}
|
2019-04-30 13:41:50 +00:00
|
|
|
${UDEV_LIBRARIES}
|
2019-03-18 05:52:32 +00:00
|
|
|
${XCB_LIBRARIES}
|
2019-09-20 10:13:43 +00:00
|
|
|
${WAYLAND_LIBRARIES}
|
2019-03-23 03:09:53 +00:00
|
|
|
OpenGL::GLX
|
2019-03-18 05:52:32 +00:00
|
|
|
)
|
|
|
|
|
2019-06-18 18:26:23 +00:00
|
|
|
if(DRIVER_OBJECTS)
|
2019-10-10 14:36:05 +00:00
|
|
|
target_sources(${RUNTIME_TARGET} PRIVATE
|
|
|
|
${DRIVER_OBJECTS}
|
|
|
|
)
|
2019-04-20 01:24:09 +00:00
|
|
|
endif()
|
2019-03-18 05:52:32 +00:00
|
|
|
|
2019-06-18 18:26:23 +00:00
|
|
|
if(DRIVER_LIBRARIES)
|
2019-10-10 14:36:05 +00:00
|
|
|
target_link_libraries(${RUNTIME_TARGET} PRIVATE
|
|
|
|
${DRIVER_LIBRARIES}
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(BUILD_WITH_SDL2)
|
|
|
|
include_directories(${SDL2_INCLUDE_DIRS})
|
|
|
|
|
|
|
|
target_link_libraries(${RUNTIME_TARGET} PUBLIC
|
|
|
|
${SDL2_LIBRARIES}
|
|
|
|
X11 # HACK HACK HACK HACK
|
|
|
|
)
|
|
|
|
|
|
|
|
target_sources(${RUNTIME_TARGET} PRIVATE
|
2019-10-22 20:37:03 +00:00
|
|
|
../../../external/imgui/cimgui_sdl.cpp
|
2019-10-10 14:36:05 +00:00
|
|
|
../../../external/imgui/imgui_impl_sdl.cpp
|
|
|
|
../../../external/imgui/imgui_impl_sdl.h
|
|
|
|
)
|
2019-03-18 05:52:32 +00:00
|
|
|
endif()
|
|
|
|
|
2019-06-18 19:59:06 +00:00
|
|
|
include(GNUInstallDirs)
|
|
|
|
|
|
|
|
# Install the runtime itself
|
|
|
|
install(TARGETS ${RUNTIME_TARGET}
|
|
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
2019-10-10 14:36:05 +00:00
|
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
|
|
)
|
2019-06-18 20:05:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
# $LIBPATH is a generator expression that is evaluated after configure_file, so we have to use file(GENERATE) instead
|
|
|
|
|
|
|
|
###
|
|
|
|
# Generate runtime manifest with absolute path to runtime intended for development without installing
|
2019-06-18 20:05:20 +00:00
|
|
|
set(MANIFEST_INPUT ${CMAKE_CURRENT_SOURCE_DIR}/openxr_monado.in.json)
|
2019-06-18 20:05:58 +00:00
|
|
|
set(RUNTIME_PATH $<TARGET_SONAME_FILE:${RUNTIME_TARGET}>)
|
|
|
|
|
|
|
|
# Need this step because file(GENERATE) only evaluates generator expressions, and not what configure_file does.
|
|
|
|
configure_file(${MANIFEST_INPUT} ${CMAKE_CURRENT_BINARY_DIR}/intermediate_manifest.json)
|
|
|
|
file(GENERATE
|
|
|
|
OUTPUT "${CMAKE_BINARY_DIR}/${RUNTIME_TARGET}-dev.json"
|
|
|
|
INPUT ${CMAKE_CURRENT_BINARY_DIR}/intermediate_manifest.json)
|
|
|
|
|
2019-06-18 20:05:20 +00:00
|
|
|
###
|
|
|
|
# Prepare the installable manifest: will be generated completely at install time,
|
|
|
|
# by a script we generate now.
|
|
|
|
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
|
|
|
set(MANIFEST_RELATIVE_DIR share/openxr/${XR_API_MAJOR}/)
|
2019-06-14 20:57:34 +00:00
|
|
|
if(INSTALL_ACTIVE_RUNTIME)
|
|
|
|
configure_file(active_runtime.cmake ${CMAKE_CURRENT_BINARY_DIR}/active_runtime.cmake @ONLY)
|
|
|
|
install(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/active_runtime.cmake)
|
|
|
|
endif()
|
2019-06-18 20:05:20 +00:00
|
|
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
|
|
|
# TODO: install target on windows just needs to know where to install manifest
|
|
|
|
set(MANIFEST_RELATIVE_DIR)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# If we know where to install the manifest, we can set it up to be installed.
|
|
|
|
if(MANIFEST_RELATIVE_DIR)
|
2019-06-18 20:09:45 +00:00
|
|
|
set(RUNTIME_RELATIVE_DIR ${CMAKE_INSTALL_LIBDIR})
|
|
|
|
set(RUNTIME_FILENAME ${CMAKE_SHARED_MODULE_PREFIX}${RUNTIME_TARGET}${CMAKE_SHARED_MODULE_SUFFIX})
|
2019-06-18 20:05:20 +00:00
|
|
|
configure_file(make_manifest.cmake ${CMAKE_CURRENT_BINARY_DIR}/make_manifest.cmake @ONLY)
|
|
|
|
install(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/make_manifest.cmake)
|
|
|
|
endif()
|