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 | 3f556a8 | 2022-03-21 11:25:15 -0500 | [diff] [blame] | 30 | gpiodcxx = dependency('libgpiodcxx', |
Patrick Williams | 3911b82 | 2021-08-27 14:31:50 -0500 | [diff] [blame] | 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 | |
Patrick Williams | 3f556a8 | 2022-03-21 11:25:15 -0500 | [diff] [blame] | 37 | sdbusplus = dependency('sdbusplus') |
| 38 | phosphor_logging_dep = dependency('phosphor-logging') |
Patrick Williams | 08d684a | 2021-08-27 15:15:34 -0500 | [diff] [blame] | 39 | |
Patrick Williams | 1889ebf | 2021-08-27 14:38:52 -0500 | [diff] [blame] | 40 | if cpp.has_header('nlohmann/json.hpp') |
| 41 | nlohmann_json = declare_dependency() |
| 42 | else |
Patrick Williams | 3f556a8 | 2022-03-21 11:25:15 -0500 | [diff] [blame] | 43 | nlohmann_json = dependency('nlohmann_json') |
Patrick Williams | 1889ebf | 2021-08-27 14:38:52 -0500 | [diff] [blame] | 44 | endif |
| 45 | |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 46 | systemd = dependency('systemd') |
Andrew Jeffery | fbf9254 | 2021-05-27 15:00:47 +0930 | [diff] [blame] | 47 | systemd_system_unit_dir = systemd.get_variable( |
| 48 | pkgconfig: 'systemdsystemunitdir', |
| 49 | pkgconfig_define: ['prefix', get_option('prefix')]) |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 50 | threads = dependency('threads') |
| 51 | |
Patrick Williams | 302a61a | 2021-08-27 15:40:08 -0500 | [diff] [blame] | 52 | default_deps = [ |
| 53 | nlohmann_json, |
Patrick Williams | 0c42f40 | 2021-08-27 16:05:45 -0500 | [diff] [blame] | 54 | phosphor_logging_dep, |
Patrick Williams | 302a61a | 2021-08-27 15:40:08 -0500 | [diff] [blame] | 55 | sdbusplus, |
| 56 | ] |
| 57 | |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 58 | thresholds_a = static_library( |
| 59 | 'thresholds_a', |
| 60 | 'src/Thresholds.cpp', |
Patrick Williams | 302a61a | 2021-08-27 15:40:08 -0500 | [diff] [blame] | 61 | dependencies: default_deps, |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 62 | implicit_include_directories: false, |
| 63 | include_directories: 'include', |
| 64 | ) |
| 65 | |
Patrick Williams | 8b8f606 | 2021-08-27 14:53:50 -0500 | [diff] [blame] | 66 | thresholds_dep = declare_dependency( |
| 67 | link_with: [ thresholds_a ], |
Patrick Williams | 302a61a | 2021-08-27 15:40:08 -0500 | [diff] [blame] | 68 | dependencies: default_deps, |
Patrick Williams | 8b8f606 | 2021-08-27 14:53:50 -0500 | [diff] [blame] | 69 | ) |
| 70 | |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 71 | utils_a = static_library( |
| 72 | 'utils_a', |
Ed Tanous | 7303063 | 2022-01-14 10:09:47 -0800 | [diff] [blame] | 73 | [ |
| 74 | 'src/FileHandle.cpp', |
| 75 | 'src/SensorPaths.cpp', |
| 76 | 'src/Utils.cpp', |
| 77 | ], |
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 | utils_dep = declare_dependency( |
| 84 | link_with: [ utils_a ], |
| 85 | dependencies: [ sdbusplus ], |
| 86 | ) |
| 87 | |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 88 | pwmsensor_a = static_library( |
| 89 | 'pwmsensor_a', |
| 90 | 'src/PwmSensor.cpp', |
Patrick Williams | 302a61a | 2021-08-27 15:40:08 -0500 | [diff] [blame] | 91 | dependencies: [ default_deps, thresholds_dep ], |
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 | pwmsensor_dep = declare_dependency( |
| 97 | link_with: [ pwmsensor_a ], |
Patrick Williams | 302a61a | 2021-08-27 15:40:08 -0500 | [diff] [blame] | 98 | dependencies: [ default_deps, thresholds_dep ], |
Patrick Williams | 8b8f606 | 2021-08-27 14:53:50 -0500 | [diff] [blame] | 99 | ) |
| 100 | |
Bruce Lee | 1263c3d | 2021-06-04 15:16:33 +0800 | [diff] [blame] | 101 | subdir('include') |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 102 | subdir('service_files') |
| 103 | subdir('src') |
| 104 | |
| 105 | if not build_tests.disabled() |
| 106 | subdir('tests') |
| 107 | endif |