xref: /openbmc/intel-ipmi-oem/meson.build (revision 97d1fb3739cf93d33b0e8d784de03afdfbdeaa8a)
1project(
2    'intel-ipmi-oem',
3    'cpp',
4    version: '0.1',
5    meson_version: '>=1.1.1',
6    default_options: ['werror=true', 'warning_level=3', 'cpp_std=c++23'],
7)
8
9# Project Arguments
10all_args = [
11    '-DBOOST_ERROR_CODE_HEADER_ONLY',
12    '-DBOOST_SYSTEM_NO_DEPRECATED',
13    '-DBOOST_ALL_NO_LIB',
14    '-DBOOST_NO_RTTI',
15    '-DBOOST_NO_TYPEID',
16    '-DBOOST_ASIO_DISABLE_THREADS',
17    '-DBOOST_COROUTINES_NO_DEPRECATION_WARNING',
18    '-DBMC_VALIDATION_UNSECURE_FEATURE',
19    '-DUSING_ENTITY_MANAGER_DECORATORS',
20    '-Wno-psabi',
21    '-Wno-pedantic',
22]
23
24feature_map = {
25    'intel-pfr': '-DINTEL_PFR_ENABLED',
26    'bmc-validation-unsecure-feature': '-DBMC_VALIDATION_UNSECURE_FEATURE',
27    'using-entity-manager-decorators': '-DUSING_ENTITY_MANAGER_DECORATORS',
28}
29
30foreach option_key, option_value : feature_map
31    if (get_option(option_key).allowed())
32        summary(option_key, option_value, section: 'Enabled Features')
33        add_project_arguments(option_value, language: 'cpp')
34    endif
35endforeach
36
37cpp = meson.get_compiler('cpp')
38add_project_arguments(cpp.get_supported_arguments(all_args), language: 'cpp')
39
40fs = import('fs')
41
42root_inc = include_directories('.', 'include')
43
44# Dependencies
45nlohmann_json_dep = dependency('nlohmann_json', include_type: 'system')
46phosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces')
47phosphor_logging_dep = dependency('phosphor-logging')
48sdbusplus_dep = dependency('sdbusplus')
49ipmid_dep = dependency('libipmid')
50channellayer_dep = dependency('libchannellayer')
51userlayer_dep = dependency('libuserlayer')
52
53
54tinyxml_dep = dependency(
55    'tinyxml2',
56    default_options: ['tests=false'],
57    include_type: 'system',
58)
59
60gpio_dep = dependency('libgpiodcxx', default_options: ['bindings=cxx'])
61
62zinteloemcmds_pre = declare_dependency(
63    include_directories: root_inc,
64    dependencies: [
65        channellayer_dep,
66        ipmid_dep,
67        gpio_dep,
68        nlohmann_json_dep,
69        phosphor_dbus_interfaces_dep,
70        phosphor_logging_dep,
71        sdbusplus_dep,
72        tinyxml_dep,
73        userlayer_dep,
74    ],
75)
76
77prog_python = import('python').find_installation('python3')
78generate_allowlist_script = files('generate-allowlist.py')
79ipmiallowlist = custom_target(
80    'ipmi-allowlist.hpp',
81    input: [generate_allowlist_script, 'ipmi-allowlist.conf'],
82    output: 'ipmi-allowlist.hpp',
83    command: [prog_python, '@INPUT0@', '@INPUT1@', '@OUTPUT@'],
84)
85
86zinteloemcmds_src = [
87    'src/oemcommands.cpp',
88    'src/sensorcommands.cpp',
89    'src/biosconfigcommands.cpp',
90    'src/storagecommands.cpp',
91    'src/multinodecommands.cpp',
92    'src/firmware-update.cpp',
93    'src/appcommands.cpp',
94    'src/smbiosmdrv2handler.cpp',
95    'src/manufacturingcommands.cpp',
96    'src/bmccontrolservices.cpp',
97    'src/bridgingcommands.cpp',
98    'src/ipmi_to_redfish_hooks.cpp',
99    'src/me_to_redfish_hooks.cpp',
100    'src/chassiscommands.cpp',
101    'src/allowlist-filter.cpp',
102    'src/fruutils.cpp',
103    ipmiallowlist,
104]
105
106zinteloemcmds_lib = library(
107    'zinteloemcmds',
108    sources: zinteloemcmds_src,
109    implicit_include_directories: false,
110    dependencies: zinteloemcmds_pre,
111    version: meson.project_version(),
112    override_options: ['b_lundef=false'],
113    install: true,
114    install_dir: get_option('libdir') / 'ipmid-providers',
115)
116
117if get_option('tests').allowed()
118    subdir('tests')
119endif
120