1# async gpio monitor needs boost library
2boost_args = ['-DBOOST_ASIO_DISABLE_THREADS',
3              '-DBOOST_ERROR_CODE_HEADER_ONLY',
4              '-DBOOST_SYSTEM_NO_DEPRECATED']
5
6# dependency to link gpiod support
7libgpiod = dependency('libgpiod', version : '>=1.4.1')
8
9# get openpower-hw-diags build configuration
10attn_conf = configuration_data()
11
12# conditionally define ENABLE_PHAL_TRUE
13if (get_option('phal').allowed())
14    attn_conf.set('ENABLE_PHAL_TRUE', '')
15else
16    attn_conf.set('ENABLE_PHAL_TRUE', '#')
17endif
18
19# attention handler default config override
20attn_conf.set('ATTN_CONFIG', get_option('attn_config'))
21
22# install attention handler unit file
23configure_file(
24    configuration: attn_conf,
25    input: 'attn_handler.service.in',
26    output: 'attn_handler.service',
27    install: true,
28    install_dir:
29        dependency('systemd').get_variable('systemdsystemunitdir')
30)
31
32# install attention handler config file
33configure_file(
34    configuration: attn_conf,
35    input: 'attn_config.in',
36    output: 'attn_config',
37    install: true,
38    install_dir: join_paths(get_option('sysconfdir'), 'default')
39)
40
41# Source files.
42attn_src = files(
43    'attention.cpp',
44    'attn_common.cpp',
45    'attn_config.cpp',
46    'attn_dbus.cpp',
47    'attn_dump.cpp',
48    'attn_handler.cpp',
49    'attn_logging.cpp',
50    'attn_main.cpp',
51    'attn_monitor.cpp',
52    'bp_handler.cpp',
53    'ti_handler.cpp',
54    'vital_handler.cpp',
55)
56
57# for custom/raw PEL creation
58pel_src = files(
59    'pel/extended_user_header.cpp',
60    'pel/pel_minimal.cpp',
61    'pel/private_header.cpp',
62    'pel/primary_src.cpp',
63    'pel/user_header.cpp',
64)
65
66# Library dependencies.
67attn_deps = [
68    libgpiod,
69    libpdbg_dep,
70    phosphor_logging_dep,
71    sdbusplus_dep,
72]
73
74# conditional library dependencies
75if get_option('phal').allowed()
76  attn_deps += libphal_dep
77endif
78
79# Create static library.
80attn_lib = static_library(
81    'attn_lib',
82    attn_src,
83    pel_src,
84    include_directories : incdir,
85    dependencies : attn_deps,
86    cpp_args : [boost_args],
87    install : false,
88)
89