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