xref: /openbmc/openpower-vpd-parser/meson.build (revision 022112bc235c7f91ee998bb131f06e212dee1f6a)
1project(
2     'vpd-manager',
3     'c',
4     'cpp',
5     default_options: [
6       'warning_level=3',
7       'werror=true',
8       'cpp_std=c++23',
9       'buildtype=debugoptimized'
10     ],
11     version: '1.0',
12     meson_version: '>=1.1.1',
13)
14
15add_global_arguments('-Wno-psabi', '-Wno-ignored-attributes', language : ['c', 'cpp'])
16
17# Disable FORTIFY_SOURCE when compiling with no optimization
18if(get_option('optimization') == '0')
19  add_project_arguments('-U_FORTIFY_SOURCE',language:['cpp','c'])
20  message('Disabling FORTIFY_SOURCE as optimization is set to 0')
21endif
22
23# Setup googletest before we import any projects that also depend on it to make
24# sure we have control over its configuration
25build_tests = get_option('tests')
26
27sdbusplus = dependency('sdbusplus', fallback: [ 'sdbusplus', 'sdbusplus_dep' ])
28phosphor_logging = dependency('phosphor-logging')
29phosphor_dbus_interfaces = dependency('phosphor-dbus-interfaces')
30
31if build_tests.allowed()
32    subdir('test')
33endif
34
35subdir('vpd-tool')
36
37compiler = meson.get_compiler('cpp')
38
39conf_data = configuration_data()
40conf_data.set_quoted('BUSNAME', get_option('BUSNAME'))
41conf_data.set_quoted('OBJPATH', get_option('OBJPATH'))
42conf_data.set_quoted('IFACE', get_option('IFACE'))
43conf_data.set_quoted('BAD_VPD_DIR', get_option('BAD_VPD_DIR'))
44conf_data.set_quoted('INVENTORY_JSON_DEFAULT', get_option('INVENTORY_JSON_DEFAULT'))
45conf_data.set_quoted('INVENTORY_JSON_SYM_LINK', get_option('INVENTORY_JSON_SYM_LINK'))
46conf_data.set_quoted('JSON_ABSOLUTE_PATH_PREFIX', get_option('JSON_ABSOLUTE_PATH_PREFIX'))
47conf_data.set_quoted('SYSTEM_VPD_FILE_PATH', get_option('SYSTEM_VPD_FILE_PATH'))
48conf_data.set_quoted('VPD_SYMLIMK_PATH', get_option('VPD_SYMLIMK_PATH'))
49conf_data.set_quoted('PIM_PATH_PREFIX', get_option('PIM_PATH_PREFIX'))
50configure_file(output: 'config.h',
51            configuration : conf_data)
52
53libvpdecc_src = files(
54    'vpdecc/vpdecc.c',
55    'vpdecc/vpdecc_support.c'
56)
57
58libvpdecc = shared_library(
59    'vpdecc',
60    libvpdecc_src,
61    version: meson.project_version(),
62    install: true,
63)
64
65libgpiodcxx = dependency(
66            'libgpiodcxx',
67            default_options: ['bindings=cxx'],
68        )
69
70subdir('vpd-manager')
71
72services = ['service_files/vpd-manager.service',
73            'service_files/system-vpd.service',
74            'service_files/wait-vpd-parsers.service']
75
76systemd_system_unit_dir = dependency('systemd').get_variable(
77        'systemdsystemunitdir')
78install_data(services, install_dir: systemd_system_unit_dir)
79
80scripts = ['scripts/wait-vpd-status.sh']
81
82install_data(scripts,
83    install_mode: 'rwxr-xr-x',
84    install_dir: get_option('bindir'))
85
86package_datadir = join_paths('share', 'vpd')
87install_subdir('configuration/ibm/', install_mode: 'rwxr-xr-x', install_dir: package_datadir, strip_directory: true)
88