targets: Add and change targets to support service process

This commit is contained in:
Jakob Bornecrantz 2020-04-29 00:56:27 +01:00
parent 220f37a75d
commit 7a70f86b2d
8 changed files with 112 additions and 12 deletions

View file

@ -17,3 +17,7 @@ add_subdirectory(cli)
if(BUILD_TARGET_GUI)
add_subdirectory(gui)
endif()
if(XRT_BUILD_IPC)
add_subdirectory(service)
endif()

View file

@ -61,3 +61,5 @@ subdir('cli')
if sdl2.found()
subdir('gui')
endif
subdir('service')

View file

@ -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

View file

@ -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.

View file

@ -6,6 +6,23 @@
* @author Jakob Bornecrantz <jakob@collabora.com>
*/
#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

View file

@ -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}
)

View file

@ -0,0 +1,28 @@
// Copyright 2020, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
/*!
* @file
* @brief Main file for Monado service.
* @author Pete Black <pblack@collabora.com>
* @author Jakob Bornecrantz <jakob@collabora.com>
* @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);
}

View file

@ -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],
)