xref: /openbmc/pldm/meson.build (revision 001f788504a38088d80c735db7957e8a689354be)
1project('pldm', ['c', 'cpp'],
2        version: '0.1', meson_version: '>=0.53.2',
3        default_options: [
4          'warning_level=3',
5          'default_library=shared',
6          'werror=true',
7          'cpp_std=c++17'
8        ])
9
10# Wno-psabi reduces the number of "Note:" messages when cross-compiling some STL
11# stuff for ARM. See https://stackoverflow.com/questions/48149323/strange-gcc-warning-when-compiling-qt-project
12# Basically, gcc 6 and gcc 7 are not ABI compatible, but since the whole OpenBMC
13# project uses the same compiler, we can safely ignmore these info notes.
14add_project_arguments('-Wno-psabi', language: 'cpp')
15
16conf_data = configuration_data()
17conf_data.set_quoted('BIOS_JSONS_DIR', '/usr/share/pldm/bios')
18conf_data.set_quoted('BIOS_TABLES_DIR', '/var/lib/pldm/bios')
19conf_data.set_quoted('PDR_JSONS_DIR', '/usr/share/pldm/pdr')
20conf_data.set_quoted('FRU_JSONS_DIR', '/usr/share/pldm/fru')
21conf_data.set_quoted('HOST_JSONS_DIR', '/usr/share/pldm/host')
22conf_data.set_quoted('EVENTS_JSONS_DIR', '/usr/share/pldm/events')
23if get_option('softoff').enabled()
24  conf_data.set('SOFTOFF_TIMEOUT_SECONDS', get_option('softoff-timeout-seconds'))
25endif
26if get_option('oem-ibm').enabled()
27  conf_data.set_quoted('FILE_TABLE_JSON', '/usr/share/pldm/fileTable.json')
28  conf_data.set_quoted('LID_RUNNING_DIR', '/var/lib/phosphor-software-manager/hostfw/running')
29  conf_data.set_quoted('LID_ALTERNATE_DIR', '/var/lib/phosphor-software-manager/hostfw/alternate')
30  conf_data.set_quoted('LID_RUNNING_PATCH_DIR', '/usr/local/share/hostfw/running')
31  conf_data.set_quoted('LID_ALTERNATE_PATCH_DIR', '/usr/local/share/hostfw/alternate')
32  conf_data.set('DMA_MAXSIZE', get_option('oem-ibm-dma-maxsize'))
33  add_global_arguments('-DOEM_IBM', language : 'c')
34  add_global_arguments('-DOEM_IBM', language : 'cpp')
35endif
36configure_file(output: 'config.h',
37  configuration: conf_data
38)
39
40phosphor_dbus_interfaces = dependency('phosphor-dbus-interfaces')
41sdbusplus = dependency('sdbusplus')
42sdeventplus = dependency('sdeventplus')
43systemd = dependency('systemd')
44
45subdir('libpldm')
46
47if get_option('libpldm-only').disabled()
48
49libpldmutils_headers = ['.']
50libpldmutils = library(
51  'pldmutils',
52  'common/utils.cpp',
53  version: meson.project_version(),
54  dependencies: [
55      libpldm,
56      phosphor_dbus_interfaces,
57      sdbusplus,
58  ],
59  install: true,
60  include_directories: include_directories(libpldmutils_headers),
61)
62
63libpldmutils = declare_dependency(
64  include_directories: include_directories(libpldmutils_headers),
65  link_with: libpldmutils)
66subdir('libpldmresponder')
67
68deps = [
69  libpldm,
70  libpldmutils,
71  libpldmresponder,
72  libpldmutils,
73  sdbusplus,
74  sdeventplus,
75  phosphor_dbus_interfaces
76]
77
78executable(
79  'pldmd',
80  'pldmd/pldmd.cpp',
81  'pldmd/dbus_impl_requester.cpp',
82  'pldmd/instance_id.cpp',
83  'pldmd/dbus_impl_pdr.cpp',
84  'host-bmc/dbus_to_host_effecters.cpp',
85  implicit_include_directories: false,
86  dependencies: deps,
87  install: true,
88  install_dir: get_option('bindir'))
89
90systemd = dependency('systemd')
91systemd_system_unit_dir = systemd.get_pkgconfig_variable(
92    'systemdsystemunitdir',
93    define_variable: ['prefix', get_option('prefix')])
94configure_file(
95  copy: true,
96  input: 'pldmd/pldmd.service',
97  install: true,
98  install_dir: systemd_system_unit_dir,
99  output: 'pldmd.service',
100)
101
102subdir('pldmtool')
103
104subdir('configurations')
105
106if get_option('tests').enabled()
107  subdir('test')
108endif
109
110if get_option('utilities').enabled()
111  subdir('utilities')
112endif
113
114if get_option('softoff').enabled()
115  subdir('softoff')
116endif
117
118endif # pldm-only
119