Brad Bishop | 0aa1590 | 2019-05-08 21:30:01 -0400 | [diff] [blame] | 1 | project( |
| 2 | 'phosphor-objmgr', |
| 3 | 'c', 'cpp', |
| 4 | default_options: [ |
Brad Bishop | d6aa552 | 2022-05-31 19:23:48 -0400 | [diff] [blame] | 5 | 'buildtype=debugoptimized', |
Brad Bishop | 370daaa | 2021-08-02 23:30:49 -0400 | [diff] [blame] | 6 | 'cpp_std=c++20', |
Brad Bishop | 0aa1590 | 2019-05-08 21:30:01 -0400 | [diff] [blame] | 7 | 'warning_level=3', |
| 8 | 'werror=true', |
| 9 | ], |
| 10 | license: 'Apache-2.0', |
Brad Bishop | 370daaa | 2021-08-02 23:30:49 -0400 | [diff] [blame] | 11 | meson_version: '>=0.57.0', |
Brad Bishop | 0aa1590 | 2019-05-08 21:30:01 -0400 | [diff] [blame] | 12 | version: '1.0', |
| 13 | ) |
| 14 | |
Patrick Williams | f814e5b | 2022-03-21 11:14:17 -0500 | [diff] [blame] | 15 | phosphor_logging = dependency('phosphor-logging') |
Brad Bishop | 5962db5 | 2022-05-16 21:04:05 -0400 | [diff] [blame] | 16 | phosphor_dbus_interfaces = dependency('phosphor-dbus-interfaces') |
Patrick Williams | f814e5b | 2022-03-21 11:14:17 -0500 | [diff] [blame] | 17 | sdbusplus = dependency('sdbusplus') |
Brad Bishop | 0aa1590 | 2019-05-08 21:30:01 -0400 | [diff] [blame] | 18 | |
Brad Bishop | d6aa552 | 2022-05-31 19:23:48 -0400 | [diff] [blame] | 19 | |
| 20 | if get_option('buildtype').startswith('debug') |
| 21 | add_project_arguments('-DMAPPER_ENABLE_DEBUG', language : 'cpp') |
| 22 | endif |
| 23 | |
Brad Bishop | 0aa1590 | 2019-05-08 21:30:01 -0400 | [diff] [blame] | 24 | if 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') |
| 47 | endif |
| 48 | |
Brad Bishop | 0aa1590 | 2019-05-08 21:30:01 -0400 | [diff] [blame] | 49 | install_headers('libmapper/mapper.h') |
| 50 | |
| 51 | libmapper = 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 Williams | d488775 | 2022-06-16 11:29:08 -0500 | [diff] [blame] | 59 | mapper_dep = declare_dependency( |
| 60 | link_with: libmapper, |
| 61 | include_directories: include_directories('libmapper'), |
| 62 | dependencies: [ dependency('libsystemd') ], |
| 63 | ) |
| 64 | |
Brad Bishop | 0aa1590 | 2019-05-08 21:30:01 -0400 | [diff] [blame] | 65 | import('pkgconfig').generate( |
| 66 | name: 'libmapper', |
| 67 | description: 'OpenBMC service discovery utility library', |
| 68 | version: meson.project_version(), |
| 69 | libraries: libmapper) |
| 70 | |
| 71 | executable( |
| 72 | 'mapper', |
| 73 | 'libmapper/app.c', |
| 74 | link_with: libmapper, |
| 75 | dependencies: [ dependency('libsystemd') ], |
| 76 | install: true) |
| 77 | |
| 78 | executable( |
| 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 Bishop | 5962db5 | 2022-05-16 21:04:05 -0400 | [diff] [blame] | 89 | phosphor_dbus_interfaces, |
Brad Bishop | 0aa1590 | 2019-05-08 21:30:01 -0400 | [diff] [blame] | 90 | phosphor_logging, |
| 91 | sdbusplus, |
| 92 | dependency('systemd'), |
| 93 | dependency('threads'), |
| 94 | dependency('tinyxml2'), |
| 95 | ], |
| 96 | install: true |
| 97 | ) |
| 98 | |
| 99 | executable( |
| 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 | ) |