meson: ipa, proxy: Generate headers and proxy with mojo
Run mojo from meson to generate the header, serializer, and proxy files for every pipeline's mojom data definition file. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
This commit is contained in:
parent
4000ed4d8d
commit
e6722b86ee
6 changed files with 172 additions and 2 deletions
|
@ -8,3 +8,123 @@ libcamera_ipa_headers = files([
|
|||
|
||||
install_headers(libcamera_ipa_headers,
|
||||
subdir: join_paths(libcamera_include_dir, 'ipa'))
|
||||
|
||||
libcamera_generated_ipa_headers = []
|
||||
|
||||
#
|
||||
# Prepare IPA/IPC generation components
|
||||
#
|
||||
|
||||
core_mojom_file = 'core.mojom'
|
||||
ipa_mojom_core = custom_target(core_mojom_file.split('.')[0] + '_mojom_module',
|
||||
input : core_mojom_file,
|
||||
output : core_mojom_file + '-module',
|
||||
command : [
|
||||
mojom_parser,
|
||||
'--output-root', meson.build_root(),
|
||||
'--input-root', meson.source_root(),
|
||||
'--mojoms', '@INPUT@'
|
||||
])
|
||||
|
||||
# core_ipa_interface.h
|
||||
libcamera_generated_ipa_headers += custom_target('core_ipa_interface_h',
|
||||
input : ipa_mojom_core,
|
||||
output : 'core_ipa_interface.h',
|
||||
depends : mojom_templates,
|
||||
command : [
|
||||
mojom_generator, 'generate',
|
||||
'-g', 'libcamera',
|
||||
'--bytecode_path', mojom_templates_dir,
|
||||
'--libcamera_generate_core_header',
|
||||
'--libcamera_output_path=@OUTPUT@',
|
||||
'./' +'@INPUT@'
|
||||
])
|
||||
|
||||
# core_ipa_serializer.h
|
||||
libcamera_generated_ipa_headers += custom_target('core_ipa_serializer_h',
|
||||
input : ipa_mojom_core,
|
||||
output : 'core_ipa_serializer.h',
|
||||
depends : mojom_templates,
|
||||
command : [
|
||||
mojom_generator, 'generate',
|
||||
'-g', 'libcamera',
|
||||
'--bytecode_path', mojom_templates_dir,
|
||||
'--libcamera_generate_core_serializer',
|
||||
'--libcamera_output_path=@OUTPUT@',
|
||||
'./' +'@INPUT@'
|
||||
])
|
||||
|
||||
ipa_mojom_files = []
|
||||
|
||||
ipa_mojoms = []
|
||||
|
||||
#
|
||||
# Generate headers from templates.
|
||||
#
|
||||
|
||||
# TODO Define per-pipeline ControlInfoMap with yaml?
|
||||
|
||||
foreach file : ipa_mojom_files
|
||||
name = file.split('.')[0]
|
||||
|
||||
# {pipeline}.mojom-module
|
||||
mojom = custom_target(file.split('.')[0] + '_mojom_module',
|
||||
input : file,
|
||||
output : file + '-module',
|
||||
depends : ipa_mojom_core,
|
||||
command : [
|
||||
mojom_parser,
|
||||
'--output-root', meson.build_root(),
|
||||
'--input-root', meson.source_root(),
|
||||
'--mojoms', '@INPUT@'
|
||||
])
|
||||
|
||||
# {pipeline}_ipa_interface.h
|
||||
header = custom_target(name + '_ipa_interface_h',
|
||||
input : mojom,
|
||||
output : name + '_ipa_interface.h',
|
||||
depends : mojom_templates,
|
||||
command : [
|
||||
mojom_generator, 'generate',
|
||||
'-g', 'libcamera',
|
||||
'--bytecode_path', mojom_templates_dir,
|
||||
'--libcamera_generate_header',
|
||||
'--libcamera_output_path=@OUTPUT@',
|
||||
'./' +'@INPUT@'
|
||||
])
|
||||
|
||||
# {pipeline}_ipa_serializer.h
|
||||
serializer = custom_target(name + '_ipa_serializer_h',
|
||||
input : mojom,
|
||||
output : name + '_ipa_serializer.h',
|
||||
depends : mojom_templates,
|
||||
command : [
|
||||
mojom_generator, 'generate',
|
||||
'-g', 'libcamera',
|
||||
'--bytecode_path', mojom_templates_dir,
|
||||
'--libcamera_generate_serializer',
|
||||
'--libcamera_output_path=@OUTPUT@',
|
||||
'./' +'@INPUT@'
|
||||
])
|
||||
|
||||
# {pipeline}_ipa_proxy.h
|
||||
proxy_header = custom_target(name + '_proxy_h',
|
||||
input : mojom,
|
||||
output : name + '_ipa_proxy.h',
|
||||
depends : mojom_templates,
|
||||
command : [
|
||||
mojom_generator, 'generate',
|
||||
'-g', 'libcamera',
|
||||
'--bytecode_path', mojom_templates_dir,
|
||||
'--libcamera_generate_proxy_h',
|
||||
'--libcamera_output_path=@OUTPUT@',
|
||||
'./' +'@INPUT@'
|
||||
])
|
||||
|
||||
ipa_mojoms += {
|
||||
'name': name,
|
||||
'mojom': mojom,
|
||||
}
|
||||
|
||||
libcamera_generated_ipa_headers += [header, serializer, proxy_header]
|
||||
endforeach
|
||||
|
|
|
@ -60,6 +60,7 @@ libcamera_sources = files([
|
|||
])
|
||||
|
||||
libcamera_sources += libcamera_public_headers
|
||||
libcamera_sources += libcamera_generated_ipa_headers
|
||||
libcamera_sources += libcamera_tracepoint_header
|
||||
|
||||
includes = [
|
||||
|
|
|
@ -4,3 +4,21 @@ libcamera_sources += files([
|
|||
'ipa_proxy_linux.cpp',
|
||||
'ipa_proxy_thread.cpp',
|
||||
])
|
||||
|
||||
# generate {pipeline}_ipa_proxy.cpp
|
||||
foreach mojom : ipa_mojoms
|
||||
proxy = custom_target(mojom['name'] + '_proxy_cpp',
|
||||
input : mojom['mojom'],
|
||||
output : mojom['name'] + '_ipa_proxy.cpp',
|
||||
depends : mojom_templates,
|
||||
command : [
|
||||
mojom_generator, 'generate',
|
||||
'-g', 'libcamera',
|
||||
'--bytecode_path', mojom_templates_dir,
|
||||
'--libcamera_generate_proxy_cpp',
|
||||
'--libcamera_output_path=@OUTPUT@',
|
||||
'./' + '@INPUT@'
|
||||
])
|
||||
|
||||
libcamera_sources += proxy
|
||||
endforeach
|
||||
|
|
|
@ -6,8 +6,23 @@ ipa_proxy_sources = [
|
|||
|
||||
proxy_install_dir = join_paths(get_option('libexecdir'), 'libcamera')
|
||||
|
||||
foreach t : ipa_proxy_sources
|
||||
proxy = executable(t[0], t[1],
|
||||
# generate {pipeline}_ipa_proxy_worker.cpp
|
||||
foreach mojom : ipa_mojoms
|
||||
worker = custom_target(mojom['name'] + '_proxy_worker',
|
||||
input : mojom['mojom'],
|
||||
output : mojom['name'] + '_ipa_proxy_worker.cpp',
|
||||
depends : mojom_templates,
|
||||
command : [
|
||||
mojom_generator, 'generate',
|
||||
'-g', 'libcamera',
|
||||
'--bytecode_path', mojom_templates_dir,
|
||||
'--libcamera_generate_proxy_worker',
|
||||
'--libcamera_output_path=@OUTPUT@',
|
||||
'./' + '@INPUT@'
|
||||
])
|
||||
|
||||
proxy = executable(mojom['name'] + '_ipa_proxy',
|
||||
[worker, libcamera_generated_ipa_headers],
|
||||
install : true,
|
||||
install_dir : proxy_install_dir,
|
||||
dependencies : libcamera_dep)
|
||||
|
|
3
utils/ipc/generators/meson.build
Normal file
3
utils/ipc/generators/meson.build
Normal file
|
@ -0,0 +1,3 @@
|
|||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
subdir('libcamera_templates')
|
|
@ -1,3 +1,16 @@
|
|||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
subdir('generators')
|
||||
|
||||
py_modules += ['jinja2', 'ply']
|
||||
|
||||
mojom_parser = find_program('./parser.py')
|
||||
|
||||
mojom_generator = find_program('./generate.py')
|
||||
|
||||
mojom_templates = custom_target('mojom_templates',
|
||||
input : mojom_template_files,
|
||||
output : 'libcamera_templates.zip',
|
||||
command : [mojom_generator, '-o', '@OUTDIR@', 'precompile'])
|
||||
|
||||
mojom_templates_dir = meson.current_build_dir()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue