xref: /openbmc/pldm/meson.build (revision 96a3a048)
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_STAGING_DIR', '/var/lib/phosphor-software-manager/hostfw/staging')
31  conf_data.set_quoted('LID_RUNNING_PATCH_DIR', '/usr/local/share/hostfw/running')
32  conf_data.set_quoted('LID_ALTERNATE_PATCH_DIR', '/usr/local/share/hostfw/alternate')
33  conf_data.set_quoted('LID_STAGING_DIR', '/var/lib/phosphor-software-manager/hostfw/staging')
34  conf_data.set('DMA_MAXSIZE', get_option('oem-ibm-dma-maxsize'))
35  add_global_arguments('-DOEM_IBM', language : 'c')
36  add_global_arguments('-DOEM_IBM', language : 'cpp')
37endif
38configure_file(output: 'config.h',
39  configuration: conf_data
40)
41
42phosphor_dbus_interfaces = dependency('phosphor-dbus-interfaces')
43sdbusplus = dependency('sdbusplus')
44sdeventplus = dependency('sdeventplus')
45systemd = dependency('systemd')
46
47subdir('libpldm')
48
49if get_option('libpldm-only').disabled()
50
51libpldmutils_headers = ['.']
52libpldmutils = library(
53  'pldmutils',
54  'common/utils.cpp',
55  version: meson.project_version(),
56  dependencies: [
57      libpldm,
58      phosphor_dbus_interfaces,
59      sdbusplus,
60  ],
61  install: true,
62  include_directories: include_directories(libpldmutils_headers),
63)
64
65libpldmutils = declare_dependency(
66  include_directories: include_directories(libpldmutils_headers),
67  link_with: libpldmutils)
68subdir('libpldmresponder')
69
70deps = [
71  libpldm,
72  libpldmutils,
73  libpldmresponder,
74  libpldmutils,
75  sdbusplus,
76  sdeventplus,
77  phosphor_dbus_interfaces
78]
79
80executable(
81  'pldmd',
82  'pldmd/pldmd.cpp',
83  'pldmd/dbus_impl_requester.cpp',
84  'pldmd/instance_id.cpp',
85  'pldmd/dbus_impl_pdr.cpp',
86  'host-bmc/dbus_to_host_effecters.cpp',
87  implicit_include_directories: false,
88  dependencies: deps,
89  install: true,
90  install_dir: get_option('bindir'))
91
92systemd_system_unit_dir = systemd.get_pkgconfig_variable(
93    'systemdsystemunitdir',
94    define_variable: ['prefix', get_option('prefix')])
95
96configure_file(
97  copy: true,
98  input: 'pldmd/service_files/pldmd.service',
99  install: true,
100  install_dir: systemd_system_unit_dir,
101  output: 'pldmd.service',
102)
103
104if get_option('oem-ibm').enabled()
105  subdir('oem/ibm/service_files')
106endif
107
108subdir('pldmtool')
109
110subdir('configurations')
111
112if get_option('tests').enabled()
113  subdir('test')
114endif
115
116if get_option('utilities').enabled()
117  subdir('utilities')
118endif
119
120if get_option('softoff').enabled()
121  subdir('softoff')
122endif
123
124endif # pldm-only
125