xref: /openbmc/entity-manager/meson.build (revision 187d6eed1b5c8d6d6e7fdb164ff86912dea03347)
1project(
2    'entity-manager',
3    'cpp',
4    default_options: ['warning_level=3', 'werror=true', 'cpp_std=c++23'],
5    license: 'Apache-2.0',
6    version: '0.1',
7    meson_version: '>=1.3.0',
8)
9add_project_arguments('-Wno-psabi', language: 'cpp')
10
11boost_args = [
12    '-DBOOST_ASIO_NO_DEPRECATED',
13    '-DBOOST_SYSTEM_NO_DEPRECATED',
14    '-DBOOST_ERROR_CODE_HEADER_ONLY',
15    '-DBOOST_NO_RTTI',
16    '-DBOOST_NO_TYPEID',
17    '-DBOOST_ALL_NO_LIB',
18    '-DBOOST_ALLOW_DEPRECATED_HEADERS',
19]
20cpp = meson.get_compiler('cpp')
21boost = dependency('boost', required: false)
22if not boost.found()
23    subproject('boost', required: false)
24    boost = declare_dependency(include_directories: 'subprojects/boost_1_88_0')
25    boost = boost.as_system('system')
26endif
27if get_option('fru-device')
28    i2c = cpp.find_library('i2c')
29endif
30
31if get_option('devicetree-vpd') or get_option('gpio-presence')
32    phosphor_dbus_interfaces_dep = dependency(
33        'phosphor-dbus-interfaces',
34        include_type: 'system',
35    )
36endif
37
38nlohmann_json_dep = dependency('nlohmann_json', include_type: 'system')
39sdbusplus = dependency('sdbusplus')
40phosphor_logging_dep = dependency('phosphor-logging')
41
42if get_option('gpio-presence') or get_option('tests').allowed()
43    libgpio_dep = dependency(
44        'libgpiodcxx',
45        default_options: ['bindings=cxx'],
46        version: '<1.7.0',
47    )
48endif
49
50systemd = dependency('systemd')
51systemd_system_unit_dir = systemd.get_variable(
52    'systemd_system_unit_dir',
53    pkgconfig_define: ['prefix', get_option('prefix')],
54)
55packagedir = join_paths(
56    get_option('prefix'),
57    get_option('datadir'),
58    meson.project_name(),
59)
60sysconfdir = join_paths(
61    get_option('prefix'),
62    get_option('sysconfdir'),
63    meson.project_name(),
64)
65threads = dependency('threads')
66if cpp.has_header('valijson/validator.hpp')
67    valijson = declare_dependency()
68else
69    subproject('valijson', required: false)
70    valijson = declare_dependency(
71        include_directories: 'subprojects/valijson/include',
72    )
73    valijson = valijson.as_system('system')
74endif
75
76install_data('blacklist.json')
77
78# this creates the 'configs' variable
79subdir('configurations')
80
81filepaths = []
82package_configdir = join_paths(packagedir, 'configurations')
83fs = import('fs')
84
85foreach c : configs
86    file = join_paths('configurations', c)
87    install_data(
88        file,
89        install_dir: join_paths(
90            package_configdir,
91            fs.parent(fs.relative_to(file, 'configurations')),
92        ),
93    )
94    filepaths += [file]
95endforeach
96
97if get_option('validate-json')
98    validate_script = files('scripts/validate_configs.py')
99    autojson = custom_target(
100        'check_syntax',
101        command: [validate_script, '-v', '-k'],
102        depend_files: files(filepaths),
103        build_by_default: true,
104        output: 'validate_configs.log',
105    )
106endif
107
108# this creates the 'schemas' variable
109subdir('schemas')
110
111foreach s : schemas
112    install_data(
113        join_paths('schemas', s),
114        install_dir: join_paths(packagedir, 'schemas'),
115    )
116endforeach
117
118subdir('service_files')
119subdir('src')
120
121if get_option('tests').allowed()
122    subdir('test')
123endif
124