xref: /openbmc/phosphor-certificate-manager/meson.build (revision 23778dd40421d6cfe73c4774442e901f66d44b33)
1bb939ea4SPatrick Williamsproject(
2bb939ea4SPatrick Williams    'phosphor-certificate-manager',
3bb939ea4SPatrick Williams    'cpp',
4bb939ea4SPatrick Williams    default_options: [
5bb939ea4SPatrick Williams        'buildtype=debugoptimized',
6*23778dd4SPatrick Williams        'cpp_std=c++23',
7bb939ea4SPatrick Williams        'warning_level=3',
8bb939ea4SPatrick Williams        'werror=true',
9bb939ea4SPatrick Williams    ],
10*23778dd4SPatrick Williams    meson_version: '>=1.1.1',
11bb939ea4SPatrick Williams)
12bb939ea4SPatrick Williams
13bb939ea4SPatrick Williamscpp = meson.get_compiler('cpp')
14bb939ea4SPatrick Williams
15447d55d6SPatrick Williamssdbusplus_dep = dependency('sdbusplus')
16447d55d6SPatrick Williamssdeventplus_dep = dependency('sdeventplus')
17447d55d6SPatrick Williamsphosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces')
18447d55d6SPatrick Williamsphosphor_logging_dep = dependency('phosphor-logging')
19bb939ea4SPatrick Williams
207047be67SNan Zhoucli11_dep = dependency('cli11', required: false)
217047be67SNan Zhouhas_cli11 = meson.get_compiler('cpp').has_header_symbol(
227047be67SNan Zhou  'CLI/CLI.hpp',
237047be67SNan Zhou  'CLI::App',
247047be67SNan Zhou  dependencies: cli11_dep,
257047be67SNan Zhou  required: false)
267047be67SNan Zhouif not has_cli11
277047be67SNan Zhou  cli11_proj = subproject('cli11', required: false)
287047be67SNan Zhou  assert(cli11_proj.found(), 'CLI11 is required')
297047be67SNan Zhou  cli11_dep = cli11_proj.get_variable('CLI11_dep')
307047be67SNan Zhouendif
317047be67SNan Zhou
32bb939ea4SPatrick Williamssystemd_dep = dependency('systemd')
33bb939ea4SPatrick Williamsopenssl_dep = dependency('openssl')
34bb939ea4SPatrick Williams
35bb939ea4SPatrick Williamsconfig_data = configuration_data()
36bb939ea4SPatrick Williamsconfig_data.set(
37bb939ea4SPatrick Williams    'authority_limit',
38bb939ea4SPatrick Williams     get_option('authority-limit')
39bb939ea4SPatrick Williams)
406ec13c8fSNan Zhouconfig_data.set(
416ec13c8fSNan Zhou    'authorities_list_name',
426ec13c8fSNan Zhou     get_option('authorities-list-name')
436ec13c8fSNan Zhou)
44bb939ea4SPatrick Williams
453c478144SLei YUif not get_option('allow-expired').disabled()
463c478144SLei YU  config_data.set('allow_expired', 'true')
473c478144SLei YUelse
483c478144SLei YU  config_data.set('allow_expired', 'false')
493c478144SLei YUendif
503c478144SLei YU
51bb939ea4SPatrick Williamsconfigure_file(
52e0e2cce9SPatrick Williams    input: 'config.h.in',
53bb939ea4SPatrick Williams    output: 'config.h',
54bb939ea4SPatrick Williams    configuration: config_data
55bb939ea4SPatrick Williams)
56bb939ea4SPatrick Williams
57bb939ea4SPatrick Williamsphosphor_certificate_deps = [
58bb939ea4SPatrick Williams    openssl_dep,
59bb939ea4SPatrick Williams    phosphor_dbus_interfaces_dep,
60bb939ea4SPatrick Williams    phosphor_logging_dep,
61bb939ea4SPatrick Williams    sdbusplus_dep,
62bb939ea4SPatrick Williams    sdeventplus_dep,
637047be67SNan Zhou    cli11_dep,
64bb939ea4SPatrick Williams]
65bb939ea4SPatrick Williams
66bb939ea4SPatrick Williamscert_manager_lib = static_library(
67bb939ea4SPatrick Williams    'phosphor-certificate-manager',
68bb939ea4SPatrick Williams    [
69bb939ea4SPatrick Williams        'argument.cpp',
70bb939ea4SPatrick Williams        'certificate.cpp',
71bb939ea4SPatrick Williams        'certs_manager.cpp',
72bb939ea4SPatrick Williams        'csr.cpp',
73bb939ea4SPatrick Williams        'watch.cpp',
74e869bb63SNan Zhou        'x509_utils.cpp',
75bb939ea4SPatrick Williams    ],
76bb939ea4SPatrick Williams    dependencies: phosphor_certificate_deps,
77bb939ea4SPatrick Williams)
78bb939ea4SPatrick Williams
79bb939ea4SPatrick Williamscert_manager_dep = declare_dependency(
80bb939ea4SPatrick Williams    link_with: cert_manager_lib,
81bb939ea4SPatrick Williams    dependencies: phosphor_certificate_deps
82bb939ea4SPatrick Williams)
83bb939ea4SPatrick Williams
84bb939ea4SPatrick Williamsexecutable(
85bb939ea4SPatrick Williams    'phosphor-certificate-manager',
86bb939ea4SPatrick Williams    'mainapp.cpp',
87bb939ea4SPatrick Williams    dependencies: cert_manager_dep,
88bb939ea4SPatrick Williams    install: true,
89bb939ea4SPatrick Williams)
90bb939ea4SPatrick Williams
91bb939ea4SPatrick Williamsif not get_option('ca-cert-extension').disabled()
92bb939ea4SPatrick Williams  subdir('bmc-vmi-ca')
93bb939ea4SPatrick Williamsendif
94bb939ea4SPatrick Williams
95bb939ea4SPatrick Williamssubdir('dist')
96bb939ea4SPatrick Williams
97bb939ea4SPatrick Williamsif not get_option('tests').disabled()
98bb939ea4SPatrick Williams    subdir('test')
99bb939ea4SPatrick Williamsendif
100bb939ea4SPatrick Williams
101