xref: /openbmc/openpower-vpd-parser/meson.build (revision 3e1cb49d2d469b79cafbd6372d071acb66ee612e)
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(
16    '-Wno-psabi',
17    '-Wno-ignored-attributes',
18    language: ['c', 'cpp'],
19)
20
21# Disable FORTIFY_SOURCE when compiling with no optimization
22if (get_option('optimization') == '0')
23    add_project_arguments('-U_FORTIFY_SOURCE', language: ['cpp', 'c'])
24    message('Disabling FORTIFY_SOURCE as optimization is set to 0')
25endif
26
27# Setup googletest before we import any projects that also depend on it to make
28# sure we have control over its configuration
29build_tests = get_option('tests')
30
31sdbusplus = dependency('sdbusplus', fallback: ['sdbusplus', 'sdbusplus_dep'])
32phosphor_logging = dependency('phosphor-logging')
33phosphor_dbus_interfaces = dependency('phosphor-dbus-interfaces')
34
35if build_tests.allowed()
36    subdir('test')
37endif
38
39compiler = meson.get_compiler('cpp')
40
41conf_data = configuration_data()
42conf_data.set_quoted('BUSNAME', get_option('BUSNAME'))
43conf_data.set_quoted('OBJPATH', get_option('OBJPATH'))
44conf_data.set_quoted('IFACE', get_option('IFACE'))
45conf_data.set_quoted(
46    'INVENTORY_JSON_DEFAULT',
47    get_option('INVENTORY_JSON_DEFAULT'),
48)
49conf_data.set_quoted(
50    'INVENTORY_JSON_SYM_LINK',
51    get_option('INVENTORY_JSON_SYM_LINK'),
52)
53conf_data.set_quoted(
54    'JSON_ABSOLUTE_PATH_PREFIX',
55    get_option('JSON_ABSOLUTE_PATH_PREFIX'),
56)
57conf_data.set_quoted('SYSTEM_VPD_FILE_PATH', get_option('SYSTEM_VPD_FILE_PATH'))
58conf_data.set_quoted('VPD_SYMLIMK_PATH', get_option('VPD_SYMLIMK_PATH'))
59conf_data.set_quoted('PIM_PATH_PREFIX', get_option('PIM_PATH_PREFIX'))
60configure_file(output: 'config.h', configuration: conf_data)
61
62services = ['service_files/vpd-manager.service']
63
64if get_option('ibm_system').allowed()
65    subdir('vpd-tool')
66    subdir('wait-vpd-parser')
67    scripts = ['scripts/wait-vpd-status.sh']
68
69    install_data(
70        scripts,
71        install_mode: 'rwxr-xr-x',
72        install_dir: get_option('bindir'),
73    )
74
75    services += [
76        'service_files/system-vpd.service',
77        'service_files/wait-vpd-parsers.service',
78    ]
79
80    package_datadir = join_paths('share', 'vpd')
81    install_subdir(
82        'configuration/ibm/',
83        install_mode: 'rwxr-xr-x',
84        install_dir: package_datadir,
85        strip_directory: true,
86    )
87endif
88
89libgpiodcxx = dependency(
90    'libgpiodcxx',
91    default_options: ['bindings=cxx'],
92    version: '<1.7.0',
93)
94
95libvpdecc_src = files('vpdecc/vpdecc.c', 'vpdecc/vpdecc_support.c')
96
97libvpdecc = shared_library(
98    'vpdecc',
99    libvpdecc_src,
100    version: meson.project_version(),
101    install: true,
102)
103
104subdir('vpd-manager')
105
106systemd_system_unit_dir = dependency('systemd').get_variable(
107    'systemd_system_unit_dir',
108)
109install_data(services, install_dir: systemd_system_unit_dir)
110