xref: /openbmc/phosphor-objmgr/meson.build (revision 964681ca)
1project(
2    'phosphor-objmgr',
3    'c', 'cpp',
4    default_options: [
5        'buildtype=debugoptimized',
6        'cpp_std=c++20',
7        'warning_level=3',
8        'werror=true',
9    ],
10    license: 'Apache-2.0',
11    meson_version: '>=0.57.0',
12    version: '1.0',
13)
14
15phosphor_logging = dependency('phosphor-logging')
16phosphor_dbus_interfaces = dependency('phosphor-dbus-interfaces')
17sdbusplus = dependency('sdbusplus')
18
19
20if get_option('buildtype').startswith('debug')
21    add_project_arguments('-DMAPPER_ENABLE_DEBUG', language : 'cpp')
22endif
23
24if 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
49install_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
59mapper_dep = declare_dependency(
60    link_with: libmapper,
61    include_directories: include_directories('libmapper'),
62    dependencies: [ dependency('libsystemd') ],
63)
64
65import('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'),
89        phosphor_dbus_interfaces,
90        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)
111