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