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 | |
| 63 | thresholds_a = static_library( |
| 64 | 'thresholds_a', |
| 65 | 'src/Thresholds.cpp', |
Patrick Williams | 8b8f606 | 2021-08-27 14:53:50 -0500 | [diff] [blame^] | 66 | dependencies: [ sdbusplus, nlohmann_json ], |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 67 | implicit_include_directories: false, |
| 68 | include_directories: 'include', |
| 69 | ) |
| 70 | |
Patrick Williams | 8b8f606 | 2021-08-27 14:53:50 -0500 | [diff] [blame^] | 71 | thresholds_dep = declare_dependency( |
| 72 | link_with: [ thresholds_a ], |
| 73 | dependencies: [ nlohmann_json ], |
| 74 | ) |
| 75 | |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 76 | utils_a = static_library( |
| 77 | 'utils_a', |
Ed Tanous | 6cb732a | 2021-02-18 15:33:51 -0800 | [diff] [blame] | 78 | ['src/Utils.cpp', 'src/SensorPaths.cpp'], |
Andrew Jeffery | 8ed93af | 2021-05-27 13:45:38 +0930 | [diff] [blame] | 79 | dependencies: [ sdbusplus ], |
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 | utils_dep = declare_dependency( |
| 85 | link_with: [ utils_a ], |
| 86 | dependencies: [ sdbusplus ], |
| 87 | ) |
| 88 | |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 89 | pwmsensor_a = static_library( |
| 90 | 'pwmsensor_a', |
| 91 | 'src/PwmSensor.cpp', |
Patrick Williams | 8b8f606 | 2021-08-27 14:53:50 -0500 | [diff] [blame^] | 92 | dependencies: [ sdbusplus, thresholds_dep ], |
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 | pwmsensor_dep = declare_dependency( |
| 98 | link_with: [ pwmsensor_a ], |
| 99 | dependencies: [ sdbusplus, thresholds_dep ], |
| 100 | ) |
| 101 | |
Bruce Lee | 1263c3d | 2021-06-04 15:16:33 +0800 | [diff] [blame] | 102 | subdir('include') |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 103 | subdir('service_files') |
| 104 | subdir('src') |
| 105 | |
| 106 | if not build_tests.disabled() |
| 107 | subdir('tests') |
| 108 | endif |