diff --git a/src/xrt/targets/CMakeLists.txt b/src/xrt/targets/CMakeLists.txt index f3f2cc557..dcedd7caa 100644 --- a/src/xrt/targets/CMakeLists.txt +++ b/src/xrt/targets/CMakeLists.txt @@ -17,3 +17,7 @@ add_subdirectory(cli) if(BUILD_TARGET_GUI) add_subdirectory(gui) endif() + +if(XRT_BUILD_IPC) + add_subdirectory(service) +endif() diff --git a/src/xrt/targets/meson.build b/src/xrt/targets/meson.build index 25addf35f..f5d3c9122 100644 --- a/src/xrt/targets/meson.build +++ b/src/xrt/targets/meson.build @@ -61,3 +61,5 @@ subdir('cli') if sdl2.found() subdir('gui') endif + +subdir('service') diff --git a/src/xrt/targets/openxr/CMakeLists.txt b/src/xrt/targets/openxr/CMakeLists.txt index acc326b2c..50f9c6e27 100644 --- a/src/xrt/targets/openxr/CMakeLists.txt +++ b/src/xrt/targets/openxr/CMakeLists.txt @@ -39,14 +39,22 @@ if(BUILD_WITH_SDL2) target_link_libraries(${RUNTIME_TARGET} PUBLIC st_gui imgui_impl_sdl) endif() -target_link_libraries(${RUNTIME_TARGET} PUBLIC - st_oxr - st_prober - target_lists - target_instance - comp_main - comp_client - ) +if(XRT_BUILD_IPC) + target_link_libraries(${RUNTIME_TARGET} PUBLIC + st_oxr + ipc_client + comp_client + ) +else() + target_link_libraries(${RUNTIME_TARGET} PUBLIC + st_oxr + st_prober + target_lists + target_instance + comp_main + comp_client + ) +endif() if(NOT MSVC) # Force the main "negotiate" symbol's inclusion diff --git a/src/xrt/targets/openxr/meson.build b/src/xrt/targets/openxr/meson.build index a9f9e01e5..1071249ff 100644 --- a/src/xrt/targets/openxr/meson.build +++ b/src/xrt/targets/openxr/meson.build @@ -78,11 +78,9 @@ openxr = library( lib_aux_util, lib_aux_math, lib_comp, + lib_ipc_client, lib_st_oxr, - lib_st_prober, - lib_target_lists, - lib_target_instance, - ] + driver_libs + hack_libs, + ] + hack_libs, include_directories: [ openxr_include, st_include, # Sigh debian meson requires this. diff --git a/src/xrt/targets/openxr/target.c b/src/xrt/targets/openxr/target.c index fadf06612..ddf1308c6 100644 --- a/src/xrt/targets/openxr/target.c +++ b/src/xrt/targets/openxr/target.c @@ -6,6 +6,23 @@ * @author Jakob Bornecrantz */ +#include "xrt/xrt_config_build.h" + +#ifdef XRT_BUILD_IPC + +struct xrt_instance; + +int +ipc_instance_create(struct xrt_instance **out_xinst); + +int +xrt_instance_create(struct xrt_instance **out_xinst) +{ + return ipc_instance_create(out_xinst); +} + +#else + #include "target_lists.h" int @@ -13,3 +30,5 @@ xrt_prober_create(struct xrt_prober **out_xp) { return xrt_prober_create_with_lists(out_xp, &target_lists); } + +#endif diff --git a/src/xrt/targets/service/CMakeLists.txt b/src/xrt/targets/service/CMakeLists.txt new file mode 100644 index 000000000..f36d54820 --- /dev/null +++ b/src/xrt/targets/service/CMakeLists.txt @@ -0,0 +1,20 @@ +# Copyright 2020, Collabora, Ltd. +# SPDX-License-Identifier: BSL-1.0 + + +add_executable(monado-service + main.c + ) + +target_link_libraries(monado-service PRIVATE + aux_util + st_prober + ipc_server + comp_main + target_lists + target_instance + ) + +install(TARGETS monado-service + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ) diff --git a/src/xrt/targets/service/main.c b/src/xrt/targets/service/main.c new file mode 100644 index 000000000..f47b9abba --- /dev/null +++ b/src/xrt/targets/service/main.c @@ -0,0 +1,28 @@ +// Copyright 2020, Collabora, Ltd. +// SPDX-License-Identifier: BSL-1.0 +/*! + * @file + * @brief Main file for Monado service. + * @author Pete Black + * @author Jakob Bornecrantz + * @ingroup ipc + */ + + +#include "target_lists.h" + +int +ipc_server_main(int argc, char *argv[]); + + +int +main(int argc, char *argv[]) +{ + return ipc_server_main(argc, argv); +} + +int +xrt_prober_create(struct xrt_prober **out_xp) +{ + return xrt_prober_create_with_lists(out_xp, &target_lists); +} diff --git a/src/xrt/targets/service/meson.build b/src/xrt/targets/service/meson.build new file mode 100644 index 000000000..c902203d8 --- /dev/null +++ b/src/xrt/targets/service/meson.build @@ -0,0 +1,21 @@ +# Copyright 2020, Collabora, Ltd. +# SPDX-License-Identifier: BSL-1.0 + +service = executable( + 'monado-service', + ['main.c'], + link_whole: [ + lib_st_prober, + lib_ipc_server, + lib_comp, + lib_target_lists, + lib_target_instance, + lib_aux_util, + ] + driver_libs, + include_directories: [ + aux_include, + common_include, + xrt_include, + ], + dependencies: [pthreads, libjpeg], +)