Fix getting absolute path to YAML_PATH
When we extend the `YAML_PATH` in bb or bbappend,
the meson.project_source_root should not get the absolute path in
meson.build, this will produce double paths and cause the build to
fail.
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I6de51da8b9fda4d00a727211edd3448802f84a43
diff --git a/meson_options.txt b/meson_options.txt
index c124f67..fce4972 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -6,6 +6,6 @@
option(
'YAML_PATH', type: 'string',
- value: 'src/example',
+ value: '',
description: 'The path to the yaml config files.'
)
\ No newline at end of file
diff --git a/src/meson.build b/src/meson.build
index 6a03a3e..64a2b86 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -14,6 +14,11 @@
'templates/event.mako.cpp',
)
+yamldir = get_option('YAML_PATH')
+if yamldir == ''
+ yamldir = meson.project_source_root() + '/src/example'
+endif
+
generated_hpp = custom_target(
'generated.hpp',
command: [
@@ -21,7 +26,7 @@
meson.project_source_root() + '/src/pdmgen.py',
'-t', 'generated.mako.hpp',
'-p', meson.project_source_root() + '/src/templates',
- '-d', meson.project_source_root() + '/' + get_option('YAML_PATH'),
+ '-d', yamldir,
'-o', meson.current_build_dir() + '/generated.hpp',
'generate-cpp'
],