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