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