Dung Cao | faf6a6a | 2020-12-28 04:44:45 +0000 | [diff] [blame] | 1 | project('ssifbridge', 'cpp', |
Patrick Williams | 16592b3 | 2023-07-12 11:15:51 -0500 | [diff] [blame] | 2 | meson_version: '>=1.1.1', |
Dung Cao | faf6a6a | 2020-12-28 04:44:45 +0000 | [diff] [blame] | 3 | default_options: [ |
| 4 | 'buildtype=debugoptimized', |
| 5 | 'warning_level=3', |
| 6 | 'werror=true', |
Ed Tanous | 7fa7e6c | 2024-02-14 14:33:32 -0800 | [diff] [blame] | 7 | 'cpp_std=c++20', |
Konstantin Aladyshev | 0940a7c | 2024-04-03 19:11:12 +0300 | [diff] [blame] | 8 | 'b_lto=true', |
Dung Cao | faf6a6a | 2020-12-28 04:44:45 +0000 | [diff] [blame] | 9 | ], |
| 10 | version: '1.0', |
Thang Q. Nguyen | 20c6f95 | 2020-12-09 03:28:44 +0000 | [diff] [blame] | 11 | ) |
| 12 | |
Ed Tanous | 8e3f0ad | 2024-02-14 08:58:32 -0800 | [diff] [blame] | 13 | add_project_arguments( |
| 14 | [ |
| 15 | '-Wno-psabi', |
| 16 | '-DBOOST_ASIO_DISABLE_THREADS', |
| 17 | '-DBOOST_ASIO_NO_DEPRECATED', |
| 18 | ], |
| 19 | language: 'cpp' |
| 20 | ) |
Thang Q. Nguyen | 20c6f95 | 2020-12-09 03:28:44 +0000 | [diff] [blame] | 21 | |
Ed Tanous | 4f14328 | 2024-02-14 08:55:54 -0800 | [diff] [blame] | 22 | sdbusplus = dependency('sdbusplus') |
| 23 | cli11 = dependency('CLI11') |
| 24 | phosphor_logging = dependency('phosphor-logging') |
Thang Q. Nguyen | 20c6f95 | 2020-12-09 03:28:44 +0000 | [diff] [blame] | 25 | |
Ed Tanous | 4f14328 | 2024-02-14 08:55:54 -0800 | [diff] [blame] | 26 | boost = dependency( |
| 27 | 'boost', |
| 28 | version : '>=1.83.0', |
| 29 | required : false, |
| 30 | ) |
| 31 | |
| 32 | if not boost.found() |
| 33 | cmake = import('cmake') |
| 34 | opt = cmake.subproject_options() |
| 35 | opt.add_cmake_defines({ |
Konstantin Aladyshev | 6f22abd | 2024-04-03 19:14:08 +0300 | [diff] [blame] | 36 | 'BOOST_INCLUDE_LIBRARIES': 'asio;callable_traits' |
Ed Tanous | 4f14328 | 2024-02-14 08:55:54 -0800 | [diff] [blame] | 37 | }) |
| 38 | boost_cmake = cmake.subproject('boost', required: true, options: opt) |
| 39 | boost_asio = boost_cmake.dependency('boost_asio').as_system() |
Konstantin Aladyshev | 6f22abd | 2024-04-03 19:14:08 +0300 | [diff] [blame] | 40 | boost_callable_traits = boost_cmake.dependency('boost_callable_traits').as_system() |
| 41 | boost = [boost_asio, boost_callable_traits] |
Ed Tanous | 4f14328 | 2024-02-14 08:55:54 -0800 | [diff] [blame] | 42 | endif |
Dung Cao | faf6a6a | 2020-12-28 04:44:45 +0000 | [diff] [blame] | 43 | |
Dung Cao | f624941 | 2021-01-14 03:41:56 +0000 | [diff] [blame] | 44 | # Configure and install systemd unit files |
| 45 | systemd = dependency('systemd') |
Patrick Williams | 6f25d7b | 2023-04-12 08:05:49 -0500 | [diff] [blame] | 46 | systemd_system_unit_dir = systemd.get_variable( |
Dung Cao | f624941 | 2021-01-14 03:41:56 +0000 | [diff] [blame] | 47 | 'systemdsystemunitdir', |
Patrick Williams | 6f25d7b | 2023-04-12 08:05:49 -0500 | [diff] [blame] | 48 | pkgconfig_define: ['prefix', get_option('prefix')]) |
Dung Cao | f624941 | 2021-01-14 03:41:56 +0000 | [diff] [blame] | 49 | |
George Liu | d122cff | 2023-08-16 16:04:49 +0800 | [diff] [blame] | 50 | fs = import('fs') |
| 51 | fs.copyfile( |
| 52 | 'ssifbridge.service', |
Dung Cao | f624941 | 2021-01-14 03:41:56 +0000 | [diff] [blame] | 53 | install: true, |
George Liu | d122cff | 2023-08-16 16:04:49 +0800 | [diff] [blame] | 54 | install_dir: systemd_system_unit_dir |
Dung Cao | f624941 | 2021-01-14 03:41:56 +0000 | [diff] [blame] | 55 | ) |
| 56 | |
Dung Cao | faf6a6a | 2020-12-28 04:44:45 +0000 | [diff] [blame] | 57 | executable('ssifbridged','ssifbridged.cpp', |
Ed Tanous | 4f14328 | 2024-02-14 08:55:54 -0800 | [diff] [blame] | 58 | dependencies: [ |
| 59 | boost, |
| 60 | sdbusplus, |
| 61 | cli11, |
| 62 | phosphor_logging, |
| 63 | ], |
Thang Q. Nguyen | 20c6f95 | 2020-12-09 03:28:44 +0000 | [diff] [blame] | 64 | install: true) |