ipc: Refactor folders

This commit is contained in:
Jakob Bornecrantz 2020-10-29 13:40:43 +00:00 committed by Ryan Pavlik
parent 5ba3486628
commit 3008e5482d
32 changed files with 86 additions and 57 deletions

View file

@ -4,5 +4,5 @@
rootProject.name = 'monado'
include ':src:xrt:auxiliary:android'
include ':src:xrt:ipc_android'
include ':src:xrt:ipc:android'
include ':src:xrt:targets:openxr_android'

View file

@ -7,12 +7,12 @@
function(proto_gen output)
add_custom_command(OUTPUT ${output}
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/proto.py
${CMAKE_CURRENT_SOURCE_DIR}/proto.json
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/shared/proto.py
${CMAKE_CURRENT_SOURCE_DIR}/shared/proto.json
${output}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/proto.py
${CMAKE_CURRENT_SOURCE_DIR}/ipcproto/common.py
${CMAKE_CURRENT_SOURCE_DIR}/proto.json
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/shared/proto.py
${CMAKE_CURRENT_SOURCE_DIR}/shared/ipcproto/common.py
${CMAKE_CURRENT_SOURCE_DIR}/shared/proto.json
)
endfunction(proto_gen)
@ -24,10 +24,10 @@ proto_gen(${CMAKE_CURRENT_BINARY_DIR}/ipc_server_generated.c)
set(IPC_COMMON_SOURCES
${CMAKE_CURRENT_BINARY_DIR}/ipc_protocol_generated.h
ipc_shmem.c
ipc_shmem.h
ipc_utils.c
ipc_utils.h)
shared/ipc_shmem.c
shared/ipc_shmem.h
shared/ipc_utils.c
shared/ipc_utils.h)
###
# Client
@ -35,11 +35,11 @@ add_library(ipc_client STATIC
${CMAKE_CURRENT_BINARY_DIR}/ipc_client_generated.c
${CMAKE_CURRENT_BINARY_DIR}/ipc_client_generated.h
${IPC_COMMON_SOURCES}
ipc_client.h
ipc_client_compositor.c
ipc_client_device.c
ipc_client_hmd.c
ipc_client_instance.c
client/ipc_client.h
client/ipc_client_compositor.c
client/ipc_client_device.c
client/ipc_client_hmd.c
client/ipc_client_instance.c
)
target_include_directories(ipc_client INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}
@ -65,9 +65,9 @@ add_library(ipc_server STATIC
${CMAKE_CURRENT_BINARY_DIR}/ipc_server_generated.c
${CMAKE_CURRENT_BINARY_DIR}/ipc_server_generated.h
${IPC_COMMON_SOURCES}
ipc_server.h
ipc_server_client.c
ipc_server_process.c
server/ipc_server.h
server/ipc_server_client.c
server/ipc_server_process.c
)
target_include_directories(ipc_server
INTERFACE

View file

@ -11,8 +11,8 @@
#pragma once
#include "xrt/xrt_compiler.h"
#include "ipc_protocol.h"
#include "ipc_utils.h"
#include "shared/ipc_protocol.h"
#include "shared/ipc_utils.h"
#include "util/u_threading.h"

View file

@ -16,8 +16,8 @@
#include "os/os_time.h"
#include "ipc_protocol.h"
#include "ipc_client.h"
#include "shared/ipc_protocol.h"
#include "client/ipc_client.h"
#include "ipc_client_generated.h"
#include <string.h>

View file

@ -25,7 +25,7 @@
#include "util/u_debug.h"
#include "util/u_device.h"
#include "ipc_client.h"
#include "client/ipc_client.h"
#include "ipc_client_generated.h"

View file

@ -26,7 +26,7 @@
#include "util/u_device.h"
#include "util/u_distortion_mesh.h"
#include "ipc_client.h"
#include "client/ipc_client.h"
#include "ipc_client_generated.h"

View file

@ -14,8 +14,8 @@
#include "util/u_misc.h"
#include "util/u_var.h"
#include "ipc_protocol.h"
#include "ipc_client.h"
#include "shared/ipc_protocol.h"
#include "client/ipc_client.h"
#include "ipc_client_generated.h"
#include <stdio.h>

View file

@ -9,15 +9,15 @@ ipc_include = include_directories('.')
prog_python = import('python').find_installation('python3')
common_sources = [
'ipc_shmem.c',
'ipc_shmem.h',
'ipc_utils.c',
'ipc_utils.h',
'shared/ipc_shmem.c',
'shared/ipc_shmem.h',
'shared/ipc_utils.c',
'shared/ipc_utils.h',
]
generated = custom_target('protocol code',
command: [prog_python, '@INPUT@', '@OUTPUT@'],
input: ['proto.py', 'proto.json'],
input: ['shared/proto.py', 'shared/proto.json'],
output: [
'ipc_protocol_generated.h',
'ipc_client_generated.c',
@ -38,11 +38,11 @@ lib_ipc_client = static_library(
generated[0],
generated[1],
generated[2],
'ipc_client.h',
'ipc_client_compositor.c',
'ipc_client_device.c',
'ipc_client_hmd.c',
'ipc_client_instance.c',
'client/ipc_client.h',
'client/ipc_client_compositor.c',
'client/ipc_client_device.c',
'client/ipc_client_hmd.c',
'client/ipc_client_instance.c',
],
include_directories: [
xrt_include,
@ -60,9 +60,9 @@ lib_ipc_server = static_library(
generated[0],
generated[3],
generated[4],
'ipc_server.h',
'ipc_server_client.c',
'ipc_server_process.c',
'server/ipc_server.h',
'server/ipc_server_client.c',
'server/ipc_server_process.c',
],
include_directories: [
xrt_include,

View file

@ -16,8 +16,8 @@
#include "os/os_threading.h"
#include "ipc_protocol.h"
#include "ipc_utils.h"
#include "shared/ipc_protocol.h"
#include "shared/ipc_utils.h"
#include <stdio.h>

View file

@ -11,7 +11,7 @@
#include "util/u_misc.h"
#include "ipc_server.h"
#include "server/ipc_server.h"
#include "ipc_server_generated.h"
#include <stdlib.h>

View file

@ -18,8 +18,8 @@
#include "util/u_misc.h"
#include "util/u_debug.h"
#include "ipc_server.h"
#include "ipc_shmem.h"
#include "shared/ipc_shmem.h"
#include "server/ipc_server.h"
#include <stdlib.h>
#include <unistd.h>

View file

@ -37,3 +37,31 @@
*
* @brief Inter-Process Communication layer
*/
/*!
* @dir xrt/ipc/shared
* @ingroup ipc
*
* @brief Inter-Process Communication layer shared code
*/
/*!
* @dir xrt/ipc/server
* @ingroup ipc
*
* @brief Inter-Process Communication layer server code
*/
/*!
* @dir xrt/ipc/client
* @ingroup ipc
*
* @brief Inter-Process Communication layer client code
*/
/*!
* @dir xrt/ipc/android
* @ingroup ipc
*
* @brief Inter-Process Communication layer android code
*/

View file

@ -11,7 +11,7 @@
#include <xrt/xrt_config_os.h>
#include "ipc_shmem.h"
#include "shared/ipc_shmem.h"
#if defined(XRT_OS_UNIX)
#include <sys/mman.h>

View file

@ -11,8 +11,8 @@
#include "xrt/xrt_config_os.h"
#include "ipc_utils.h"
#include "ipc_protocol.h"
#include "shared/ipc_utils.h"
#include "shared/ipc_protocol.h"
#include <errno.h>
#include <sys/socket.h>

View file

@ -97,7 +97,7 @@ def generate_client_c(file, p):
f = open(file, "w")
f.write(header.format(brief='Generated IPC client code', suffix='_client'))
f.write('''
#include "ipc_client.h"
#include "client/ipc_client.h"
#include "ipc_protocol_generated.h"
@ -215,9 +215,9 @@ def generate_client_h(file, p):
f.write('''
#pragma once
#include "ipc_protocol.h"
#include "shared/ipc_protocol.h"
#include "ipc_protocol_generated.h"
#include "ipc_client.h"
#include "client/ipc_client.h"
// clang-format off
@ -238,9 +238,10 @@ def generate_server_c(file, p):
f.write('''
#include "ipc_server_generated.h"
#include "ipc_protocol.h"
#include "ipc_server.h"
#include "ipc_utils.h"
#include "shared/ipc_protocol.h"
#include "shared/ipc_utils.h"
#include "server/ipc_server.h"
// clang-format off
@ -373,9 +374,9 @@ def generate_server_header(file, p):
f.write('''
#pragma once
#include "ipc_protocol.h"
#include "shared/ipc_protocol.h"
#include "ipc_protocol_generated.h"
#include "ipc_server.h"
#include "server/ipc_server.h"
// clang-format off

View file

@ -7,7 +7,7 @@
* @ingroup ipc
*/
#include "ipc_client.h"
#include "client/ipc_client.h"
#include "ipc_client_generated.h"
#include <sys/socket.h>

View file

@ -58,7 +58,7 @@ android {
}
dependencies {
outOfProcessImplementation project(':src:xrt:ipc_android')
outOfProcessImplementation project(':src:xrt:ipc:android')
implementation project(':src:xrt:auxiliary:android')
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"