2021-11-11 23:41:58 +00:00
|
|
|
# Copyright 2020-2021, Collabora, Ltd.
|
2020-04-11 00:28:35 +00:00
|
|
|
# SPDX-License-Identifier: BSL-1.0
|
|
|
|
|
|
|
|
###
|
|
|
|
# Generator
|
|
|
|
|
2021-11-11 23:41:58 +00:00
|
|
|
foreach(
|
|
|
|
fn
|
|
|
|
ipc_protocol_generated.h
|
|
|
|
ipc_client_generated.h
|
|
|
|
ipc_client_generated.c
|
|
|
|
ipc_server_generated.h
|
|
|
|
ipc_server_generated.c
|
|
|
|
)
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${fn}"
|
|
|
|
COMMAND
|
|
|
|
${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/shared/proto.py
|
2020-10-29 13:40:43 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/shared/proto.json
|
2021-11-11 23:41:58 +00:00
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/${fn}"
|
|
|
|
VERBATIM
|
|
|
|
DEPENDS
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/shared/proto.py
|
2020-10-29 13:40:43 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/shared/ipcproto/common.py
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/shared/proto.json
|
2021-11-11 23:41:58 +00:00
|
|
|
COMMENT "Generating ${fn} from protocol JSON description"
|
|
|
|
)
|
|
|
|
endforeach()
|
2020-04-11 00:28:35 +00:00
|
|
|
|
2020-07-07 19:35:17 +00:00
|
|
|
set(IPC_COMMON_SOURCES
|
2021-11-11 23:41:58 +00:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/ipc_protocol_generated.h
|
|
|
|
shared/ipc_shmem.c
|
|
|
|
shared/ipc_shmem.h
|
|
|
|
shared/ipc_utils.c
|
|
|
|
shared/ipc_utils.h
|
|
|
|
)
|
|
|
|
|
|
|
|
add_library(ipc_shared STATIC ${IPC_COMMON_SOURCES})
|
|
|
|
target_include_directories(
|
|
|
|
ipc_shared PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}
|
|
|
|
)
|
2022-07-27 17:04:09 +00:00
|
|
|
|
|
|
|
if(WIN32)
|
|
|
|
target_sources(ipc_shared PRIVATE shared/ipc_utils_windows.cpp)
|
|
|
|
endif()
|
|
|
|
|
2021-11-11 23:41:58 +00:00
|
|
|
target_link_libraries(ipc_shared PRIVATE aux_util)
|
|
|
|
|
|
|
|
if(RT_LIBRARY)
|
|
|
|
target_link_libraries(ipc_shared PUBLIC ${RT_LIBRARY})
|
|
|
|
endif()
|
|
|
|
|
2020-04-11 00:28:35 +00:00
|
|
|
###
|
|
|
|
# Client
|
|
|
|
|
2021-11-11 23:41:58 +00:00
|
|
|
add_library(
|
|
|
|
ipc_client STATIC
|
2020-04-11 00:28:35 +00:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/ipc_client_generated.c
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/ipc_client_generated.h
|
2020-10-29 13:40:43 +00:00
|
|
|
client/ipc_client.h
|
|
|
|
client/ipc_client_compositor.c
|
2023-06-16 19:33:57 +00:00
|
|
|
client/ipc_client_connection.c
|
2020-10-29 13:40:43 +00:00
|
|
|
client/ipc_client_device.c
|
|
|
|
client/ipc_client_hmd.c
|
|
|
|
client/ipc_client_instance.c
|
2023-02-27 14:10:21 +00:00
|
|
|
client/ipc_client_space_overseer.c
|
2023-10-11 14:10:46 +00:00
|
|
|
client/ipc_client_system_devices.c
|
2020-04-11 00:28:35 +00:00
|
|
|
)
|
2021-11-11 23:41:58 +00:00
|
|
|
target_include_directories(
|
|
|
|
ipc_client PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}
|
2020-04-11 00:28:35 +00:00
|
|
|
)
|
2022-07-27 17:04:09 +00:00
|
|
|
if(WIN32)
|
|
|
|
if(XRT_SERVICE_EXECUTABLE)
|
|
|
|
target_compile_definitions(
|
|
|
|
ipc_client PUBLIC XRT_SERVICE_EXECUTABLE="${XRT_SERVICE_EXECUTABLE}.exe"
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
endif()
|
2021-11-11 23:41:58 +00:00
|
|
|
target_link_libraries(ipc_client PRIVATE aux_util ipc_shared)
|
2020-04-11 00:28:35 +00:00
|
|
|
|
|
|
|
###
|
|
|
|
# Server
|
|
|
|
|
2021-11-11 23:41:58 +00:00
|
|
|
add_library(
|
|
|
|
ipc_server STATIC
|
2020-04-11 00:28:35 +00:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/ipc_server_generated.c
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/ipc_server_generated.h
|
2020-10-29 13:40:43 +00:00
|
|
|
server/ipc_server.h
|
2020-12-09 19:14:06 +00:00
|
|
|
server/ipc_server_handler.c
|
2020-12-09 18:32:03 +00:00
|
|
|
server/ipc_server_per_client_thread.c
|
2020-10-29 13:40:43 +00:00
|
|
|
server/ipc_server_process.c
|
2020-04-11 00:28:35 +00:00
|
|
|
)
|
2021-11-11 23:41:58 +00:00
|
|
|
target_include_directories(
|
|
|
|
ipc_server
|
|
|
|
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
|
2020-04-11 00:28:35 +00:00
|
|
|
)
|
2023-03-06 22:28:50 +00:00
|
|
|
target_link_libraries(ipc_server PRIVATE aux_util aux_util_process aux_util_debug_gui ipc_shared)
|
2020-07-07 22:46:53 +00:00
|
|
|
|
2020-05-01 20:55:12 +00:00
|
|
|
if(XRT_HAVE_SYSTEMD)
|
2021-11-11 23:41:58 +00:00
|
|
|
target_include_directories(ipc_server PRIVATE ${SYSTEMD_INCLUDE_DIRS})
|
|
|
|
target_link_libraries(ipc_server PRIVATE ${SYSTEMD_LIBRARIES})
|
2020-05-01 20:55:12 +00:00
|
|
|
endif()
|
2020-07-07 22:46:53 +00:00
|
|
|
|
|
|
|
if(ANDROID)
|
2021-11-11 23:41:58 +00:00
|
|
|
add_library(
|
|
|
|
ipc_android STATIC
|
2020-11-09 21:24:22 +00:00
|
|
|
android/ipc_client_android.cpp
|
|
|
|
android/ipc_client_android.h
|
|
|
|
android/org.freedesktop.monado.ipc.cpp
|
|
|
|
android/org.freedesktop.monado.ipc.hpp
|
|
|
|
android/org.freedesktop.monado.ipc.impl.hpp
|
|
|
|
)
|
2021-11-11 23:41:58 +00:00
|
|
|
target_link_libraries(
|
|
|
|
ipc_android PUBLIC xrt-external-jni-wrap xrt-external-jnipp aux_android
|
2021-02-12 15:23:59 +00:00
|
|
|
)
|
2021-11-11 23:41:58 +00:00
|
|
|
target_sources(
|
|
|
|
ipc_server PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/server/ipc_server_mainloop_android.c
|
2020-11-09 21:24:22 +00:00
|
|
|
)
|
2021-11-11 23:41:58 +00:00
|
|
|
target_link_libraries(
|
|
|
|
ipc_shared
|
|
|
|
PUBLIC ${ANDROID_LIBRARY}
|
|
|
|
PRIVATE aux_android ipc_android
|
2020-11-09 21:24:22 +00:00
|
|
|
)
|
2021-02-08 18:50:21 +00:00
|
|
|
elseif(XRT_HAVE_LINUX)
|
2021-11-11 23:41:58 +00:00
|
|
|
target_sources(
|
|
|
|
ipc_server PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/server/ipc_server_mainloop_linux.c
|
2021-02-08 18:50:21 +00:00
|
|
|
)
|
2022-07-27 17:04:09 +00:00
|
|
|
elseif(WIN32)
|
|
|
|
target_sources(
|
|
|
|
ipc_server
|
|
|
|
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/server/ipc_server_mainloop_windows.cpp
|
|
|
|
)
|
2020-07-07 22:46:53 +00:00
|
|
|
endif()
|