blob: 58f94164cdac159ac21bb35a99686d2e3a7a778f [file] [log] [blame]
Ed Tanous0bff6852023-07-27 09:23:42 -07001project(
Patrick Williamse0483052025-02-01 08:38:14 -05002 'libpeci',
3 'c',
4 'cpp',
5 version: '1.0',
6 meson_version: '>=1.1.1',
7 default_options: [
8 'b_ndebug=if-release',
9 'cpp_rtti=false',
10 'cpp_std=c++23',
11 'warning_level=3',
12 'werror=true',
13 ],
Ed Tanous0bff6852023-07-27 09:23:42 -070014)
15
Patrick Williamsf6e3f162023-11-29 06:45:02 -060016if (get_option('raw-peci').allowed())
Patrick Williamse0483052025-02-01 08:38:14 -050017 sdbusplus = dependency('sdbusplus')
Ed Tanous0bff6852023-07-27 09:23:42 -070018
Patrick Williamse0483052025-02-01 08:38:14 -050019 systemd = dependency('systemd', required: true)
20 systemd_system_unit_dir = systemd.get_variable(
21 pkgconfig: 'systemdsystemunitdir',
22 )
Ed Tanous0bff6852023-07-27 09:23:42 -070023
Patrick Williamse0483052025-02-01 08:38:14 -050024 boost = dependency('boost', version: '>=1.82')
25 add_project_arguments(
26 [
27 '-DBOOST_ASIO_DISABLE_THREADS',
28 '-DBOOST_ASIO_EXCEPTION_DISABLE',
29 '-DBOOST_ASIO_NO_DEPRECATED',
30 '-DBOOST_NO_RTTI',
31 '-DBOOST_NO_TYPEID',
32 ],
33 language: 'cpp',
34 )
Ed Tanous0bff6852023-07-27 09:23:42 -070035endif
36
37add_project_arguments(
Patrick Williamse0483052025-02-01 08:38:14 -050038 [
39 '-Wcast-align',
40 '-Wconversion',
41 '-Wdouble-promotion',
42 '-Wduplicated-branches',
43 '-Wduplicated-cond',
44 '-Wformat=2',
45 '-Wlogical-op',
46 '-Wsign-conversion',
47 '-Wunused',
48 '-Wno-unused-parameter',
49 '-Wno-psabi',
50 ],
51 language: 'c',
Ed Tanous0bff6852023-07-27 09:23:42 -070052)
53
54add_project_arguments(
Patrick Williamse0483052025-02-01 08:38:14 -050055 [
56 '-Wcast-align',
57 '-Wconversion',
58 '-Wdouble-promotion',
59 '-Wduplicated-branches',
60 '-Wduplicated-cond',
61 '-Wformat=2',
62 '-Wlogical-op',
63 '-Wnull-dereference',
64 '-Wsign-conversion',
65 '-Wunused',
66 '-Wno-psabi',
67 '-Wno-unused-parameter',
68 '-fno-rtti',
69 ],
70 language: 'cpp',
Ed Tanous0bff6852023-07-27 09:23:42 -070071)
72
73libpeci = library(
Patrick Williamse0483052025-02-01 08:38:14 -050074 'peci',
75 'peci.c',
76 version: meson.project_version(),
77 install: true,
Ed Tanous0bff6852023-07-27 09:23:42 -070078)
79install_headers('peci.h')
80
Jonathan Domandf5c8682023-08-02 18:42:01 -070081libpeci_dep = declare_dependency(
Patrick Williamse0483052025-02-01 08:38:14 -050082 link_with: libpeci,
83 include_directories: include_directories('.'),
Jonathan Domandf5c8682023-08-02 18:42:01 -070084)
85
Ed Tanous0bff6852023-07-27 09:23:42 -070086bindir = get_option('prefix') + '/' + get_option('bindir')
87
88executable(
Patrick Williamse0483052025-02-01 08:38:14 -050089 'peci_cmds',
90 'peci_cmds.c',
91 link_with: libpeci,
92 install: true,
93 install_dir: bindir,
Ed Tanous0bff6852023-07-27 09:23:42 -070094)
95
Patrick Williamsf6e3f162023-11-29 06:45:02 -060096if (get_option('raw-peci').allowed())
Patrick Williamse0483052025-02-01 08:38:14 -050097 executable(
98 'raw-peci',
99 'dbus_raw_peci.cpp',
100 dependencies: [boost, sdbusplus, systemd],
101 link_with: libpeci,
102 install: true,
103 install_dir: bindir,
104 )
105 subdir('service_files')
Ed Tanous0bff6852023-07-27 09:23:42 -0700106endif
107
108import('pkgconfig').generate(
109 libpeci,
110 name: meson.project_name(),
111 version: meson.project_version(),
112 description: 'PECI utilities',
113)