xref: /openbmc/ipmi-fru-parser/meson.build (revision 440d84d4)
1project(
2  'ipmi-fru-parser',
3  'cpp',
4  version: '1.0',
5  default_options: [
6    'buildtype=debugoptimized',
7    'cpp_std=c++23',
8    'warning_level=3',
9    'werror=true',
10  ],
11  meson_version: '>=1.1.1',
12)
13
14cxx = meson.get_compiler('cpp')
15
16phosphor_logging_dep = dependency('phosphor-logging')
17sdbusplus_dep = dependency('sdbusplus')
18ipmid_dep = dependency('libipmid')
19
20if cxx.has_header('CLI/CLI.hpp')
21    CLI11_dep = declare_dependency()
22else
23    CLI11_dep = dependency('CLI11')
24endif
25
26python_prog = find_program('python3', native: true)
27
28fru_gen = custom_target(
29  'fru-gen.cpp'.underscorify(),
30  input: [
31    'scripts/fru_gen.py',
32    get_option('fru_yaml'),
33  ],
34  output: 'fru-gen.cpp',
35  command: [
36    python_prog, '@INPUT0@',
37    '-i', '@INPUT1@',
38    '-o', meson.current_build_dir(),
39    'generate-cpp',
40  ],
41)
42
43properties_gen = custom_target(
44  'extra-properties-gen.cpp'.underscorify(),
45  input: [
46    'scripts/extra-properties.py',
47    get_option('properties_yaml'),
48  ],
49  output: 'extra-properties-gen.cpp',
50  command: [
51    python_prog, '@INPUT0@',
52    '-e', '@INPUT1@',
53  ],
54)
55
56writefrudata_lib = library(
57  'writefrudata',
58  fru_gen,
59  properties_gen,
60  'fru_area.cpp',
61  'frup.cpp',
62  'writefrudata.cpp',
63  dependencies: [
64    sdbusplus_dep,
65    phosphor_logging_dep,
66    ipmid_dep,
67  ],
68  version: meson.project_version(),
69  install: true,
70)
71
72writefrudata_dep = declare_dependency(
73  link_with: writefrudata_lib,
74)
75
76strgfnhandler_lib = library(
77  'strgfnhandler',
78  'strgfnhandler.cpp',
79  dependencies: [
80    writefrudata_dep,
81    phosphor_logging_dep,
82    ipmid_dep,
83  ],
84  override_options: [ 'b_lundef=false' ],
85  version: meson.project_version(),
86  install: true,
87  install_dir: get_option('libdir') / 'ipmid-providers',
88)
89
90executable(
91  'phosphor-read-eeprom',
92  'readeeprom.cpp',
93  dependencies: [
94    CLI11_dep,
95    phosphor_logging_dep,
96    sdbusplus_dep,
97    writefrudata_dep,
98  ],
99  install: true,
100)
101