xref: /openbmc/bios-settings-mgr/meson.build (revision d37ce23a)
1642f437eSKuiying Wangproject(
2642f437eSKuiying Wang    'biosconfig-manager',
3642f437eSKuiying Wang    'cpp',
49ace6ac5SPatrick Williams    meson_version: '>=1.1.1',
5642f437eSKuiying Wang    default_options: [
6642f437eSKuiying Wang        'warning_level=3',
7642f437eSKuiying Wang        'werror=true',
89ace6ac5SPatrick Williams        'cpp_std=c++23',
9fb928424SGeorge Liu        'buildtype=debugoptimized'
10642f437eSKuiying Wang    ],
11642f437eSKuiying Wang    license: 'Apache-2.0',
12642f437eSKuiying Wang    version: '1.0',
13642f437eSKuiying Wang)
14642f437eSKuiying Wang
15642f437eSKuiying Wang# Wno-psabi reduces the number of "Note:" messages when cross-compiling some STL
16642f437eSKuiying Wang# stuff for ARM. See https://stackoverflow.com/questions/48149323/strange-gcc-warning-when-compiling-qt-project
17642f437eSKuiying Wang# Basically, gcc 6 and gcc 7 are not ABI compatible, but since the whole OpenBMC
18642f437eSKuiying Wang# project uses the same compiler, we can safely ignmore these info notes.
19642f437eSKuiying Wangadd_project_arguments('-Wno-psabi', language: 'cpp')
20642f437eSKuiying Wang
21f1101df2STom Josephconf_data = configuration_data()
22f1101df2STom Josephconf_data.set_quoted('BIOS_PERSIST_PATH', get_option('bios-persist-path'))
23f1101df2STom Josephconfigure_file(output: 'config.h', configuration: conf_data)
24f1101df2STom Joseph
25642f437eSKuiying Wangboost_args = ['-DBOOST_ALL_NO_LIB',
26642f437eSKuiying Wang              '-DBOOST_ASIO_DISABLE_THREADS',
27642f437eSKuiying Wang              '-DBOOST_ERROR_CODE_HEADER_ONLY',
28642f437eSKuiying Wang              '-DBOOST_NO_RTTI',
29642f437eSKuiying Wang              '-DBOOST_NO_TYPEID',
30642f437eSKuiying Wang              '-DBOOST_SYSTEM_NO_DEPRECATED']
31642f437eSKuiying Wang
32642f437eSKuiying Wangdeps = [dependency('boost'),
33642f437eSKuiying Wang        dependency('phosphor-dbus-interfaces'),
34642f437eSKuiying Wang        dependency('phosphor-logging'),
35642f437eSKuiying Wang        dependency('sdbusplus'),
36*d37ce23aSPatrick Williams        dependency('libsystemd'),
378f706213SKuiying Wang        dependency('openssl'),
38e7f0b66cSManojkiran Eda        dependency('nlohmann_json',include_type: 'system'),
39642f437eSKuiying Wang]
40642f437eSKuiying Wang
4172bed802SManojkiran Edacereal = dependency('cereal', required: false)
4272bed802SManojkiran Edacpp = meson.get_compiler('cpp')
4372bed802SManojkiran Edahas_cereal = cpp.has_header_symbol(
4472bed802SManojkiran Eda    'cereal/cereal.hpp',
4572bed802SManojkiran Eda    'cereal::specialize',
4672bed802SManojkiran Eda    dependencies: cereal,
4772bed802SManojkiran Eda    required: false)
4872bed802SManojkiran Edaif not has_cereal
4972bed802SManojkiran Eda    cereal_opts = import('cmake').subproject_options()
5072bed802SManojkiran Eda    cereal_opts.add_cmake_defines({'BUILD_TESTS': 'OFF'})
5172bed802SManojkiran Eda    cereal_proj = import('cmake').subproject(
5272bed802SManojkiran Eda        'cereal',
5372bed802SManojkiran Eda        options: cereal_opts,
5472bed802SManojkiran Eda        required: false)
5572bed802SManojkiran Eda    assert(cereal_proj.found(), 'cereal is required')
5672bed802SManojkiran Eda    cereal = cereal_proj.dependency('cereal')
5772bed802SManojkiran Edaendif
5872bed802SManojkiran Edadeps += cereal
5972bed802SManojkiran Eda
601a1dfbd2SArun Lal K Msrc_files = ['src/main.cpp',
61642f437eSKuiying Wang             'src/manager.cpp',
62f1101df2STom Joseph             'src/manager_serialize.cpp',
631a1dfbd2SArun Lal K M             'src/password.cpp'
641a1dfbd2SArun Lal K M]
65642f437eSKuiying Wang
661a1dfbd2SArun Lal K Mexecutable('biosconfig-manager',
671a1dfbd2SArun Lal K M           src_files,
688f706213SKuiying Wang           implicit_include_directories: true,
698f706213SKuiying Wang           include_directories: ['include'],
708f706213SKuiying Wang           dependencies: deps,
718f706213SKuiying Wang           cpp_args : boost_args,
728f706213SKuiying Wang           install: true,
738f706213SKuiying Wang           install_dir: get_option('bindir'))
748f706213SKuiying Wang
75642f437eSKuiying Wangsystemd = dependency('systemd')
766a7ee5c2SGeorge Liusystemd_system_unit_dir = systemd.get_variable(
77c76391beSPatrick Williams    'systemdsystemunitdir',
786a7ee5c2SGeorge Liu    pkgconfig_define: ['prefix', get_option('prefix')])
79642f437eSKuiying Wang
80628e4aa4SGeorge Liufs = import('fs')
81628e4aa4SGeorge Liufs.copyfile(
82628e4aa4SGeorge Liu    'service_files/xyz.openbmc_project.biosconfig_manager.service',
83642f437eSKuiying Wang    install: true,
84628e4aa4SGeorge Liu    install_dir: systemd_system_unit_dir
85642f437eSKuiying Wang)
86