blob: 85e2ee02a5f5cd0d2651235a96c6a22221241ce7 [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')
Ed Tanous26ed4a12022-07-13 13:46:08 -070018boost = dependency('boost', version : '>=1.79.0', required: false, include_type: 'system')
19if not boost.found()
20 subproject('boost', required: false)
21 boost_inc = include_directories('subprojects/boost_1_79_0/', is_system:true)
22 boost = declare_dependency(include_directories : boost_inc)
23 boost = boost.as_system('system')
24endif
Brad Bishopd6aa5522022-05-31 19:23:48 -040025
26if get_option('buildtype').startswith('debug')
27 add_project_arguments('-DMAPPER_ENABLE_DEBUG', language : 'cpp')
28endif
29
Brad Bishop0aa15902019-05-08 21:30:01 -040030if get_option('tests').enabled()
31 gtest = dependency('gtest', main: true, disabler: true, required: false)
32 gmock = dependency('gmock', disabler: true, required: false)
33 if not gtest.found() or not gmock.found()
34 gtest_proj = import('cmake').subproject('googletest', required: false)
35 if gtest_proj.found()
36 gtest = declare_dependency(
37 dependencies: [
38 dependency('threads'),
39 gtest_proj.dependency('gtest'),
40 gtest_proj.dependency('gtest_main'),
41 ]
42 )
43 gmock = gtest_proj.dependency('gmock')
44 else
45 assert(
46 not get_option('tests').enabled(),
47 'Googletest is required if tests are enabled'
48 )
49 endif
50 endif
51 subdir('src/test')
52 subdir('libmapper/test')
53endif
54
Brad Bishop0aa15902019-05-08 21:30:01 -040055install_headers('libmapper/mapper.h')
56
57libmapper = library(
58 'mapper',
59 'libmapper/mapper.c',
60 dependencies: [ dependency('libsystemd') ],
61 gnu_symbol_visibility: 'hidden',
62 version: meson.project_version(),
63 install: true)
64
Patrick Williamsd4887752022-06-16 11:29:08 -050065mapper_dep = declare_dependency(
66 link_with: libmapper,
67 include_directories: include_directories('libmapper'),
68 dependencies: [ dependency('libsystemd') ],
69)
70
Brad Bishop0aa15902019-05-08 21:30:01 -040071import('pkgconfig').generate(
72 name: 'libmapper',
73 description: 'OpenBMC service discovery utility library',
74 version: meson.project_version(),
75 libraries: libmapper)
76
77executable(
78 'mapper',
79 'libmapper/app.c',
80 link_with: libmapper,
81 dependencies: [ dependency('libsystemd') ],
82 install: true)
83
84executable(
85 'mapperx',
86 [
87 'src/main.cpp',
88 'src/argument.cpp',
89 'src/processing.cpp',
90 'src/associations.cpp',
91 ],
92 dependencies: [
Ed Tanous26ed4a12022-07-13 13:46:08 -070093 boost,
Brad Bishop0aa15902019-05-08 21:30:01 -040094 dependency('libsystemd'),
Brad Bishop5962db52022-05-16 21:04:05 -040095 phosphor_dbus_interfaces,
Brad Bishop0aa15902019-05-08 21:30:01 -040096 phosphor_logging,
97 sdbusplus,
98 dependency('systemd'),
99 dependency('threads'),
100 dependency('tinyxml2'),
101 ],
102 install: true
103)
104
105executable(
106 'phosphor-unit-failure-monitor',
107 [
108 'fail-monitor/argument.cpp',
109 'fail-monitor/main.cpp',
110 'fail-monitor/monitor.cpp',
111 ],
112 dependencies: [
113 phosphor_logging,
114 ],
115 install: true
116)