summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorPaul Elder <paul.elder@ideasonboard.com>2020-12-05 19:30:51 +0900
committerPaul Elder <paul.elder@ideasonboard.com>2021-02-16 19:21:39 +0900
commite6722b86eef7c88358d4b4535d75ac3415c12004 (patch)
tree325d27622294e78fb4af99d174e473aad72eb903 /include
parent4000ed4d8d9ec6bcf9177872604b6b6e23bc22ee (diff)
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>
Diffstat (limited to 'include')
-rw-r--r--include/libcamera/ipa/meson.build120
1 files changed, 120 insertions, 0 deletions
diff --git a/include/libcamera/ipa/meson.build b/include/libcamera/ipa/meson.build
index 508c6bd1..499d1bc0 100644
--- a/include/libcamera/ipa/meson.build
+++ b/include/libcamera/ipa/meson.build
@@ -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