| project('rded', ['c', 'cpp'], |
| version: '0.1', meson_version: '>=1.1.1', |
| default_options: [ |
| 'warning_level=3', |
| 'werror=true', |
| 'cpp_std=c++23', |
| 'c_std=c18', |
| ]) |
| |
| lib_sources = [ |
| 'interface/pldm_interface.cpp', |
| 'interface/pldm_rde.cpp', |
| 'util/matcher/rde_match_handler.cpp', |
| 'util/state_machine/discovery/base/base_disc_state_machine.cpp', |
| 'util/state_machine/discovery/rde/rde_disc_state_machine.cpp', |
| 'util/state_machine/discovery/rde/dictionary.cpp', |
| ] |
| |
| all_sources = ['rded.cpp'] + lib_sources |
| |
| cpp = meson.get_compiler('cpp') |
| phosphor_dbus_interfaces = dependency('phosphor-dbus-interfaces') |
| sdbusplus = dependency('sdbusplus') |
| sdeventplus = dependency('sdeventplus') |
| stdplus = dependency('stdplus') |
| phosphor_logging_dep = dependency('phosphor-logging') |
| |
| if cpp.has_header('nlohmann/json.hpp') |
| nlohmann_json = declare_dependency() |
| else |
| nlohmann_json = dependency('nlohmann_json') |
| endif |
| |
| headers = [ |
| '.', |
| 'util', |
| 'interface', |
| 'util/state_machine', |
| 'util/state_machine/discovery/'] |
| |
| requester_inc = include_directories(headers) |
| req_src = declare_dependency(include_directories:requester_inc) |
| |
| libbej_dep = dependency('libbej') |
| libpldm_dep = dependency('libpldm') |
| |
| boost = dependency( |
| 'boost', |
| version : '>=1.82.0', |
| required : false, |
| include_type: 'system' |
| ) |
| |
| if not boost.found() |
| boost = subproject('boost', required: true).get_variable('boost_dep') |
| boost = boost.as_system('system') |
| endif |
| |
| boost_compile_args = [ |
| '-DBOOST_ASIO_DISABLE_THREADS', |
| '-DBOOST_ALL_NO_LIB', |
| '-DBOOST_SYSTEM_NO_DEPRECATED', |
| '-DBOOST_ERROR_CODE_HEADER_ONLY', |
| '-DBOOST_COROUTINES_NO_DEPRECATION_WARNING', |
| ] |
| |
| boost_dep = declare_dependency( |
| dependencies: dependency('boost', |
| modules: ['coroutine', 'context'], |
| disabler: true, |
| required: false |
| ), |
| compile_args: boost_compile_args) |
| |
| deps = [ |
| libpldm_dep, |
| libbej_dep, |
| boost_dep, |
| nlohmann_json, |
| phosphor_dbus_interfaces, |
| sdbusplus, |
| sdeventplus, |
| stdplus, |
| req_src, |
| ] |
| |
| rded_lib = static_library( |
| 'rded_lib', |
| lib_sources, |
| include_directories: headers, |
| implicit_include_directories: false, |
| dependencies: deps) |
| |
| rded_lib_dep = declare_dependency( |
| dependencies: deps, |
| include_directories: headers, |
| link_with: rded_lib) |
| |
| if get_option('tests').allowed() |
| subdir('tests') |
| endif |
| |
| executable( |
| 'rded', |
| all_sources, |
| implicit_include_directories: false, |
| dependencies: deps, |
| install: true, |
| install_dir: get_option('bindir')) |
| |
| systemd_dep = dependency('systemd') |
| if systemd_dep.found() |
| configure_file( |
| copy: true, |
| input: 'service_files/rded.service', |
| install: true, |
| install_dir: systemd_dep.get_variable('systemdsystemunitdir'), |
| output: 'rded.service', |
| ) |
| endif |