Patrick Williams | bb939ea | 2021-12-03 15:41:02 -0600 | [diff] [blame] | 1 | project( |
| 2 | 'phosphor-certificate-manager', |
| 3 | 'cpp', |
| 4 | default_options: [ |
| 5 | 'buildtype=debugoptimized', |
| 6 | 'cpp_std=c++20', |
| 7 | 'warning_level=3', |
| 8 | 'werror=true', |
| 9 | ], |
| 10 | meson_version: '>=0.57.0', |
| 11 | ) |
| 12 | |
| 13 | cpp = meson.get_compiler('cpp') |
| 14 | |
Patrick Williams | 447d55d | 2022-03-21 10:18:25 -0500 | [diff] [blame] | 15 | sdbusplus_dep = dependency('sdbusplus') |
| 16 | sdeventplus_dep = dependency('sdeventplus') |
| 17 | phosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces') |
| 18 | phosphor_logging_dep = dependency('phosphor-logging') |
Patrick Williams | bb939ea | 2021-12-03 15:41:02 -0600 | [diff] [blame] | 19 | |
Nan Zhou | 7047be6 | 2022-03-10 12:34:06 -0800 | [diff] [blame] | 20 | cli11_dep = dependency('cli11', required: false) |
| 21 | has_cli11 = meson.get_compiler('cpp').has_header_symbol( |
| 22 | 'CLI/CLI.hpp', |
| 23 | 'CLI::App', |
| 24 | dependencies: cli11_dep, |
| 25 | required: false) |
| 26 | if not has_cli11 |
| 27 | cli11_proj = subproject('cli11', required: false) |
| 28 | assert(cli11_proj.found(), 'CLI11 is required') |
| 29 | cli11_dep = cli11_proj.get_variable('CLI11_dep') |
| 30 | endif |
| 31 | |
Patrick Williams | bb939ea | 2021-12-03 15:41:02 -0600 | [diff] [blame] | 32 | systemd_dep = dependency('systemd') |
| 33 | openssl_dep = dependency('openssl') |
| 34 | |
| 35 | config_data = configuration_data() |
| 36 | config_data.set( |
| 37 | 'authority_limit', |
| 38 | get_option('authority-limit') |
| 39 | ) |
Nan Zhou | 6ec13c8 | 2021-12-30 11:34:50 -0800 | [diff] [blame] | 40 | config_data.set( |
| 41 | 'authorities_list_name', |
| 42 | get_option('authorities-list-name') |
| 43 | ) |
Patrick Williams | bb939ea | 2021-12-03 15:41:02 -0600 | [diff] [blame] | 44 | |
| 45 | configure_file( |
Patrick Williams | e0e2cce | 2021-12-13 08:40:50 -0600 | [diff] [blame] | 46 | input: 'config.h.in', |
Patrick Williams | bb939ea | 2021-12-03 15:41:02 -0600 | [diff] [blame] | 47 | output: 'config.h', |
| 48 | configuration: config_data |
| 49 | ) |
| 50 | |
| 51 | phosphor_certificate_deps = [ |
| 52 | openssl_dep, |
| 53 | phosphor_dbus_interfaces_dep, |
| 54 | phosphor_logging_dep, |
| 55 | sdbusplus_dep, |
| 56 | sdeventplus_dep, |
Nan Zhou | 7047be6 | 2022-03-10 12:34:06 -0800 | [diff] [blame] | 57 | cli11_dep, |
Patrick Williams | bb939ea | 2021-12-03 15:41:02 -0600 | [diff] [blame] | 58 | ] |
| 59 | |
| 60 | cert_manager_lib = static_library( |
| 61 | 'phosphor-certificate-manager', |
| 62 | [ |
| 63 | 'argument.cpp', |
| 64 | 'certificate.cpp', |
| 65 | 'certs_manager.cpp', |
| 66 | 'csr.cpp', |
| 67 | 'watch.cpp', |
Nan Zhou | e869bb6 | 2021-12-30 11:34:42 -0800 | [diff] [blame] | 68 | 'x509_utils.cpp', |
Patrick Williams | bb939ea | 2021-12-03 15:41:02 -0600 | [diff] [blame] | 69 | ], |
| 70 | dependencies: phosphor_certificate_deps, |
| 71 | ) |
| 72 | |
| 73 | cert_manager_dep = declare_dependency( |
| 74 | link_with: cert_manager_lib, |
| 75 | dependencies: phosphor_certificate_deps |
| 76 | ) |
| 77 | |
| 78 | executable( |
| 79 | 'phosphor-certificate-manager', |
| 80 | 'mainapp.cpp', |
| 81 | dependencies: cert_manager_dep, |
| 82 | install: true, |
| 83 | ) |
| 84 | |
| 85 | if not get_option('ca-cert-extension').disabled() |
| 86 | subdir('bmc-vmi-ca') |
| 87 | endif |
| 88 | |
| 89 | subdir('dist') |
| 90 | |
| 91 | if not get_option('tests').disabled() |
| 92 | subdir('test') |
| 93 | endif |
| 94 | |