Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 1 | project( |
| 2 | 'dbus-sensors', |
| 3 | 'cpp', |
| 4 | default_options: [ |
| 5 | 'warning_level=3', |
| 6 | 'werror=true', |
Andrew Jeffery | fbf9254 | 2021-05-27 15:00:47 +0930 | [diff] [blame] | 7 | 'cpp_std=c++20' |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 8 | ], |
| 9 | license: 'Apache-2.0', |
| 10 | version: '0.1', |
Andrew Jeffery | fbf9254 | 2021-05-27 15:00:47 +0930 | [diff] [blame] | 11 | meson_version: '>=0.57.0', |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 12 | ) |
| 13 | |
| 14 | add_project_arguments( |
Andrew Jeffery | e3b23c0 | 2021-09-23 11:29:49 +0930 | [diff] [blame] | 15 | '-Wno-psabi', |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 16 | '-DBOOST_SYSTEM_NO_DEPRECATED', |
| 17 | '-DBOOST_ERROR_CODE_HEADER_ONLY', |
| 18 | '-DBOOST_NO_RTTI', |
| 19 | '-DBOOST_NO_TYPEID', |
| 20 | '-DBOOST_ALL_NO_LIB', |
| 21 | '-DBOOST_ASIO_DISABLE_THREADS', |
| 22 | '-DBOOST_ALLOW_DEPRECATED_HEADERS', |
| 23 | language: 'cpp', |
| 24 | ) |
| 25 | |
Patrick Williams | 1889ebf | 2021-08-27 14:38:52 -0500 | [diff] [blame] | 26 | cpp = meson.get_compiler('cpp') |
| 27 | |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 28 | build_tests = get_option('tests') |
Patrick Williams | 3911b82 | 2021-08-27 14:31:50 -0500 | [diff] [blame] | 29 | gpiodcxx = dependency( |
| 30 | 'libgpiodcxx', |
| 31 | fallback: ['libgpiod', 'gpiodcxx_dep'], |
| 32 | default_options: ['bindings=cxx'], |
| 33 | ) |
Andrew Jeffery | 2d66c24 | 2021-05-27 12:57:50 +0930 | [diff] [blame] | 34 | |
| 35 | # i2c-tools doesn't ship a pkg-config file for libi2c |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 36 | i2c = meson.get_compiler('cpp').find_library('i2c') |
Andrew Jeffery | 2d66c24 | 2021-05-27 12:57:50 +0930 | [diff] [blame] | 37 | |
Andrew Jeffery | 3f2e052 | 2021-05-27 13:26:20 +0930 | [diff] [blame] | 38 | sdbusplus = dependency( |
| 39 | 'sdbusplus', |
| 40 | fallback: [ |
| 41 | 'sdbusplus', |
| 42 | 'sdbusplus_dep' |
| 43 | ], |
| 44 | ) |
| 45 | |
Patrick Williams | 08d684a | 2021-08-27 15:15:34 -0500 | [diff] [blame] | 46 | phosphor_logging_dep = dependency( |
| 47 | 'phosphor-logging', |
| 48 | fallback: ['phosphor-logging', 'phosphor_logging_dep'], |
| 49 | ) |
| 50 | |
Patrick Williams | 1889ebf | 2021-08-27 14:38:52 -0500 | [diff] [blame] | 51 | if cpp.has_header('nlohmann/json.hpp') |
| 52 | nlohmann_json = declare_dependency() |
| 53 | else |
| 54 | subproject('nlohmann-json') |
| 55 | nlohmann_json = declare_dependency( |
| 56 | include_directories: include_directories( |
| 57 | 'subprojects/nlohmann-json/single_include', |
| 58 | 'subprojects/nlohmann-json/single_include/nlohmann', |
| 59 | ) |
| 60 | ) |
| 61 | endif |
| 62 | |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 63 | systemd = dependency('systemd') |
Andrew Jeffery | fbf9254 | 2021-05-27 15:00:47 +0930 | [diff] [blame] | 64 | systemd_system_unit_dir = systemd.get_variable( |
| 65 | pkgconfig: 'systemdsystemunitdir', |
| 66 | pkgconfig_define: ['prefix', get_option('prefix')]) |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 67 | threads = dependency('threads') |
| 68 | |
Patrick Williams | 302a61a | 2021-08-27 15:40:08 -0500 | [diff] [blame] | 69 | default_deps = [ |
| 70 | nlohmann_json, |
Patrick Williams | 0c42f40 | 2021-08-27 16:05:45 -0500 | [diff] [blame] | 71 | phosphor_logging_dep, |
Patrick Williams | 302a61a | 2021-08-27 15:40:08 -0500 | [diff] [blame] | 72 | sdbusplus, |
| 73 | ] |
| 74 | |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 75 | thresholds_a = static_library( |
| 76 | 'thresholds_a', |
| 77 | 'src/Thresholds.cpp', |
Patrick Williams | 302a61a | 2021-08-27 15:40:08 -0500 | [diff] [blame] | 78 | dependencies: default_deps, |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 79 | implicit_include_directories: false, |
| 80 | include_directories: 'include', |
| 81 | ) |
| 82 | |
Patrick Williams | 8b8f606 | 2021-08-27 14:53:50 -0500 | [diff] [blame] | 83 | thresholds_dep = declare_dependency( |
| 84 | link_with: [ thresholds_a ], |
Patrick Williams | 302a61a | 2021-08-27 15:40:08 -0500 | [diff] [blame] | 85 | dependencies: default_deps, |
Patrick Williams | 8b8f606 | 2021-08-27 14:53:50 -0500 | [diff] [blame] | 86 | ) |
| 87 | |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 88 | utils_a = static_library( |
| 89 | 'utils_a', |
Ed Tanous | 6cb732a | 2021-02-18 15:33:51 -0800 | [diff] [blame] | 90 | ['src/Utils.cpp', 'src/SensorPaths.cpp'], |
Patrick Williams | 302a61a | 2021-08-27 15:40:08 -0500 | [diff] [blame] | 91 | dependencies: default_deps, |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 92 | implicit_include_directories: false, |
| 93 | include_directories: 'include', |
| 94 | ) |
| 95 | |
Patrick Williams | 8b8f606 | 2021-08-27 14:53:50 -0500 | [diff] [blame] | 96 | utils_dep = declare_dependency( |
| 97 | link_with: [ utils_a ], |
| 98 | dependencies: [ sdbusplus ], |
| 99 | ) |
| 100 | |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 101 | pwmsensor_a = static_library( |
| 102 | 'pwmsensor_a', |
| 103 | 'src/PwmSensor.cpp', |
Patrick Williams | 302a61a | 2021-08-27 15:40:08 -0500 | [diff] [blame] | 104 | dependencies: [ default_deps, thresholds_dep ], |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 105 | implicit_include_directories: false, |
| 106 | include_directories: 'include', |
| 107 | ) |
| 108 | |
Patrick Williams | 8b8f606 | 2021-08-27 14:53:50 -0500 | [diff] [blame] | 109 | pwmsensor_dep = declare_dependency( |
| 110 | link_with: [ pwmsensor_a ], |
Patrick Williams | 302a61a | 2021-08-27 15:40:08 -0500 | [diff] [blame] | 111 | dependencies: [ default_deps, thresholds_dep ], |
Patrick Williams | 8b8f606 | 2021-08-27 14:53:50 -0500 | [diff] [blame] | 112 | ) |
| 113 | |
Bruce Lee | 1263c3d | 2021-06-04 15:16:33 +0800 | [diff] [blame] | 114 | subdir('include') |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 115 | subdir('service_files') |
| 116 | subdir('src') |
| 117 | |
| 118 | if not build_tests.disabled() |
| 119 | subdir('tests') |
| 120 | endif |