yaml: move to subdirectory

A pending sdbusplus change (I38b69bc67b6a3d80cda1b508a76e106a50d8ab93)
is going to require YAML to be in a specific subdirectory and not in
the root.  Move here in prep for that change.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I42cd6599f751b34284243080dd213be3254d147c
diff --git a/gen/meson.build b/gen/meson.build
index 56193c7..2756633 100644
--- a/gen/meson.build
+++ b/gen/meson.build
@@ -4,10 +4,10 @@
     '--version',
 ).stdout().strip().split('\n')[0]
 
-if sdbuspp_gen_meson_ver != 'sdbus++-gen-meson version 3'
+if sdbuspp_gen_meson_ver != 'sdbus++-gen-meson version 4'
     warning('Generated meson files from wrong version of sdbus++-gen-meson.')
     warning(
-        'Expected "sdbus++-gen-meson version 3", got:',
+        'Expected "sdbus++-gen-meson version 4", got:',
         sdbuspp_gen_meson_ver
     )
 endif
diff --git a/gen/org/open_power/OCC/Device/meson.build b/gen/org/open_power/OCC/Device/meson.build
index 0f287ad..84af1ab 100644
--- a/gen/org/open_power/OCC/Device/meson.build
+++ b/gen/org/open_power/OCC/Device/meson.build
@@ -1,13 +1,14 @@
 # Generated file; do not modify.
 generated_sources += custom_target(
     'org/open_power/OCC/Device__cpp'.underscorify(),
-    input: [ '../../../../../org/open_power/OCC/Device.errors.yaml',  ],
+    input: [ '../../../../../yaml/org/open_power/OCC/Device.errors.yaml',  ],
     output: [ 'error.cpp', 'error.hpp',  ],
+    depend_files: sdbusplusplus_depfiles,
     command: [
         sdbuspp_gen_meson_prog, '--command', 'cpp',
         '--output', meson.current_build_dir(),
         '--tool', sdbusplusplus_prog,
-        '--directory', meson.current_source_dir() / '../../../../..',
+        '--directory', meson.current_source_dir() / '../../../../../yaml',
         'org/open_power/OCC/Device',
     ],
 )
diff --git a/gen/org/open_power/OCC/meson.build b/gen/org/open_power/OCC/meson.build
index 7433b15..c80db64 100644
--- a/gen/org/open_power/OCC/meson.build
+++ b/gen/org/open_power/OCC/meson.build
@@ -2,13 +2,14 @@
 subdir('Device')
 generated_others += custom_target(
     'org/open_power/OCC/Device__markdown'.underscorify(),
-    input: [ '../../../../org/open_power/OCC/Device.errors.yaml',  ],
+    input: [ '../../../../yaml/org/open_power/OCC/Device.errors.yaml',  ],
     output: [ 'Device.md' ],
+    depend_files: sdbusplusplus_depfiles,
     command: [
         sdbuspp_gen_meson_prog, '--command', 'markdown',
         '--output', meson.current_build_dir(),
         '--tool', sdbusplusplus_prog,
-        '--directory', meson.current_source_dir() / '../../../..',
+        '--directory', meson.current_source_dir() / '../../../../yaml',
         'org/open_power/OCC/Device',
     ],
 )
diff --git a/gen/regenerate-meson b/gen/regenerate-meson
index 56bc2c6..a39ad64 100755
--- a/gen/regenerate-meson
+++ b/gen/regenerate-meson
@@ -19,5 +19,5 @@
 
 $SDBUSPP_GEN_MESON \
     --command meson \
-    --directory "$REPO_ROOT" \
+    --directory "$REPO_ROOT/yaml" \
     --output "$REPO_ROOT/gen"
diff --git a/meson.build b/meson.build
index 843a9a7..73daee4 100644
--- a/meson.build
+++ b/meson.build
@@ -48,8 +48,14 @@
     configuration: conf_data
 )
 
+sdbusplus_dep = dependency('sdbusplus')
 sdbusplusplus_prog = find_program('sdbus++')
 sdbuspp_gen_meson_prog = find_program('sdbus++-gen-meson')
+sdbusplusplus_depfiles = files()
+if sdbusplus_dep.type_name() == 'internal'
+    sdbusplusplus_depfiles = subproject('sdbusplus').get_variable('sdbusplusplus_depfiles')
+endif
+
 python_prog = find_program('python3', required: true)
 realpath_prog = find_program('realpath')
 
@@ -92,19 +98,6 @@
 deps = []
 sources = []
 if get_option('install-error-yaml').disabled()
-    sdbusplus_dep = dependency('sdbusplus')
-    if sdbusplus_dep.found()
-        sdbusplusplus_prog = find_program('sdbus++')
-        sdbuspp_gen_meson_prog = find_program('sdbus++-gen-meson')
-    else
-        sdbusplus_proj = subproject('sdbusplus', required: true)
-        sdbusplus_dep = sdbusplus_proj.get_variable('sdbusplus_dep')
-        sdbusplusplus_prog = sdbusplus_proj.get_variable('sdbusplusplus_prog')
-        sdbuspp_gen_meson_prog = sdbusplus_proj.get_variable(
-            'sdbuspp_gen_meson_prog'
-        )
-    endif
-
     sdeventplus_dep = dependency(
         'sdeventplus',
         fallback: [
diff --git a/subprojects/sdbusplus.wrap b/subprojects/sdbusplus.wrap
index d470130..edd9a31 100644
--- a/subprojects/sdbusplus.wrap
+++ b/subprojects/sdbusplus.wrap
@@ -1,3 +1,7 @@
 [wrap-git]
 url = https://github.com/openbmc/sdbusplus.git
 revision = HEAD
+
+[provide]
+sdbusplus = sdbusplus_dep
+program_names = sdbus++, sdbus++-gen-meson
diff --git a/org/open_power/OCC/Device.errors.yaml b/yaml/org/open_power/OCC/Device.errors.yaml
similarity index 100%
rename from org/open_power/OCC/Device.errors.yaml
rename to yaml/org/open_power/OCC/Device.errors.yaml
diff --git a/org/open_power/OCC/Device.metadata.yaml b/yaml/org/open_power/OCC/Device.metadata.yaml
similarity index 100%
rename from org/open_power/OCC/Device.metadata.yaml
rename to yaml/org/open_power/OCC/Device.metadata.yaml