1project( 2 'phosphor-dbus-interfaces', 3 'cpp', 4 meson_version: '>=1.1.1', 5 default_options: [ 6 'buildtype=debugoptimized', 7 'cpp_std=c++23', 8 'warning_level=3', 9 'werror=true', 10 'generate_md=' + (meson.is_subproject() ? 'false' : 'true'), 11 ], 12 version: '1.0.0', 13) 14 15sdbusplus_dep = dependency('sdbusplus') 16sdbusplusplus_prog = find_program('sdbus++', native: true) 17sdbuspp_gen_meson_prog = find_program('sdbus++-gen-meson', native: true) 18sdbusplusplus_depfiles = files() 19if sdbusplus_dep.type_name() == 'internal' 20 sdbusplusplus_depfiles = subproject('sdbusplus').get_variable( 21 'sdbusplusplus_depfiles', 22 ) 23endif 24 25# Parse options to determine appropriate subdirectories to support. 26yaml_selected_subdirs = [] 27if get_option('data_com_ampere') 28 yaml_selected_subdirs += 'com/ampere' 29endif 30if get_option('data_com_google') 31 yaml_selected_subdirs += 'com/google' 32endif 33if get_option('data_com_ibm') 34 yaml_selected_subdirs += 'com/ibm' 35endif 36if get_option('data_com_intel') 37 yaml_selected_subdirs += 'com/intel' 38endif 39if get_option('data_com_meta') 40 yaml_selected_subdirs += 'com/meta' 41endif 42if get_option('data_com_qualcomm') 43 yaml_selected_subdirs += 'com/qualcomm' 44endif 45if get_option('data_org_freedesktop') 46 yaml_selected_subdirs += 'org/freedesktop' 47endif 48if get_option('data_org_open_power') 49 yaml_selected_subdirs += 'org/open_power' 50endif 51if get_option('data_xyz_openbmc_project') 52 yaml_selected_subdirs += 'xyz/openbmc_project' 53endif 54 55# Install the selected YAML files. 56inst_yaml_dir = get_option('datadir') / 'phosphor-dbus-yaml' 57foreach d : yaml_selected_subdirs 58 install_subdir( 59 'yaml' / d, 60 install_dir: inst_yaml_dir / d, 61 strip_directory: true, 62 ) 63endforeach 64 65# If libphosphor_dbus was not enabled, exit out from here. We installed 66# the YAML which is all we are asked to do. 67if not get_option('libphosphor_dbus') 68 subdir_done() 69endif 70 71should_generate_cpp = true 72should_generate_markdown = get_option('generate_md') 73should_generate_registry = true 74 75# Source the generated meson files. 76subdir('gen') 77 78# Source the extra target to copy registry files into a separate tree so they 79# can be useful for dependees when we are built as a sub-project. 80subdir('registry') 81 82# Define and build libphosphor_dbus.so from the C++ files. 83libphosphor_dbus = library( 84 'phosphor_dbus', 85 generated_sources, 86 implicit_include_directories: false, 87 include_directories: include_directories('gen'), 88 dependencies: sdbusplus_dep, 89 version: meson.project_version(), 90 install: true, 91) 92 93import('pkgconfig').generate( 94 libphosphor_dbus, 95 name: meson.project_name(), 96 version: meson.project_version(), 97 description: 'Generated sdbusplus bindings for phosphor-dbus-interfaces', 98 variables: [ 99 'yamldir=' + '${pc_sysrootdir}${prefix}' / inst_yaml_dir, 100 'registry_dir=' + '${prefix}' / inst_registry_dir, 101 ], 102) 103 104phosphor_dbus_interfaces_dep = declare_dependency( 105 sources: [generated_headers, registry_target], 106 include_directories: include_directories('gen'), 107 link_with: libphosphor_dbus, 108 dependencies: sdbusplus_dep, 109 variables: [ 110 'yamldir=' + meson.project_source_root() / 'yaml', 111 'registry_dir=' + registry_copy_dir, 112 ], 113) 114 115if meson.is_subproject() 116 phosphor_dbus_interfaces_dep = phosphor_dbus_interfaces_dep.as_system() 117endif 118 119meson.override_dependency( 120 'phosphor-dbus-interfaces', 121 phosphor_dbus_interfaces_dep, 122) 123