xref: /openbmc/entity-manager/meson.build (revision cefe4bb6b95624a4d1691cfdba075fff4fdb39f8)
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')
41zlib_dep = dependency('zlib', include_type: 'system')
42libxml2_dep = dependency('libxml-2.0', include_type: 'system')
43
44if get_option('gpio-presence') or get_option('tests').allowed()
45    libgpio_dep = dependency(
46        'libgpiodcxx',
47        default_options: ['bindings=cxx'],
48        version: '<1.7.0',
49    )
50endif
51
52systemd = dependency('systemd')
53systemd_system_unit_dir = systemd.get_variable(
54    'systemd_system_unit_dir',
55    pkgconfig_define: ['prefix', get_option('prefix')],
56)
57packagedir = join_paths(
58    get_option('prefix'),
59    get_option('datadir'),
60    meson.project_name(),
61)
62sysconfdir = join_paths(
63    get_option('prefix'),
64    get_option('sysconfdir'),
65    meson.project_name(),
66)
67threads = dependency('threads')
68if cpp.has_header('valijson/validator.hpp')
69    valijson = declare_dependency()
70else
71    subproject('valijson', required: false)
72    valijson = declare_dependency(
73        include_directories: 'subprojects/valijson/include',
74    )
75    valijson = valijson.as_system('system')
76endif
77
78install_data('blacklist.json')
79
80# this creates the 'configs' variable
81subdir('configurations')
82
83filepaths = []
84package_configdir = join_paths(packagedir, 'configurations')
85fs = import('fs')
86
87foreach c : configs
88    file = join_paths('configurations', c)
89    install_data(
90        file,
91        install_dir: join_paths(
92            package_configdir,
93            fs.parent(fs.relative_to(file, 'configurations')),
94        ),
95    )
96    filepaths += [file]
97endforeach
98
99if get_option('validate-json')
100    validate_script = files('scripts/validate_configs.py')
101    autojson = custom_target(
102        'check_syntax',
103        command: [validate_script, '-v', '-k'],
104        depend_files: files(filepaths),
105        build_by_default: true,
106        output: 'validate_configs.log',
107    )
108endif
109
110# this creates the 'schemas' variable
111subdir('schemas')
112
113foreach s : schemas
114    install_data(
115        join_paths('schemas', s),
116        install_dir: join_paths(packagedir, 'schemas'),
117    )
118endforeach
119
120subdir('service_files')
121subdir('src')
122
123if get_option('tests').allowed()
124    subdir('test')
125endif
126