xref: /openbmc/phosphor-objmgr/meson.build (revision 2352088e)
1project(
2    'phosphor-objmgr',
3    'c', 'cpp',
4    default_options: [
5        'cpp_std=c++20',
6        'warning_level=3',
7        'werror=true',
8    ],
9    license: 'Apache-2.0',
10    meson_version: '>=0.57.0',
11    version: '1.0',
12)
13
14phosphor_logging = dependency('phosphor-logging')
15phosphor_dbus_interfaces = dependency('phosphor-dbus-interfaces')
16sdbusplus = dependency('sdbusplus')
17
18if get_option('tests').enabled()
19    gtest = dependency('gtest', main: true, disabler: true, required: false)
20    gmock = dependency('gmock', disabler: true, required: false)
21    if not gtest.found() or not gmock.found()
22        gtest_proj = import('cmake').subproject('googletest', required: false)
23        if gtest_proj.found()
24            gtest = declare_dependency(
25                dependencies: [
26                    dependency('threads'),
27                    gtest_proj.dependency('gtest'),
28                    gtest_proj.dependency('gtest_main'),
29                ]
30            )
31            gmock = gtest_proj.dependency('gmock')
32        else
33            assert(
34                not get_option('tests').enabled(),
35                'Googletest is required if tests are enabled'
36            )
37        endif
38    endif
39    subdir('src/test')
40    subdir('libmapper/test')
41endif
42
43install_headers('libmapper/mapper.h')
44
45libmapper = library(
46    'mapper',
47    'libmapper/mapper.c',
48    dependencies: [ dependency('libsystemd') ],
49    gnu_symbol_visibility: 'hidden',
50    version: meson.project_version(),
51    install: true)
52
53import('pkgconfig').generate(
54    name: 'libmapper',
55    description: 'OpenBMC service discovery utility library',
56    version: meson.project_version(),
57    libraries: libmapper)
58
59executable(
60    'mapper',
61    'libmapper/app.c',
62    link_with: libmapper,
63    dependencies: [ dependency('libsystemd') ],
64    install: true)
65
66executable(
67    'mapperx',
68    [
69        'src/main.cpp',
70        'src/argument.cpp',
71        'src/processing.cpp',
72        'src/associations.cpp',
73    ],
74    dependencies: [
75        dependency('boost'),
76        dependency('libsystemd'),
77        phosphor_dbus_interfaces,
78        phosphor_logging,
79        sdbusplus,
80        dependency('systemd'),
81        dependency('threads'),
82        dependency('tinyxml2'),
83    ],
84    install: true
85)
86
87executable(
88    'phosphor-unit-failure-monitor',
89    [
90        'fail-monitor/argument.cpp',
91        'fail-monitor/main.cpp',
92        'fail-monitor/monitor.cpp',
93    ],
94    dependencies: [
95        phosphor_logging,
96    ],
97    install: true
98)
99