blob: 124b37a750885f843f4d66ac1c68048074b238b0 [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
Brad Bishop8c243622022-07-11 11:21:50 -040015cxx = meson.get_compiler('cpp')
16
17if cxx.has_header('CLI/CLI.hpp')
18 cli11_dep = declare_dependency()
19else
20 cli11_dep = dependency('cli11')
21endif
Patrick Williamsf814e5b2022-03-21 11:14:17 -050022phosphor_logging = dependency('phosphor-logging')
Brad Bishop5962db52022-05-16 21:04:05 -040023phosphor_dbus_interfaces = dependency('phosphor-dbus-interfaces')
Patrick Williamsf814e5b2022-03-21 11:14:17 -050024sdbusplus = dependency('sdbusplus')
Ed Tanous26ed4a12022-07-13 13:46:08 -070025boost = dependency('boost', version : '>=1.79.0', required: false, include_type: 'system')
26if not boost.found()
27 subproject('boost', required: false)
28 boost_inc = include_directories('subprojects/boost_1_79_0/', is_system:true)
29 boost = declare_dependency(include_directories : boost_inc)
30 boost = boost.as_system('system')
31endif
Brad Bishopd6aa5522022-05-31 19:23:48 -040032
33if get_option('buildtype').startswith('debug')
34 add_project_arguments('-DMAPPER_ENABLE_DEBUG', language : 'cpp')
35endif
36
Brad Bishop0aa15902019-05-08 21:30:01 -040037if get_option('tests').enabled()
38 gtest = dependency('gtest', main: true, disabler: true, required: false)
39 gmock = dependency('gmock', disabler: true, required: false)
40 if not gtest.found() or not gmock.found()
41 gtest_proj = import('cmake').subproject('googletest', required: false)
42 if gtest_proj.found()
43 gtest = declare_dependency(
44 dependencies: [
45 dependency('threads'),
46 gtest_proj.dependency('gtest'),
47 gtest_proj.dependency('gtest_main'),
48 ]
49 )
50 gmock = gtest_proj.dependency('gmock')
51 else
52 assert(
53 not get_option('tests').enabled(),
54 'Googletest is required if tests are enabled'
55 )
56 endif
57 endif
58 subdir('src/test')
59 subdir('libmapper/test')
60endif
61
Brad Bishop0aa15902019-05-08 21:30:01 -040062install_headers('libmapper/mapper.h')
63
64libmapper = library(
65 'mapper',
66 'libmapper/mapper.c',
67 dependencies: [ dependency('libsystemd') ],
68 gnu_symbol_visibility: 'hidden',
69 version: meson.project_version(),
70 install: true)
71
Patrick Williamsd4887752022-06-16 11:29:08 -050072mapper_dep = declare_dependency(
73 link_with: libmapper,
74 include_directories: include_directories('libmapper'),
75 dependencies: [ dependency('libsystemd') ],
76)
77
Brad Bishop0aa15902019-05-08 21:30:01 -040078import('pkgconfig').generate(
79 name: 'libmapper',
80 description: 'OpenBMC service discovery utility library',
81 version: meson.project_version(),
82 libraries: libmapper)
83
84executable(
85 'mapper',
86 'libmapper/app.c',
87 link_with: libmapper,
88 dependencies: [ dependency('libsystemd') ],
89 install: true)
90
91executable(
92 '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 phosphor_logging,
104 sdbusplus,
105 dependency('systemd'),
106 dependency('threads'),
107 dependency('tinyxml2'),
108 ],
109 install: true
110)
111
112executable(
113 'phosphor-unit-failure-monitor',
114 [
Brad Bishop0aa15902019-05-08 21:30:01 -0400115 'fail-monitor/main.cpp',
116 'fail-monitor/monitor.cpp',
117 ],
118 dependencies: [
Brad Bishop8c243622022-07-11 11:21:50 -0400119 cli11_dep,
Brad Bishop0aa15902019-05-08 21:30:01 -0400120 phosphor_logging,
121 ],
122 install: true
123)