Kun Yi | 0d14a59 | 2020-04-06 14:01:36 -0700 | [diff] [blame^] | 1 | project( |
| 2 | 'phosphor-host-postd', |
| 3 | 'cpp', |
| 4 | default_options: [ |
| 5 | 'warning_level=3', |
| 6 | 'werror=true', |
| 7 | 'cpp_std=c++17' |
| 8 | ], |
| 9 | license: 'Apache-2.0', |
| 10 | version: '1.0', |
| 11 | ) |
| 12 | |
| 13 | build_tests = get_option('tests') |
| 14 | |
| 15 | postd_headers = include_directories('.') |
| 16 | |
| 17 | phosphor_dbus_interfaces = dependency('phosphor-dbus-interfaces') |
| 18 | sdbusplus = dependency('sdbusplus') |
| 19 | sdeventplus = dependency('sdeventplus') |
| 20 | systemd = dependency('systemd') |
| 21 | |
| 22 | conf_data = configuration_data() |
| 23 | conf_data.set('bindir', get_option('prefix') / get_option('bindir')) |
| 24 | conf_data.set('SNOOP_DEVICE', get_option('snoop-device')) |
| 25 | conf_data.set('POST_CODE_BYTES', get_option('post-code-bytes')) |
| 26 | conf_data.set('SYSTEMD_TARGET', get_option('systemd-target')) |
| 27 | |
| 28 | configure_file( |
| 29 | input: 'lpcsnoop.service.in', |
| 30 | output: 'lpcsnoop.service', |
| 31 | configuration: conf_data, |
| 32 | install: true, |
| 33 | install_dir: systemd.get_pkgconfig_variable('systemdsystemunitdir')) |
| 34 | |
| 35 | executable( |
| 36 | 'snoopd', |
| 37 | 'main.cpp', |
| 38 | dependencies: [ |
| 39 | sdbusplus, |
| 40 | sdeventplus, |
| 41 | phosphor_dbus_interfaces, |
| 42 | ], |
| 43 | install: true, |
| 44 | ) |
| 45 | |
| 46 | executable( |
| 47 | 'snooper', |
| 48 | 'example.cpp', |
| 49 | dependencies: [ |
| 50 | sdbusplus, |
| 51 | sdeventplus, |
| 52 | phosphor_dbus_interfaces, |
| 53 | ], |
| 54 | install: true, |
| 55 | ) |
| 56 | |
| 57 | if get_option('7seg').enabled() |
| 58 | udevdir = dependency('udev', required : false).get_pkgconfig_variable('udevdir') |
| 59 | assert(udevdir != '', 'Cannot find udevdir') |
| 60 | install_data(['80-7seg.rules'], install_dir : udevdir) |
| 61 | |
| 62 | install_data( |
| 63 | ['postcode-7seg@.service'], |
| 64 | install_dir: systemd.get_pkgconfig_variable('systemdsystemunitdir') |
| 65 | ) |
| 66 | |
| 67 | executable( |
| 68 | 'postcode_7seg', |
| 69 | '7seg.cpp', |
| 70 | dependencies: [ |
| 71 | sdbusplus, |
| 72 | phosphor_dbus_interfaces, |
| 73 | ], |
| 74 | link_args : [ |
| 75 | '-lstdc++fs', |
| 76 | ], |
| 77 | install: true, |
| 78 | ) |
| 79 | endif |
| 80 | |
| 81 | install_headers( |
| 82 | 'lpcsnoop/snoop.hpp', |
| 83 | 'lpcsnoop/snoop_listen.hpp', |
| 84 | subdir: 'lpcsnoop') |
| 85 | |
| 86 | if not build_tests.disabled() |
| 87 | subdir('test') |
| 88 | endif |