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