| 1 |
# Copyright 2019-2024, Collabora, Ltd. |
| 2 |
# SPDX-License-Identifier: BSL-1.0 |
| 3 |
|
| 4 |
#### |
| 5 |
# Main util library |
| 6 |
# |
| 7 |
# Avoid linking with libraries that brings in DSOs as this |
| 8 |
# library is used everywhere. Including libraries loaded in |
| 9 |
# by applications like the OpenXR runtime library. |
| 10 |
# |
| 11 |
|
| 12 |
configure_file( |
| 13 |
"${CMAKE_CURRENT_SOURCE_DIR}/u_git_tag.c.in" "${CMAKE_CURRENT_BINARY_DIR}/u_git_tag.c" |
| 14 |
@ONLY |
| 15 |
) |
| 16 |
|
| 17 |
add_library( |
| 18 |
aux_util STATIC |
| 19 |
u_autoexpgain.c |
| 20 |
u_autoexpgain.h |
| 21 |
u_bitwise.c |
| 22 |
u_bitwise.h |
| 23 |
u_builders.c |
| 24 |
u_builders.h |
| 25 |
u_debug.c |
| 26 |
u_debug.h |
| 27 |
u_deque.cpp |
| 28 |
u_deque.h |
| 29 |
u_device.c |
| 30 |
u_device.h |
| 31 |
u_distortion.c |
| 32 |
u_distortion.h |
| 33 |
u_distortion_mesh.c |
| 34 |
u_distortion_mesh.h |
| 35 |
u_documentation.h |
| 36 |
u_file.c |
| 37 |
u_file.cpp |
| 38 |
u_file.h |
| 39 |
u_format.c |
| 40 |
u_format.h |
| 41 |
u_frame.c |
| 42 |
u_frame.h |
| 43 |
u_generic_callbacks.hpp |
| 44 |
u_git_tag.h |
| 45 |
u_hand_tracking.c |
| 46 |
u_hand_tracking.h |
| 47 |
u_hand_simulation.c |
| 48 |
u_hand_simulation.h |
| 49 |
u_handles.c |
| 50 |
u_handles.h |
| 51 |
u_hashmap.cpp |
| 52 |
u_hashmap.h |
| 53 |
u_hashset.cpp |
| 54 |
u_hashset.h |
| 55 |
u_id_ringbuffer.cpp |
| 56 |
u_id_ringbuffer.h |
| 57 |
u_imu_sink_split.c |
| 58 |
u_imu_sink_force_monotonic.c |
| 59 |
u_json.c |
| 60 |
u_json.h |
| 61 |
u_json.hpp |
| 62 |
u_limited_unique_id.cpp |
| 63 |
u_limited_unique_id.h |
| 64 |
u_live_stats.cpp |
| 65 |
u_live_stats.h |
| 66 |
u_logging.c |
| 67 |
u_logging.h |
| 68 |
u_metrics.c |
| 69 |
u_metrics.h |
| 70 |
u_misc.c |
| 71 |
u_misc.h |
| 72 |
u_native_images_debug.h |
| 73 |
u_pacing.h |
| 74 |
u_pacing_app.c |
| 75 |
u_pacing_compositor.c |
| 76 |
u_pacing_compositor_fake.c |
| 77 |
u_pretty_print.c |
| 78 |
u_pretty_print.h |
| 79 |
u_prober.c |
| 80 |
u_prober.h |
| 81 |
u_session.c |
| 82 |
u_session.h |
| 83 |
u_space_overseer.c |
| 84 |
u_space_overseer.h |
| 85 |
u_string_list.cpp |
| 86 |
u_string_list.h |
| 87 |
u_string_list.hpp |
| 88 |
u_system.c |
| 89 |
u_system.h |
| 90 |
u_system_helpers.c |
| 91 |
u_system_helpers.h |
| 92 |
u_template_historybuf.hpp |
| 93 |
u_time.cpp |
| 94 |
u_time.h |
| 95 |
u_trace_marker.c |
| 96 |
u_trace_marker.h |
| 97 |
u_tracked_imu_3dof.c |
| 98 |
u_tracked_imu_3dof.h |
| 99 |
u_var.cpp |
| 100 |
u_var.h |
| 101 |
u_vector.cpp |
| 102 |
u_vector.h |
| 103 |
u_config_json.c |
| 104 |
u_config_json.h |
| 105 |
u_verify.h |
| 106 |
u_visibility_mask.c |
| 107 |
u_visibility_mask.h |
| 108 |
u_win32_com_guard.cpp |
| 109 |
u_win32_com_guard.hpp |
| 110 |
u_worker.c |
| 111 |
u_worker.cpp |
| 112 |
u_worker.h |
| 113 |
u_worker.hpp |
| 114 |
"${CMAKE_CURRENT_BINARY_DIR}/u_git_tag.c" |
| 115 |
) |
| 116 |
target_link_libraries( |
| 117 |
aux_util |
| 118 |
PUBLIC |
| 119 |
xrt-external-nanopb |
| 120 |
aux-includes |
| 121 |
aux_generated_bindings |
| 122 |
aux_os |
| 123 |
aux_math |
| 124 |
) |
| 125 |
|
| 126 |
# Only uses normal Windows libraries, doesn't add anything extra. |
| 127 |
if(WIN32) |
| 128 |
target_sources(aux_util PRIVATE u_windows.c u_windows.h) |
| 129 |
endif() |
| 130 |
|
| 131 |
# WIL is lacking official support on MINGW. |
| 132 |
# If necessary, please refer to https://github.com/microsoft/wil/pull/467 |
| 133 |
if(WIN32 AND NOT MINGW) |
| 134 |
target_link_libraries(aux_util PRIVATE WIL::WIL) |
| 135 |
endif() |
| 136 |
|
| 137 |
# Only uses POSIX/Linux libraries, doesn't add anything extra. |
| 138 |
if(XRT_HAVE_LINUX OR ANDROID) |
| 139 |
target_sources(aux_util PRIVATE u_linux.c u_linux.h) |
| 140 |
endif() |
| 141 |
|
| 142 |
# Is basically used everywhere, unavoidable. |
| 143 |
if(XRT_HAVE_SYSTEM_CJSON) |
| 144 |
target_link_libraries(aux_util PUBLIC cJSON::cJSON) |
| 145 |
target_compile_definitions(aux_util PRIVATE XRT_HAVE_SYSTEM_CJSON) |
| 146 |
else() |
| 147 |
target_link_libraries(aux_util PUBLIC xrt-external-cjson) |
| 148 |
endif() |
| 149 |
|
| 150 |
# Is basically used everywhere, only used in debugging. |
| 151 |
if(XRT_FEATURE_TRACING AND XRT_HAVE_PERCETTO) |
| 152 |
target_link_libraries(aux_util PUBLIC percetto::percetto) |
| 153 |
endif() |
| 154 |
|
| 155 |
# Is basically used everywhere, only used in debugging. |
| 156 |
if(XRT_FEATURE_TRACING AND XRT_HAVE_TRACY) |
| 157 |
target_link_libraries(aux_util PUBLIC xrt-external-tracy) |
| 158 |
endif() |
| 159 |
|
| 160 |
# Is basically used everywhere, so link with here. |
| 161 |
if(ANDROID) |
| 162 |
target_link_libraries(aux_util PUBLIC ${ANDROID_LOG_LIBRARY}) |
| 163 |
endif() |
| 164 |
|
| 165 |
# Internal dependency and doesn't bring in any DSO. |
| 166 |
target_include_directories(aux_util PRIVATE ${EIGEN3_INCLUDE_DIR}) |
| 167 |
|
| 168 |
#### |
| 169 |
# Debug UI library |
| 170 |
# |
| 171 |
|
| 172 |
add_library(aux_util_debug_gui STATIC u_debug_gui.c u_debug_gui.h) # Always built, for stubs. |
| 173 |
target_link_libraries( |
| 174 |
aux_util_debug_gui |
| 175 |
INTERFACE xrt-interfaces |
| 176 |
PRIVATE aux-includes |
| 177 |
) |
| 178 |
|
| 179 |
if(XRT_FEATURE_DEBUG_GUI) |
| 180 |
target_link_libraries(aux_util_debug_gui PRIVATE aux_util) |
| 181 |
|
| 182 |
if(XRT_HAVE_OPENGL) |
| 183 |
target_link_libraries(aux_util_debug_gui PUBLIC aux_ogl) |
| 184 |
endif() |
| 185 |
|
| 186 |
if(XRT_HAVE_SDL2) |
| 187 |
target_link_libraries(aux_util_debug_gui PRIVATE st_gui xrt-external-imgui-sdl2) |
| 188 |
|
| 189 |
if(XRT_BUILD_DRIVER_QWERTY) |
| 190 |
target_link_libraries( |
| 191 |
aux_util_debug_gui PRIVATE drv_qwerty drv_qwerty_includes |
| 192 |
) |
| 193 |
endif() |
| 194 |
endif() |
| 195 |
endif() |
| 196 |
|
| 197 |
#### |
| 198 |
# Sink library |
| 199 |
# |
| 200 |
|
| 201 |
add_library( |
| 202 |
aux_util_sink STATIC |
| 203 |
u_sink.h |
| 204 |
u_sink_combiner.c |
| 205 |
u_sink_force_genlock.c |
| 206 |
u_sink_converter.c |
| 207 |
u_sink_deinterleaver.c |
| 208 |
u_sink_queue.c |
| 209 |
u_sink_simple_queue.c |
| 210 |
u_sink_quirk.c |
| 211 |
u_sink_split.c |
| 212 |
u_sink_stereo_sbs_to_slam_sbs.c |
| 213 |
) |
| 214 |
target_link_libraries( |
| 215 |
aux_util_sink |
| 216 |
PUBLIC |
| 217 |
aux-includes |
| 218 |
xrt-pthreads |
| 219 |
aux_os |
| 220 |
aux_math |
| 221 |
aux_util |
| 222 |
) |
| 223 |
|
| 224 |
if(XRT_HAVE_JPEG) |
| 225 |
target_link_libraries(aux_util_sink PRIVATE ${JPEG_LIBRARIES}) |
| 226 |
target_include_directories(aux_util_sink PRIVATE ${JPEG_INCLUDE_DIRS}) |
| 227 |
endif() |
| 228 |
|
| 229 |
#### |
| 230 |
# Process library |
| 231 |
# |
| 232 |
|
| 233 |
add_library(aux_util_process STATIC u_process.c u_process.h) |
| 234 |
target_link_libraries(aux_util_process PUBLIC aux-includes aux_util) |
| 235 |
|
| 236 |
if(XRT_HAVE_LIBBSD) |
| 237 |
target_include_directories(aux_util_process SYSTEM PRIVATE ${LIBBSD_INCLUDE_DIRS}) |
| 238 |
target_link_libraries(aux_util_process PUBLIC ${LIBBSD_LIBRARIES}) |
| 239 |
endif() |