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