mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2024-12-29 11:06:18 +00:00
build: Refactor CMake build to use static libraries instead of object bundles.
This allows transitive dependencies to work easier and improves compatibility. It takes a little bit more storage at build time, and possibly a little extra time.
This commit is contained in:
parent
91ba5d04bc
commit
92205ab5be
|
@ -1,4 +1,9 @@
|
|||
# Copyright 2019-2020, Collabora, Ltd.
|
||||
# SPDX-License-Identifier: BSL-1.0
|
||||
|
||||
# "Link" against this interface target if your module
|
||||
# uses the files in "external".
|
||||
add_library(xrt-external-headers INTERFACE)
|
||||
target_include_directories(xrt-external-headers SYSTEM INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/external)
|
||||
|
||||
add_subdirectory(xrt)
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
# Copyright 2019, Collabora, Ltd.
|
||||
# SPDX-License-Identifier: BSL-1.0
|
||||
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include)
|
||||
|
||||
add_subdirectory(include)
|
||||
add_subdirectory(auxiliary)
|
||||
add_subdirectory(drivers)
|
||||
|
|
|
@ -93,33 +93,32 @@ set(VK_SOURCE_FILES
|
|||
)
|
||||
|
||||
# Common includes
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
add_library(aux-includes INTERFACE)
|
||||
target_include_directories(aux-includes INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
target_link_libraries(aux-includes INTERFACE xrt-interfaces)
|
||||
|
||||
# OpenGL library.
|
||||
# Use OBJECT to not create a archive, since it just gets in the way.
|
||||
add_library(aux_ogl OBJECT ${OGL_SOURCE_FILES})
|
||||
target_include_directories(aux_ogl SYSTEM
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../external
|
||||
)
|
||||
add_library(aux_ogl STATIC ${OGL_SOURCE_FILES})
|
||||
target_link_libraries(aux_ogl PUBLIC aux-includes)
|
||||
# for GLAD
|
||||
target_link_libraries(aux_ogl PRIVATE xrt-external-headers)
|
||||
|
||||
# Util library.
|
||||
# Use OBJECT to not create a archive, since it just gets in the way.
|
||||
add_library(aux_util OBJECT ${UTIL_SOURCE_FILES})
|
||||
target_include_directories(aux_util SYSTEM
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../external
|
||||
)
|
||||
add_library(aux_util STATIC ${UTIL_SOURCE_FILES})
|
||||
target_link_libraries(aux_util PUBLIC aux-includes)
|
||||
# for cJSON
|
||||
target_link_libraries(aux_util PUBLIC xrt-external-headers)
|
||||
if(BUILD_WITH_JPEG)
|
||||
target_link_libraries(aux_util PRIVATE ${JPEG_LIBRARIES})
|
||||
endif()
|
||||
|
||||
# OS library.
|
||||
add_library(aux_os OBJECT ${OS_SOURCE_FILES})
|
||||
add_library(aux_os STATIC ${OS_SOURCE_FILES})
|
||||
target_link_libraries(aux_os PUBLIC aux-includes PRIVATE Threads::Threads)
|
||||
|
||||
# Math library.
|
||||
# Use OBJECT to not create a archive, since it just gets in the way.
|
||||
add_library(aux_math OBJECT ${MATH_SOURCE_FILES})
|
||||
add_library(aux_math STATIC ${MATH_SOURCE_FILES})
|
||||
target_link_libraries(aux_math PUBLIC aux-includes)
|
||||
|
||||
# Math files has extra include(s).
|
||||
target_include_directories(aux_math SYSTEM
|
||||
|
@ -127,26 +126,25 @@ target_include_directories(aux_math SYSTEM
|
|||
)
|
||||
|
||||
# Tracking library.
|
||||
# Use OBJECT to not create a archive, since it just gets in the way.
|
||||
add_library(aux_tracking OBJECT ${TRACKING_SOURCE_FILES})
|
||||
add_library(aux_tracking STATIC ${TRACKING_SOURCE_FILES})
|
||||
target_link_libraries(aux_tracking PUBLIC aux-includes PRIVATE aux_math)
|
||||
|
||||
# Tracking files have extra includes.
|
||||
target_include_directories(aux_tracking SYSTEM
|
||||
PRIVATE
|
||||
${EIGEN3_INCLUDE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../external
|
||||
)
|
||||
# for flexkalman
|
||||
target_link_libraries(aux_tracking PRIVATE xrt-external-headers)
|
||||
if(BUILD_TRACKING)
|
||||
target_include_directories(aux_tracking SYSTEM
|
||||
PRIVATE
|
||||
${OpenCV_INCLUDE_DIRS}
|
||||
)
|
||||
target_link_libraries(aux_tracking PUBLIC ${OpenCV_LIBRARIES})
|
||||
endif()
|
||||
|
||||
# Vulkan library.
|
||||
# Use OBJECT to not create a archive, since it just gets in the way.
|
||||
add_library(aux_vk OBJECT ${VK_SOURCE_FILES})
|
||||
target_include_directories(aux_vk SYSTEM
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../external
|
||||
)
|
||||
add_library(aux_vk STATIC ${VK_SOURCE_FILES})
|
||||
target_link_libraries(aux_vk PUBLIC aux-includes)
|
||||
target_link_libraries(aux_vk PUBLIC Vulkan::Vulkan)
|
||||
|
|
|
@ -32,18 +32,7 @@ set(MAIN_SOURCE_FILES
|
|||
main/comp_window.h
|
||||
)
|
||||
|
||||
include_directories(PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../auxiliary
|
||||
)
|
||||
|
||||
include_directories(SYSTEM PRIVATE
|
||||
${VULKAN_INCLUDE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../external
|
||||
)
|
||||
|
||||
if (${VULKAN_ENABLE_VALIDATION})
|
||||
if (VULKAN_ENABLE_VALIDATION)
|
||||
add_definitions(-DXRT_ENABLE_VK_VALIDATION)
|
||||
endif()
|
||||
|
||||
|
@ -74,9 +63,9 @@ if(BUILD_WITH_OPENGL AND BUILD_WITH_EGL)
|
|||
)
|
||||
endif()
|
||||
|
||||
# Use OBJECT to not create a archive, since it just gets in the way.
|
||||
add_library(comp_client OBJECT ${CLIENT_SOURCE_FILES})
|
||||
|
||||
add_library(comp_client STATIC ${CLIENT_SOURCE_FILES})
|
||||
target_link_libraries(comp_client PUBLIC xrt-interfaces PRIVATE aux_util)
|
||||
target_include_directories(comp_client PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
##
|
||||
# Main library
|
||||
|
@ -123,8 +112,9 @@ if(BUILD_COMPOSITOR_MAIN)
|
|||
)
|
||||
endif()
|
||||
|
||||
# Use OBJECT to not create a archive, since it just gets in the way.
|
||||
add_library(comp_main OBJECT ${SHADER_HEADERS} ${MAIN_SOURCE_FILES} ${WL_PROTOS_SRC})
|
||||
add_library(comp_main STATIC ${SHADER_HEADERS} ${MAIN_SOURCE_FILES} ${WL_PROTOS_SRC})
|
||||
target_link_libraries(comp_main PUBLIC xrt-interfaces PRIVATE aux_util aux_os)
|
||||
target_include_directories(comp_main PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
target_include_directories(comp_main SYSTEM PRIVATE
|
||||
# Shaders - marked SYSTEM so we get no warnings
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
|
@ -132,12 +122,19 @@ if(BUILD_COMPOSITOR_MAIN)
|
|||
|
||||
if(BUILD_WITH_WAYLAND)
|
||||
target_include_directories(comp_main SYSTEM PRIVATE ${WL_PROTOS_DIR})
|
||||
target_link_libraries(comp_main PRIVATE ${WAYLAND_LIBRARIES})
|
||||
endif()
|
||||
if(BUILD_WITH_XCB)
|
||||
target_include_directories(comp_main SYSTEM PRIVATE ${XCB_INCLUDE_DIRS})
|
||||
target_link_libraries(comp_main PRIVATE ${XCB_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(BUILD_WITH_XCB AND BUILD_WITH_XLIB)
|
||||
target_link_libraries(comp_main PRIVATE ${X11_X11_LIB})
|
||||
endif()
|
||||
if(BUILD_WITH_EGL)
|
||||
target_include_directories(comp_main SYSTEM PRIVATE ${EGL_INCLUDE_DIRS})
|
||||
target_link_libraries(comp_main PRIVATE ${XCB_LIBRARIES})
|
||||
endif()
|
||||
|
||||
add_subdirectory(shaders)
|
||||
|
|
|
@ -2,12 +2,6 @@
|
|||
# SPDX-License-Identifier: BSL-1.0
|
||||
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../auxiliary
|
||||
)
|
||||
|
||||
|
||||
set(ENABLED_HEADSET_DRIVERS)
|
||||
set(ENABLED_DRIVERS)
|
||||
|
||||
|
@ -18,8 +12,8 @@ if(BUILD_DRIVER_DUMMY)
|
|||
dummy/dummy_prober.c
|
||||
)
|
||||
|
||||
# Use OBJECT to not create a archive, since it just gets in the way.
|
||||
add_library(drv_dummy OBJECT ${DUMMY_SOURCE_FILES})
|
||||
add_library(drv_dummy STATIC ${DUMMY_SOURCE_FILES})
|
||||
target_link_libraries(drv_dummy PRIVATE xrt-interfaces aux_util)
|
||||
list(APPEND ENABLED_HEADSET_DRIVERS dummy)
|
||||
endif()
|
||||
|
||||
|
@ -31,8 +25,8 @@ if(BUILD_DRIVER_HDK)
|
|||
hdk/hdk_prober.c
|
||||
)
|
||||
|
||||
# Use OBJECT to not create a archive, since it just gets in the way.
|
||||
add_library(drv_hdk OBJECT ${HDK_SOURCE_FILES})
|
||||
add_library(drv_hdk STATIC ${HDK_SOURCE_FILES})
|
||||
target_link_libraries(drv_hdk PRIVATE xrt-interfaces aux_math)
|
||||
list(APPEND ENABLED_HEADSET_DRIVERS hdk)
|
||||
endif()
|
||||
|
||||
|
@ -43,8 +37,8 @@ if(BUILD_DRIVER_HYDRA)
|
|||
hydra/hydra_interface.h
|
||||
)
|
||||
|
||||
# Use OBJECT to not create a archive, since it just gets in the way.
|
||||
add_library(drv_hydra OBJECT ${HYDRA_SOURCE_FILES})
|
||||
add_library(drv_hydra STATIC ${HYDRA_SOURCE_FILES})
|
||||
target_link_libraries(drv_hydra PRIVATE xrt-interfaces aux_os)
|
||||
list(APPEND ENABLED_DRIVERS hydra)
|
||||
endif()
|
||||
|
||||
|
@ -59,9 +53,8 @@ if(BUILD_DRIVER_NS)
|
|||
north_star/ns_prober.c
|
||||
)
|
||||
|
||||
# Use OBJECT to not create a archive, since it just gets in the way.
|
||||
add_library(drv_ns OBJECT ${NS_SOURCE_FILES})
|
||||
target_include_directories(drv_ns SYSTEM PRIVATE ../../external)
|
||||
add_library(drv_ns STATIC ${NS_SOURCE_FILES})
|
||||
target_link_libraries(drv_ns PRIVATE xrt-interfaces aux_math xrt-external-headers)
|
||||
list(APPEND ENABLED_HEADSET_DRIVERS ns)
|
||||
endif()
|
||||
|
||||
|
@ -73,11 +66,8 @@ if(BUILD_DRIVER_OHMD)
|
|||
ohmd/oh_prober.c
|
||||
)
|
||||
|
||||
# Use OBJECT to not create a archive, since it just gets in the way.
|
||||
add_library(drv_ohmd OBJECT ${OHMD_SOURCE_FILES})
|
||||
target_include_directories(drv_ohmd SYSTEM
|
||||
PRIVATE ${OPENHMD_INCLUDE_DIRS}
|
||||
)
|
||||
add_library(drv_ohmd STATIC ${OHMD_SOURCE_FILES})
|
||||
target_link_libraries(drv_ohmd PRIVATE xrt-interfaces OpenHMD::OpenHMD aux_util aux_math)
|
||||
list(APPEND ENABLED_HEADSET_DRIVERS openhmd)
|
||||
endif()
|
||||
|
||||
|
@ -88,8 +78,8 @@ if(BUILD_DRIVER_PSMV)
|
|||
psmv/psmv_interface.h
|
||||
)
|
||||
|
||||
# Use OBJECT to not create a archive, since it just gets in the way.
|
||||
add_library(drv_psmv OBJECT ${PSMOVE_SOURCE_FILES})
|
||||
add_library(drv_psmv STATIC ${PSMOVE_SOURCE_FILES})
|
||||
target_link_libraries(drv_psmv PRIVATE xrt-interfaces PUBLIC aux_os aux_tracking)
|
||||
list(APPEND ENABLED_DRIVERS psmv)
|
||||
endif()
|
||||
|
||||
|
@ -103,11 +93,8 @@ if(BUILD_DRIVER_PSVR)
|
|||
psvr/psvr_prober.c
|
||||
)
|
||||
|
||||
# Use OBJECT to not create a archive, since it just gets in the way.
|
||||
add_library(drv_psvr OBJECT ${PSVR_SOURCE_FILES})
|
||||
target_include_directories(drv_psvr SYSTEM
|
||||
PRIVATE ${HIDAPI_INCLUDE_DIRS}
|
||||
)
|
||||
add_library(drv_psvr STATIC ${PSVR_SOURCE_FILES})
|
||||
target_link_libraries(drv_psvr PRIVATE xrt-interfaces HIDAPI::hidapi aux_util)
|
||||
list(APPEND ENABLED_HEADSET_DRIVERS psvr)
|
||||
endif()
|
||||
|
||||
|
@ -116,8 +103,8 @@ if(BUILD_DRIVER_RS)
|
|||
realsense/rs_6dof.c
|
||||
)
|
||||
|
||||
# Use OBJECT to not create a archive, since it just gets in the way.
|
||||
add_library(drv_rs OBJECT ${RS_SOURCE_FILES})
|
||||
add_library(drv_rs STATIC ${RS_SOURCE_FILES})
|
||||
target_link_libraries(drv_rs PRIVATE xrt-interfaces ${realsense2_LIBRARY} aux_util)
|
||||
target_include_directories(drv_rs SYSTEM
|
||||
PRIVATE ${realsense2_INCLUDE_DIR}
|
||||
)
|
||||
|
@ -133,10 +120,10 @@ if(BUILD_DRIVER_VIVE)
|
|||
vive/vive_protocol.h
|
||||
)
|
||||
|
||||
# Use OBJECT to not create a archive, since it just gets in the way.
|
||||
add_library(drv_vive OBJECT ${VIVE_SOURCE_FILES})
|
||||
target_include_directories(drv_vive SYSTEM PRIVATE ../../external)
|
||||
target_link_libraries(drv_vive z)
|
||||
add_library(drv_vive STATIC ${VIVE_SOURCE_FILES})
|
||||
target_link_libraries(drv_vive PRIVATE xrt-interfaces aux_os aux_util aux_math)
|
||||
target_link_libraries(drv_vive PRIVATE ${ZLIB_LIBRARIES})
|
||||
target_include_directories(drv_vive PRIVATE ${ZLIB_INCLUDE_DIRS})
|
||||
list(APPEND ENABLED_HEADSET_DRIVERS vive)
|
||||
endif()
|
||||
|
||||
|
@ -145,8 +132,8 @@ if(BUILD_DRIVER_V4L2)
|
|||
v4l2/v4l2_driver.c
|
||||
)
|
||||
|
||||
# Use OBJECT to not create a archive, since it just gets in the way.
|
||||
add_library(drv_v4l2 OBJECT ${V4L2_SOURCE_FILES})
|
||||
add_library(drv_v4l2 STATIC ${V4L2_SOURCE_FILES})
|
||||
target_link_libraries(drv_v4l2 PRIVATE xrt-interfaces aux_os)
|
||||
list(APPEND ENABLED_DRIVERS v4l2)
|
||||
endif()
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include "xrt/xrt_device.h"
|
||||
#include "xrt/xrt_prober.h"
|
||||
|
||||
#include <hidapi.h>
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
|
||||
#include <hidapi.h>
|
||||
#include <hidapi/hidapi.h>
|
||||
#include "xrt/xrt_prober.h"
|
||||
|
||||
#include "util/u_misc.h"
|
||||
|
|
|
@ -2,3 +2,6 @@
|
|||
# SPDX-License-Identifier: BSL-1.0
|
||||
|
||||
add_subdirectory(xrt)
|
||||
|
||||
add_library(xrt-interfaces INTERFACE)
|
||||
target_include_directories(xrt-interfaces INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
|
|
@ -1,14 +1,6 @@
|
|||
# Copyright 2019, Collabora, Ltd.
|
||||
# Copyright 2019-2020, Collabora, Ltd.
|
||||
# SPDX-License-Identifier: BSL-1.0
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../auxiliary
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../external
|
||||
)
|
||||
|
||||
set(GUI_INCLUDES)
|
||||
|
||||
set(GUI_SOURCE_FILES
|
||||
gui_common.h
|
||||
gui_imgui.h
|
||||
|
@ -35,10 +27,20 @@ set(GUI_SOURCE_FILES
|
|||
../../../external/imgui/imstb_truetype.h
|
||||
)
|
||||
|
||||
# Use OBJECT to not create a archive, since it just gets in the way.
|
||||
add_library(st_gui OBJECT ${GUI_SOURCE_FILES})
|
||||
add_library(st_gui STATIC ${GUI_SOURCE_FILES})
|
||||
|
||||
target_link_libraries(st_gui PRIVATE aux_util xrt-external-headers)
|
||||
target_include_directories(st_gui
|
||||
PRIVATE
|
||||
${GUI_INCLUDES}
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
)
|
||||
|
||||
if(BUILD_WITH_SDL2)
|
||||
add_library(imgui_impl_sdl STATIC
|
||||
../../../external/imgui/cimgui_sdl.cpp
|
||||
../../../external/imgui/imgui_impl_sdl.cpp
|
||||
../../../external/imgui/imgui_impl_sdl.h
|
||||
)
|
||||
target_link_libraries(imgui_impl_sdl PRIVATE ${SDL2_LIBRARIES} xrt-external-headers)
|
||||
target_include_directories(imgui_impl_sdl PRIVATE ${SDL2_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
|
|
@ -1,12 +1,6 @@
|
|||
# Copyright 2019, Collabora, Ltd.
|
||||
# Copyright 2019-2020, Collabora, Ltd.
|
||||
# SPDX-License-Identifier: BSL-1.0
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../auxiliary
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../external
|
||||
)
|
||||
|
||||
set(OXR_SOURCE_FILES
|
||||
oxr_api_action.c
|
||||
oxr_api_funcs.h
|
||||
|
@ -57,10 +51,5 @@ if(BUILD_WITH_EGL)
|
|||
list(APPEND OXR_SOURCE_FILES oxr_session_egl.c)
|
||||
endif()
|
||||
|
||||
# Use OBJECT to not create a archive, since it just gets in the way.
|
||||
add_library(st_oxr OBJECT ${OXR_SOURCE_FILES})
|
||||
|
||||
target_include_directories(st_oxr SYSTEM
|
||||
PRIVATE
|
||||
${VULKAN_INCLUDE_DIR}
|
||||
)
|
||||
add_library(st_oxr STATIC ${OXR_SOURCE_FILES})
|
||||
target_link_libraries(st_oxr PRIVATE xrt-interfaces aux_util aux_math Vulkan::Vulkan)
|
||||
|
|
|
@ -1,13 +1,6 @@
|
|||
# Copyright 2019, Collabora, Ltd.
|
||||
# Copyright 2019-2020, Collabora, Ltd.
|
||||
# SPDX-License-Identifier: BSL-1.0
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../auxiliary
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../drivers
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../external
|
||||
)
|
||||
|
||||
set(PROBER_INCLUDES)
|
||||
|
||||
set(PROBER_SOURCE_FILES
|
||||
|
@ -23,9 +16,6 @@ if(BUILD_WITH_LIBUDEV)
|
|||
list(APPEND PROBER_SOURCE_FILES
|
||||
p_udev.c
|
||||
)
|
||||
list(APPEND PROBER_INCLUDES
|
||||
${LIBUDEV_INCLUDES}
|
||||
)
|
||||
endif()
|
||||
|
||||
# Add libusb
|
||||
|
@ -33,9 +23,6 @@ if(BUILD_WITH_LIBUSB)
|
|||
list(APPEND PROBER_SOURCE_FILES
|
||||
p_libusb.c
|
||||
)
|
||||
list(APPEND PROBER_INCLUDES
|
||||
${LIBUSB_INCLUDES}
|
||||
)
|
||||
endif()
|
||||
|
||||
# Add libuvc
|
||||
|
@ -43,15 +30,32 @@ if(BUILD_WITH_LIBUVC)
|
|||
list(APPEND PROBER_SOURCE_FILES
|
||||
p_libuvc.c
|
||||
)
|
||||
list(APPEND PROBER_INCLUDES
|
||||
${LIBUVC_INCLUDES}
|
||||
)
|
||||
endif()
|
||||
|
||||
# Use OBJECT to not create a archive, since it just gets in the way.
|
||||
add_library(st_prober OBJECT ${PROBER_SOURCE_FILES})
|
||||
add_library(st_prober STATIC ${PROBER_SOURCE_FILES})
|
||||
target_link_libraries(st_prober PUBLIC xrt-interfaces PRIVATE aux_util aux_os aux_tracking)
|
||||
target_include_directories(st_prober PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../drivers)
|
||||
|
||||
target_include_directories(st_prober
|
||||
PRIVATE
|
||||
${PROBER_INCLUDES}
|
||||
)
|
||||
if(BUILD_WITH_LIBUDEV)
|
||||
target_include_directories(st_prober
|
||||
PRIVATE
|
||||
${UDEV_INCLUDE_DIRS}
|
||||
)
|
||||
target_link_libraries(st_prober PRIVATE ${UDEV_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(BUILD_WITH_LIBUSB)
|
||||
target_include_directories(st_prober
|
||||
PRIVATE
|
||||
${LIBUSB1_INCLUDE_DIRS}
|
||||
)
|
||||
target_link_libraries(st_prober PRIVATE ${LIBUSB1_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(BUILD_WITH_LIBUVC)
|
||||
target_include_directories(st_prober
|
||||
PRIVATE
|
||||
${LIBUVC_INCLUDES}
|
||||
)
|
||||
target_link_libraries(st_prober PRIVATE ${LIBUVC_LIBRARIES})
|
||||
endif()
|
||||
|
|
|
@ -6,81 +6,12 @@
|
|||
# the source tree and build a complete driver or integration part.
|
||||
|
||||
|
||||
# Set up these two lists for use across multiple targets.
|
||||
|
||||
list(APPEND DRIVER_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
|
||||
|
||||
if(BUILD_WITH_LIBUSB)
|
||||
list(APPEND DRIVER_LIBRARIES ${LIBUSB1_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(BUILD_WITH_LIBUVC)
|
||||
list(APPEND DRIVER_LIBRARIES ${LIBUVC_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(BUILD_WITH_LIBUDEV)
|
||||
list(APPEND DRIVER_LIBRARIES ${UDEV_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(BUILD_WITH_JPEG)
|
||||
list(APPEND DRIVER_LIBRARIES ${JPEG_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(BUILD_DRIVER_DUMMY)
|
||||
list(APPEND DRIVER_OBJECTS $<TARGET_OBJECTS:drv_dummy>)
|
||||
endif()
|
||||
|
||||
if(BUILD_DRIVER_HDK)
|
||||
list(APPEND DRIVER_OBJECTS $<TARGET_OBJECTS:drv_hdk>)
|
||||
list(APPEND DRIVER_LIBRARIES ${HIDAPI_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(BUILD_DRIVER_HYDRA)
|
||||
list(APPEND DRIVER_OBJECTS $<TARGET_OBJECTS:drv_hydra>)
|
||||
endif()
|
||||
|
||||
if(BUILD_DRIVER_NS)
|
||||
list(APPEND DRIVER_OBJECTS $<TARGET_OBJECTS:drv_ns>)
|
||||
endif()
|
||||
|
||||
if(BUILD_DRIVER_OHMD)
|
||||
list(APPEND DRIVER_OBJECTS $<TARGET_OBJECTS:drv_ohmd>)
|
||||
list(APPEND DRIVER_LIBRARIES OpenHMD::OpenHMD)
|
||||
endif()
|
||||
|
||||
if(BUILD_DRIVER_PSMV)
|
||||
list(APPEND DRIVER_OBJECTS $<TARGET_OBJECTS:drv_psmv>)
|
||||
endif()
|
||||
|
||||
if(BUILD_DRIVER_PSVR)
|
||||
list(APPEND DRIVER_OBJECTS $<TARGET_OBJECTS:drv_psvr>)
|
||||
list(APPEND DRIVER_LIBRARIES ${HIDAPI_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(BUILD_DRIVER_RS)
|
||||
list(APPEND DRIVER_OBJECTS $<TARGET_OBJECTS:drv_rs>)
|
||||
list(APPEND DRIVER_LIBRARIES ${realsense2_LIBRARY})
|
||||
endif()
|
||||
|
||||
if(BUILD_DRIVER_V4L2)
|
||||
list(APPEND DRIVER_OBJECTS $<TARGET_OBJECTS:drv_v4l2>)
|
||||
endif()
|
||||
|
||||
if(BUILD_DRIVER_VIVE)
|
||||
list(APPEND DRIVER_OBJECTS $<TARGET_OBJECTS:drv_vive>)
|
||||
list(APPEND DRIVER_LIBRARIES ${ZLIB_LIBRARIES})
|
||||
endif()
|
||||
|
||||
list(APPEND DRIVER_OBJECTS $<TARGET_OBJECTS:aux_tracking>)
|
||||
|
||||
if(BUILD_TRACKING)
|
||||
list(APPEND DRIVER_LIBRARIES ${OpenCV_LIBRARIES})
|
||||
endif()
|
||||
|
||||
add_subdirectory(common)
|
||||
|
||||
if(BUILD_TARGET_OPENXR)
|
||||
add_subdirectory(openxr)
|
||||
endif()
|
||||
|
||||
add_subdirectory(cli)
|
||||
|
||||
if(BUILD_TARGET_GUI)
|
||||
|
|
|
@ -1,15 +1,9 @@
|
|||
# Copyright 2019, Collabora, Ltd.
|
||||
# Copyright 2019-2020, Collabora, Ltd.
|
||||
# SPDX-License-Identifier: BSL-1.0
|
||||
|
||||
######
|
||||
# Create a cli interface for Monado.
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../targets/common
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../auxiliary
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../drivers
|
||||
)
|
||||
|
||||
set(SOURCE_FILES
|
||||
cli_cmd_calibrate.c
|
||||
|
@ -22,11 +16,6 @@ set(SOURCE_FILES
|
|||
|
||||
add_executable(cli
|
||||
${SOURCE_FILES}
|
||||
$<TARGET_OBJECTS:aux_os>
|
||||
$<TARGET_OBJECTS:aux_util>
|
||||
$<TARGET_OBJECTS:aux_math>
|
||||
$<TARGET_OBJECTS:st_prober>
|
||||
$<TARGET_OBJECTS:target_lists>
|
||||
)
|
||||
|
||||
set_target_properties(cli PROPERTIES
|
||||
|
@ -35,13 +24,10 @@ set_target_properties(cli PROPERTIES
|
|||
)
|
||||
|
||||
target_link_libraries(cli PRIVATE
|
||||
Threads::Threads
|
||||
aux_os
|
||||
aux_util
|
||||
aux_math
|
||||
st_prober
|
||||
target_lists
|
||||
)
|
||||
|
||||
if(DRIVER_OBJECTS)
|
||||
target_sources(cli PRIVATE ${DRIVER_OBJECTS})
|
||||
endif()
|
||||
|
||||
if(DRIVER_LIBRARIES)
|
||||
target_link_libraries(cli PRIVATE ${DRIVER_LIBRARIES})
|
||||
endif()
|
||||
|
|
|
@ -1,14 +1,51 @@
|
|||
# Copyright 2019, Collabora, Ltd.
|
||||
# Copyright 2019-2020, Collabora, Ltd.
|
||||
# SPDX-License-Identifier: BSL-1.0
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../auxiliary
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../drivers
|
||||
)
|
||||
|
||||
set(SOURCE_FILES
|
||||
target_lists.c
|
||||
)
|
||||
|
||||
add_library(target_lists OBJECT ${SOURCE_FILES})
|
||||
add_library(target_lists STATIC ${SOURCE_FILES})
|
||||
target_link_libraries(target_lists PRIVATE xrt-interfaces)
|
||||
target_include_directories(target_lists PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../drivers)
|
||||
target_include_directories(target_lists PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
if(BUILD_DRIVER_DUMMY)
|
||||
target_link_libraries(target_lists PRIVATE drv_dummy)
|
||||
endif()
|
||||
|
||||
if(BUILD_DRIVER_HDK)
|
||||
target_link_libraries(target_lists PRIVATE drv_hdk)
|
||||
endif()
|
||||
|
||||
if(BUILD_DRIVER_HYDRA)
|
||||
target_link_libraries(target_lists PRIVATE drv_hydra)
|
||||
endif()
|
||||
|
||||
if(BUILD_DRIVER_NS)
|
||||
target_link_libraries(target_lists PRIVATE drv_ns)
|
||||
endif()
|
||||
|
||||
if(BUILD_DRIVER_OHMD)
|
||||
target_link_libraries(target_lists PRIVATE drv_ohmd)
|
||||
endif()
|
||||
|
||||
if(BUILD_DRIVER_PSMV)
|
||||
target_link_libraries(target_lists PRIVATE drv_psmv)
|
||||
endif()
|
||||
|
||||
if(BUILD_DRIVER_PSVR)
|
||||
target_link_libraries(target_lists PRIVATE drv_psvr)
|
||||
endif()
|
||||
|
||||
if(BUILD_DRIVER_RS)
|
||||
target_link_libraries(target_lists PRIVATE drv_rs)
|
||||
endif()
|
||||
|
||||
if(BUILD_DRIVER_V4L2)
|
||||
target_link_libraries(target_lists PRIVATE drv_v4l2)
|
||||
endif()
|
||||
|
||||
if(BUILD_DRIVER_VIVE)
|
||||
target_link_libraries(target_lists PRIVATE drv_vive)
|
||||
endif()
|
||||
|
|
|
@ -1,38 +1,18 @@
|
|||
# Copyright 2019, Collabora, Ltd.
|
||||
# Copyright 2019-2020, Collabora, Ltd.
|
||||
# SPDX-License-Identifier: BSL-1.0
|
||||
|
||||
######
|
||||
# Create a small SDL2 based GUI for Monado.
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../targets/common
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../auxiliary
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../drivers
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../state_trackers
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../external
|
||||
${SDL2_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
set(SOURCE_FILES
|
||||
gui_sdl2.c
|
||||
gui_sdl2_imgui.c
|
||||
gui_sdl2_main.c
|
||||
gui_sdl2_prober.c
|
||||
../../../external/imgui/cimgui_sdl.cpp
|
||||
../../../external/imgui/imgui_impl_sdl.cpp
|
||||
../../../external/imgui/imgui_impl_sdl.h
|
||||
)
|
||||
|
||||
add_executable(gui
|
||||
${SOURCE_FILES}
|
||||
$<TARGET_OBJECTS:aux_os>
|
||||
$<TARGET_OBJECTS:aux_ogl>
|
||||
$<TARGET_OBJECTS:aux_util>
|
||||
$<TARGET_OBJECTS:aux_math>
|
||||
$<TARGET_OBJECTS:st_gui>
|
||||
$<TARGET_OBJECTS:st_prober>
|
||||
$<TARGET_OBJECTS:target_lists>
|
||||
)
|
||||
|
||||
set_target_properties(gui PROPERTIES
|
||||
|
@ -41,20 +21,13 @@ set_target_properties(gui PROPERTIES
|
|||
)
|
||||
|
||||
target_link_libraries(gui PRIVATE
|
||||
${LIBUSB_LIBRARIES}
|
||||
${LIBUVC_LIBRARIES}
|
||||
${UDEV_LIBRARIES}
|
||||
${SDL2_LIBRARIES}
|
||||
aux_os
|
||||
aux_ogl
|
||||
aux_util
|
||||
aux_math
|
||||
st_gui
|
||||
st_prober
|
||||
target_lists
|
||||
imgui_impl_sdl
|
||||
)
|
||||
|
||||
if(DRIVER_OBJECTS)
|
||||
target_sources(gui PRIVATE ${DRIVER_OBJECTS})
|
||||
endif()
|
||||
|
||||
if(BUILD_WITH_JPEG)
|
||||
target_link_libraries(gui PRIVATE ${JPEG_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(DRIVER_LIBRARIES)
|
||||
target_link_libraries(gui PRIVATE ${DRIVER_LIBRARIES})
|
||||
endif()
|
||||
target_include_directories(gui PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/..)
|
||||
|
|
|
@ -4,9 +4,6 @@
|
|||
######
|
||||
# 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})
|
||||
|
||||
|
@ -15,15 +12,6 @@ set(RUNTIME_TARGET ${RUNTIME_PREFIX}openxr${RUNTIME_SUFFIX} CACHE INTERNAL "" FO
|
|||
# OpenXR 1.0
|
||||
set(XR_API_MAJOR "1")
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../external
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../targets/common
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../auxiliary
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../drivers
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../state_trackers
|
||||
)
|
||||
|
||||
set(SOURCE_FILES
|
||||
target.c
|
||||
oxr_sdl2_hack.c
|
||||
|
@ -34,67 +22,27 @@ add_library(${RUNTIME_TARGET} SHARED
|
|||
${MANIFEST_DEV_PATH}
|
||||
${MANIFEST_PATH}
|
||||
${SOURCE_FILES}
|
||||
$<TARGET_OBJECTS:aux_vk>
|
||||
$<TARGET_OBJECTS:aux_os>
|
||||
$<TARGET_OBJECTS:aux_ogl>
|
||||
$<TARGET_OBJECTS:aux_util>
|
||||
$<TARGET_OBJECTS:aux_math>
|
||||
$<TARGET_OBJECTS:comp_main>
|
||||
$<TARGET_OBJECTS:comp_client>
|
||||
$<TARGET_OBJECTS:st_oxr>
|
||||
$<TARGET_OBJECTS:st_gui>
|
||||
$<TARGET_OBJECTS:st_prober>
|
||||
$<TARGET_OBJECTS:target_lists>
|
||||
)
|
||||
|
||||
target_link_libraries(${RUNTIME_TARGET} PUBLIC
|
||||
${Vulkan_LIBRARIES}
|
||||
OpenGL::GLX
|
||||
aux_vk
|
||||
aux_os
|
||||
aux_ogl
|
||||
aux_util
|
||||
aux_math
|
||||
comp_main
|
||||
comp_client
|
||||
st_oxr
|
||||
st_gui
|
||||
st_prober
|
||||
target_lists
|
||||
)
|
||||
|
||||
if(BUILD_WITH_XCB)
|
||||
target_link_libraries(${RUNTIME_TARGET} PUBLIC
|
||||
${XCB_LIBRARIES}
|
||||
)
|
||||
endif()
|
||||
|
||||
if(BUILD_WITH_WAYLAND)
|
||||
target_link_libraries(${RUNTIME_TARGET} PUBLIC
|
||||
${WAYLAND_LIBRARIES}
|
||||
)
|
||||
endif()
|
||||
|
||||
if(DRIVER_OBJECTS)
|
||||
target_sources(${RUNTIME_TARGET} PRIVATE
|
||||
${DRIVER_OBJECTS}
|
||||
)
|
||||
endif()
|
||||
|
||||
if(DRIVER_LIBRARIES)
|
||||
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}
|
||||
)
|
||||
|
||||
target_sources(${RUNTIME_TARGET} PRIVATE
|
||||
../../../external/imgui/cimgui_sdl.cpp
|
||||
../../../external/imgui/imgui_impl_sdl.cpp
|
||||
../../../external/imgui/imgui_impl_sdl.h
|
||||
)
|
||||
endif()
|
||||
if(BUILD_WITH_XCB AND BUILD_WITH_XLIB)
|
||||
target_link_libraries(${RUNTIME_TARGET} PUBLIC
|
||||
${X11_X11_LIB}
|
||||
)
|
||||
target_link_libraries(${RUNTIME_TARGET} PUBLIC imgui_impl_sdl)
|
||||
endif()
|
||||
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
# Install the runtime itself
|
||||
|
|
Loading…
Reference in a new issue