The open source OpenXR runtime

cmake: Substantial cleanups and simplifications

We now have a cmake-format config file.
We no longer use list variables for sources, instead using
target_sources when we need to add, in accordance with current
best practice. (This makes it a lot easier to edit too.) There's no more
include_directories(), add_definitions(), or other gently-deprecated
directory-scoped commands, nor any CMake scripts that include
a parent directory reference (named targets instead)

+1013 -1077
+23
.cmake-format.py
··· 1 + # SPDX-FileCopyrightText: 2021, Collabora, Ltd. 2 + # SPDX-License-Identifier: CC0-1.0 3 + 4 + with section("format"): 5 + line_width = 100 6 + tab_size = 8 7 + use_tabchars = True 8 + fractional_tab_policy = "use-space" 9 + 10 + max_prefix_chars = 4 11 + 12 + dangle_parens = True 13 + dangle_align = "prefix-indent" 14 + max_pargs_hwrap = 4 15 + max_rows_cmdline = 1 16 + 17 + keyword_case = 'upper' 18 + 19 + 20 + # Do not reflow comments 21 + 22 + with section("markup"): 23 + enable_markup = False
+53 -35
CMakeLists.txt
··· 9 9 cmake_policy(SET CMP0072 NEW) 10 10 endif() 11 11 12 - option(XRT_OPENXR_INSTALL_ABSOLUTE_RUNTIME_PATH "Use the absolute path to the runtime in the installed manifest, rather than a bare filename." ON) 12 + option( 13 + XRT_OPENXR_INSTALL_ABSOLUTE_RUNTIME_PATH 14 + "Use the absolute path to the runtime in the installed manifest, rather than a bare filename." 15 + ON 16 + ) 13 17 option(XRT_OPENXR_INSTALL_ACTIVE_RUNTIME "Make Monado the default OpenXR runtime on install" ON) 14 18 15 19 # We use C++17 ··· 45 49 find_program(PYTHON_EXECUTABLE python3) 46 50 if(PYTHON_EXECUTABLE MATCHES "WindowsApps") 47 51 # If you hit this error, you will have to install Python 3 or try harder to tell CMake where it is. 48 - message(FATAL_ERROR "Found WindowsApps alias for Python. Make sure Python3 is installed, then choose 'Manage App Execution Aliases' in Start and disable the aliases for Python.") 52 + message( 53 + FATAL_ERROR 54 + "Found WindowsApps alias for Python. Make sure Python3 is installed, then choose 'Manage App Execution Aliases' in Start and disable the aliases for Python." 55 + ) 49 56 endif() 50 57 endif() 51 58 ··· 56 63 find_package(EGL MODULE) 57 64 find_package(HIDAPI MODULE) 58 65 find_package(OpenHMD MODULE) 59 - find_package(OpenCV COMPONENTS core calib3d highgui imgproc imgcodecs features2d video CONFIG) 66 + find_package( 67 + OpenCV 68 + COMPONENTS 69 + core 70 + calib3d 71 + highgui 72 + imgproc 73 + imgcodecs 74 + features2d 75 + video 76 + CONFIG 77 + ) 60 78 find_package(Libusb1 MODULE) 61 79 find_package(JPEG MODULE) 62 80 find_package(realsense2 CONFIG) ··· 94 112 pkg_check_modules(FFMPEG libavcodec) 95 113 endif() 96 114 97 - 98 115 find_package(OpenGL) 99 116 set(OPENGL_WITHOUT_GLX_FOUND ${OPENGL_FOUND}) 100 117 if(CMAKE_SYSTEM_NAME STREQUAL "Linux") ··· 112 129 pkg_search_module(WAYLAND wayland-client) 113 130 pkg_search_module(WAYLAND_SCANNER wayland-scanner) 114 131 pkg_search_module(WAYLAND_PROTOCOLS wayland-protocols) 115 - pkg_search_module(LIBDRM libdrm) 132 + pkg_search_module(LIBDRM IMPORTED_TARGET libdrm) 116 133 endif() 117 134 find_package(OpenGL COMPONENTS GLX) 118 135 pkg_search_module(DBUS dbus-1) 119 136 pkg_search_module(LIBBSD libbsd) 120 137 121 - pkg_check_modules(GST 122 - gstreamer-1.0 123 - gstreamer-app-1.0 124 - gstreamer-video-1.0 125 - ) 138 + pkg_check_modules(GST gstreamer-1.0 gstreamer-app-1.0 gstreamer-video-1.0) 126 139 127 140 pkg_check_modules(SURVIVE IMPORTED_TARGET survive) 128 - else() 129 141 endif() 130 142 131 143 find_library(RT_LIBRARY rt) 144 + 132 145 if(ANDROID) 133 146 find_library(ANDROID_LIBRARY android) 134 147 find_library(ANDROID_LOG_LIBRARY log) ··· 149 162 endif() 150 163 endforeach() 151 164 165 + # ILLIXR 166 + set(ILLIXR_PATH 167 + "" 168 + CACHE PATH "Path to ILLIXR headers" 169 + ) 170 + 152 171 # This one is named differently because that's what CTest uses 153 172 option(BUILD_TESTING "Enable building of the test suite?" ON) 173 + 174 + # cmake-format: off 154 175 155 176 option(XRT_FEATURE_COLOR_LOG "Enable logging in color on supported platforms" ON) 156 177 cmake_dependent_option(XRT_HAVE_PERCETTO "Enable percetto support" ON "PERCETTO_FOUND" OFF) ··· 198 219 # Most users won't touch these. 199 220 mark_as_advanced(XRT_FEATURE_COMPOSITOR_MAIN XRT_FEATURE_OPENXR) 200 221 201 - # ILLIXR 202 - set(ILLIXR_PATH "" CACHE PATH "Path to ILLIXR headers") 203 222 204 223 if(CMAKE_SYSTEM_NAME STREQUAL "Linux") 205 224 set(XRT_HAVE_LIBUDEV ON) ··· 207 226 else() 208 227 cmake_dependent_option(XRT_HAVE_LIBUDEV "Enable libudev (used for device probing on Linux)" ON "UDEV_FOUND" OFF) 209 228 endif() 229 + 210 230 cmake_dependent_option(XRT_HAVE_LIBUSB "Enable libusb (used for most drivers)" ON "LIBUSB1_FOUND" OFF) 211 231 cmake_dependent_option(XRT_HAVE_JPEG "Enable jpeg code (used for some video drivers)" ON "JPEG_FOUND" OFF) 212 232 cmake_dependent_option(XRT_HAVE_OPENCV "Enable OpenCV backend" ON "OpenCV_FOUND" OFF) ··· 248 268 cmake_dependent_option(XRT_BUILD_DRIVER_QWERTY "Enable Qwerty driver" ON "XRT_HAVE_SDL2" OFF) 249 269 cmake_dependent_option(XRT_BUILD_DRIVER_EUROC "Enable EuRoC dataset driver for SLAM evaluation" ON "XRT_HAVE_OPENCV" OFF) 250 270 271 + # cmake-format: on 272 + 251 273 # You can set this from a superproject to add a driver 252 274 # All drivers must be listed in here to be included in the generated header! 253 - list(APPEND AVAILABLE_DRIVERS 275 + list( 276 + APPEND 277 + AVAILABLE_DRIVERS 254 278 "ANDROID" 255 279 "ARDUINO" 256 280 "DAYDREAM" ··· 275 299 "WMR" 276 300 "EUROC" 277 301 ) 278 - 279 302 280 303 # Package name needs to be known by the native code itself. 281 304 # Can be overridden from outside/command line ··· 313 336 if(XRT_HAVE_XCB) 314 337 set(VK_USE_PLATFORM_XCB_KHR TRUE) 315 338 endif() 316 - if(XRT_HAVE_XCB AND XRT_HAVE_XLIB AND XRT_HAVE_XRANDR) 339 + if(XRT_HAVE_XCB 340 + AND XRT_HAVE_XLIB 341 + AND XRT_HAVE_XRANDR 342 + ) 317 343 set(VK_USE_PLATFORM_XLIB_XRANDR_EXT TRUE) 318 344 endif() 319 345 if(XRT_HAVE_WAYLAND) ··· 325 351 if(WIN32) 326 352 set(VK_USE_PLATFORM_WIN32_KHR TRUE) 327 353 endif() 328 - if (XRT_HAVE_VULKAN AND NOT ANDROID) 354 + if(XRT_HAVE_VULKAN AND NOT ANDROID) 329 355 set(VK_USE_PLATFORM_DISPLAY_KHR TRUE) 330 356 endif() 331 357 332 - if(NOT MSVC) 333 - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wall -Wextra -Wno-unused-parameter") 334 - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror-implicit-function-declaration -Werror=incompatible-pointer-types") 335 - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=int-conversion") 336 - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Wno-unused-parameter") 337 - 338 - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined") 339 - set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--no-undefined") 340 - endif() 358 + include(CompilerFlags.cmake) 341 359 342 360 # Default to PIC code 343 361 set(CMAKE_POSITION_INDEPENDENT_CODE ON) ··· 348 366 endif() 349 367 350 368 # Make sure we have pretty colours 351 - option (FORCE_COLORED_OUTPUT "Always produce ANSI-colored output (GNU/Clang only)." FALSE) 369 + option(FORCE_COLORED_OUTPUT "Always produce ANSI-colored output (GNU/Clang only)." FALSE) 352 370 353 - if ("${FORCE_COLORED_OUTPUT}") 354 - if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") 355 - add_compile_options (-fdiagnostics-color=always) 356 - elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") 357 - add_compile_options (-fcolor-diagnostics) 358 - endif () 359 - endif () 371 + if(FORCE_COLORED_OUTPUT) 372 + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") 373 + add_compile_options(-fdiagnostics-color=always) 374 + elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") 375 + add_compile_options(-fcolor-diagnostics) 376 + endif() 377 + endif() 360 378 361 379 ### 362 - # Decend into madness. 380 + # Descend into the source 363 381 ### 364 382 365 383 add_subdirectory(src)
+14
CompilerFlags.cmake
··· 1 + # Copyright 2018-2021, Collabora, Ltd. 2 + # SPDX-License-Identifier: BSL-1.0 3 + 4 + if(NOT MSVC) 5 + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wall -Wextra -Wno-unused-parameter") 6 + set(CMAKE_C_FLAGS 7 + "${CMAKE_C_FLAGS} -Werror-implicit-function-declaration -Werror=incompatible-pointer-types" 8 + ) 9 + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=int-conversion") 10 + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Wno-unused-parameter") 11 + 12 + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined") 13 + set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--no-undefined") 14 + endif()
+15 -7
doc/CMakeLists.txt
··· 3 3 4 4 # check if Doxygen is installed 5 5 find_package(Doxygen) 6 + 7 + # cmake-format: off 8 + 6 9 cmake_dependent_option(BUILD_DOC "Build documentation" ON "DOXYGEN_FOUND" OFF) 7 10 cmake_dependent_option(BUILD_DOC_WARN_UNDOCUMENTED "Warn on undocumented entities when building documentation" OFF "DOXYGEN_FOUND" OFF) 8 11 cmake_dependent_option(BUILD_DOC_EXTRACT_ALL "Extract all entities for documentation, not just documented ones (conflicts with BUILD_DOC_WARN_UNDOCUMENTED)" ON "DOXYGEN_FOUND AND NOT BUILD_DOC_WARN_UNDOCUMENTED" OFF) 12 + 13 + # cmake-format: on 9 14 10 15 if(BUILD_DOC) 11 16 if(BUILD_DOC_WARN_UNDOCUMENTED) ··· 30 35 configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY) 31 36 32 37 # copy the schema 33 - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/example_configs/config_v0.schema.json 34 - ${CMAKE_CURRENT_BINARY_DIR}/html/config_v0.schema.json 35 - @ONLY) 36 - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/example_configs/config_v0.schema.json.license 37 - ${CMAKE_CURRENT_BINARY_DIR}/html/config_v0.schema.json.license 38 - @ONLY) 38 + configure_file( 39 + ${CMAKE_CURRENT_SOURCE_DIR}/example_configs/config_v0.schema.json 40 + ${CMAKE_CURRENT_BINARY_DIR}/html/config_v0.schema.json @ONLY 41 + ) 42 + configure_file( 43 + ${CMAKE_CURRENT_SOURCE_DIR}/example_configs/config_v0.schema.json.license 44 + ${CMAKE_CURRENT_BINARY_DIR}/html/config_v0.schema.json.license @ONLY 45 + ) 39 46 40 47 # note the option ALL which allows to build the docs together with the application 41 - add_custom_target(doc_doxygen ALL 48 + add_custom_target( 49 + doc_doxygen ALL 42 50 COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT} 43 51 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} 44 52 COMMENT "Generating API documentation with Doxygen"
+42 -22
src/external/CMakeLists.txt
··· 5 5 add_library(xrt-external-catch2 INTERFACE) 6 6 target_include_directories(xrt-external-catch2 INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/Catch2) 7 7 add_library(xrt-external-openvr INTERFACE) 8 - target_include_directories(xrt-external-openvr INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/openvr_includes) 9 - 8 + target_include_directories( 9 + xrt-external-openvr INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/openvr_includes 10 + ) 10 11 11 12 # cJSON 12 13 add_library(xrt-external-cjson INTERFACE) ··· 31 32 32 33 # JNIPP and Android JNI wrappers 33 34 if(ANDROID) 34 - add_library(xrt-external-jnipp STATIC 35 - jnipp/jnipp.cpp) 35 + add_library(xrt-external-jnipp STATIC jnipp/jnipp.cpp) 36 36 target_include_directories(xrt-external-jnipp PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/jnipp) 37 37 38 38 file(GLOB WRAP_SOURCES android-jni-wrap/wrap/*.cpp) 39 - add_library(xrt-external-jni-wrap STATIC 40 - ${WRAP_SOURCES}) 41 - target_include_directories(xrt-external-jni-wrap PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/android-jni-wrap) 39 + add_library(xrt-external-jni-wrap STATIC ${WRAP_SOURCES}) 40 + target_include_directories( 41 + xrt-external-jni-wrap PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/android-jni-wrap 42 + ) 42 43 target_link_libraries(xrt-external-jni-wrap PUBLIC xrt-external-jnipp) 43 44 endif() 44 45 45 46 # OpenXR 46 47 add_library(xrt-external-openxr INTERFACE) 47 - target_include_directories(xrt-external-openxr INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/openxr_includes) 48 + target_include_directories( 49 + xrt-external-openxr INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/openxr_includes 50 + ) 48 51 49 52 # External SLAM tracking 50 - if (SLAM) 53 + if(SLAM) 51 54 add_library(xrt-external-slam STATIC slam_tracker/slam_tracker.hpp) 52 55 set_target_properties(xrt-external-slam PROPERTIES LINKER_LANGUAGE CXX) 53 - target_include_directories(xrt-external-slam INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/slam_tracker) 56 + target_include_directories( 57 + xrt-external-slam INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/slam_tracker 58 + ) 54 59 target_include_directories(xrt-external-slam INTERFACE ${SLAM_INCLUDE_DIRS}) 55 60 target_link_libraries(xrt-external-slam INTERFACE ${SLAM_LIBRARIES}) 56 61 endif() ··· 60 65 target_include_directories(xrt-external-stb INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/stb) 61 66 62 67 # imgui 63 - if(XRT_HAVE_SDL2) 64 - # c-imgui doesn't do well with IPO - lots of warnings. 65 - set(CMAKE_INTERPROCEDURAL_OPTIMIZATION OFF) 68 + if(XRT_HAVE_OPENGL) 66 69 add_library( 67 70 xrt-external-imgui STATIC 68 71 imgui/imgui/cimgui.cpp ··· 88 91 imgui/imgui/imstb_truetype.h 89 92 imgui/imgui_monado/imgui_monado.cpp 90 93 ) 91 - target_include_directories(xrt-external-imgui PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/imgui) 92 94 95 + target_include_directories( 96 + xrt-external-imgui SYSTEM PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/imgui 97 + ) 98 + target_include_directories(xrt-external-imgui PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/imgui) 93 99 target_compile_definitions(xrt-external-imgui PUBLIC CIMGUI_NO_EXPORT) 94 - target_link_libraries(xrt-external-imgui PRIVATE xrt-external-glad) 100 + set_target_properties(xrt-external-imgui PROPERTIES INTERPROCEDURAL_OPTIMIZATION OFF) 101 + target_link_libraries(xrt-external-imgui PUBLIC xrt-external-glad) 95 102 96 - add_library( 97 - xrt-external-imgui-sdl2 STATIC imgui/imgui/cimgui_sdl.cpp imgui/imgui/imgui_impl_sdl.cpp 98 - imgui/imgui/imgui_impl_sdl.h 99 - ) 100 - target_link_libraries(xrt-external-imgui-sdl2 PRIVATE xrt-external-imgui ${SDL2_LIBRARIES}) 103 + if(XRT_HAVE_SDL2) 104 + add_library( 105 + xrt-external-imgui-sdl2 STATIC 106 + imgui/imgui/cimgui_sdl.cpp imgui/imgui/imgui_impl_sdl.cpp 107 + imgui/imgui/imgui_impl_sdl.h 108 + ) 109 + target_link_libraries( 110 + xrt-external-imgui-sdl2 111 + PUBLIC xrt-external-imgui 112 + PRIVATE ${SDL2_LIBRARIES} 113 + ) 101 114 102 - target_include_directories(xrt-external-imgui-sdl2 PRIVATE ${SDL2_INCLUDE_DIRS}) 103 - target_include_directories(xrt-external-imgui-sdl2 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/imgui) 115 + target_include_directories(xrt-external-imgui-sdl2 PRIVATE ${SDL2_INCLUDE_DIRS}) 116 + target_include_directories( 117 + xrt-external-imgui-sdl2 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/imgui 118 + ) 119 + set_target_properties( 120 + xrt-external-imgui-sdl2 PROPERTIES INTERPROCEDURAL_OPTIMIZATION OFF 121 + ) 122 + endif() 123 + 104 124 endif()
+151 -183
src/xrt/auxiliary/CMakeLists.txt
··· 1 - # Copyright 2019-2020, Collabora, Ltd. 1 + # Copyright 2019-2021, Collabora, Ltd. 2 2 # SPDX-License-Identifier: BSL-1.0 3 3 4 4 add_subdirectory(bindings) 5 5 6 - set(ANDROID_SOURCE_FILES 7 - android/android_ahardwarebuffer_allocator.c 8 - android/android_ahardwarebuffer_allocator.h 9 - android/android_custom_surface.cpp 10 - android/android_custom_surface.h 11 - android/android_globals.cpp 12 - android/android_globals.h 13 - android/android_load_class.cpp 14 - android/android_load_class.hpp 15 - android/android_looper.c 16 - android/android_looper.h 17 - android/org.freedesktop.monado.auxiliary.cpp 18 - android/org.freedesktop.monado.auxiliary.hpp 19 - android/org.freedesktop.monado.auxiliary.impl.hpp 6 + # Common includes 7 + add_library(aux-includes INTERFACE) 8 + target_include_directories( 9 + aux-includes INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} 20 10 ) 11 + target_link_libraries(aux-includes INTERFACE xrt-interfaces) 21 12 22 - set(MATH_SOURCE_FILES 13 + # OpenGL library. 14 + if(XRT_HAVE_OPENGL OR XRT_HAVE_OPENGLES) 15 + add_library( 16 + aux_ogl STATIC 17 + ogl/ogl_documentation.h 18 + ogl/ogl_api.c 19 + ogl/ogl_api.h 20 + ogl/ogl_helpers.c 21 + ogl/ogl_helpers.h 22 + ) 23 + target_link_libraries(aux_ogl PUBLIC aux-includes xrt-external-glad) 24 + if(XRT_HAVE_EGL) 25 + target_sources(aux_ogl PRIVATE ogl/egl_api.c ogl/egl_api.h) 26 + endif() 27 + if(XRT_HAVE_OPENGLES) 28 + target_link_libraries(aux_ogl PUBLIC EGL::EGL) 29 + endif() 30 + endif() 31 + 32 + # Math library. 33 + add_library( 34 + aux_math STATIC 23 35 math/m_api.h 24 36 math/m_base.cpp 25 37 math/m_eigen_interop.hpp ··· 45 57 math/m_vec2.h 46 58 math/m_vec3.h 47 59 ) 48 - 49 - set(OGL_SOURCE_FILES 50 - ogl/ogl_documentation.h 51 - ) 52 - if(XRT_HAVE_OPENGL OR XRT_HAVE_OPENGLES) 53 - list(APPEND OGL_SOURCE_FILES 54 - ogl/ogl_api.c 55 - ogl/ogl_api.h 56 - ogl/ogl_helpers.c 57 - ogl/ogl_helpers.h 58 - ) 59 - endif() 60 - if(XRT_HAVE_EGL) 61 - list(APPEND OGL_SOURCE_FILES 62 - ogl/egl_api.c 63 - ogl/egl_api.h 64 - ) 65 - endif() 60 + target_link_libraries(aux_math PUBLIC aux-includes aux_util) 61 + target_include_directories(aux_math SYSTEM PRIVATE ${EIGEN3_INCLUDE_DIR}) 66 62 67 - set(OS_SOURCE_FILES 63 + # OS library. 64 + add_library( 65 + aux_os STATIC 68 66 os/os_ble.h 69 67 os/os_documentation.h 70 68 os/os_hid.h 71 69 os/os_hid_hidraw.c 72 70 os/os_threading.h 73 71 ) 72 + target_link_libraries(aux_os PUBLIC aux-includes xrt-pthreads) 74 73 if(XRT_HAVE_DBUS) 75 - list(APPEND OS_SOURCE_FILES 76 - os/os_ble_dbus.c 74 + target_sources(aux_os PRIVATE os/os_ble_dbus.c) 75 + target_link_libraries(aux_os PRIVATE ${DBUS_LIBRARIES}) 76 + target_include_directories(aux_os SYSTEM PRIVATE ${DBUS_INCLUDE_DIRS}) 77 + endif() 78 + 79 + # GStreamer library. 80 + if(XRT_HAVE_GST) 81 + add_library( 82 + aux_gstreamer STATIC 83 + gstreamer/gst_internal.h 84 + gstreamer/gst_sink.h 85 + gstreamer/gst_sink.c 86 + gstreamer/gst_pipeline.h 87 + gstreamer/gst_pipeline.c 77 88 ) 89 + target_link_libraries(aux_gstreamer PUBLIC aux-includes) 90 + target_link_libraries(aux_gstreamer PRIVATE xrt-interfaces aux_math aux_os ${GST_LIBRARIES}) 91 + target_include_directories(aux_gstreamer PRIVATE ${GST_INCLUDE_DIRS}) 78 92 endif() 79 93 80 - set(GSTREAMER_SOURCE_FILES 81 - gstreamer/gst_internal.h 82 - gstreamer/gst_sink.h 83 - gstreamer/gst_sink.c 84 - gstreamer/gst_pipeline.h 85 - gstreamer/gst_pipeline.c 86 - ) 87 - 88 - set(TRACKING_SOURCE_FILES 94 + # Tracking library. 95 + add_library( 96 + aux_tracking STATIC 89 97 tracking/t_data_utils.c 90 98 tracking/t_imu_fusion.hpp 91 99 tracking/t_imu.cpp ··· 94 102 tracking/t_lowpass.hpp 95 103 tracking/t_tracking.h 96 104 ) 105 + target_link_libraries( 106 + aux_tracking 107 + PUBLIC aux-includes 108 + PRIVATE aux_math aux_util xrt-external-flexkalman xrt-external-hungarian 109 + ) 110 + target_include_directories(aux_tracking SYSTEM PRIVATE ${EIGEN3_INCLUDE_DIR}) 97 111 if(XRT_HAVE_OPENCV) 98 - list(APPEND TRACKING_SOURCE_FILES 99 - tracking/t_calibration_opencv.hpp 100 - tracking/t_calibration.cpp 101 - tracking/t_convert.cpp 102 - tracking/t_debug_hsv_filter.cpp 103 - tracking/t_debug_hsv_picker.cpp 104 - tracking/t_debug_hsv_viewer.cpp 105 - tracking/t_file.cpp 106 - tracking/t_frame_cv_mat_wrapper.cpp 107 - tracking/t_frame_cv_mat_wrapper.hpp 108 - tracking/t_fusion.hpp 109 - tracking/t_helper_debug_sink.hpp 110 - tracking/t_hsv_filter.c 111 - tracking/t_kalman.cpp 112 - tracking/t_tracker_psmv_fusion.hpp 113 - tracking/t_tracker_psmv.cpp 114 - tracking/t_tracker_psvr.cpp 115 - tracking/t_tracker_hand.cpp 112 + target_sources( 113 + aux_tracking 114 + PRIVATE 115 + tracking/t_calibration_opencv.hpp 116 + tracking/t_calibration.cpp 117 + tracking/t_convert.cpp 118 + tracking/t_debug_hsv_filter.cpp 119 + tracking/t_debug_hsv_picker.cpp 120 + tracking/t_debug_hsv_viewer.cpp 121 + tracking/t_file.cpp 122 + tracking/t_frame_cv_mat_wrapper.cpp 123 + tracking/t_frame_cv_mat_wrapper.hpp 124 + tracking/t_fusion.hpp 125 + tracking/t_helper_debug_sink.hpp 126 + tracking/t_hsv_filter.c 127 + tracking/t_kalman.cpp 128 + tracking/t_tracker_psmv_fusion.hpp 129 + tracking/t_tracker_psmv.cpp 130 + tracking/t_tracker_psvr.cpp 131 + tracking/t_tracker_hand.cpp 116 132 ) 117 - 133 + target_include_directories(aux_tracking SYSTEM PRIVATE ${OpenCV_INCLUDE_DIRS}) 134 + target_link_libraries(aux_tracking PUBLIC ${OpenCV_LIBRARIES}) 118 135 endif() 119 136 if(XRT_HAVE_SLAM) 120 - list(APPEND TRACKING_SOURCE_FILES tracking/t_tracker_slam.cpp) 137 + target_sources(aux_tracking PRIVATE tracking/t_tracker_slam.cpp) 138 + target_link_libraries(aux_tracking PRIVATE xrt-external-slam) 121 139 endif() 122 140 123 - set(UTIL_SOURCE_FILES 141 + # Util library. 142 + add_library( 143 + aux_util STATIC 124 144 util/u_bitwise.c 125 145 util/u_bitwise.h 126 146 util/u_debug.c ··· 178 198 util/u_verify.h 179 199 util/u_process.c 180 200 util/u_process.h 181 - ) 182 - 183 - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/util/u_git_tag.c.in" "${CMAKE_CURRENT_BINARY_DIR}/u_git_tag.c" @ONLY) 184 - list(APPEND UTIL_SOURCE_FILES "${CMAKE_CURRENT_BINARY_DIR}/u_git_tag.c") 185 - 186 - set(VK_SOURCE_FILES 187 - vk/vk_command_buffer.c 188 - vk/vk_documentation.h 189 - vk/vk_helpers.c 190 - vk/vk_helpers.h 191 - vk/vk_image_allocator.c 192 - vk/vk_image_allocator.h 193 - vk/vk_state_creators.c 201 + "${CMAKE_CURRENT_BINARY_DIR}/u_git_tag.c" 194 202 ) 195 203 196 - # Common includes 197 - add_library(aux-includes INTERFACE) 198 - target_include_directories(aux-includes INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) 199 - target_link_libraries(aux-includes INTERFACE xrt-interfaces) 200 - 201 - if(XRT_HAVE_OPENGL OR XRT_HAVE_OPENGLES) 202 - # OpenGL library. 203 - add_library(aux_ogl STATIC ${OGL_SOURCE_FILES}) 204 - target_link_libraries(aux_ogl PUBLIC aux-includes) 205 - # for GLAD 206 - target_link_libraries(aux_ogl PUBLIC xrt-external-glad) 207 - if(XRT_HAVE_OPENGLES) 208 - target_link_libraries(aux_ogl PUBLIC EGL::EGL) 209 - endif() 210 - endif() 211 - 212 - # OS library. 213 - add_library(aux_os STATIC ${OS_SOURCE_FILES}) 214 - target_link_libraries(aux_os PUBLIC aux-includes xrt-pthreads) 215 - if(XRT_HAVE_DBUS) 216 - target_link_libraries(aux_os PRIVATE ${DBUS_LIBRARIES}) 217 - target_include_directories(aux_os SYSTEM 218 - PRIVATE 219 - ${DBUS_INCLUDE_DIRS} 220 - ) 221 - endif() 222 - 223 - 224 - # Math library. 225 - add_library(aux_math STATIC ${MATH_SOURCE_FILES}) 226 - target_link_libraries(aux_math PUBLIC aux-includes aux_util) 227 - 228 - # Math files has extra include(s). 229 - target_include_directories(aux_math SYSTEM 230 - PRIVATE ${EIGEN3_INCLUDE_DIR} 204 + configure_file( 205 + "${CMAKE_CURRENT_SOURCE_DIR}/util/u_git_tag.c.in" "${CMAKE_CURRENT_BINARY_DIR}/u_git_tag.c" 206 + @ONLY 231 207 ) 232 - 233 - # Util library. 234 - add_library(aux_util STATIC ${UTIL_SOURCE_FILES}) 235 - target_link_libraries(aux_util PUBLIC aux-includes xrt-pthreads aux_generated_bindings) 236 - # for u_device 237 - target_link_libraries(aux_util PUBLIC aux_math) 208 + target_link_libraries(aux_util PUBLIC aux-includes xrt-pthreads aux_generated_bindings aux_math) 238 209 if(XRT_HAVE_JPEG) 239 210 target_link_libraries(aux_util PRIVATE ${JPEG_LIBRARIES}) 240 211 target_include_directories(aux_util PRIVATE ${JPEG_INCLUDE_DIRS}) 241 212 endif() 242 - # for cJSON 243 213 if(XRT_HAVE_SYSTEM_CJSON) 244 214 target_link_libraries(aux_util PUBLIC cJSON::cJSON) 245 215 target_compile_definitions(aux_util PRIVATE XRT_HAVE_SYSTEM_CJSON) 246 216 else() 247 217 target_link_libraries(aux_util PUBLIC xrt-external-cjson) 248 218 endif() 249 - # For u_trace_marker 250 219 if(XRT_FEATURE_TRACING AND XRT_HAVE_PERCETTO) 251 220 target_link_libraries(aux_util PUBLIC Percetto::percetto) 252 221 endif() ··· 258 227 target_link_libraries(aux_util PUBLIC ${ANDROID_LOG_LIBRARY}) 259 228 endif() 260 229 261 - 262 - # GStreamer library. 263 - if(XRT_HAVE_GST) 264 - add_library(aux_gstreamer STATIC ${GSTREAMER_SOURCE_FILES}) 265 - target_link_libraries(aux_gstreamer PUBLIC 266 - aux-includes 267 - ) 268 - target_link_libraries(aux_gstreamer PRIVATE 269 - xrt-interfaces 270 - aux_math 271 - aux_os 272 - ${GST_LIBRARIES} 273 - ) 274 - target_include_directories(aux_gstreamer PRIVATE 275 - ${GST_INCLUDE_DIRS} 276 - ) 277 - endif() 278 - 279 - # Tracking library. 280 - add_library(aux_tracking STATIC ${TRACKING_SOURCE_FILES}) 281 - target_link_libraries(aux_tracking PUBLIC aux-includes PRIVATE aux_math aux_util) 282 - 283 - # Tracking files have extra includes. 284 - target_include_directories(aux_tracking SYSTEM 285 - PRIVATE 286 - ${EIGEN3_INCLUDE_DIR} 287 - ) 288 - target_link_libraries(aux_tracking PRIVATE 289 - xrt-external-flexkalman 290 - xrt-external-hungarian 291 - ) 292 - if(XRT_HAVE_OPENCV) 293 - target_include_directories(aux_tracking SYSTEM 294 - PRIVATE 295 - ${OpenCV_INCLUDE_DIRS} 296 - ) 297 - target_link_libraries(aux_tracking PUBLIC ${OpenCV_LIBRARIES}) 298 - if(XRT_HAVE_SLAM) 299 - target_link_libraries(aux_tracking PRIVATE xrt-external-slam) 300 - endif() 301 - endif() 302 - 303 - if (XRT_BUILD_DRIVER_VIVE OR XRT_BUILD_DRIVER_SURVIVE) 304 - set(VIVE_CONFIG_SOURCE_FILES 305 - vive/vive_config.h 306 - vive/vive_config.c 307 - ) 308 - add_library(aux_vive STATIC ${VIVE_CONFIG_SOURCE_FILES}) 309 - target_link_libraries(aux_vive PRIVATE xrt-interfaces aux_util aux_math aux_tracking xrt-external-cjson) 310 - target_link_libraries(aux_vive PRIVATE ${ZLIB_LIBRARIES}) 311 - target_include_directories(aux_vive PRIVATE ${ZLIB_INCLUDE_DIRS}) 312 - endif() 313 - 314 230 if(XRT_HAVE_VULKAN) 315 231 # Vulkan library. 316 - add_library(aux_vk STATIC ${VK_SOURCE_FILES}) 232 + add_library( 233 + aux_vk STATIC 234 + vk/vk_command_buffer.c 235 + vk/vk_documentation.h 236 + vk/vk_helpers.c 237 + vk/vk_helpers.h 238 + vk/vk_image_allocator.c 239 + vk/vk_image_allocator.h 240 + vk/vk_state_creators.c 241 + ) 317 242 target_link_libraries(aux_vk PUBLIC aux_os aux_util) 318 243 target_link_libraries(aux_vk PUBLIC Vulkan::Vulkan) 319 244 target_include_directories(aux_vk PUBLIC ${Vulkan_INCLUDE_DIR}) ··· 322 247 endif() 323 248 endif() 324 249 250 + if(XRT_BUILD_DRIVER_VIVE OR XRT_BUILD_DRIVER_SURVIVE) 251 + set(VIVE_CONFIG_SOURCE_FILES vive/vive_config.h vive/vive_config.c) 252 + add_library(aux_vive STATIC ${VIVE_CONFIG_SOURCE_FILES}) 253 + target_link_libraries( 254 + aux_vive 255 + PRIVATE 256 + xrt-interfaces 257 + aux_util 258 + aux_math 259 + aux_tracking 260 + xrt-external-cjson 261 + ${ZLIB_LIBRARIES} 262 + ) 263 + target_include_directories(aux_vive PRIVATE ${ZLIB_INCLUDE_DIRS}) 264 + endif() 325 265 326 266 if(ANDROID) 327 - add_library(android_app_glue STATIC 328 - ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c) 329 - target_include_directories(android_app_glue PUBLIC ${ANDROID_NDK}/sources/android/native_app_glue) 330 - add_library(aux_android STATIC ${ANDROID_SOURCE_FILES}) 331 - target_link_libraries(aux_android 267 + add_library( 268 + android_app_glue STATIC 269 + ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c 270 + ) 271 + target_include_directories( 272 + android_app_glue PUBLIC ${ANDROID_NDK}/sources/android/native_app_glue 273 + ) 274 + # disable these warnings in external code 275 + target_compile_options(android_app_glue PRIVATE -Wno-format-pedantic) 276 + 277 + add_library( 278 + aux_android STATIC 279 + android/android_ahardwarebuffer_allocator.c 280 + android/android_ahardwarebuffer_allocator.h 281 + android/android_custom_surface.cpp 282 + android/android_custom_surface.h 283 + android/android_globals.cpp 284 + android/android_globals.h 285 + android/android_load_class.cpp 286 + android/android_load_class.hpp 287 + android/android_looper.c 288 + android/android_looper.h 289 + android/org.freedesktop.monado.auxiliary.cpp 290 + android/org.freedesktop.monado.auxiliary.hpp 291 + android/org.freedesktop.monado.auxiliary.impl.hpp 292 + ) 293 + target_link_libraries( 294 + aux_android 332 295 PUBLIC aux_util 333 - PRIVATE ${ANDROID_LIBRARY} ${ANDROID_LOG_LIBRARY} xrt-external-jni-wrap xrt-external-jnipp android_app_glue 296 + PRIVATE 297 + ${ANDROID_LIBRARY} 298 + ${ANDROID_LOG_LIBRARY} 299 + xrt-external-jni-wrap 300 + xrt-external-jnipp 301 + android_app_glue 334 302 ) 335 303 target_link_libraries(aux_vk PUBLIC aux_android) 336 304 endif()
+17 -16
src/xrt/auxiliary/bindings/CMakeLists.txt
··· 1 1 # Copyright 2019-2021, Collabora, Ltd. 2 2 # SPDX-License-Identifier: BSL-1.0 3 3 4 - ### 5 - # Binding generation 6 - # 7 - 8 - function(bindings_gen output custom_target) 9 - add_custom_command(OUTPUT ${output} 10 - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/bindings.py 4 + # Binding generation: pass filename to generate 5 + function(bindings_gen output) 6 + add_custom_command( 7 + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${output}" 8 + COMMAND 9 + ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/bindings.py 11 10 ${CMAKE_CURRENT_SOURCE_DIR}/bindings.json 12 - ${output} 11 + "${CMAKE_CURRENT_BINARY_DIR}/${output}" 12 + VERBATIM 13 13 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bindings.py 14 14 ${CMAKE_CURRENT_SOURCE_DIR}/bindings.json 15 - ) 16 - add_custom_target(${custom_target} DEPENDS ${output}) 17 - endfunction(bindings_gen) 15 + COMMENT "Generating ${output}" 16 + ) 17 + endfunction() 18 18 19 - bindings_gen(${CMAKE_CURRENT_BINARY_DIR}/b_generated_bindings.h generated_bindings_h) 20 - bindings_gen(${CMAKE_CURRENT_BINARY_DIR}/b_generated_bindings.c generated_bindings_c) 19 + bindings_gen(b_generated_bindings.h) 20 + bindings_gen(b_generated_bindings.c) 21 21 22 22 # Bindings library. 23 - add_library(aux_generated_bindings STATIC ${CMAKE_CURRENT_BINARY_DIR}/b_generated_bindings.c) 24 - add_dependencies(aux_generated_bindings generated_bindings_h) 23 + add_library( 24 + aux_generated_bindings STATIC ${CMAKE_CURRENT_BINARY_DIR}/b_generated_bindings.c 25 + ${CMAKE_CURRENT_BINARY_DIR}/b_generated_bindings.h 26 + ) 25 27 26 28 # needed globally for steamvr input profile generation in steamvr target 27 29 set_property(GLOBAL PROPERTY AUX_BINDINGS_DIR_PROP "${CMAKE_CURRENT_SOURCE_DIR}") 28 30 29 - target_include_directories(aux_generated_bindings PRIVATE aux-includes xrt-interfaces) 30 31 target_link_libraries(aux_generated_bindings PRIVATE xrt-interfaces aux_util)
+164 -189
src/xrt/compositor/CMakeLists.txt
··· 1 1 # Copyright 2019-2021, Collabora, Ltd. 2 2 # SPDX-License-Identifier: BSL-1.0 3 3 4 - spirv_shaders(SHADER_HEADERS 5 - shaders/clear.comp 6 - shaders/distortion.comp 7 - shaders/distortion_timewarp.comp 8 - shaders/mesh.frag 9 - shaders/mesh.vert 10 - shaders/layer.frag 11 - shaders/layer.vert 12 - shaders/equirect1.vert 13 - shaders/equirect1.frag 14 - shaders/equirect2.vert 15 - shaders/equirect2.frag 16 - ) 4 + ### 5 + # Client library 6 + # 17 7 18 - set(CLIENT_SOURCE_FILES) 8 + add_library(comp_client STATIC) 19 9 20 - set(UTIL_SOURCE_FILES 21 - util/comp_base.h 22 - util/comp_base.c 23 - util/comp_swapchain.h 24 - util/comp_swapchain.c 25 - util/comp_sync.h 26 - util/comp_sync.c 27 - util/comp_vulkan.h 28 - util/comp_vulkan.c 10 + target_link_libraries( 11 + comp_client 12 + PUBLIC xrt-interfaces 13 + PRIVATE aux_util 29 14 ) 30 - 31 - set(RENDER_SOURCE_FILES 32 - render/comp_buffer.c 33 - render/comp_compute.c 34 - render/comp_render.h 35 - render/comp_rendering.c 36 - render/comp_resources.c 37 - render/comp_shaders.c 38 - render/comp_util.c 39 - ) 40 - 41 - set(MAIN_SOURCE_FILES 42 - main/comp_compositor.c 43 - main/comp_compositor.h 44 - main/comp_documentation.h 45 - main/comp_renderer.c 46 - main/comp_renderer.h 47 - main/comp_settings.c 48 - main/comp_settings.h 49 - main/comp_target.h 50 - main/comp_target_swapchain.c 51 - main/comp_target_swapchain.h 52 - main/comp_window.h 53 - main/comp_layer.h 54 - main/comp_layer.c 55 - main/comp_layer_renderer.h 56 - main/comp_layer_renderer.c 57 - ) 58 - 59 - set(MULTI_SOURCE_FILES 60 - multi/comp_multi_compositor.c 61 - multi/comp_multi_interface.h 62 - multi/comp_multi_private.h 63 - multi/comp_multi_system.c 64 - ) 65 - 66 - 67 - ### 68 - # Client library 69 - # 15 + target_include_directories(comp_client PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) 70 16 71 17 if(XRT_HAVE_VULKAN) 72 - list(APPEND CLIENT_SOURCE_FILES 73 - client/comp_vk_client.c 74 - client/comp_vk_client.h 75 - client/comp_vk_glue.c 18 + target_sources( 19 + comp_client PRIVATE client/comp_vk_client.c client/comp_vk_client.h 20 + client/comp_vk_glue.c 76 21 ) 22 + target_link_libraries(comp_client PRIVATE aux_vk) 77 23 endif() 24 + 78 25 if(XRT_HAVE_OPENGL OR XRT_HAVE_OPENGLES) 79 - list(APPEND CLIENT_SOURCE_FILES 80 - client/comp_gl_client.c 81 - client/comp_gl_client.h 82 - client/comp_gl_memobj_swapchain.c 83 - client/comp_gl_memobj_swapchain.h 26 + target_sources( 27 + comp_client 28 + PRIVATE client/comp_gl_client.c client/comp_gl_client.h 29 + client/comp_gl_memobj_swapchain.c client/comp_gl_memobj_swapchain.h 84 30 ) 31 + target_link_libraries(comp_client PRIVATE aux_ogl) 85 32 endif() 33 + 86 34 if(XRT_HAVE_OPENGL) 87 - list(APPEND CLIENT_SOURCE_FILES 88 - client/comp_gl_glue.c 89 - ) 35 + target_sources(comp_client PRIVATE client/comp_gl_glue.c) 90 36 endif() 37 + 91 38 if(XRT_HAVE_OPENGLES) 92 - list(APPEND CLIENT_SOURCE_FILES 93 - client/comp_gles_glue.c 94 - client/comp_gl_eglimage_swapchain.c 95 - client/comp_gl_eglimage_swapchain.h 39 + target_sources( 40 + comp_client PRIVATE client/comp_gles_glue.c client/comp_gl_eglimage_swapchain.c 41 + client/comp_gl_eglimage_swapchain.h 96 42 ) 97 43 endif() 44 + 98 45 if(XRT_HAVE_OPENGL_GLX AND XRT_HAVE_XLIB) 99 - list(APPEND CLIENT_SOURCE_FILES 100 - client/comp_gl_xlib_client.c 101 - client/comp_gl_xlib_client.h 102 - client/comp_gl_xlib_glue.c 103 - ) 104 - endif() 105 - if(XRT_HAVE_EGL) 106 - list(APPEND CLIENT_SOURCE_FILES 107 - client/comp_egl_client.c 108 - client/comp_egl_client.h 46 + target_sources( 47 + comp_client PRIVATE client/comp_gl_xlib_client.c client/comp_gl_xlib_client.h 48 + client/comp_gl_xlib_glue.c 109 49 ) 110 - endif() 111 - 112 - add_library(comp_client STATIC ${CLIENT_SOURCE_FILES}) 113 - target_link_libraries(comp_client PUBLIC xrt-interfaces PRIVATE aux_util) 114 - target_include_directories(comp_client PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) 115 - 116 - if(XRT_HAVE_VULKAN) 117 - target_link_libraries(comp_client PRIVATE aux_vk) 118 - endif() 119 - if(XRT_HAVE_OPENGL OR XRT_HAVE_OPENGLES) 120 - target_link_libraries(comp_client PRIVATE aux_ogl) 121 - endif() 122 - 123 - if(XRT_HAVE_OPENGL AND XRT_HAVE_XLIB) 124 50 target_link_libraries(comp_client PRIVATE OpenGL::GLX) 125 51 endif() 126 52 53 + if(XRT_HAVE_EGL) 54 + target_sources(comp_client PRIVATE client/comp_egl_client.c client/comp_egl_client.h) 55 + endif() 127 56 128 57 ## 129 58 # Util library 130 59 # 131 60 132 61 if(XRT_HAVE_VULKAN) 133 - add_library(comp_util STATIC ${UTIL_SOURCE_FILES}) 134 - target_link_libraries(comp_util PUBLIC xrt-interfaces PRIVATE aux_util aux_os aux_vk) 62 + add_library( 63 + comp_util STATIC 64 + util/comp_base.h 65 + util/comp_base.c 66 + util/comp_swapchain.h 67 + util/comp_swapchain.c 68 + util/comp_sync.h 69 + util/comp_sync.c 70 + util/comp_vulkan.h 71 + util/comp_vulkan.c 72 + ) 73 + target_link_libraries( 74 + comp_util 75 + PUBLIC xrt-interfaces 76 + PRIVATE aux_util aux_os aux_vk 77 + ) 135 78 target_include_directories(comp_util PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) 136 79 endif() 137 - 138 80 139 81 ## 140 82 # Render library 141 83 # 142 84 143 85 if(XRT_HAVE_VULKAN) 144 - add_library(comp_render STATIC ${SHADER_HEADERS} ${RENDER_SOURCE_FILES}) 145 - target_link_libraries(comp_render PUBLIC xrt-interfaces PRIVATE aux_util aux_os aux_vk) 146 - target_include_directories(comp_render PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) 147 - target_include_directories(comp_render SYSTEM PRIVATE 148 - # Shaders - marked SYSTEM so we get no warnings 149 - ${CMAKE_CURRENT_BINARY_DIR} 86 + spirv_shaders( 87 + SHADER_HEADERS 88 + shaders/clear.comp 89 + shaders/distortion.comp 90 + shaders/distortion_timewarp.comp 91 + shaders/mesh.frag 92 + shaders/mesh.vert 93 + shaders/layer.frag 94 + shaders/layer.vert 95 + shaders/equirect1.vert 96 + shaders/equirect1.frag 97 + shaders/equirect2.vert 98 + shaders/equirect2.frag 99 + ) 100 + 101 + add_library( 102 + comp_render STATIC 103 + ${SHADER_HEADERS} 104 + render/comp_buffer.c 105 + render/comp_compute.c 106 + render/comp_render.h 107 + render/comp_rendering.c 108 + render/comp_resources.c 109 + render/comp_shaders.c 110 + render/comp_util.c 150 111 ) 112 + target_link_libraries( 113 + comp_render 114 + PUBLIC xrt-interfaces 115 + PRIVATE aux_util aux_os aux_vk 116 + ) 117 + target_include_directories(comp_render PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) 118 + # Shaders - marked SYSTEM so we get no warnings 119 + target_include_directories(comp_render SYSTEM PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) 151 120 152 121 add_subdirectory(shaders) 153 122 endif() 154 - 155 123 156 124 ## 157 125 # Main library ··· 159 127 160 128 if(XRT_FEATURE_COMPOSITOR_MAIN) 161 129 130 + add_library( 131 + comp_main STATIC 132 + main/comp_compositor.c 133 + main/comp_compositor.h 134 + main/comp_documentation.h 135 + main/comp_renderer.c 136 + main/comp_renderer.h 137 + main/comp_settings.c 138 + main/comp_settings.h 139 + main/comp_target.h 140 + main/comp_target_swapchain.c 141 + main/comp_target_swapchain.h 142 + main/comp_window.h 143 + main/comp_layer.h 144 + main/comp_layer.c 145 + main/comp_layer_renderer.h 146 + main/comp_layer_renderer.c 147 + ) 148 + target_link_libraries( 149 + comp_main 150 + PUBLIC xrt-interfaces 151 + PRIVATE 152 + aux_util 153 + aux_os 154 + aux_vk 155 + comp_util 156 + comp_render 157 + ) 158 + target_include_directories(comp_main PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) 159 + 162 160 if(XRT_HAVE_XCB) 163 - list(APPEND MAIN_SOURCE_FILES 164 - main/comp_window_xcb.c 165 - ) 161 + target_sources(comp_main PRIVATE main/comp_window_xcb.c) 162 + target_include_directories(comp_main SYSTEM PRIVATE ${XCB_INCLUDE_DIRS}) 163 + target_link_libraries(comp_main PRIVATE ${XCB_LIBRARIES}) 164 + if(XRT_HAVE_EGL) 165 + target_include_directories(comp_main SYSTEM PRIVATE ${EGL_INCLUDE_DIRS}) 166 + target_link_libraries(comp_main PRIVATE ${XCB_LIBRARIES}) 167 + endif() 166 168 endif() 167 169 if(XRT_HAVE_XCB AND XRT_HAVE_XLIB) 168 - list(APPEND MAIN_SOURCE_FILES 169 - main/comp_window_direct_randr.c 170 - main/comp_window_direct_nvidia.c 170 + target_sources( 171 + comp_main PRIVATE main/comp_window_direct_randr.c 172 + main/comp_window_direct_nvidia.c 171 173 ) 174 + target_link_libraries(comp_main PRIVATE ${X11_X11_LIB}) 172 175 endif() 173 176 if(WIN32) 174 - list(APPEND MAIN_SOURCE_FILES 175 - main/comp_window_mswin.c 176 - ) 177 + target_sources(comp_main PRIVATE main/comp_window_mswin.c) 177 178 endif() 178 - if (VK_USE_PLATFORM_DISPLAY_KHR) 179 - list(APPEND MAIN_SOURCE_FILES 180 - main/comp_window_vk_display.c 181 - ) 179 + if(VK_USE_PLATFORM_DISPLAY_KHR) 180 + target_sources(comp_main PRIVATE main/comp_window_vk_display.c) 182 181 endif() 183 - if (VK_USE_PLATFORM_DISPLAY_KHR OR XRT_HAVE_XCB) 184 - list(APPEND MAIN_SOURCE_FILES 185 - main/comp_window_direct.c 186 - ) 182 + if(VK_USE_PLATFORM_DISPLAY_KHR OR XRT_HAVE_XCB) 183 + target_sources(comp_main PRIVATE main/comp_window_direct.c) 187 184 endif() 188 185 189 186 # generate wayland protocols 190 187 if(XRT_HAVE_WAYLAND) 188 + target_sources(comp_main PRIVATE main/comp_window_wayland.c) 191 189 pkg_get_variable(WL_PROTOS_PKG_DIR wayland-protocols pkgdatadir) 192 190 pkg_get_variable(WL_SCANNER wayland-scanner wayland_scanner) 193 191 194 192 set(WL_PROTOS_DIR "${CMAKE_CURRENT_BINARY_DIR}/wayland-protocols") 195 193 file(MAKE_DIRECTORY "${WL_PROTOS_DIR}") 196 194 197 - set(WL_PROTOS_XML 198 - ${WL_PROTOS_PKG_DIR}/stable/xdg-shell/xdg-shell.xml 199 - ) 195 + set(WL_PROTOS_XML ${WL_PROTOS_PKG_DIR}/stable/xdg-shell/xdg-shell.xml) 200 196 201 - list(APPEND MAIN_SOURCE_FILES 202 - main/comp_window_wayland.c 203 - ) 197 + target_include_directories(comp_main SYSTEM PRIVATE ${WL_PROTOS_DIR}) 198 + target_link_libraries(comp_main PRIVATE ${WAYLAND_LIBRARIES}) 204 199 205 - if (XRT_HAVE_WAYLAND_DIRECT) 206 - list(APPEND WL_PROTOS_XML 200 + if(XRT_HAVE_WAYLAND_DIRECT) 201 + list( 202 + APPEND WL_PROTOS_XML 207 203 ${WL_PROTOS_PKG_DIR}/staging/drm-lease/drm-lease-v1.xml 208 - ) 209 - 210 - list(APPEND MAIN_SOURCE_FILES 211 - main/comp_window_direct_wayland.c 212 204 ) 213 205 214 - pkg_check_modules(LIBDRM IMPORTED_TARGET libdrm) 215 - set(WAYLAND_DEPS 216 - ${WAYLAND_LIBRARIES} 217 - PkgConfig::LIBDRM 218 - ) 206 + target_sources(comp_main PRIVATE main/comp_window_direct_wayland.c) 207 + 208 + target_link_libraries(comp_main PRIVATE PkgConfig::LIBDRM) 219 209 endif() 220 210 221 - foreach(WL_PROTO_XML ${WL_PROTOS_XML}) 222 - get_filename_component(WL_PROTO ${WL_PROTO_XML} NAME_WE) 211 + foreach(wl_proto_xml ${WL_PROTOS_XML}) 212 + get_filename_component(WL_PROTO ${wl_proto_xml} NAME_WE) 223 213 224 214 set(WL_PROTO_C "${WL_PROTOS_DIR}/${WL_PROTO}.c") 225 215 set(WL_PROTO_H "${WL_PROTOS_DIR}/${WL_PROTO}-client-protocol.h") 226 216 227 217 add_custom_command( 218 + OUTPUT "${WL_PROTO_C}" 228 219 COMMAND 229 - ${WL_SCANNER} private-code "${WL_PROTO_XML}" "${WL_PROTO_C}" 230 - OUTPUT "${WL_PROTO_C}" VERBATIM) 220 + "${WL_SCANNER}" private-code "${wl_proto_xml}" 221 + "${WL_PROTO_C}" 222 + VERBATIM 223 + DEPENDS "${WL_SCANNER}" "${wl_proto_xml}" 224 + COMMENT "Generating ${WL_PROTO_C}" 225 + ) 231 226 232 227 add_custom_command( 228 + OUTPUT "${WL_PROTO_H}" 233 229 COMMAND 234 - ${WL_SCANNER} client-header "${WL_PROTO_XML}" "${WL_PROTO_H}" 235 - OUTPUT "${WL_PROTO_H}" VERBATIM) 236 - 237 - list(APPEND MAIN_SOURCE_FILES 238 - ${WL_PROTO_C} 239 - ${WL_PROTO_H} 230 + "${WL_SCANNER}" client-header "${wl_proto_xml}" 231 + "${WL_PROTO_H}" 232 + VERBATIM 233 + DEPENDS "${WL_SCANNER}" "${wl_proto_xml}" 234 + COMMENT "Generating ${WL_PROTO_H}" 240 235 ) 241 - endforeach() 242 236 243 - endif() 244 - if(ANDROID) 245 - list(APPEND MAIN_SOURCE_FILES 246 - main/comp_window_android.c 247 - ) 248 - endif() 249 - 250 - add_library(comp_main STATIC ${MAIN_SOURCE_FILES}) 251 - target_link_libraries(comp_main PUBLIC xrt-interfaces PRIVATE aux_util aux_os aux_vk comp_util comp_render) 252 - target_include_directories(comp_main PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) 253 - 254 - if(XRT_HAVE_WAYLAND) 255 - target_include_directories(comp_main SYSTEM PRIVATE ${WL_PROTOS_DIR}) 256 - target_link_libraries(comp_main PRIVATE 257 - ${WAYLAND_DEPS} ${WAYLAND_LIBRARIES} 258 - ) 259 - endif() 260 - if(XRT_HAVE_XCB) 261 - target_include_directories(comp_main SYSTEM PRIVATE ${XCB_INCLUDE_DIRS}) 262 - target_link_libraries(comp_main PRIVATE ${XCB_LIBRARIES}) 263 - endif() 237 + target_sources(comp_main PRIVATE ${WL_PROTO_C} ${WL_PROTO_H}) 238 + endforeach() 264 239 265 - if(XRT_HAVE_XCB AND XRT_HAVE_XLIB) 266 - target_link_libraries(comp_main PRIVATE ${X11_X11_LIB}) 267 - endif() 268 - if(XRT_HAVE_EGL AND XRT_HAVE_XCB) 269 - target_include_directories(comp_main SYSTEM PRIVATE ${EGL_INCLUDE_DIRS}) 270 - target_link_libraries(comp_main PRIVATE ${XCB_LIBRARIES}) 271 240 endif() 272 241 if(ANDROID) 242 + target_sources(comp_main PRIVATE main/comp_window_android.c) 273 243 target_link_libraries(comp_main PRIVATE aux_ogl aux_android) 274 244 endif() 275 245 endif() 276 246 277 - 278 247 ### 279 248 # Multi client compositor library 280 249 # 281 250 282 - add_library(comp_multi STATIC ${MULTI_SOURCE_FILES}) 283 - target_link_libraries(comp_multi PUBLIC xrt-interfaces PRIVATE aux_util aux_os) 251 + add_library( 252 + comp_multi STATIC multi/comp_multi_compositor.c multi/comp_multi_interface.h 253 + multi/comp_multi_private.h multi/comp_multi_system.c 254 + ) 255 + target_link_libraries( 256 + comp_multi 257 + PUBLIC xrt-interfaces 258 + PRIVATE aux_util aux_os 259 + ) 284 260 target_include_directories(comp_multi PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 285 - 286 261 287 262 if(XRT_FEATURE_COMPOSITOR_MAIN) 288 263 target_link_libraries(comp_main PRIVATE comp_multi)
+142 -112
src/xrt/drivers/CMakeLists.txt
··· 2 2 # 3 3 # SPDX-License-Identifier: BSL-1.0 4 4 5 - 6 5 set(ENABLED_HEADSET_DRIVERS) 7 6 set(ENABLED_DRIVERS) 7 + 8 + add_library(drv_includes INTERFACE) 9 + target_include_directories(drv_includes INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) 8 10 9 11 if(XRT_BUILD_DRIVER_ARDUINO) 10 - add_library(drv_arduino STATIC 11 - arduino/arduino_device.c 12 - arduino/arduino_interface.h 13 - arduino/arduino_prober.c) 12 + add_library( 13 + drv_arduino STATIC arduino/arduino_device.c arduino/arduino_interface.h 14 + arduino/arduino_prober.c 15 + ) 14 16 target_link_libraries(drv_arduino PRIVATE xrt-interfaces aux_util aux_os) 15 17 list(APPEND ENABLED_DRIVERS arduino) 16 18 endif() 17 19 18 20 if(XRT_BUILD_DRIVER_DAYDREAM) 19 - add_library(drv_daydream STATIC 20 - daydream/daydream_device.c 21 - daydream/daydream_device.h 22 - daydream/daydream_interface.h 23 - daydream/daydream_prober.c) 21 + add_library( 22 + drv_daydream STATIC daydream/daydream_device.c daydream/daydream_device.h 23 + daydream/daydream_interface.h daydream/daydream_prober.c 24 + ) 24 25 target_link_libraries(drv_daydream PRIVATE xrt-interfaces aux_util aux_os) 25 26 list(APPEND ENABLED_DRIVERS daydream) 26 27 endif() 27 28 28 29 if(XRT_BUILD_DRIVER_DEPTHAI) 29 - add_library(drv_depthai STATIC 30 - depthai/depthai_driver.cpp 31 - depthai/depthai_interface.h) 32 - target_link_libraries(drv_depthai PRIVATE 33 - xrt-interfaces 34 - aux_os 35 - ${OpenCV_LIBRARIES} 36 - depthai::opencv 37 - depthai::core 38 - XLink 30 + add_library(drv_depthai STATIC depthai/depthai_driver.cpp depthai/depthai_interface.h) 31 + target_link_libraries( 32 + drv_depthai 33 + PRIVATE 34 + xrt-interfaces 35 + aux_os 36 + ${OpenCV_LIBRARIES} 37 + depthai::opencv 38 + depthai::core 39 + XLink 39 40 ) 40 41 target_include_directories(drv_depthai PRIVATE ${OpenCV_INCLUDE_DIRS}) 41 42 list(APPEND ENABLED_DRIVERS depthai) 42 43 endif() 43 44 44 45 if(XRT_BUILD_DRIVER_DUMMY) 45 - add_library(drv_dummy STATIC 46 - dummy/dummy_hmd.c 47 - dummy/dummy_interface.h 48 - dummy/dummy_prober.c) 46 + add_library(drv_dummy STATIC dummy/dummy_hmd.c dummy/dummy_interface.h dummy/dummy_prober.c) 49 47 target_link_libraries(drv_dummy PRIVATE xrt-interfaces aux_util) 50 48 list(APPEND ENABLED_HEADSET_DRIVERS dummy) 51 49 endif() 52 50 53 51 if(XRT_BUILD_DRIVER_QWERTY) 54 - add_library(drv_qwerty STATIC 52 + add_library( 53 + drv_qwerty STATIC 55 54 qwerty/qwerty_device.c 56 55 qwerty/qwerty_device.h 57 56 qwerty/qwerty_interface.h 58 57 qwerty/qwerty_prober.c 59 - qwerty/qwerty_sdl.c) 60 - target_link_libraries(drv_qwerty PRIVATE 61 - xrt-interfaces 62 - aux_util 63 - ${SDL2_LIBRARIES} 64 - ) 65 - target_include_directories(drv_qwerty PRIVATE 66 - ${SDL2_INCLUDE_DIRS} 58 + qwerty/qwerty_sdl.c 67 59 ) 60 + target_link_libraries(drv_qwerty PRIVATE xrt-interfaces aux_util ${SDL2_LIBRARIES}) 61 + target_include_directories(drv_qwerty PRIVATE ${SDL2_INCLUDE_DIRS}) 68 62 list(APPEND ENABLED_DRIVERS qwerty) 69 63 70 64 add_library(drv_qwerty_includes INTERFACE) ··· 72 66 endif() 73 67 74 68 if(XRT_BUILD_DRIVER_HDK) 75 - set(HDK_SOURCE_FILES 69 + set(HDK_SOURCE_FILES) 70 + 71 + add_library( 72 + drv_hdk STATIC hdk/hdk_device.cpp hdk/hdk_device.h hdk/hdk_interface.h 73 + hdk/hdk_prober.c 76 74 ) 77 - 78 - add_library(drv_hdk STATIC 79 - hdk/hdk_device.cpp 80 - hdk/hdk_device.h 81 - hdk/hdk_interface.h 82 - hdk/hdk_prober.c) 83 75 target_link_libraries(drv_hdk PRIVATE xrt-interfaces aux_math) 84 76 list(APPEND ENABLED_HEADSET_DRIVERS hdk) 85 77 endif() 86 78 87 - 88 79 if(XRT_BUILD_DRIVER_HYDRA) 89 - set(HYDRA_SOURCE_FILES 90 - ) 80 + set(HYDRA_SOURCE_FILES) 91 81 92 - add_library(drv_hydra STATIC 93 - hydra/hydra_driver.c 94 - hydra/hydra_interface.h) 82 + add_library(drv_hydra STATIC hydra/hydra_driver.c hydra/hydra_interface.h) 95 83 target_link_libraries(drv_hydra PRIVATE xrt-interfaces aux_os) 96 84 list(APPEND ENABLED_DRIVERS hydra) 97 85 endif() 98 86 99 87 if(XRT_BUILD_DRIVER_NS) 100 - add_library(drv_ns STATIC 88 + add_library( 89 + drv_ns STATIC 101 90 north_star/distortion_3d/utility_northstar.h 102 91 north_star/distortion_3d/deformation_northstar.h 103 92 north_star/distortion_3d/deformation_northstar.cpp 104 93 north_star/ns_hmd.h 105 94 north_star/ns_hmd.c 106 95 north_star/ns_interface.h 107 - north_star/ns_prober.c) 96 + north_star/ns_prober.c 97 + ) 108 98 target_link_libraries(drv_ns PRIVATE xrt-interfaces aux_math xrt-external-cjson) 109 99 list(APPEND ENABLED_HEADSET_DRIVERS ns) 110 100 endif() 111 101 112 102 if(XRT_BUILD_DRIVER_ULV2) 113 - add_library(drv_ulv2 STATIC 114 - ultraleap_v2/ulv2_driver.cpp 115 - ultraleap_v2/ulv2_interface.h) 103 + add_library(drv_ulv2 STATIC ultraleap_v2/ulv2_driver.cpp ultraleap_v2/ulv2_interface.h) 116 104 target_link_libraries(drv_ulv2 PRIVATE xrt-interfaces aux_util aux_math LeapV2::LeapV2) 117 105 endif() 118 106 119 107 if(XRT_BUILD_DRIVER_OHMD) 120 - add_library(drv_ohmd STATIC 121 - ohmd/oh_device.c 122 - ohmd/oh_device.h 123 - ohmd/oh_interface.h 124 - ohmd/oh_prober.c) 108 + add_library( 109 + drv_ohmd STATIC ohmd/oh_device.c ohmd/oh_device.h ohmd/oh_interface.h 110 + ohmd/oh_prober.c 111 + ) 125 112 target_link_libraries(drv_ohmd PRIVATE xrt-interfaces OpenHMD::OpenHMD aux_util aux_math) 126 113 list(APPEND ENABLED_HEADSET_DRIVERS openhmd) 127 114 endif() 128 115 129 - 130 - 131 116 if(XRT_BUILD_DRIVER_PSMV) 132 - add_library(drv_psmv STATIC 133 - psmv/psmv_driver.c 134 - psmv/psmv_interface.h) 135 - target_link_libraries(drv_psmv PRIVATE xrt-interfaces PUBLIC aux_os aux_tracking) 117 + add_library(drv_psmv STATIC psmv/psmv_driver.c psmv/psmv_interface.h) 118 + target_link_libraries( 119 + drv_psmv 120 + PRIVATE xrt-interfaces 121 + PUBLIC aux_os aux_tracking 122 + ) 136 123 list(APPEND ENABLED_DRIVERS psmv) 137 124 endif() 138 125 139 126 if(XRT_BUILD_DRIVER_PSVR) 140 - add_library(drv_psvr STATIC 127 + add_library( 128 + drv_psvr STATIC 141 129 psvr/psvr_device.c 142 130 psvr/psvr_device.h 143 131 psvr/psvr_interface.h 144 132 psvr/psvr_packet.c 145 - psvr/psvr_prober.c) 133 + psvr/psvr_prober.c 134 + ) 146 135 target_link_libraries(drv_psvr PRIVATE xrt-interfaces HIDAPI::hidapi aux_util) 147 136 target_include_directories(drv_psvr PRIVATE ${HIDAPI_INCLUDE_DIRS}) 148 137 list(APPEND ENABLED_HEADSET_DRIVERS psvr) 149 138 endif() 150 139 151 140 if(XRT_BUILD_DRIVER_RS) 152 - add_library(drv_rs STATIC 141 + add_library( 142 + drv_rs STATIC 153 143 realsense/rs_ddev.c 154 144 realsense/rs_hdev.c 155 145 realsense/rs_prober.c 156 146 realsense/rs_driver.h 157 - realsense/rs_interface.h) 147 + realsense/rs_interface.h 148 + ) 158 149 target_link_libraries(drv_rs PRIVATE xrt-interfaces realsense2::realsense2 aux_util) 159 150 list(APPEND ENABLED_HEADSET_DRIVERS rs) 160 151 endif() 161 152 162 153 if(XRT_BUILD_DRIVER_REMOTE) 163 - add_library(drv_remote STATIC 154 + add_library( 155 + drv_remote STATIC 164 156 remote/r_device.c 165 157 remote/r_hmd.c 166 158 remote/r_hub.c 167 159 remote/r_interface.h 168 - remote/r_internal.h) 160 + remote/r_internal.h 161 + ) 169 162 target_link_libraries(drv_remote PRIVATE xrt-interfaces aux_util) 170 163 list(APPEND ENABLED_HEADSET_DRIVERS remote) 171 164 endif() 172 165 173 166 set(VIVE_CONFIG_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/vive") 174 167 if(XRT_BUILD_DRIVER_VIVE) 175 - add_library(drv_vive STATIC 168 + add_library( 169 + drv_vive STATIC 176 170 vive/vive_device.h 177 171 vive/vive_device.c 178 172 vive/vive_prober.h ··· 182 176 vive/vive_controller.h 183 177 vive/vive_controller.c 184 178 vive/vive_lighthouse.h 185 - vive/vive_lighthouse.c) 186 - target_link_libraries(drv_vive PRIVATE xrt-interfaces aux_os aux_util aux_math xrt-external-cjson aux_vive) 179 + vive/vive_lighthouse.c 180 + ) 181 + target_link_libraries( 182 + drv_vive 183 + PRIVATE 184 + xrt-interfaces 185 + aux_os 186 + aux_util 187 + aux_math 188 + xrt-external-cjson 189 + aux_vive 190 + ) 187 191 target_link_libraries(drv_vive PRIVATE ${ZLIB_LIBRARIES}) 188 192 target_include_directories(drv_vive PRIVATE ${ZLIB_INCLUDE_DIRS}) 189 193 list(APPEND ENABLED_HEADSET_DRIVERS vive) 190 194 191 - if (XRT_BUILD_DRIVER_HANDTRACKING) 195 + if(XRT_BUILD_DRIVER_HANDTRACKING) 192 196 target_link_libraries(drv_vive PRIVATE drv_ht) 193 197 endif() 194 198 endif() 195 199 196 200 if(XRT_HAVE_V4L2) 197 201 add_library(drv_v4l2 STATIC v4l2/v4l2_driver.c) 198 - target_link_libraries(drv_v4l2 PRIVATE 199 - xrt-interfaces 200 - aux_os 201 - aux_util 202 - ) 202 + target_link_libraries(drv_v4l2 PRIVATE xrt-interfaces aux_os aux_util) 203 203 list(APPEND ENABLED_DRIVERS v4l2) 204 204 endif() 205 205 ··· 211 211 endif() 212 212 213 213 if(XRT_BUILD_DRIVER_HANDTRACKING) 214 - add_library(drv_ht STATIC 214 + add_library( 215 + drv_ht STATIC 215 216 ht/ht_algorithm.cpp 216 217 ht/ht_driver.cpp 217 218 ht/ht_driver.hpp ··· 219 220 ht/ht_models.cpp 220 221 ht/ht_hand_math.cpp 221 222 ht/ht_image_math.cpp 222 - ht/ht_nms.cpp) 223 - target_link_libraries(drv_ht PRIVATE xrt-interfaces aux_os aux_util aux_math aux_gstreamer ONNXRuntime::ONNXRuntime ${OpenCV_LIBRARIES}) 223 + ht/ht_nms.cpp 224 + ) 225 + target_link_libraries( 226 + drv_ht 227 + PRIVATE 228 + xrt-interfaces 229 + aux_os 230 + aux_util 231 + aux_math 232 + aux_gstreamer 233 + ONNXRuntime::ONNXRuntime 234 + ${OpenCV_LIBRARIES} 235 + ) 224 236 target_include_directories(drv_ht PRIVATE ${OpenCV_INCLUDE_DIRS} ${EIGEN3_INCLUDE_DIR}) 225 237 list(APPEND ENABLED_DRIVERS ht) 226 238 endif() 227 239 228 - if (XRT_BUILD_DRIVER_SURVIVE) 229 - add_library(drv_survive STATIC 230 - survive/survive_driver.c 231 - survive/survive_driver.h 232 - survive/survive_interface.h 233 - survive/survive_prober.c) 234 - target_link_libraries(drv_survive PRIVATE xrt-interfaces aux_os aux_util aux_math aux_vive PkgConfig::SURVIVE) 240 + if(XRT_BUILD_DRIVER_SURVIVE) 241 + add_library( 242 + drv_survive STATIC survive/survive_driver.c survive/survive_driver.h 243 + survive/survive_interface.h survive/survive_prober.c 244 + ) 245 + target_link_libraries( 246 + drv_survive 247 + PRIVATE 248 + xrt-interfaces 249 + aux_os 250 + aux_util 251 + aux_math 252 + aux_vive 253 + PkgConfig::SURVIVE 254 + ) 235 255 list(APPEND ENABLED_HEADSET_DRIVERS survive) 236 256 237 - if (XRT_BUILD_DRIVER_HANDTRACKING) 257 + if(XRT_BUILD_DRIVER_HANDTRACKING) 238 258 target_link_libraries(drv_survive PRIVATE drv_ht) 239 259 endif() 240 260 endif() 241 261 242 262 if(XRT_BUILD_DRIVER_ANDROID) 243 - add_library(drv_android STATIC 244 - android/android_prober.c 245 - android/android_prober.h 246 - android/android_sensors.c 247 - android/android_sensors.h) 248 - target_link_libraries(drv_android PRIVATE xrt-interfaces aux_util aux_os aux_android ${ANDROID_LIBRARY}) 263 + add_library( 264 + drv_android STATIC android/android_prober.c android/android_prober.h 265 + android/android_sensors.c android/android_sensors.h 266 + ) 267 + target_link_libraries( 268 + drv_android 269 + PRIVATE 270 + xrt-interfaces 271 + aux_util 272 + aux_os 273 + aux_android 274 + ${ANDROID_LIBRARY} 275 + ) 249 276 list(APPEND ENABLED_DRIVERS android) 250 277 endif() 251 278 252 - if (XRT_BUILD_DRIVER_ILLIXR) 253 - add_library(drv_illixr STATIC 279 + if(XRT_BUILD_DRIVER_ILLIXR) 280 + add_library( 281 + drv_illixr STATIC 254 282 illixr/illixr_device.cpp 255 283 illixr/illixr_interface.h 256 284 illixr/illixr_prober.c 257 285 illixr/illixr_component.cpp 258 - illixr/illixr_component.h) 286 + illixr/illixr_component.h 287 + ) 259 288 target_link_libraries(drv_illixr PUBLIC ${CMAKE_DL_LIBS} xrt-interfaces aux_util aux_os) 260 289 target_include_directories(drv_illixr PUBLIC ${ILLIXR_PATH}) 261 290 list(APPEND ENABLED_HEADSET_DRIVERS illixr) 262 291 endif() 263 292 264 - add_library(drv_multi STATIC 265 - multi_wrapper/multi.c 266 - multi_wrapper/multi.h) 293 + add_library(drv_multi STATIC multi_wrapper/multi.c multi_wrapper/multi.h) 267 294 target_link_libraries(drv_multi PUBLIC xrt-interfaces aux_util) 268 295 list(APPEND ENABLED_HEADSET_DRIVERS drv_multi) 269 296 270 297 if(XRT_BUILD_DRIVER_WMR) 271 - add_library(drv_wmr STATIC 298 + add_library( 299 + drv_wmr STATIC 272 300 wmr/wmr_common.h 273 301 wmr/wmr_config.c 274 302 wmr/wmr_config.h ··· 277 305 wmr/wmr_interface.h 278 306 wmr/wmr_prober.c 279 307 wmr/wmr_protocol.c 280 - wmr/wmr_protocol.h) 308 + wmr/wmr_protocol.h 309 + ) 281 310 target_link_libraries(drv_wmr PRIVATE xrt-interfaces aux_util aux_math xrt-external-cjson) 282 311 list(APPEND ENABLED_HEADSET_DRIVERS wmr) 283 312 endif() 284 313 285 314 if(XRT_BUILD_DRIVER_EUROC) 286 - add_library(drv_euroc STATIC 287 - euroc/euroc_player.cpp 288 - euroc/euroc_driver.h 289 - euroc/euroc_device.c 290 - euroc/euroc_interface.h) 291 - target_link_libraries(drv_euroc PRIVATE xrt-interfaces aux_util aux_tracking ${OpenCV_LIBRARIES}) 315 + add_library( 316 + drv_euroc STATIC euroc/euroc_player.cpp euroc/euroc_driver.h euroc/euroc_device.c 317 + euroc/euroc_interface.h 318 + ) 319 + target_link_libraries( 320 + drv_euroc PRIVATE xrt-interfaces aux_util aux_tracking ${OpenCV_LIBRARIES} 321 + ) 292 322 target_include_directories(drv_euroc PRIVATE ${OpenCV_INCLUDE_DIRS}) 293 323 list(APPEND ENABLED_DRIVERS euroc) 294 324 endif() ··· 296 326 if(XRT_BUILD_SAMPLES) 297 327 # We build the sample driver to make sure it stays valid, 298 328 # but it never gets linked into a final target. 299 - add_library(drv_sample STATIC 300 - sample/sample_hmd.c 301 - sample/sample_interface.h 302 - sample/sample_prober.c) 329 + add_library( 330 + drv_sample STATIC sample/sample_hmd.c sample/sample_interface.h 331 + sample/sample_prober.c 332 + ) 303 333 target_link_libraries(drv_sample PRIVATE xrt-interfaces aux_util) 304 334 endif() 305 335
+3 -1
src/xrt/include/CMakeLists.txt
··· 4 4 add_subdirectory(xrt) 5 5 6 6 add_library(xrt-interfaces INTERFACE) 7 - target_include_directories(xrt-interfaces INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) 7 + target_include_directories( 8 + xrt-interfaces INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} 9 + )
+9 -14
src/xrt/include/xrt/CMakeLists.txt
··· 1 - # Copyright 2020, Collabora, Ltd. 1 + # Copyright 2020-2021, Collabora, Ltd. 2 2 # SPDX-License-Identifier: BSL-1.0 3 3 4 4 # Generate a header containing defines for each enabled driver 5 5 set(FILE_CONTENTS "") 6 - foreach(DRIVER ${AVAILABLE_DRIVERS}) 7 - if(XRT_BUILD_DRIVER_${DRIVER}) 8 - string(APPEND FILE_CONTENTS "#define XRT_BUILD_DRIVER_${DRIVER}\n") 6 + foreach(driver ${AVAILABLE_DRIVERS}) 7 + if(XRT_BUILD_DRIVER_${driver}) 8 + string(APPEND FILE_CONTENTS "#define XRT_BUILD_DRIVER_${driver}\n") 9 9 endif() 10 10 endforeach() 11 11 12 12 # First setup all of the config headers. 13 13 configure_file( 14 14 ${CMAKE_CURRENT_SOURCE_DIR}/xrt_config_drivers.h.cmake_in 15 - ${CMAKE_CURRENT_BINARY_DIR}/xrt_config_drivers.h 16 - @ONLY 15 + ${CMAKE_CURRENT_BINARY_DIR}/xrt_config_drivers.h @ONLY 17 16 ) 18 17 configure_file( 19 18 ${CMAKE_CURRENT_SOURCE_DIR}/xrt_config_have.h.cmake_in 20 - ${CMAKE_CURRENT_BINARY_DIR}/xrt_config_have.h 21 - @ONLY 19 + ${CMAKE_CURRENT_BINARY_DIR}/xrt_config_have.h @ONLY 22 20 ) 23 21 configure_file( 24 22 ${CMAKE_CURRENT_SOURCE_DIR}/xrt_config_build.h.cmake_in 25 - ${CMAKE_CURRENT_BINARY_DIR}/xrt_config_build.h 26 - @ONLY 23 + ${CMAKE_CURRENT_BINARY_DIR}/xrt_config_build.h @ONLY 27 24 ) 28 25 configure_file( 29 26 ${CMAKE_CURRENT_SOURCE_DIR}/xrt_config_vulkan.h.cmake_in 30 - ${CMAKE_CURRENT_BINARY_DIR}/xrt_config_vulkan.h 31 - @ONLY 27 + ${CMAKE_CURRENT_BINARY_DIR}/xrt_config_vulkan.h @ONLY 32 28 ) 33 29 34 30 configure_file( 35 31 ${CMAKE_CURRENT_SOURCE_DIR}/xrt_config_android.h.cmake_in 36 - ${CMAKE_CURRENT_BINARY_DIR}/xrt_config_android.h 37 - @ONLY 32 + ${CMAKE_CURRENT_BINARY_DIR}/xrt_config_android.h @ONLY 38 33 )
+63 -81
src/xrt/ipc/CMakeLists.txt
··· 1 - # Copyright 2020, Collabora, Ltd. 1 + # Copyright 2020-2021, Collabora, Ltd. 2 2 # SPDX-License-Identifier: BSL-1.0 3 - 4 3 5 4 ### 6 5 # Generator 7 6 8 - function(proto_gen output) 9 - add_custom_command(OUTPUT ${output} 10 - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/shared/proto.py 7 + foreach( 8 + fn 9 + ipc_protocol_generated.h 10 + ipc_client_generated.h 11 + ipc_client_generated.c 12 + ipc_server_generated.h 13 + ipc_server_generated.c 14 + ) 15 + add_custom_command( 16 + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${fn}" 17 + COMMAND 18 + ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/shared/proto.py 11 19 ${CMAKE_CURRENT_SOURCE_DIR}/shared/proto.json 12 - ${output} 13 - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/shared/proto.py 20 + "${CMAKE_CURRENT_BINARY_DIR}/${fn}" 21 + VERBATIM 22 + DEPENDS 23 + ${CMAKE_CURRENT_SOURCE_DIR}/shared/proto.py 14 24 ${CMAKE_CURRENT_SOURCE_DIR}/shared/ipcproto/common.py 15 25 ${CMAKE_CURRENT_SOURCE_DIR}/shared/proto.json 16 - ) 17 - endfunction(proto_gen) 18 - 19 - proto_gen(${CMAKE_CURRENT_BINARY_DIR}/ipc_protocol_generated.h) 20 - proto_gen(${CMAKE_CURRENT_BINARY_DIR}/ipc_client_generated.h) 21 - proto_gen(${CMAKE_CURRENT_BINARY_DIR}/ipc_client_generated.c) 22 - proto_gen(${CMAKE_CURRENT_BINARY_DIR}/ipc_server_generated.h) 23 - proto_gen(${CMAKE_CURRENT_BINARY_DIR}/ipc_server_generated.c) 26 + COMMENT "Generating ${fn} from protocol JSON description" 27 + ) 28 + endforeach() 24 29 25 30 set(IPC_COMMON_SOURCES 26 - ${CMAKE_CURRENT_BINARY_DIR}/ipc_protocol_generated.h 27 - shared/ipc_shmem.c 28 - shared/ipc_shmem.h 29 - shared/ipc_utils.c 30 - shared/ipc_utils.h) 31 + ${CMAKE_CURRENT_BINARY_DIR}/ipc_protocol_generated.h 32 + shared/ipc_shmem.c 33 + shared/ipc_shmem.h 34 + shared/ipc_utils.c 35 + shared/ipc_utils.h 36 + ) 37 + 38 + add_library(ipc_shared STATIC ${IPC_COMMON_SOURCES}) 39 + target_include_directories( 40 + ipc_shared PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} 41 + ) 42 + target_link_libraries(ipc_shared PRIVATE aux_util) 43 + 44 + if(RT_LIBRARY) 45 + target_link_libraries(ipc_shared PUBLIC ${RT_LIBRARY}) 46 + endif() 47 + 31 48 ### 32 49 # Client 33 50 34 - add_library(ipc_client STATIC 51 + add_library( 52 + ipc_client STATIC 35 53 ${CMAKE_CURRENT_BINARY_DIR}/ipc_client_generated.c 36 54 ${CMAKE_CURRENT_BINARY_DIR}/ipc_client_generated.h 37 - ${IPC_COMMON_SOURCES} 38 55 client/ipc_client.h 39 56 client/ipc_client_compositor.c 40 57 client/ipc_client_device.c 41 58 client/ipc_client_hmd.c 42 59 client/ipc_client_instance.c 43 60 ) 44 - target_include_directories(ipc_client INTERFACE 45 - ${CMAKE_CURRENT_SOURCE_DIR} 46 - ${CMAKE_CURRENT_BINARY_DIR} 47 - ) 48 - target_include_directories(ipc_client PRIVATE 49 - ${CMAKE_CURRENT_SOURCE_DIR} 50 - ${CMAKE_CURRENT_BINARY_DIR} 51 - ) 52 - target_link_libraries(ipc_client PRIVATE 53 - aux_util 61 + target_include_directories( 62 + ipc_client PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} 54 63 ) 55 - if(ANDROID) 56 - endif() 64 + target_link_libraries(ipc_client PRIVATE aux_util ipc_shared) 57 65 58 66 ### 59 67 # Server 60 68 61 - add_library(ipc_server STATIC 69 + add_library( 70 + ipc_server STATIC 62 71 ${CMAKE_CURRENT_BINARY_DIR}/ipc_server_generated.c 63 72 ${CMAKE_CURRENT_BINARY_DIR}/ipc_server_generated.h 64 - ${IPC_COMMON_SOURCES} 65 73 server/ipc_server.h 66 74 server/ipc_server_handler.c 67 75 server/ipc_server_per_client_thread.c 68 76 server/ipc_server_process.c 69 77 ) 70 - target_include_directories(ipc_server 71 - INTERFACE 72 - ${CMAKE_CURRENT_SOURCE_DIR} 73 - ${CMAKE_CURRENT_BINARY_DIR} 74 - ) 75 - target_include_directories(ipc_server PRIVATE 76 - ${CMAKE_CURRENT_SOURCE_DIR}/../compositor 77 - ${CMAKE_CURRENT_SOURCE_DIR} 78 - ${CMAKE_CURRENT_BINARY_DIR} 79 - ) 80 - target_link_libraries(ipc_server PRIVATE 81 - aux_util 78 + target_include_directories( 79 + ipc_server 80 + PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} 81 + PRIVATE ${CMAKE_CURRENT_BINARY_DIR} 82 82 ) 83 - 84 - if(RT_LIBRARY) 85 - target_link_libraries(ipc_client PRIVATE 86 - ${RT_LIBRARY} 87 - ) 88 - target_link_libraries(ipc_server PRIVATE 89 - ${RT_LIBRARY} 90 - ) 91 - endif() 83 + target_link_libraries(ipc_server PRIVATE aux_util ipc_shared) 92 84 93 85 if(XRT_HAVE_SYSTEMD) 94 - target_include_directories(ipc_server PRIVATE 95 - ${SYSTEMD_INCLUDE_DIRS}) 96 - target_link_libraries(ipc_server PRIVATE 97 - ${SYSTEMD_LIBRARIES}) 86 + target_include_directories(ipc_server PRIVATE ${SYSTEMD_INCLUDE_DIRS}) 87 + target_link_libraries(ipc_server PRIVATE ${SYSTEMD_LIBRARIES}) 98 88 endif() 99 89 100 90 if(ANDROID) 101 - add_library(ipc_android STATIC 91 + add_library( 92 + ipc_android STATIC 102 93 android/ipc_client_android.cpp 103 94 android/ipc_client_android.h 104 95 android/org.freedesktop.monado.ipc.cpp 105 96 android/org.freedesktop.monado.ipc.hpp 106 97 android/org.freedesktop.monado.ipc.impl.hpp 107 98 ) 108 - target_link_libraries(ipc_android PUBLIC 109 - xrt-external-jni-wrap 110 - xrt-external-jnipp 111 - aux_android 99 + target_link_libraries( 100 + ipc_android PUBLIC xrt-external-jni-wrap xrt-external-jnipp aux_android 112 101 ) 113 - target_sources(ipc_server PRIVATE 114 - ${CMAKE_CURRENT_SOURCE_DIR}/server/ipc_server_mainloop_android.c 115 - ) 116 - target_link_libraries(ipc_server PUBLIC 117 - ${ANDROID_LIBRARY} 118 - PRIVATE 119 - aux_android 120 - ipc_android 102 + target_sources( 103 + ipc_server PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/server/ipc_server_mainloop_android.c 121 104 ) 122 - target_link_libraries(ipc_client PUBLIC 123 - ${ANDROID_LIBRARY} 124 - PRIVATE 125 - aux_android 126 - ipc_android 105 + target_link_libraries( 106 + ipc_shared 107 + PUBLIC ${ANDROID_LIBRARY} 108 + PRIVATE aux_android ipc_android 127 109 ) 128 110 elseif(XRT_HAVE_LINUX) 129 - target_sources(ipc_server PRIVATE 130 - ${CMAKE_CURRENT_SOURCE_DIR}/server/ipc_server_mainloop_linux.c 111 + target_sources( 112 + ipc_server PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/server/ipc_server_mainloop_linux.c 131 113 ) 132 114 endif()
+14 -11
src/xrt/state_trackers/gui/CMakeLists.txt
··· 23 23 gui_window_record.h 24 24 ) 25 25 26 - target_link_libraries(st_gui PRIVATE xrt-external-stb aux_util aux_os aux_ogl) 27 - target_include_directories(st_gui PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/../../drivers) 26 + target_link_libraries( 27 + st_gui 28 + PRIVATE 29 + xrt-external-stb 30 + aux_util 31 + aux_os 32 + aux_ogl 33 + drv_includes 34 + xrt-external-imgui 35 + ) 36 + target_include_directories(st_gui INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/..) 28 37 29 38 if(XRT_HAVE_GST) 30 - target_link_libraries(st_gui PRIVATE 31 - aux_gstreamer 32 - ) 39 + target_link_libraries(st_gui PRIVATE aux_gstreamer) 33 40 endif() 34 41 35 42 if(XRT_BUILD_DRIVER_DEPTHAI) 36 - target_link_libraries(st_gui PRIVATE 37 - drv_depthai 38 - ) 43 + target_link_libraries(st_gui PRIVATE drv_depthai) 39 44 endif() 40 45 41 46 if(XRT_BUILD_DRIVER_REMOTE) 42 - target_link_libraries(st_gui PRIVATE 43 - drv_remote 44 - ) 47 + target_link_libraries(st_gui PRIVATE drv_remote) 45 48 endif() 46 49 47 50 if(XRT_HAVE_SDL2)
+32 -48
src/xrt/state_trackers/oxr/CMakeLists.txt
··· 1 - # Copyright 2019-2020, Collabora, Ltd. 1 + # Copyright 2019-2021, Collabora, Ltd. 2 2 # SPDX-License-Identifier: BSL-1.0 3 3 4 4 ### 5 5 # Main code 6 6 # 7 7 8 - set(OXR_SOURCE_FILES 8 + add_library( 9 + st_oxr STATIC 9 10 oxr_api_action.c 10 11 oxr_api_funcs.h 11 12 oxr_api_instance.c ··· 39 40 ) 40 41 41 42 if(XRT_HAVE_VULKAN) 42 - list(APPEND OXR_SOURCE_FILES 43 - oxr_session_gfx_vk.c 44 - oxr_swapchain_vk.c 45 - oxr_vulkan.c 46 - ) 43 + target_sources(st_oxr PRIVATE oxr_session_gfx_vk.c oxr_swapchain_vk.c oxr_vulkan.c) 44 + target_link_libraries(st_oxr PUBLIC Vulkan::Vulkan) 47 45 endif() 48 46 49 47 if(XRT_HAVE_OPENGL) 50 - add_definitions(-DXR_USE_GRAPHICS_API_OPENGL) 48 + target_compile_definitions(st_oxr PRIVATE XR_USE_GRAPHICS_API_OPENGL) 51 49 endif() 52 50 if(XRT_HAVE_OPENGLES) 53 - add_definitions(-DXR_USE_GRAPHICS_API_OPENGL_ES) 51 + target_compile_definitions(st_oxr PRIVATE XR_USE_GRAPHICS_API_OPENGL_ES) 54 52 endif() 55 53 56 54 if(XRT_HAVE_OPENGL OR XRT_HAVE_OPENGLES) 57 - list(APPEND OXR_SOURCE_FILES 58 - oxr_session_gfx_gl.c 59 - oxr_swapchain_gl.c 60 - ) 55 + target_sources(st_oxr PRIVATE oxr_session_gfx_gl.c oxr_swapchain_gl.c) 56 + target_link_libraries(st_oxr PUBLIC aux_ogl) 61 57 endif() 62 58 63 59 if(XRT_HAVE_XLIB) 64 - add_definitions(-DXR_USE_PLATFORM_XLIB) 60 + target_compile_definitions(st_oxr PRIVATE XR_USE_PLATFORM_XLIB) 65 61 endif() 66 62 67 63 if(XRT_HAVE_EGL) 68 - add_definitions(-DXR_USE_PLATFORM_EGL) 69 - list(APPEND OXR_SOURCE_FILES 70 - oxr_session_gfx_egl.c 71 - ) 64 + target_compile_definitions(st_oxr PRIVATE XR_USE_PLATFORM_EGL) 65 + target_sources(st_oxr PRIVATE oxr_session_gfx_egl.c) 72 66 endif() 73 67 74 - 75 68 if(ANDROID) 76 - add_definitions(-DXR_USE_PLATFORM_ANDROID) 77 - list(APPEND OXR_SOURCE_FILES 78 - oxr_session_gfx_gles_android.c 79 - ) 80 - endif() 81 - 82 - add_library(st_oxr STATIC ${OXR_SOURCE_FILES}) 83 - target_link_libraries(st_oxr PRIVATE 84 - xrt-interfaces 85 - xrt-external-openxr 86 - aux_util 87 - aux_math 88 - aux_generated_bindings 89 - comp_client 90 - aux-includes 91 - PUBLIC 92 - aux_os 93 - ) 94 - if(XRT_HAVE_VULKAN) 95 - target_link_libraries(st_oxr PUBLIC Vulkan::Vulkan) 96 - endif() 97 - if(XRT_HAVE_OPENGL OR XRT_HAVE_OPENGLES) 98 - target_link_libraries(st_oxr PUBLIC aux_ogl) 99 - endif() 100 - if(ANDROID) 69 + target_compile_definitions(st_oxr PRIVATE XR_USE_PLATFORM_ANDROID) 70 + target_sources(st_oxr PRIVATE oxr_session_gfx_gles_android.c) 101 71 target_link_libraries(st_oxr PRIVATE aux_android) 102 72 endif() 103 - target_include_directories(st_oxr 73 + 74 + target_link_libraries( 75 + st_oxr 104 76 PRIVATE 105 - ${CMAKE_CURRENT_BINARY_DIR} 106 - INTERFACE 107 - ${CMAKE_CURRENT_SOURCE_DIR}/..) 77 + xrt-interfaces 78 + xrt-external-openxr 79 + aux_util 80 + aux_math 81 + aux_generated_bindings 82 + comp_client 83 + aux-includes 84 + PUBLIC aux_os 85 + ) 86 + 87 + target_include_directories( 88 + st_oxr 89 + PRIVATE ${CMAKE_CURRENT_BINARY_DIR} 90 + INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/.. 91 + )
+26 -68
src/xrt/state_trackers/prober/CMakeLists.txt
··· 1 - # Copyright 2019-2020, Collabora, Ltd. 1 + # Copyright 2019-2021, Collabora, Ltd. 2 2 # SPDX-License-Identifier: BSL-1.0 3 3 4 - set(PROBER_INCLUDES) 5 - 6 - set(PROBER_SOURCE_FILES 4 + add_library( 5 + st_prober STATIC 7 6 p_documentation.h 8 7 p_dump.c 9 8 p_prober.c ··· 11 10 p_tracking.c 12 11 ) 13 12 13 + target_link_libraries(st_prober PUBLIC xrt-interfaces) 14 + target_link_libraries( 15 + st_prober 16 + PRIVATE 17 + drv_includes 18 + drv_multi 19 + aux_util 20 + aux_os 21 + aux_tracking 22 + ) 23 + 14 24 # Add libudev 15 25 if(XRT_HAVE_LIBUDEV) 16 - list(APPEND PROBER_SOURCE_FILES 17 - p_udev.c 18 - ) 26 + target_sources(st_prober PRIVATE p_udev.c) 27 + target_include_directories(st_prober PRIVATE ${UDEV_INCLUDE_DIRS}) 28 + target_link_libraries(st_prober PRIVATE ${UDEV_LIBRARIES}) 19 29 endif() 20 30 21 31 # Add libusb 22 32 if(XRT_HAVE_LIBUSB) 23 - list(APPEND PROBER_SOURCE_FILES 24 - p_libusb.c 25 - ) 33 + target_sources(st_prober PRIVATE p_libusb.c) 34 + target_include_directories(st_prober PUBLIC ${LIBUSB1_INCLUDE_DIRS}) 35 + target_link_libraries(st_prober PRIVATE ${LIBUSB1_LIBRARIES}) 26 36 endif() 27 37 28 38 # Add libuvc 29 39 if(XRT_HAVE_LIBUVC) 30 - list(APPEND PROBER_SOURCE_FILES 31 - p_libuvc.c 32 - ) 33 - endif() 34 - 35 - add_library(st_prober STATIC 36 - ${PROBER_SOURCE_FILES} 37 - ) 38 - target_link_libraries(st_prober PUBLIC 39 - xrt-interfaces 40 - ) 41 - target_link_libraries(st_prober PRIVATE 42 - drv_multi 43 - aux_util 44 - aux_os 45 - aux_tracking 46 - ) 47 - target_include_directories(st_prober PRIVATE 48 - ${CMAKE_CURRENT_SOURCE_DIR}/../../drivers 49 - ) 50 - 51 - if(XRT_HAVE_LIBUDEV) 52 - target_include_directories(st_prober 53 - PRIVATE 54 - ${UDEV_INCLUDE_DIRS} 55 - ) 56 - target_link_libraries(st_prober PRIVATE 57 - ${UDEV_LIBRARIES} 58 - ) 59 - endif() 60 - 61 - if(XRT_HAVE_LIBUSB) 62 - target_include_directories(st_prober 63 - PUBLIC 64 - ${LIBUSB1_INCLUDE_DIRS} 65 - ) 66 - target_link_libraries(st_prober PRIVATE 67 - ${LIBUSB1_LIBRARIES} 68 - ) 69 - endif() 70 - 71 - if(XRT_HAVE_LIBUVC) 72 - target_include_directories(st_prober 73 - PRIVATE 74 - ${LIBUVC_INCLUDES} 75 - ) 76 - target_link_libraries(st_prober PRIVATE 77 - ${LIBUVC_LIBRARIES} 78 - ) 40 + target_sources(st_prober PRIVATE p_libuvc.c) 41 + target_include_directories(st_prober PRIVATE ${LIBUVC_INCLUDES}) 42 + target_link_libraries(st_prober PRIVATE ${LIBUVC_LIBRARIES}) 79 43 endif() 80 44 81 45 if(XRT_HAVE_V4L2) 82 46 # Uses v4l2_fs_create 83 - target_link_libraries(st_prober PRIVATE 84 - drv_v4l2 85 - ) 47 + target_link_libraries(st_prober PRIVATE drv_v4l2) 86 48 endif() 87 49 88 50 if(XRT_BUILD_DRIVER_REMOTE) 89 - target_link_libraries(st_prober PRIVATE 90 - drv_remote 91 - ) 51 + target_link_libraries(st_prober PRIVATE drv_remote) 92 52 endif() 93 53 94 54 if(XRT_BUILD_DRIVER_VF) 95 - target_link_libraries(st_prober PRIVATE 96 - drv_vf 97 - ) 55 + target_link_libraries(st_prober PRIVATE drv_vf) 98 56 endif()
+5 -16
src/xrt/state_trackers/steamvr_drv/CMakeLists.txt
··· 1 - # Copyright 2020, Collabora, Ltd. 1 + # Copyright 2020-2021, Collabora, Ltd. 2 2 # SPDX-License-Identifier: BSL-1.0 3 3 4 - set(OVRD_SOURCE_FILES 5 - ovrd_driver.cpp 6 - ovrd_interface.h 7 - ) 4 + add_library(st_ovrd STATIC ovrd_driver.cpp ovrd_interface.h) 8 5 9 - add_library(st_ovrd STATIC 10 - ${OVRD_SOURCE_FILES} 11 - ) 12 - target_include_directories(st_ovrd INTERFACE 13 - ${CMAKE_CURRENT_SOURCE_DIR} 14 - ) 15 - target_link_libraries(st_ovrd PRIVATE 16 - xrt-interfaces 17 - xrt-external-openvr 18 - aux_math 19 - aux_generated_bindings 6 + target_include_directories(st_ovrd INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) 7 + target_link_libraries( 8 + st_ovrd PRIVATE xrt-interfaces xrt-external-openvr aux_math aux_generated_bindings 20 9 )
-1
src/xrt/targets/CMakeLists.txt
··· 5 5 # This is where we collect all of the pieces from the different parts of 6 6 # the source tree and build a complete driver or integration part. 7 7 8 - 9 8 add_subdirectory(common) 10 9 11 10 if(XRT_FEATURE_OPENXR)
+7 -23
src/xrt/targets/cli/CMakeLists.txt
··· 4 4 ###### 5 5 # Create a cli interface for Monado. 6 6 7 - 8 - set(SOURCE_FILES 7 + add_executable( 8 + cli 9 9 cli_cmd_lighthouse.c 10 10 cli_cmd_probe.c 11 11 cli_cmd_test.c 12 12 cli_common.h 13 13 cli_main.c 14 14 ) 15 + add_sanitizers(cli) 15 16 16 17 if(NOT WIN32) 17 18 # No getline on Windows, so until we have a portable impl 18 - list(APPEND SOURCE_FILES 19 - cli_cmd_calibrate.c 20 - ) 19 + target_sources(cli PRIVATE cli_cmd_calibrate.c) 21 20 endif() 22 21 23 - add_executable(cli 24 - ${SOURCE_FILES} 25 - ) 26 - add_sanitizers(cli) 27 - 28 - set_target_properties(cli PROPERTIES 29 - OUTPUT_NAME monado-cli 30 - PREFIX "" 31 - ) 22 + set_target_properties(cli PROPERTIES OUTPUT_NAME monado-cli PREFIX "") 32 23 33 - target_link_libraries(cli PRIVATE 34 - aux_os 35 - aux_util 36 - aux_math 37 - target_instance_no_comp 38 - ) 24 + target_link_libraries(cli PRIVATE aux_os aux_util aux_math target_instance_no_comp) 39 25 40 - install(TARGETS cli 41 - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 42 - ) 26 + install(TARGETS cli RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+30 -43
src/xrt/targets/common/CMakeLists.txt
··· 1 - # Copyright 2019-2020, Collabora, Ltd. 1 + # Copyright 2019-2021, Collabora, Ltd. 2 2 # SPDX-License-Identifier: BSL-1.0 3 - 4 3 5 4 #### 6 5 # Lists 7 6 # 8 7 9 - add_library(target_lists STATIC 10 - target_lists.c 8 + add_library(target_lists STATIC target_lists.c) 9 + target_link_libraries( 10 + target_lists 11 + PRIVATE 12 + xrt-interfaces 13 + aux_util # TODO Remove this after removing #include "util/u_time.h" from xrt_defines.h 14 + drv_includes 11 15 ) 12 - target_link_libraries(target_lists PRIVATE 13 - xrt-interfaces 14 - aux_util # TODO Remove this after removing #include "util/u_time.h" from xrt_defines.h 15 - ) 16 - target_include_directories(target_lists PRIVATE 17 - ${CMAKE_CURRENT_SOURCE_DIR}/../../drivers 18 - ) 19 - target_include_directories(target_lists PUBLIC 20 - ${CMAKE_CURRENT_SOURCE_DIR} 21 - ) 16 + target_include_directories(target_lists PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 22 17 23 18 if(XRT_BUILD_DRIVER_ARDUINO) 24 19 target_link_libraries(target_lists PRIVATE drv_arduino) ··· 114 109 # Instance 115 110 # 116 111 if(XRT_FEATURE_COMPOSITOR_MAIN) 117 - add_library(target_instance STATIC 118 - target_instance.c 119 - ) 120 - target_link_libraries(target_instance PRIVATE 121 - xrt-interfaces 122 - aux_util 123 - st_prober 124 - target_lists 125 - comp_main 126 - ) 127 - target_include_directories(target_instance PRIVATE 128 - ${CMAKE_CURRENT_SOURCE_DIR}/../../drivers 129 - ) 130 - target_include_directories(target_instance PUBLIC 131 - ${CMAKE_CURRENT_SOURCE_DIR} 112 + add_library(target_instance STATIC target_instance.c) 113 + target_link_libraries( 114 + target_instance 115 + PRIVATE 116 + xrt-interfaces 117 + aux_util 118 + st_prober 119 + target_lists 120 + comp_main 121 + drv_includes 132 122 ) 123 + target_include_directories(target_instance PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 133 124 endif() 134 125 135 126 #### 136 127 # Instance without Compositor 137 128 # 138 129 139 - add_library(target_instance_no_comp STATIC 140 - target_instance_no_comp.c 130 + add_library(target_instance_no_comp STATIC target_instance_no_comp.c) 131 + target_link_libraries( 132 + target_instance_no_comp 133 + PRIVATE 134 + xrt-interfaces 135 + aux_util 136 + st_prober 137 + target_lists 138 + drv_includes 141 139 ) 142 - target_link_libraries(target_instance_no_comp PRIVATE 143 - xrt-interfaces 144 - aux_util 145 - st_prober 146 - target_lists 147 - ) 148 - target_include_directories(target_instance_no_comp PRIVATE 149 - ${CMAKE_CURRENT_SOURCE_DIR}/../../drivers 150 - ) 151 - target_include_directories(target_instance_no_comp PUBLIC 152 - ${CMAKE_CURRENT_SOURCE_DIR} 153 - ) 140 + target_include_directories(target_instance_no_comp PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
+4 -15
src/xrt/targets/ctl/CMakeLists.txt
··· 1 1 # Copyright 2020-2021, Collabora, Ltd. 2 2 # SPDX-License-Identifier: BSL-1.0 3 3 4 - 5 - add_executable(monado-ctl 6 - main.c 7 - ) 4 + add_executable(monado-ctl main.c) 8 5 add_sanitizers(monado-ctl) 9 6 10 - target_include_directories(monado-ctl PRIVATE 11 - ipc 12 - ) 7 + target_include_directories(monado-ctl PRIVATE ipc) 13 8 14 - target_link_libraries(monado-ctl PRIVATE 15 - aux_util 16 - ipc_client 17 - ) 9 + target_link_libraries(monado-ctl PRIVATE aux_util ipc_client) 18 10 19 - install(TARGETS monado-ctl 20 - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 21 - ) 22 - 11 + install(TARGETS monado-ctl RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+8 -7
src/xrt/targets/gui/CMakeLists.txt
··· 11 11 12 12 target_link_libraries( 13 13 gui 14 - PRIVATE aux_os 15 - aux_ogl 16 - aux_util 17 - aux_math 18 - st_gui 19 - target_instance_no_comp 20 - xrt-external-imgui-sdl2 14 + PRIVATE 15 + aux_os 16 + aux_ogl 17 + aux_util 18 + aux_math 19 + st_gui 20 + target_instance_no_comp 21 + xrt-external-imgui-sdl2 21 22 ) 22 23 if(WIN32) 23 24 target_link_libraries(gui PRIVATE SDL2::SDL2main)
+56 -63
src/xrt/targets/openxr/CMakeLists.txt
··· 7 7 set(RUNTIME_BARE_SUFFIX monado) 8 8 set(RUNTIME_SUFFIX _${RUNTIME_BARE_SUFFIX}) 9 9 10 - set(RUNTIME_TARGET ${RUNTIME_PREFIX}openxr${RUNTIME_SUFFIX} CACHE INTERNAL "" FORCE) 10 + set(RUNTIME_TARGET 11 + ${RUNTIME_PREFIX}openxr${RUNTIME_SUFFIX} 12 + CACHE INTERNAL "" FORCE 13 + ) 11 14 12 15 # OpenXR 1.0 13 16 set(XR_API_MAJOR "1") 14 17 15 - set(SOURCE_FILES 16 - target.c 17 - oxr_sdl2_hack.c 18 - libopenxr.def 19 - ) 20 - 21 - # depends on above generated files 22 - add_library(${RUNTIME_TARGET} MODULE 23 - ${MANIFEST_DEV_PATH} 24 - ${MANIFEST_PATH} 25 - ${SOURCE_FILES} 26 - ) 18 + add_library(${RUNTIME_TARGET} MODULE target.c libopenxr.def) 27 19 28 20 # Note: Order may matter in these lists! 29 - target_link_libraries(${RUNTIME_TARGET} PUBLIC 30 - aux_vk 31 - aux_os 32 - aux_util 33 - aux_math 34 - ) 35 - 36 - if(XRT_HAVE_OPENGL) 37 - target_link_libraries(${RUNTIME_TARGET} PUBLIC aux_ogl) 38 - endif() 39 - 40 - if(XRT_HAVE_SDL2) 41 - target_link_libraries(${RUNTIME_TARGET} PRIVATE st_gui xrt-external-imgui-sdl2 ${SDL2_LIBRARIES}) 42 - 43 - if(XRT_BUILD_DRIVER_QWERTY) 44 - target_link_libraries(${RUNTIME_TARGET} PRIVATE 45 - drv_qwerty 46 - drv_qwerty_includes 47 - ) 48 - endif() 49 - endif() 21 + target_link_libraries(${RUNTIME_TARGET} PUBLIC aux_vk aux_os aux_util aux_math) 50 22 51 23 if(XRT_FEATURE_SERVICE) 52 - target_link_libraries(${RUNTIME_TARGET} PUBLIC 53 - st_oxr 54 - ipc_client 55 - comp_client 56 - ) 24 + target_link_libraries(${RUNTIME_TARGET} PUBLIC st_oxr ipc_client comp_client) 57 25 else() 58 - target_link_libraries(${RUNTIME_TARGET} PUBLIC 59 - st_oxr 60 - st_prober 61 - target_lists 62 - target_instance 63 - comp_main 64 - comp_client 26 + target_link_libraries( 27 + ${RUNTIME_TARGET} 28 + PUBLIC 29 + st_oxr 30 + st_prober 31 + target_lists 32 + target_instance 33 + comp_main 34 + comp_client 65 35 ) 66 36 endif() 67 37 68 38 if(NOT MSVC) 69 39 # Force the main "negotiate" symbol's inclusion 70 40 # and use a version script to ensure that's the only one we expose. 71 - set_property(TARGET ${RUNTIME_TARGET} 41 + set_property( 42 + TARGET ${RUNTIME_TARGET} 72 43 APPEND_STRING 73 - PROPERTY LINK_FLAGS 74 - "-u xrNegotiateLoaderRuntimeInterface -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/libopenxr.version") 44 + PROPERTY 45 + LINK_FLAGS 46 + "-u xrNegotiateLoaderRuntimeInterface -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/libopenxr.version" 47 + ) 75 48 # Re-link if the version script changes. 76 - set_property(TARGET ${RUNTIME_TARGET} 49 + set_property( 50 + TARGET ${RUNTIME_TARGET} 77 51 APPEND 78 - PROPERTY LINK_DEPENDS 79 - "${CMAKE_CURRENT_SOURCE_DIR}/libopenxr.version") 52 + PROPERTY LINK_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/libopenxr.version" 53 + ) 80 54 endif() 81 - 82 55 83 56 # Install the runtime itself 84 - install(TARGETS ${RUNTIME_TARGET} 85 - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} 86 - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} 57 + install( 58 + TARGETS ${RUNTIME_TARGET} # 59 + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} # 60 + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} # 87 61 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 88 62 ) 89 - 90 - 91 - # $LIBPATH is a generator expression that is evaluated after configure_file, so we have to use file(GENERATE) instead 92 63 93 64 ### 94 65 # Generate runtime manifest with absolute path to runtime intended for development without installing ··· 116 87 set(DEV_MANIFEST_OUTPUT "${CMAKE_BINARY_DIR}/${RUNTIME_TARGET}-dev.json") 117 88 endif() 118 89 119 - file(GENERATE 90 + file( 91 + GENERATE 120 92 OUTPUT "${DEV_MANIFEST_OUTPUT}" 121 - INPUT ${CMAKE_CURRENT_BINARY_DIR}/intermediate_manifest.json) 93 + INPUT ${CMAKE_CURRENT_BINARY_DIR}/intermediate_manifest.json 94 + ) 122 95 123 96 ### 124 97 # Prepare the installable manifest: will be generated completely at install time, ··· 126 99 if(CMAKE_SYSTEM_NAME STREQUAL "Linux") 127 100 set(MANIFEST_RELATIVE_DIR share/openxr/${XR_API_MAJOR}/) 128 101 if(XRT_OPENXR_INSTALL_ACTIVE_RUNTIME) 129 - configure_file(active_runtime.cmake ${CMAKE_CURRENT_BINARY_DIR}/active_runtime.cmake @ONLY) 102 + configure_file( 103 + active_runtime.cmake ${CMAKE_CURRENT_BINARY_DIR}/active_runtime.cmake @ONLY 104 + ) 130 105 install(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/active_runtime.cmake) 131 106 endif() 132 107 elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows") ··· 137 112 # If we know where to install the manifest, we can set it up to be installed. 138 113 if(MANIFEST_RELATIVE_DIR) 139 114 set(RUNTIME_RELATIVE_DIR ${CMAKE_INSTALL_LIBDIR}) 140 - set(RUNTIME_FILENAME ${CMAKE_SHARED_MODULE_PREFIX}${RUNTIME_TARGET}${CMAKE_SHARED_MODULE_SUFFIX}) 115 + set(RUNTIME_FILENAME 116 + ${CMAKE_SHARED_MODULE_PREFIX}${RUNTIME_TARGET}${CMAKE_SHARED_MODULE_SUFFIX} 117 + ) 141 118 configure_file(make_manifest.cmake ${CMAKE_CURRENT_BINARY_DIR}/make_manifest.cmake @ONLY) 142 119 install(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/make_manifest.cmake) 143 120 endif() 121 + 122 + ### 123 + # Inelegant but effective SDL2-based debug GUI 124 + add_library(oxr_sdl2 STATIC oxr_sdl2_hack.c) 125 + target_link_libraries(oxr_sdl2 PRIVATE aux_util) 126 + if(XRT_HAVE_OPENGL) 127 + target_link_libraries(oxr_sdl2 PUBLIC aux_ogl) 128 + endif() 129 + if(XRT_HAVE_SDL2) 130 + target_link_libraries(oxr_sdl2 PRIVATE st_gui xrt-external-imgui-sdl2 ${SDL2_LIBRARIES}) 131 + 132 + if(XRT_BUILD_DRIVER_QWERTY) 133 + target_link_libraries(oxr_sdl2 PRIVATE drv_qwerty drv_qwerty_includes) 134 + endif() 135 + endif() 136 + target_link_libraries(${RUNTIME_TARGET} PRIVATE oxr_sdl2)
+8 -6
src/xrt/targets/openxr/active_runtime.cmake
··· 7 7 set(XR_API_MAJOR @XR_API_MAJOR@) 8 8 set(RUNTIME_TARGET @RUNTIME_TARGET@) 9 9 10 - execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink 11 - ${CMAKE_INSTALL_PREFIX}/${MANIFEST_RELATIVE_DIR}/${RUNTIME_TARGET}.json 12 - ${CMAKE_BINARY_DIR}/active_runtime.json) 10 + execute_process( 11 + COMMAND 12 + ${CMAKE_COMMAND} -E create_symlink 13 + ${CMAKE_INSTALL_PREFIX}/${MANIFEST_RELATIVE_DIR}/${RUNTIME_TARGET}.json 14 + ${CMAKE_BINARY_DIR}/active_runtime.json 15 + ) 13 16 file( 14 17 INSTALL 15 18 DESTINATION "${CMAKE_INSTALL_FULL_SYSCONFDIR}/xdg/openxr/${XR_API_MAJOR}" 16 - TYPE FILE 17 - FILES "${CMAKE_BINARY_DIR}/active_runtime.json" 18 - ) 19 + TYPE FILE FILES "${CMAKE_BINARY_DIR}/active_runtime.json" 20 + )
+15 -14
src/xrt/targets/openxr/make_manifest.cmake
··· 13 13 string(REGEX REPLACE "/$" "" MANIFEST_RELATIVE_DIR "${MANIFEST_RELATIVE_DIR}") 14 14 15 15 if(XRT_OPENXR_INSTALL_ABSOLUTE_RUNTIME_PATH) 16 - # Absolute path to runtime 17 - set(RUNTIME_PATH ${RUNTIME_RELATIVE_DIR}/${RUNTIME_FILENAME}) 18 - if(NOT IS_ABSOLUTE ${RUNTIME_RELATIVE_DIR}) 19 - set(RUNTIME_PATH ${CMAKE_INSTALL_PREFIX}/${RUNTIME_PATH}) 20 - endif() 16 + # Absolute path to runtime 17 + set(RUNTIME_PATH ${RUNTIME_RELATIVE_DIR}/${RUNTIME_FILENAME}) 18 + if(NOT IS_ABSOLUTE ${RUNTIME_RELATIVE_DIR}) 19 + set(RUNTIME_PATH ${CMAKE_INSTALL_PREFIX}/${RUNTIME_PATH}) 20 + endif() 21 21 else() 22 - # Relative path to runtime: requires it exist on the system shared library search path. 23 - set(RUNTIME_PATH ${RUNTIME_FILENAME}) 22 + # Relative path to runtime: requires it exist on the system shared library search path. 23 + set(RUNTIME_PATH ${RUNTIME_FILENAME}) 24 24 endif() 25 25 26 26 set(runtime_path ${RUNTIME_PATH}) 27 27 28 28 if("x${CMAKE_INSTALL_COMPONENT}x" STREQUAL "xUnspecifiedx" OR NOT CMAKE_INSTALL_COMPONENT) 29 29 30 - # Create manifest 31 - configure_file(${MANIFEST_INPUT} ${CMAKE_CURRENT_LIST_DIR}/@RUNTIME_TARGET@.json) 30 + # Create manifest 31 + configure_file(${MANIFEST_INPUT} ${CMAKE_CURRENT_LIST_DIR}/@RUNTIME_TARGET@.json) 32 32 33 - # Install it 34 - file(INSTALL 35 - DESTINATION "${CMAKE_INSTALL_PREFIX}/${MANIFEST_RELATIVE_DIR}" 36 - TYPE FILE 37 - FILES "${CMAKE_CURRENT_LIST_DIR}/@RUNTIME_TARGET@.json") 33 + # Install it 34 + file( 35 + INSTALL 36 + DESTINATION "${CMAKE_INSTALL_PREFIX}/${MANIFEST_RELATIVE_DIR}" 37 + TYPE FILE FILES "${CMAKE_CURRENT_LIST_DIR}/@RUNTIME_TARGET@.json" 38 + ) 38 39 endif()
+11 -12
src/xrt/targets/service-lib/CMakeLists.txt
··· 1 1 # Copyright 2020, Collabora, Ltd. 2 2 # SPDX-License-Identifier: BSL-1.0 3 3 4 + add_library(monado-service MODULE service_target.cpp) 4 5 5 - add_library(monado-service MODULE 6 - service_target.cpp 7 - ) 8 - 9 - target_link_libraries(monado-service PRIVATE 10 - aux_util 11 - st_prober 12 - ipc_server 13 - comp_main 14 - target_lists 15 - target_instance 16 - xrt-external-jni-wrap 6 + target_link_libraries( 7 + monado-service 8 + PRIVATE 9 + aux_util 10 + st_prober 11 + ipc_server 12 + comp_main 13 + target_lists 14 + target_instance 15 + xrt-external-jni-wrap 17 16 )
+54 -34
src/xrt/targets/service/CMakeLists.txt
··· 1 - # Copyright 2020, Collabora, Ltd. 1 + # Copyright 2020-2021, Collabora, Ltd. 2 2 # SPDX-License-Identifier: BSL-1.0 3 3 4 - 5 - add_executable(monado-service 6 - main.c 7 - ../openxr/oxr_sdl2_hack.c 8 - ) 4 + add_executable(monado-service main.c) 9 5 add_sanitizers(monado-service) 10 6 11 - target_link_libraries(monado-service PRIVATE 12 - aux_util 13 - st_prober 14 - ipc_server 15 - comp_main 16 - target_lists 17 - target_instance 7 + target_link_libraries( 8 + monado-service 9 + PRIVATE 10 + aux_util 11 + st_prober 12 + ipc_server 13 + comp_main 14 + target_lists 15 + target_instance 16 + oxr_sdl2 18 17 ) 19 18 20 - install(TARGETS monado-service 21 - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 22 - ) 19 + install(TARGETS monado-service RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) 23 20 24 21 if(XRT_HAVE_SYSTEMD) 25 - set(SERVICE_INPUT ${CMAKE_CURRENT_SOURCE_DIR}/monado.in.service) 26 - set(SOCKET_INPUT ${CMAKE_CURRENT_SOURCE_DIR}/monado.in.socket) 22 + set(SERVICE_INPUT "${CMAKE_CURRENT_SOURCE_DIR}/monado.in.service") 23 + set(SOCKET_INPUT "${CMAKE_CURRENT_SOURCE_DIR}/monado.in.socket") 27 24 ### 28 - # Generate systemd unit files with absolute path to service intended for development without installing 25 + # Generate systemd unit files with absolute path to service 26 + # intended for development without installing 29 27 set(UNIT_NAME monado-dev) 30 28 set(service_path $<TARGET_FILE:monado-service>) 31 29 set(conflicts monado) 32 30 set(exit_on_disconnect ON) 33 31 set(extra_desc "in build tree") 34 - configure_file(${SOCKET_INPUT} ${CMAKE_CURRENT_BINARY_DIR}/${UNIT_NAME}.socket) 35 - # Need this step because file(GENERATE) only evaluates generator expressions, and not what configure_file does. 36 - configure_file(${SERVICE_INPUT} ${CMAKE_CURRENT_BINARY_DIR}/${UNIT_NAME}-intermediate.service) 37 - file(GENERATE 32 + configure_file(${SOCKET_INPUT} "${CMAKE_CURRENT_BINARY_DIR}/${UNIT_NAME}.socket") 33 + 34 + # Need this step because file(GENERATE) only evaluates generator expressions, 35 + # and not what configure_file does. 36 + configure_file( 37 + ${SERVICE_INPUT} "${CMAKE_CURRENT_BINARY_DIR}/${UNIT_NAME}-intermediate.service" 38 + ) 39 + file( 40 + GENERATE 38 41 OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${UNIT_NAME}.service" 39 - INPUT ${CMAKE_CURRENT_BINARY_DIR}/${UNIT_NAME}-intermediate.service) 42 + INPUT "${CMAKE_CURRENT_BINARY_DIR}/${UNIT_NAME}-intermediate.service" 43 + ) 40 44 41 - configure_file(${SOCKET_INPUT} ${CMAKE_CURRENT_BINARY_DIR}/${UNIT_NAME}.socket @ONLY) 45 + configure_file(${SOCKET_INPUT} "${CMAKE_CURRENT_BINARY_DIR}/${UNIT_NAME}.socket" @ONLY) 42 46 43 47 # Make a custom target to link those in. 44 - add_custom_target(link-systemd-dev-units 45 - COMMAND systemctl --user link ${CMAKE_CURRENT_BINARY_DIR}/${UNIT_NAME}.socket 46 - COMMAND systemctl --user link ${CMAKE_CURRENT_BINARY_DIR}/${UNIT_NAME}.service 48 + add_custom_target( 49 + link-systemd-dev-units 50 + COMMAND systemctl --user link "${CMAKE_CURRENT_BINARY_DIR}/${UNIT_NAME}.socket" 51 + COMMAND systemctl --user link "${CMAKE_CURRENT_BINARY_DIR}/${UNIT_NAME}.service" 47 52 COMMAND systemctl --user daemon-reload 48 53 VERBATIM 49 - COMMENT "Linking monado-dev.{socket,service} into your local systemd unit directory." 50 - ) 54 + COMMENT 55 + "Linking monado-dev.{socket,service} into your local systemd unit directory." 56 + ) 51 57 endif() 52 58 53 59 if(XRT_INSTALL_SYSTEMD_UNIT_FILES) ··· 63 69 set(XRT_SYSTEMD_UNIT_INSTALL_DIR lib/systemd/user) 64 70 if(PC_SYSTEMD_USERUNITDIR AND PC_SYSTEMD_PREFIX) 65 71 # Strip prefix 66 - string(REGEX REPLACE "^${PC_SYSTEMD_PREFIX}/" "" XRT_SYSTEMD_UNIT_INSTALL_DIR "${PC_SYSTEMD_USERUNITDIR}") 72 + string( 73 + REGEX 74 + REPLACE "^${PC_SYSTEMD_PREFIX}/" "" XRT_SYSTEMD_UNIT_INSTALL_DIR 75 + "${PC_SYSTEMD_USERUNITDIR}" 76 + ) 67 77 endif() 68 - set(XRT_SYSTEMD_UNIT_INSTALL_DIR "${XRT_SYSTEMD_UNIT_INSTALL_DIR}" CACHE STRING "The (absolute, or CMAKE_INSTALL_PREFIX-relative) path to install the systemd user unit files.") 78 + set(XRT_SYSTEMD_UNIT_INSTALL_DIR 79 + "${XRT_SYSTEMD_UNIT_INSTALL_DIR}" 80 + CACHE 81 + STRING 82 + "The (absolute, or CMAKE_INSTALL_PREFIX-relative) path to install the systemd user unit files." 83 + ) 69 84 mark_as_advanced(XRT_SYSTEMD_UNIT_INSTALL_DIR) 70 85 endif() 71 86 if(XRT_SYSTEMD_UNIT_INSTALL_DIR MATCHES "^/") ··· 75 90 # Destination is relative: prepend destdir (implicitly) and install prefix at install time 76 91 set(UNIT_DIR "\${CMAKE_INSTALL_PREFIX}/${XRT_SYSTEMD_UNIT_INSTALL_DIR}") 77 92 endif() 78 - configure_file(configure_and_install_units.cmake ${CMAKE_CURRENT_BINARY_DIR}/configure_and_install_units.cmake @ONLY) 93 + configure_file( 94 + configure_and_install_units.cmake 95 + ${CMAKE_CURRENT_BINARY_DIR}/configure_and_install_units.cmake @ONLY 96 + ) 79 97 80 98 # This script will configure the units and install them at install time. 81 99 install(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/configure_and_install_units.cmake) 82 100 endif() 83 101 84 102 if(XRT_HAVE_SDL2) 85 - target_link_libraries(monado-service PRIVATE st_gui xrt-external-imgui-sdl2 aux_ogl drv_qwerty_includes) 103 + target_link_libraries( 104 + monado-service PRIVATE st_gui xrt-external-imgui-sdl2 aux_ogl drv_qwerty_includes 105 + ) 86 106 endif()
+9 -8
src/xrt/targets/service/configure_and_install_units.cmake
··· 8 8 set(exit_on_disconnect @exit_on_disconnect@) 9 9 set(service_path "monado-service") 10 10 if(XRT_INSTALL_ABSOLUTE_SYSTEMD_UNIT_FILES) 11 - set(service_path 12 - "${CMAKE_INSTALL_PREFIX}/@CMAKE_INSTALL_BINDIR@/${service_path}") 11 + set(service_path "${CMAKE_INSTALL_PREFIX}/@CMAKE_INSTALL_BINDIR@/${service_path}") 13 12 endif() 14 13 15 14 # Create unit files ··· 18 17 19 18 # Install them 20 19 file( 21 - INSTALL 22 - DESTINATION "@UNIT_DIR@" 23 - TYPE FILE 24 - FILES 25 - "@CMAKE_CURRENT_BINARY_DIR@/@UNIT_NAME@.socket" 26 - "@CMAKE_CURRENT_BINARY_DIR@/@UNIT_NAME@.service") 20 + INSTALL 21 + DESTINATION "@UNIT_DIR@" 22 + TYPE 23 + FILE 24 + FILES 25 + "@CMAKE_CURRENT_BINARY_DIR@/@UNIT_NAME@.socket" 26 + "@CMAKE_CURRENT_BINARY_DIR@/@UNIT_NAME@.service" 27 + )
+35 -42
src/xrt/targets/steamvr_drv/CMakeLists.txt
··· 1 - # Copyright 2020, Collabora, Ltd. 1 + # Copyright 2020-2021, Collabora, Ltd. 2 2 # SPDX-License-Identifier: BSL-1.0 3 3 4 4 get_property(AUX_BINDINGS_DIR GLOBAL PROPERTY AUX_BINDINGS_DIR_PROP) 5 5 set(INPUT_PROFILES_INPUT_DIR ${AUX_BINDINGS_DIR}) 6 6 set(INPUT_PROFILES_OUTPUT_DIR "${PROJECT_BINARY_DIR}/steamvr-monado/resources/input/") 7 7 8 - function(input_profiles_gen output custom_target) 9 - add_custom_command(OUTPUT ${output} 10 - COMMAND ${PYTHON_EXECUTABLE} ${INPUT_PROFILES_INPUT_DIR}/steamvr_profiles.py 11 - ${INPUT_PROFILES_INPUT_DIR}/bindings.json 12 - ${output} 13 - DEPENDS ${INPUT_PROFILES_INPUT_DIR}/bindings.py 14 - ${INPUT_PROFILES_INPUT_DIR}/bindings.json 15 - ) 16 - add_custom_target(${custom_target} DEPENDS ${output}) 17 - endfunction(input_profiles_gen) 18 - 19 - input_profiles_gen(${INPUT_PROFILES_OUTPUT_DIR} generated_input_profiles) 8 + add_custom_command( 9 + OUTPUT "${INPUT_PROFILES_OUTPUT_DIR}" 10 + COMMAND 11 + ${PYTHON_EXECUTABLE} ${INPUT_PROFILES_INPUT_DIR}/steamvr_profiles.py 12 + ${INPUT_PROFILES_INPUT_DIR}/bindings.json "${INPUT_PROFILES_OUTPUT_DIR}" 13 + DEPENDS ${INPUT_PROFILES_INPUT_DIR}/bindings.py ${INPUT_PROFILES_INPUT_DIR}/bindings.json 14 + COMMENT "Generating SteamVR input profiles to ${INPUT_PROFILES_OUTPUT_DIR}" 15 + ) 16 + add_custom_target( 17 + steamvr_generated_input_profiles 18 + DEPENDS "${INPUT_PROFILES_OUTPUT_DIR}" 19 + COMMENT "Generating SteamVR input profiles" 20 + ) 20 21 21 22 add_library(driver_monado MODULE main.c) 22 - add_dependencies(driver_monado generated_input_profiles) 23 + add_dependencies(driver_monado steamvr_generated_input_profiles) 23 24 24 25 target_link_libraries( 25 - driver_monado PRIVATE xrt-external-openvr aux_util st_ovrd st_prober target_lists target_instance_no_comp 26 + driver_monado 27 + PRIVATE 28 + xrt-external-openvr 29 + aux_util 30 + st_ovrd 31 + st_prober 32 + target_lists 33 + target_instance_no_comp 26 34 ) 27 35 28 36 # meta data that the steamvr plugin needs in the base directory of the steamvr plugin 29 37 file(COPY driver.vrdrivermanifest DESTINATION ${PROJECT_BINARY_DIR}/steamvr-monado) 30 38 file(COPY resources DESTINATION ${PROJECT_BINARY_DIR}/steamvr-monado) 31 39 32 - #determine the output directory for the steamvr plugin 40 + # determine the output directory for the steamvr plugin 33 41 if(WIN32) 34 42 # FIXME need to account for different architectures 35 43 if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") 36 - set(PLUGINDIR 37 - ${PROJECT_BINARY_DIR}/steamvr-monado/bin/win64 38 - CACHE INTERNAL "" 39 - ) 44 + set(PLUGINDIR "${PROJECT_BINARY_DIR}/steamvr-monado/bin/win64") 40 45 else() 41 - set(PLUGINDIR 42 - ${PROJECT_BINARY_DIR}/steamvr-monado/bin/win32 43 - CACHE INTERNAL "" 44 - ) 46 + set(PLUGINDIR "${PROJECT_BINARY_DIR}/steamvr-monado/bin/win32") 45 47 endif() 46 48 elseif(APPLE) 47 49 if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") 48 - set(PLUGINDIR 49 - ${PROJECT_BINARY_DIR}/steamvr-monado/bin/osx64 50 - CACHE INTERNAL "" 51 - ) 50 + set(PLUGINDIR "${PROJECT_BINARY_DIR}/steamvr-monado/bin/osx64") 52 51 else() 53 - set(PLUGINDIR 54 - ${PROJECT_BINARY_DIR}/steamvr-monado/bin/osx32 55 - CACHE INTERNAL "" 56 - ) 52 + set(PLUGINDIR "${PROJECT_BINARY_DIR}/steamvr-monado/bin/osx32") 57 53 endif() 58 54 elseif(NOT ANDROID) 59 55 if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") 60 - set(PLUGINDIR 61 - ${PROJECT_BINARY_DIR}/steamvr-monado/bin/linux64 62 - CACHE INTERNAL "" 63 - ) 56 + set(PLUGINDIR "${PROJECT_BINARY_DIR}/steamvr-monado/bin/linux64") 64 57 else() 65 - set(PLUGINDIR 66 - ${PROJECT_BINARY_DIR}/steamvr-monado/bin/linux32 67 - CACHE INTERNAL "" 68 - ) 58 + set(PLUGINDIR "${PROJECT_BINARY_DIR}/steamvr-monado/bin/linux32") 69 59 endif() 70 60 endif() 71 61 72 - message("SteamVR plugin path: ${PLUGINDIR}") 62 + # message("SteamVR plugin path: ${PLUGINDIR}") 73 63 set_target_properties(driver_monado PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${PLUGINDIR}") 74 64 75 65 # don't add lib prefix to driver_monado.so 76 66 set_target_properties(driver_monado PROPERTIES PREFIX "") 77 67 78 - install(DIRECTORY "${PROJECT_BINARY_DIR}/steamvr-monado" DESTINATION "${CMAKE_INSTALL_PREFIX}/share") 68 + install( 69 + DIRECTORY "${PROJECT_BINARY_DIR}/steamvr-monado" 70 + DESTINATION "${CMAKE_INSTALL_PREFIX}/share" 71 + )
+3 -6
tests/CMakeLists.txt
··· 9 9 target_link_libraries(tests_main PUBLIC log) 10 10 endif() 11 11 12 - 13 12 # Input transform test 14 13 add_executable(tests_input_transform tests_input_transform.cpp) 15 14 target_link_libraries(tests_input_transform PRIVATE tests_main) 16 - target_link_libraries(tests_input_transform PRIVATE 17 - st_oxr 18 - xrt-interfaces 19 - xrt-external-openxr 20 - aux_util) 15 + target_link_libraries( 16 + tests_input_transform PRIVATE st_oxr xrt-interfaces xrt-external-openxr aux_util 17 + ) 21 18 add_test(NAME input_transform COMMAND tests_input_transform --success) 22 19 23 20 # Generic callbacks