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_org_freedesktop') 43 yaml_selected_subdirs += 'org/freedesktop' 44endif 45if get_option('data_org_open_power') 46 yaml_selected_subdirs += 'org/open_power' 47endif 48if get_option('data_xyz_openbmc_project') 49 yaml_selected_subdirs += 'xyz/openbmc_project' 50endif 51 52# Install the selected YAML files. 53inst_yaml_dir = get_option('datadir') / 'phosphor-dbus-yaml' 54foreach d : yaml_selected_subdirs 55 install_subdir( 56 'yaml' / d, 57 install_dir: inst_yaml_dir / d, 58 strip_directory: true, 59 ) 60endforeach 61 62# If libphosphor_dbus was not enabled, exit out from here. We installed 63# the YAML which is all we are asked to do. 64if not get_option('libphosphor_dbus') 65 subdir_done() 66endif 67 68should_generate_cpp = true 69should_generate_markdown = get_option('generate_md') 70should_generate_registry = true 71 72# Source the generated meson files. 73subdir('gen') 74 75# Source the extra target to copy registry files into a separate tree so they 76# can be useful for dependees when we are built as a sub-project. 77subdir('registry') 78 79# Define and build libphosphor_dbus.so from the C++ files. 80libphosphor_dbus = library( 81 'phosphor_dbus', 82 generated_sources, 83 implicit_include_directories: false, 84 include_directories: include_directories('gen'), 85 dependencies: sdbusplus_dep, 86 version: meson.project_version(), 87 install: true, 88) 89 90import('pkgconfig').generate( 91 libphosphor_dbus, 92 name: meson.project_name(), 93 version: meson.project_version(), 94 description: 'Generated sdbusplus bindings for phosphor-dbus-interfaces', 95 variables: [ 96 'yamldir=' + '${pc_sysrootdir}${prefix}' / inst_yaml_dir, 97 'registry_dir=' + '${prefix}' / inst_registry_dir, 98 ], 99) 100 101phosphor_dbus_interfaces_dep = declare_dependency( 102 sources: [generated_headers, registry_target], 103 include_directories: include_directories('gen'), 104 link_with: libphosphor_dbus, 105 dependencies: sdbusplus_dep, 106 variables: [ 107 'yamldir=' + meson.project_source_root() / 'yaml', 108 'registry_dir=' + registry_copy_dir, 109 ], 110) 111 112if meson.is_subproject() 113 phosphor_dbus_interfaces_dep = phosphor_dbus_interfaces_dep.as_system() 114endif 115 116meson.override_dependency( 117 'phosphor-dbus-interfaces', 118 phosphor_dbus_interfaces_dep, 119) 120