blob: 4df6652a8cf25029cab157e2dd267bbbce7147e1 [file] [log] [blame]
Brad Bishopb4459912019-11-05 19:39:11 -05001project(
2 'entity-manager',
3 'cpp',
Patrick Williams37304f02025-02-01 08:38:32 -05004 default_options: ['warning_level=3', 'werror=true', 'cpp_std=c++23'],
Brad Bishopb4459912019-11-05 19:39:11 -05005 license: 'Apache-2.0',
6 version: '0.1',
Patrick Williams213b3972025-07-24 12:11:52 -04007 meson_version: '>=1.3.0',
Brad Bishopb4459912019-11-05 19:39:11 -05008)
Ed Tanous77192692025-06-24 11:32:12 -07009add_project_arguments(
10 ['-Wno-psabi', '-DJSON_USE_IMPLICIT_CONVERSIONS=0'],
11 language: 'cpp',
12)
Brad Bishopb4459912019-11-05 19:39:11 -050013
14boost_args = [
Ed Tanousae2d4352025-02-12 15:51:48 -080015 '-DBOOST_ASIO_NO_DEPRECATED',
Brad Bishopb4459912019-11-05 19:39:11 -050016 '-DBOOST_SYSTEM_NO_DEPRECATED',
17 '-DBOOST_ERROR_CODE_HEADER_ONLY',
18 '-DBOOST_NO_RTTI',
19 '-DBOOST_NO_TYPEID',
20 '-DBOOST_ALL_NO_LIB',
Patrick Williams37304f02025-02-01 08:38:32 -050021 '-DBOOST_ALLOW_DEPRECATED_HEADERS',
Brad Bishopb4459912019-11-05 19:39:11 -050022]
Brad Bishope3a12b62020-01-15 11:56:29 -050023cpp = meson.get_compiler('cpp')
Brad Bishop787e8282020-01-15 12:16:53 -050024boost = dependency('boost', required: false)
25if not boost.found()
Patrick Williams37304f02025-02-01 08:38:32 -050026 subproject('boost', required: false)
Christopher Meis7cf43112025-07-15 09:09:02 +020027 boost = declare_dependency(include_directories: 'subprojects/boost_1_88_0')
Patrick Williams37304f02025-02-01 08:38:32 -050028 boost = boost.as_system('system')
Brad Bishop787e8282020-01-15 12:16:53 -050029endif
Brad Bishop92daaaa2020-01-20 15:45:01 -050030if get_option('fru-device')
31 i2c = cpp.find_library('i2c')
32endif
Andrew Jeffery14a7bc92021-08-02 10:01:22 +093033
Alexander Hansen8c4b1d92024-11-04 14:06:24 +010034if get_option('devicetree-vpd') or get_option('gpio-presence')
Patrick Williams37304f02025-02-01 08:38:32 -050035 phosphor_dbus_interfaces_dep = dependency(
36 'phosphor-dbus-interfaces',
37 include_type: 'system',
38 )
Chris Sides2ab73412024-10-15 16:04:11 -050039endif
40
Patrick Williams7e119822023-12-07 11:38:19 -060041nlohmann_json_dep = dependency('nlohmann_json', include_type: 'system')
Patrick Williamsd909b2d2025-08-11 10:51:08 -040042sdbusplus = dependency('sdbusplus')
Alexander Hansenc3db2c32024-08-20 15:01:38 +020043phosphor_logging_dep = dependency('phosphor-logging')
Ed Tanous10c57652025-09-30 10:24:57 -070044zlib_dep = dependency('zlib', include_type: 'system')
45libxml2_dep = dependency('libxml-2.0', include_type: 'system')
Andrew Jeffery14a7bc92021-08-02 10:01:22 +093046
Alexander Hansen8c4b1d92024-11-04 14:06:24 +010047if get_option('gpio-presence') or get_option('tests').allowed()
Alexander Hansen7cf00d32025-07-24 15:53:31 +020048 libgpio_dep = dependency(
49 'libgpiodcxx',
50 default_options: ['bindings=cxx'],
51 version: '<1.7.0',
52 )
Alexander Hansen8c4b1d92024-11-04 14:06:24 +010053endif
54
Brad Bishopb4459912019-11-05 19:39:11 -050055systemd = dependency('systemd')
Patrick Williamsee1db762023-04-12 08:05:58 -050056systemd_system_unit_dir = systemd.get_variable(
Patrick Williams187d6ee2025-07-09 11:28:01 -040057 'systemd_system_unit_dir',
Patrick Williams37304f02025-02-01 08:38:32 -050058 pkgconfig_define: ['prefix', get_option('prefix')],
59)
Brad Bishopb4459912019-11-05 19:39:11 -050060packagedir = join_paths(
61 get_option('prefix'),
62 get_option('datadir'),
63 meson.project_name(),
64)
Andrew Jefferya9c58922021-06-01 09:28:59 +093065sysconfdir = join_paths(
66 get_option('prefix'),
67 get_option('sysconfdir'),
68 meson.project_name(),
69)
Brad Bishopb4459912019-11-05 19:39:11 -050070threads = dependency('threads')
Ed Tanous55ae5a82021-08-02 14:00:02 -070071if cpp.has_header('valijson/validator.hpp')
72 valijson = declare_dependency()
73else
74 subproject('valijson', required: false)
75 valijson = declare_dependency(
Patrick Williams37304f02025-02-01 08:38:32 -050076 include_directories: 'subprojects/valijson/include',
Ed Tanous55ae5a82021-08-02 14:00:02 -070077 )
78 valijson = valijson.as_system('system')
Brad Bishopff1ddb72020-01-15 12:24:56 -050079endif
Brad Bishopb4459912019-11-05 19:39:11 -050080
81install_data('blacklist.json')
82
Alexander Hansenedc46342025-01-06 17:01:54 +010083# this creates the 'configs' variable
84subdir('configurations')
85
Ed Tanous9dc2cc52021-12-20 16:05:49 -080086filepaths = []
Alexander Hansend8e86032025-04-25 14:49:15 +020087package_configdir = join_paths(packagedir, 'configurations')
88fs = import('fs')
89
Brad Bishopb4459912019-11-05 19:39:11 -050090foreach c : configs
Ed Tanous9dc2cc52021-12-20 16:05:49 -080091 file = join_paths('configurations', c)
Alexander Hansend8e86032025-04-25 14:49:15 +020092 install_data(
93 file,
94 install_dir: join_paths(
95 package_configdir,
96 fs.parent(fs.relative_to(file, 'configurations')),
97 ),
98 )
Ed Tanous9dc2cc52021-12-20 16:05:49 -080099 filepaths += [file]
Brad Bishopb4459912019-11-05 19:39:11 -0500100endforeach
101
Matt Spinler7742c872024-05-02 14:13:21 -0500102if get_option('validate-json')
103 validate_script = files('scripts/validate_configs.py')
104 autojson = custom_target(
Patrick Williams37304f02025-02-01 08:38:32 -0500105 'check_syntax',
106 command: [validate_script, '-v', '-k'],
107 depend_files: files(filepaths),
108 build_by_default: true,
Patrick Williams37304f02025-02-01 08:38:32 -0500109 output: 'validate_configs.log',
Matt Spinler7742c872024-05-02 14:13:21 -0500110 )
111endif
Ed Tanous9dc2cc52021-12-20 16:05:49 -0800112
Alexander Hansen6eead742025-04-25 18:15:52 +0200113# this creates the 'schemas' variable
114subdir('schemas')
Brad Bishopb4459912019-11-05 19:39:11 -0500115
116foreach s : schemas
117 install_data(
118 join_paths('schemas', s),
Alexander Hansenddc8eb62025-04-25 18:08:51 +0200119 install_dir: join_paths(packagedir, 'schemas'),
Brad Bishopb4459912019-11-05 19:39:11 -0500120 )
121endforeach
122
123subdir('service_files')
124subdir('src')
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400125
Ed Tanous955c6eb2025-04-08 12:41:55 -0700126if get_option('tests').allowed()
Alexander Hansenf440def2025-06-17 16:29:59 +0200127 subdir('test')
Jason M. Billsff58eba2020-04-14 16:05:30 -0700128endif