blob: e86c378629092883eee3e14416162fee83883636 [file] [log] [blame]
Brad Bishop0aa15902019-05-08 21:30:01 -04001project(
2 'phosphor-objmgr',
3 'c', 'cpp',
4 default_options: [
Brad Bishopd6aa5522022-05-31 19:23:48 -04005 'buildtype=debugoptimized',
Brad Bishop370daaa2021-08-02 23:30:49 -04006 'cpp_std=c++20',
Brad Bishop0aa15902019-05-08 21:30:01 -04007 'warning_level=3',
8 'werror=true',
9 ],
10 license: 'Apache-2.0',
Brad Bishop370daaa2021-08-02 23:30:49 -040011 meson_version: '>=0.57.0',
Brad Bishop0aa15902019-05-08 21:30:01 -040012 version: '1.0',
13)
14
Patrick Williamsf814e5b2022-03-21 11:14:17 -050015phosphor_logging = dependency('phosphor-logging')
Brad Bishop5962db52022-05-16 21:04:05 -040016phosphor_dbus_interfaces = dependency('phosphor-dbus-interfaces')
Patrick Williamsf814e5b2022-03-21 11:14:17 -050017sdbusplus = dependency('sdbusplus')
Brad Bishop0aa15902019-05-08 21:30:01 -040018
Brad Bishopd6aa5522022-05-31 19:23:48 -040019
20if get_option('buildtype').startswith('debug')
21 add_project_arguments('-DMAPPER_ENABLE_DEBUG', language : 'cpp')
22endif
23
Brad Bishop0aa15902019-05-08 21:30:01 -040024if get_option('tests').enabled()
25 gtest = dependency('gtest', main: true, disabler: true, required: false)
26 gmock = dependency('gmock', disabler: true, required: false)
27 if not gtest.found() or not gmock.found()
28 gtest_proj = import('cmake').subproject('googletest', required: false)
29 if gtest_proj.found()
30 gtest = declare_dependency(
31 dependencies: [
32 dependency('threads'),
33 gtest_proj.dependency('gtest'),
34 gtest_proj.dependency('gtest_main'),
35 ]
36 )
37 gmock = gtest_proj.dependency('gmock')
38 else
39 assert(
40 not get_option('tests').enabled(),
41 'Googletest is required if tests are enabled'
42 )
43 endif
44 endif
45 subdir('src/test')
46 subdir('libmapper/test')
47endif
48
Brad Bishop0aa15902019-05-08 21:30:01 -040049install_headers('libmapper/mapper.h')
50
51libmapper = library(
52 'mapper',
53 'libmapper/mapper.c',
54 dependencies: [ dependency('libsystemd') ],
55 gnu_symbol_visibility: 'hidden',
56 version: meson.project_version(),
57 install: true)
58
Patrick Williamsd4887752022-06-16 11:29:08 -050059mapper_dep = declare_dependency(
60 link_with: libmapper,
61 include_directories: include_directories('libmapper'),
62 dependencies: [ dependency('libsystemd') ],
63)
64
Brad Bishop0aa15902019-05-08 21:30:01 -040065import('pkgconfig').generate(
66 name: 'libmapper',
67 description: 'OpenBMC service discovery utility library',
68 version: meson.project_version(),
69 libraries: libmapper)
70
71executable(
72 'mapper',
73 'libmapper/app.c',
74 link_with: libmapper,
75 dependencies: [ dependency('libsystemd') ],
76 install: true)
77
78executable(
79 'mapperx',
80 [
81 'src/main.cpp',
82 'src/argument.cpp',
83 'src/processing.cpp',
84 'src/associations.cpp',
85 ],
86 dependencies: [
87 dependency('boost'),
88 dependency('libsystemd'),
Brad Bishop5962db52022-05-16 21:04:05 -040089 phosphor_dbus_interfaces,
Brad Bishop0aa15902019-05-08 21:30:01 -040090 phosphor_logging,
91 sdbusplus,
92 dependency('systemd'),
93 dependency('threads'),
94 dependency('tinyxml2'),
95 ],
96 install: true
97)
98
99executable(
100 'phosphor-unit-failure-monitor',
101 [
102 'fail-monitor/argument.cpp',
103 'fail-monitor/main.cpp',
104 'fail-monitor/monitor.cpp',
105 ],
106 dependencies: [
107 phosphor_logging,
108 ],
109 install: true
110)