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