blob: d170cf3700571a43249e5da1d2f204fb80fb01f9 [file] [log] [blame]
Brad Bishop0aa15902019-05-08 21:30:01 -04001project(
2 'phosphor-objmgr',
Patrick Williams2a1ef012025-03-03 11:09:20 -05003 'c',
4 'cpp',
Brad Bishop0aa15902019-05-08 21:30:01 -04005 default_options: [
Brad Bishopd6aa5522022-05-31 19:23:48 -04006 'buildtype=debugoptimized',
Patrick Williams26ed9802023-07-12 11:16:09 -05007 'cpp_std=c++23',
Brad Bishop0aa15902019-05-08 21:30:01 -04008 'warning_level=3',
9 'werror=true',
10 ],
11 license: 'Apache-2.0',
Patrick Williams26ed9802023-07-12 11:16:09 -050012 meson_version: '>=1.1.1',
Brad Bishop0aa15902019-05-08 21:30:01 -040013 version: '1.0',
14)
15
Brad Bishop1d706372025-07-09 16:39:15 -040016cli11 = dependency('CLI11', required: false, include_type: 'system')
17if not cli11.found()
18 cli11_proj = subproject('cli11', required: true)
19 cli11 = cli11_proj.get_variable('CLI11_dep')
20 cli11 = cli11.as_system('system')
Brad Bishop8c243622022-07-11 11:21:50 -040021endif
Brad Bishop1d706372025-07-09 16:39:15 -040022
Patrick Williamsf814e5b2022-03-21 11:14:17 -050023phosphor_logging = dependency('phosphor-logging')
Brad Bishop5962db52022-05-16 21:04:05 -040024phosphor_dbus_interfaces = dependency('phosphor-dbus-interfaces')
Patrick Williamsf814e5b2022-03-21 11:14:17 -050025sdbusplus = dependency('sdbusplus')
Patrick Williams2a1ef012025-03-03 11:09:20 -050026boost = dependency(
27 'boost',
28 version: '>=1.79.0',
29 required: false,
30 include_type: 'system',
31)
Ed Tanous26ed4a12022-07-13 13:46:08 -070032if not boost.found()
Patrick Williams2a1ef012025-03-03 11:09:20 -050033 subproject('boost', required: false)
34 boost_inc = include_directories('subprojects/boost_1_79_0/', is_system: true)
35 boost = declare_dependency(include_directories: boost_inc)
36 boost = boost.as_system('system')
Ed Tanous26ed4a12022-07-13 13:46:08 -070037endif
Ed Tanous41ad8382025-02-13 17:00:14 -080038add_project_arguments(
Patrick Williams2a1ef012025-03-03 11:09:20 -050039 ['-DBOOST_ASIO_DISABLE_THREADS', '-DBOOST_ASIO_NO_DEPRECATED'],
Ed Tanous41ad8382025-02-13 17:00:14 -080040 language: 'cpp',
41)
Brad Bishopd6aa5522022-05-31 19:23:48 -040042
43if get_option('buildtype').startswith('debug')
Patrick Williams2a1ef012025-03-03 11:09:20 -050044 add_project_arguments('-DMAPPER_ENABLE_DEBUG', language: 'cpp')
Brad Bishopd6aa5522022-05-31 19:23:48 -040045endif
46
Patrick Williamsec874072023-11-29 06:45:19 -060047if get_option('tests').allowed()
Brad Bishopf3fe0db2025-07-09 16:33:11 -040048 gtest = dependency(
49 'gtest_main',
50 main: true,
51 version: '>=1.15.2',
52 required: true,
53 )
54 gmock = dependency('gmock', required: true)
Brad Bishop0aa15902019-05-08 21:30:01 -040055 subdir('src/test')
56 subdir('libmapper/test')
57endif
58
Brad Bishop0aa15902019-05-08 21:30:01 -040059install_headers('libmapper/mapper.h')
60
61libmapper = library(
62 'mapper',
63 'libmapper/mapper.c',
Patrick Williams2a1ef012025-03-03 11:09:20 -050064 dependencies: [dependency('libsystemd')],
Brad Bishop0aa15902019-05-08 21:30:01 -040065 gnu_symbol_visibility: 'hidden',
66 version: meson.project_version(),
Patrick Williams2a1ef012025-03-03 11:09:20 -050067 install: true,
68)
Brad Bishop0aa15902019-05-08 21:30:01 -040069
Patrick Williamsd4887752022-06-16 11:29:08 -050070mapper_dep = declare_dependency(
71 link_with: libmapper,
72 include_directories: include_directories('libmapper'),
Patrick Williams2a1ef012025-03-03 11:09:20 -050073 dependencies: [dependency('libsystemd')],
Patrick Williamsd4887752022-06-16 11:29:08 -050074)
75
Brad Bishop0aa15902019-05-08 21:30:01 -040076import('pkgconfig').generate(
77 name: 'libmapper',
78 description: 'OpenBMC service discovery utility library',
79 version: meson.project_version(),
Patrick Williams2a1ef012025-03-03 11:09:20 -050080 libraries: libmapper,
81)
Brad Bishop0aa15902019-05-08 21:30:01 -040082
83executable(
84 'mapper',
85 'libmapper/app.c',
86 link_with: libmapper,
Patrick Williams2a1ef012025-03-03 11:09:20 -050087 dependencies: [dependency('libsystemd')],
88 install: true,
89)
Brad Bishop0aa15902019-05-08 21:30:01 -040090
Andrew Jefferyfb853662024-05-03 14:54:11 +093091mapperx = executable(
Brad Bishop0aa15902019-05-08 21:30:01 -040092 'mapperx',
93 [
94 'src/main.cpp',
Brad Bishop0aa15902019-05-08 21:30:01 -040095 'src/processing.cpp',
96 'src/associations.cpp',
Willy Tuaba14d32023-01-31 14:19:59 -080097 'src/handler.cpp',
Brad Bishop0aa15902019-05-08 21:30:01 -040098 ],
99 dependencies: [
Ed Tanous26ed4a12022-07-13 13:46:08 -0700100 boost,
Brad Bishop0aa15902019-05-08 21:30:01 -0400101 dependency('libsystemd'),
Brad Bishop5962db52022-05-16 21:04:05 -0400102 phosphor_dbus_interfaces,
Brad Bishop0aa15902019-05-08 21:30:01 -0400103 sdbusplus,
Brad Bishop0aa15902019-05-08 21:30:01 -0400104 dependency('threads'),
Konstantin Aladyshev883d91d2024-04-03 12:38:37 +0300105 dependency('tinyxml2', default_options: ['tests=false']),
Brad Bishop0aa15902019-05-08 21:30:01 -0400106 ],
Brad Bishop2ec91572022-06-03 08:52:11 -0400107 install: true,
108 install_dir: join_paths(
Patrick Williams2a1ef012025-03-03 11:09:20 -0500109 get_option('prefix'),
110 get_option('libexecdir'),
111 meson.project_name(),
112 ),
Brad Bishop0aa15902019-05-08 21:30:01 -0400113)
Andrew Jefferyfb853662024-05-03 14:54:11 +0930114meson.override_find_program('mapperx', mapperx)
Brad Bishop0aa15902019-05-08 21:30:01 -0400115
Brad Bishop2ec91572022-06-03 08:52:11 -0400116systemd_system_unit_dir = dependency('systemd').get_variable(
Patrick Williamsfcae5262025-07-09 11:27:59 -0400117 'systemd_system_unit_dir',
Brad Bishop2ec91572022-06-03 08:52:11 -0400118)
119
120conf = configuration_data()
121conf.set('BINDIR', join_paths(get_option('prefix'), get_option('bindir')))
Patrick Williams2a1ef012025-03-03 11:09:20 -0500122conf.set(
123 'LIBEXECDIR',
124 join_paths(get_option('prefix'), get_option('libexecdir')),
125)
Brad Bishop2ec91572022-06-03 08:52:11 -0400126
127unit_files = [
128 'xyz.openbmc_project.ObjectMapper.service',
129 'mapper-subtree-remove@.service',
Patrick Williams2a1ef012025-03-03 11:09:20 -0500130 'mapper-wait@.service',
Brad Bishop2ec91572022-06-03 08:52:11 -0400131]
132
133foreach u : unit_files
134 configure_file(
135 configuration: conf,
Patrick Williams2a1ef012025-03-03 11:09:20 -0500136 input: join_paths('src/systemd', u) + '.in',
137 install: true,
Brad Bishop2ec91572022-06-03 08:52:11 -0400138 install_dir: systemd_system_unit_dir,
Patrick Williams2a1ef012025-03-03 11:09:20 -0500139 output: u,
Brad Bishop2ec91572022-06-03 08:52:11 -0400140 )
141endforeach
142
143dbus_system_bus_services_dir = dependency('dbus-1').get_variable(
Patrick Williams40302742023-04-12 08:01:37 -0500144 'system_bus_services_dir',
Patrick Williams2a1ef012025-03-03 11:09:20 -0500145 pkgconfig_define: ['prefix', get_option('prefix')],
Brad Bishop2ec91572022-06-03 08:52:11 -0400146)
147
148install_data(
149 'src/dbus/xyz.openbmc_project.ObjectMapper.service',
Patrick Williams2a1ef012025-03-03 11:09:20 -0500150 install_dir: dbus_system_bus_services_dir,
151)
Brad Bishop2ec91572022-06-03 08:52:11 -0400152
153install_data(
154 'src/dbus/xyz.openbmc_project.ObjectMapper.conf',
Patrick Williams2a1ef012025-03-03 11:09:20 -0500155 install_dir: get_option('datadir') / 'dbus-1' / 'system.d',
156)
Brad Bishop2ec91572022-06-03 08:52:11 -0400157
Brad Bishop42e5aee2023-02-03 13:57:33 -0500158if not get_option('unit-failure-monitor').disabled()
159 executable(
160 'phosphor-unit-failure-monitor',
Patrick Williams2a1ef012025-03-03 11:09:20 -0500161 ['fail-monitor/main.cpp', 'fail-monitor/monitor.cpp'],
Brad Bishop0426f312025-07-14 16:23:53 -0400162 dependencies: [cli11, phosphor_logging, sdbusplus],
Patrick Williams2a1ef012025-03-03 11:09:20 -0500163 install: true,
Brad Bishop42e5aee2023-02-03 13:57:33 -0500164 )
165endif