Ed Tanous | 0bff685 | 2023-07-27 09:23:42 -0700 | [diff] [blame] | 1 | project( |
| 2 | 'libpeci', |
| 3 | 'c', 'cpp', |
| 4 | version : '1.0', |
| 5 | meson_version: '>=1.1.1', |
| 6 | default_options: [ |
| 7 | 'b_ndebug=if-release', |
| 8 | 'cpp_rtti=false', |
Patrick Williams | 110caf8 | 2023-08-23 06:31:05 -0500 | [diff] [blame] | 9 | 'cpp_std=c++23', |
Ed Tanous | 0bff685 | 2023-07-27 09:23:42 -0700 | [diff] [blame] | 10 | 'warning_level=3', |
| 11 | 'werror=true', |
| 12 | ] |
| 13 | ) |
| 14 | |
Patrick Williams | f6e3f16 | 2023-11-29 06:45:02 -0600 | [diff] [blame] | 15 | if (get_option('raw-peci').allowed()) |
Ed Tanous | 0bff685 | 2023-07-27 09:23:42 -0700 | [diff] [blame] | 16 | sdbusplus = dependency('sdbusplus') |
| 17 | |
| 18 | systemd = dependency('systemd', required: true) |
| 19 | systemd_system_unit_dir = systemd.get_variable(pkgconfig: |
| 20 | 'systemdsystemunitdir' |
| 21 | ) |
| 22 | |
| 23 | boost = dependency('boost', version: '>=1.82') |
| 24 | add_project_arguments( |
| 25 | [ |
| 26 | '-DBOOST_ASIO_DISABLE_THREADS', |
| 27 | '-DBOOST_ASIO_EXCEPTION_DISABLE', |
| 28 | '-DBOOST_ASIO_NO_DEPRECATED', |
| 29 | '-DBOOST_NO_RTTI', |
| 30 | '-DBOOST_NO_TYPEID', |
| 31 | ], |
| 32 | language : 'cpp' |
| 33 | ) |
| 34 | endif |
| 35 | |
| 36 | add_project_arguments( |
| 37 | [ |
| 38 | '-Wcast-align', |
| 39 | '-Wconversion', |
| 40 | '-Wdouble-promotion', |
| 41 | '-Wduplicated-branches', |
| 42 | '-Wduplicated-cond', |
| 43 | '-Wformat=2', |
| 44 | '-Wlogical-op', |
| 45 | '-Wsign-conversion', |
| 46 | '-Wunused', |
| 47 | '-Wno-unused-parameter', |
| 48 | '-Wno-psabi', |
| 49 | ], |
| 50 | language : 'c' |
| 51 | ) |
| 52 | |
| 53 | add_project_arguments( |
| 54 | [ |
| 55 | '-Wcast-align', |
| 56 | '-Wconversion', |
| 57 | '-Wdouble-promotion', |
| 58 | '-Wduplicated-branches', |
| 59 | '-Wduplicated-cond', |
| 60 | '-Wformat=2', |
| 61 | '-Wlogical-op', |
| 62 | '-Wnull-dereference', |
| 63 | '-Wsign-conversion', |
| 64 | '-Wunused', |
| 65 | '-Wno-psabi', |
| 66 | '-Wno-unused-parameter', |
| 67 | '-fno-rtti', |
| 68 | ], |
| 69 | language : 'cpp' |
| 70 | ) |
| 71 | |
| 72 | libpeci = library( |
| 73 | 'peci', |
| 74 | 'peci.c', |
| 75 | version: meson.project_version(), |
| 76 | install: true |
| 77 | ) |
| 78 | install_headers('peci.h') |
| 79 | |
Jonathan Doman | df5c868 | 2023-08-02 18:42:01 -0700 | [diff] [blame] | 80 | libpeci_dep = declare_dependency( |
| 81 | link_with: libpeci, |
| 82 | include_directories: include_directories('.') |
| 83 | ) |
| 84 | |
Ed Tanous | 0bff685 | 2023-07-27 09:23:42 -0700 | [diff] [blame] | 85 | bindir = get_option('prefix') + '/' + get_option('bindir') |
| 86 | |
| 87 | executable( |
| 88 | 'peci_cmds', |
| 89 | 'peci_cmds.c', |
| 90 | link_with: libpeci, |
| 91 | install: true, |
| 92 | install_dir: bindir |
| 93 | ) |
| 94 | |
Patrick Williams | f6e3f16 | 2023-11-29 06:45:02 -0600 | [diff] [blame] | 95 | if (get_option('raw-peci').allowed()) |
Ed Tanous | 0bff685 | 2023-07-27 09:23:42 -0700 | [diff] [blame] | 96 | executable( |
| 97 | 'raw-peci', |
| 98 | 'dbus_raw_peci.cpp', |
| 99 | dependencies: [ |
| 100 | boost, |
| 101 | sdbusplus, |
| 102 | systemd, |
| 103 | ], |
| 104 | link_with: libpeci, |
| 105 | install: true, |
| 106 | install_dir: bindir |
| 107 | ) |
| 108 | subdir('service_files') |
| 109 | endif |
| 110 | |
| 111 | import('pkgconfig').generate( |
| 112 | libpeci, |
| 113 | name: meson.project_name(), |
| 114 | version: meson.project_version(), |
| 115 | description: 'PECI utilities', |
| 116 | ) |