xref: /openbmc/bmcweb/meson.build (revision 6384e3239a6567db6e9b0df73f77193768c5a86d)
1af6298daSManojkiran Edaproject('bmcweb', 'cpp',
2af6298daSManojkiran Eda        version : '1.0',
3c52ee72bSPatrick Williams        meson_version: '>=0.57.0',
4af6298daSManojkiran Eda        default_options: [
5cb2ed190SManojkiran Eda            'b_lto_mode=default',
6f523c324SEd Tanous            'b_lto_threads=0',
7f523c324SEd Tanous            'b_lto=true',
8f523c324SEd Tanous            'b_ndebug=if-release',
9f523c324SEd Tanous            'buildtype=debugoptimized',
10f523c324SEd Tanous            'cpp_rtti=false',
11f523c324SEd Tanous            'cpp_std=c++20',
12f523c324SEd Tanous            'warning_level=3',
13f523c324SEd Tanous            'werror=true',
14af6298daSManojkiran Eda           ])
15af6298daSManojkiran Eda
16af6298daSManojkiran Eda# Project related links
17af6298daSManojkiran Eda
18af6298daSManojkiran Edaproject_pretty_name = 'bmcweb'
19af6298daSManojkiran Edaproject_url = 'https://github.com/openbmc/' + project_pretty_name
20af6298daSManojkiran Edaproject_issues_url = project_url + '/issues/new'
21af6298daSManojkiran Edasummary('Issues',project_issues_url, section: 'Report Issues')
22af6298daSManojkiran Eda
23af6298daSManojkiran Eda# Validate the c++ Standard
24af6298daSManojkiran Eda
25c52ee72bSPatrick Williamsif get_option('cpp_std') != 'c++20'
26c52ee72bSPatrick Williams    error('This project requires c++20 support')
27af6298daSManojkiran Edaendif
28af6298daSManojkiran Eda
29af6298daSManojkiran Eda# Get compiler and default build type
30af6298daSManojkiran Eda
31af6298daSManojkiran Edacxx = meson.get_compiler('cpp')
32af6298daSManojkiran Edabuild = get_option('buildtype')
33af6298daSManojkiran Edaoptimization = get_option('optimization')
34af6298daSManojkiran Edasummary('Build Type',build, section : 'Build Info')
35af6298daSManojkiran Edasummary('Optimization',optimization, section : 'Build Info')
36af6298daSManojkiran Eda
375e34b67aSEd Tanous
38af6298daSManojkiran Eda# remove debug information for minsize buildtype
39af6298daSManojkiran Edaif(get_option('buildtype') == 'minsize')
405e34b67aSEd Tanous  add_project_arguments(['-fdata-sections', '-ffunction-sections'], language : 'cpp')
41af6298daSManojkiran Eda  add_project_arguments('-DNDEBUG', language : 'cpp')
42af6298daSManojkiran Edaendif
43af6298daSManojkiran Eda
44af6298daSManojkiran Eda# Disable lto when compiling with no optimization
45af6298daSManojkiran Edaif(get_option('optimization') == '0')
46af6298daSManojkiran Eda  add_project_arguments('-fno-lto', language: 'cpp')
47af6298daSManojkiran Eda  message('Disabling lto & its supported features as optimization is disabled')
48af6298daSManojkiran Edaendif
49af6298daSManojkiran Eda
50af6298daSManojkiran Eda# Include Directories
51af6298daSManojkiran Eda
52cf2f932eSEd Tanousincdir = include_directories(
53cf2f932eSEd Tanous  'include',
54cf2f932eSEd Tanous  'redfish-core/include',
55cf2f932eSEd Tanous  'redfish-core/lib',
56cf2f932eSEd Tanous  'http'
57cf2f932eSEd Tanous)
58af6298daSManojkiran Eda
59af6298daSManojkiran Eda# Get the options and enable the respective features
60af6298daSManojkiran Eda## create a MAP of  "options : feature_flag"
61af6298daSManojkiran Eda
62af6298daSManojkiran Edafeature_map = {
632d74fbc4SManojkiran Eda  'basic-auth'                                  : '-DBMCWEB_ENABLE_BASIC_AUTHENTICATION',
642d74fbc4SManojkiran Eda  'cookie-auth'                                 : '-DBMCWEB_ENABLE_COOKIE_AUTHENTICATION',
652d74fbc4SManojkiran Eda  'google-api'                                  : '-DBMCWEB_ENABLE_GOOGLE_API',
662d74fbc4SManojkiran Eda  'host-serial-socket'                          : '-DBMCWEB_ENABLE_HOST_SERIAL_WEBSOCKET',
672d74fbc4SManojkiran Eda  'ibm-management-console'                      : '-DBMCWEB_ENABLE_IBM_MANAGEMENT_CONSOLE',
68a43ea82fSNan Zhou  'insecure-disable-auth'                       : '-DBMCWEB_INSECURE_DISABLE_AUTHX',
69af6298daSManojkiran Eda  'insecure-disable-csrf'                       : '-DBMCWEB_INSECURE_DISABLE_CSRF_PREVENTION',
70af6298daSManojkiran Eda  'insecure-disable-ssl'                        : '-DBMCWEB_INSECURE_DISABLE_SSL',
712d74fbc4SManojkiran Eda  'insecure-push-style-notification'            : '-DBMCWEB_INSECURE_ENABLE_HTTP_PUSH_STYLE_EVENTING',
722d74fbc4SManojkiran Eda  'insecure-tftp-update'                        : '-DBMCWEB_INSECURE_ENABLE_REDFISH_FW_TFTP_UPDATE',
73af6298daSManojkiran Eda  'kvm'                                         : '-DBMCWEB_ENABLE_KVM' ,
74af6298daSManojkiran Eda  'mutual-tls-auth'                             : '-DBMCWEB_ENABLE_MUTUAL_TLS_AUTHENTICATION',
757fb33566SCarson Labrado  'redfish-aggregation'                         : '-DBMCWEB_ENABLE_REDFISH_AGGREGATION',
76f523c324SEd Tanous  'redfish-allow-deprecated-power-thermal'      : '-DBMCWEB_ALLOW_DEPRECATED_POWER_THERMAL',
77af6298daSManojkiran Eda  'redfish-bmc-journal'                         : '-DBMCWEB_ENABLE_REDFISH_BMC_JOURNAL',
78af6298daSManojkiran Eda  'redfish-cpu-log'                             : '-DBMCWEB_ENABLE_REDFISH_CPU_LOG',
79af6298daSManojkiran Eda  'redfish-dbus-log'                            : '-DBMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES',
803fad0d59SRavi Teja  'redfish-dump-log'                            : '-DBMCWEB_ENABLE_REDFISH_DUMP_LOG',
81f523c324SEd Tanous  'redfish-host-logger'                         : '-DBMCWEB_ENABLE_REDFISH_HOST_LOGGER',
822d74fbc4SManojkiran Eda  'redfish-new-powersubsystem-thermalsubsystem' : '-DBMCWEB_NEW_POWERSUBSYSTEM_THERMALSUBSYSTEM',
83f523c324SEd Tanous  'redfish-provisioning-feature'                : '-DBMCWEB_ENABLE_REDFISH_PROVISIONING_FEATURE',
844dc23f3fSEd Tanous  'redfish-post-to-old-updateservice'           : '-DBMCWEB_ENABLE_REDFISH_UPDATESERVICE_OLD_POST_URL',
85f523c324SEd Tanous  'redfish'                                     : '-DBMCWEB_ENABLE_REDFISH',
86f523c324SEd Tanous  'rest'                                        : '-DBMCWEB_ENABLE_DBUS_REST',
872d74fbc4SManojkiran Eda  'session-auth'                                : '-DBMCWEB_ENABLE_SESSION_AUTHENTICATION',
88af6298daSManojkiran Eda  'static-hosting'                              : '-DBMCWEB_ENABLE_STATIC_HOSTING',
89af6298daSManojkiran Eda  'vm-websocket'                                : '-DBMCWEB_ENABLE_VM_WEBSOCKET',
902d74fbc4SManojkiran Eda  'xtoken-auth'                                 : '-DBMCWEB_ENABLE_XTOKEN_AUTHENTICATION',
91f523c324SEd Tanous  #'vm-nbdproxy'                                : '-DBMCWEB_ENABLE_VM_NBDPROXY',
92af6298daSManojkiran Eda}
93af6298daSManojkiran Eda
94af6298daSManojkiran Eda# Get the options status and build a project summary to show which flags are
95af6298daSManojkiran Eda# being enabled during the configuration time.
96af6298daSManojkiran Eda
97af6298daSManojkiran Edaforeach option_key,option_value : feature_map
98af6298daSManojkiran Eda  if(get_option(option_key).enabled())
99af6298daSManojkiran Eda    if(option_key == 'mutual-tls-auth' or option_key == 'insecure-disable-ssl')
100af6298daSManojkiran Eda      if(get_option('insecure-disable-ssl').disabled() or get_option('mutual-tls-auth').disabled())
101af6298daSManojkiran Eda        add_project_arguments(option_value,language:'cpp')
102af6298daSManojkiran Eda        summary(option_key,option_value, section : 'Enabled Features')
103af6298daSManojkiran Eda      endif
104af6298daSManojkiran Eda    else
105af6298daSManojkiran Eda      summary(option_key,option_value, section : 'Enabled Features')
106af6298daSManojkiran Eda      add_project_arguments(option_value,language:'cpp')
107af6298daSManojkiran Eda    endif
108af6298daSManojkiran Eda  else
109af6298daSManojkiran Eda      if(option_key == 'insecure-disable-ssl')
110af6298daSManojkiran Eda        summary('ssl','-DBMCWEB_ENABLE_SSL', section : 'Enabled Features')
111af6298daSManojkiran Eda        add_project_arguments('-DBMCWEB_ENABLE_SSL', language : 'cpp')
112af6298daSManojkiran Eda      endif
113af6298daSManojkiran Eda  endif
114af6298daSManojkiran Edaendforeach
115af6298daSManojkiran Eda
116af6298daSManojkiran Edaif(get_option('tests').enabled())
117af6298daSManojkiran Eda  summary('unittest','NA', section : 'Enabled Features')
118af6298daSManojkiran Edaendif
119af6298daSManojkiran Eda
120af6298daSManojkiran Eda# Add compiler arguments
121af6298daSManojkiran Eda
122af6298daSManojkiran Eda# -Wpedantic, -Wextra comes by default with warning level
123af6298daSManojkiran Edaadd_project_arguments(
124af6298daSManojkiran Eda  cxx.get_supported_arguments([
125af6298daSManojkiran Eda  '-Wcast-align',
126af6298daSManojkiran Eda  '-Wconversion',
127f523c324SEd Tanous  '-Wformat=2',
128f523c324SEd Tanous  '-Wold-style-cast',
129f523c324SEd Tanous  '-Woverloaded-virtual',
130af6298daSManojkiran Eda  '-Wsign-conversion',
131f523c324SEd Tanous  '-Wunused',
132af6298daSManojkiran Eda  '-Wno-attributes',
133af6298daSManojkiran Eda  ]),
134af6298daSManojkiran Eda  language: 'cpp'
135af6298daSManojkiran Eda)
136af6298daSManojkiran Eda
137af6298daSManojkiran Edaif (cxx.get_id() == 'clang' and cxx.version().version_compare('>9.0'))
138af6298daSManojkiran Edaadd_project_arguments(
139af6298daSManojkiran Eda  cxx.get_supported_arguments([
140af6298daSManojkiran Eda    '-Weverything',
141af6298daSManojkiran Eda    '-Wno-c++98-compat-pedantic',
142f523c324SEd Tanous    '-Wno-c++98-compat',
143f523c324SEd Tanous    '-Wno-documentation-unknown-command',
144f523c324SEd Tanous    '-Wno-documentation',
145af6298daSManojkiran Eda    '-Wno-exit-time-destructors',
146f523c324SEd Tanous    '-Wno-global-constructors',
147f523c324SEd Tanous    '-Wno-newline-eof',
148f523c324SEd Tanous    '-Wno-padded',
149af6298daSManojkiran Eda    '-Wno-shadow',
150af6298daSManojkiran Eda    '-Wno-used-but-marked-unused',
151af6298daSManojkiran Eda    '-Wno-weak-vtables',
152af6298daSManojkiran Eda  ]),
153af6298daSManojkiran Eda  language:'cpp')
154af6298daSManojkiran Edaendif
155af6298daSManojkiran Eda
156af6298daSManojkiran Eda# if compiler is gnu-gcc , and version is > 8.0 then we add few more
157af6298daSManojkiran Eda# compiler arguments , we know that will pass
158af6298daSManojkiran Eda
159af6298daSManojkiran Edaif (cxx.get_id() == 'gcc' and cxx.version().version_compare('>8.0'))
160af6298daSManojkiran Eda  add_project_arguments(
161af6298daSManojkiran Eda    cxx.get_supported_arguments([
162af6298daSManojkiran Eda     '-Wduplicated-cond',
163af6298daSManojkiran Eda     '-Wduplicated-branches',
164af6298daSManojkiran Eda     '-Wlogical-op',
165af6298daSManojkiran Eda     '-Wunused-parameter',
166af6298daSManojkiran Eda     '-Wnull-dereference',
167af6298daSManojkiran Eda     '-Wdouble-promotion',
1688a592810SEd Tanous     '-Wshadow',
16930f11eb4SEd Tanous     '-Wno-psabi',
170af6298daSManojkiran Eda     ]),
171af6298daSManojkiran Eda    language:'cpp')
172c66403c3SEd Tanousendif
173af6298daSManojkiran Eda
174af6298daSManojkiran Edaif (get_option('buildtype') != 'plain')
175af6298daSManojkiran Eda  if (get_option('b_lto') == true and get_option('optimization')!='0')
176af6298daSManojkiran Eda    # Reduce the binary size by removing unnecessary
177af6298daSManojkiran Eda    # dynamic symbol table entries
178af6298daSManojkiran Eda
179af6298daSManojkiran Eda    add_project_arguments(
180af6298daSManojkiran Eda     cxx.get_supported_arguments([
181af6298daSManojkiran Eda     '-fno-fat-lto-objects',
182af6298daSManojkiran Eda     '-fvisibility=hidden',
183af6298daSManojkiran Eda     '-fvisibility-inlines-hidden'
184af6298daSManojkiran Eda     ]),
185af6298daSManojkiran Eda     language: 'cpp')
186af6298daSManojkiran Eda
187af6298daSManojkiran Eda    if cxx.has_link_argument('-Wl,--exclude-libs,ALL')
188af6298daSManojkiran Eda      add_project_link_arguments('-Wl,--exclude-libs,ALL', language: 'cpp')
189af6298daSManojkiran Eda    endif
190af6298daSManojkiran Eda  endif
191c66403c3SEd Tanousendif
192af6298daSManojkiran Eda
193620a6e14SManojkiran Edaif( get_option('bmcweb-logging').enabled() or \
194af6298daSManojkiran Eda    get_option('buildtype').startswith('debug'))
195af6298daSManojkiran Eda add_project_arguments([
196af6298daSManojkiran Eda   '-DBMCWEB_ENABLE_LOGGING',
197af6298daSManojkiran Eda   '-DBMCWEB_ENABLE_DEBUG'
198af6298daSManojkiran Eda   ],
199af6298daSManojkiran Eda  language : 'cpp')
200af6298daSManojkiran Eda
201af6298daSManojkiran Eda  summary({'debug' :'-DBMCWEB_ENABLE_DEBUG',
202af6298daSManojkiran Eda     'logging' : '-DBMCWEB_ENABLE_LOGGING',
203af6298daSManojkiran Eda
204e8204933SGeorge Liu    },section : 'Enabled Features')
205e8204933SGeorge Liuendif
206af6298daSManojkiran Eda
207af6298daSManojkiran Eda# Set Compiler Security flags
208af6298daSManojkiran Eda
209af6298daSManojkiran Edasecurity_flags = [
210af6298daSManojkiran Eda  '-fstack-protector-strong',
211af6298daSManojkiran Eda  '-fPIE',
212af6298daSManojkiran Eda  '-fPIC',
213af6298daSManojkiran Eda  '-D_FORTIFY_SOURCE=2',
214af6298daSManojkiran Eda  '-Wformat',
215af6298daSManojkiran Eda  '-Wformat-security'
216af6298daSManojkiran Eda]
217af6298daSManojkiran Eda
218af6298daSManojkiran Eda## Add security flags for builds of type 'release','debugoptimized' and 'minsize'
219af6298daSManojkiran Eda
220af6298daSManojkiran Edaif not (get_option('buildtype') == 'plain' or get_option('buildtype').startswith('debug'))
221af6298daSManojkiran Eda  add_project_arguments(
222af6298daSManojkiran Eda   cxx.get_supported_arguments([
223af6298daSManojkiran Eda    security_flags
224af6298daSManojkiran Eda  ]),
225af6298daSManojkiran Eda  language: 'cpp')
226af6298daSManojkiran Edaendif
227af6298daSManojkiran Eda
228af6298daSManojkiran Eda# Boost dependency configuration
229af6298daSManojkiran Eda
230af6298daSManojkiran Edaadd_project_arguments(
231af6298daSManojkiran Edacxx.get_supported_arguments([
232af6298daSManojkiran Eda  '-DBOOST_ALL_NO_LIB',
23358e42b18SEd Tanous  '-DBOOST_ALLOW_DEPRECATED_HEADERS',
234f523c324SEd Tanous  '-DBOOST_ASIO_DISABLE_THREADS',
235f523c324SEd Tanous  '-DBOOST_ASIO_NO_DEPRECATED',
236f523c324SEd Tanous  '-DBOOST_ASIO_SEPARATE_COMPILATION',
237f523c324SEd Tanous  '-DBOOST_BEAST_SEPARATE_COMPILATION',
238f523c324SEd Tanous  '-DBOOST_BEAST_USE_STD_STRING_VIEW',
2399e710e7fSEd Tanous  '-DBOOST_EXCEPTION_DISABLE',
2409e710e7fSEd Tanous  '-DJSON_NOEXCEPTION',
241af6298daSManojkiran Eda]),
242af6298daSManojkiran Edalanguage : 'cpp')
243af6298daSManojkiran Eda
244af6298daSManojkiran Eda# Find the dependency modules, if not found use meson wrap to get them
245af6298daSManojkiran Eda# automatically during the configure step
246ceb8ddc1SJason M. Billsbmcweb_dependencies = []
247af6298daSManojkiran Eda
2488682c5adSNan Zhoupam = cxx.find_library('pam', required: true)
249af6298daSManojkiran Edaatomic =  cxx.find_library('atomic', required: true)
250af6298daSManojkiran Edaopenssl = dependency('openssl', required : true)
251ceb8ddc1SJason M. Billsbmcweb_dependencies += [pam, atomic, openssl]
252af6298daSManojkiran Eda
2537bb985eeSEd Tanoussdbusplus = dependency('sdbusplus', required : false, include_type: 'system')
254af6298daSManojkiran Edaif not sdbusplus.found()
255af6298daSManojkiran Eda  sdbusplus_proj = subproject('sdbusplus', required: true)
256af6298daSManojkiran Eda  sdbusplus = sdbusplus_proj.get_variable('sdbusplus_dep')
257af6298daSManojkiran Eda  sdbusplus = sdbusplus.as_system('system')
258af6298daSManojkiran Edaendif
259ceb8ddc1SJason M. Billsbmcweb_dependencies += sdbusplus
260af6298daSManojkiran Eda
261565c0911SPatrick Williamstinyxml = dependency('tinyxml2',
262565c0911SPatrick Williams    default_options: ['tests=false'],
263565c0911SPatrick Williams    include_type: 'system',
264565c0911SPatrick Williams)
265ceb8ddc1SJason M. Billsbmcweb_dependencies += tinyxml
266af6298daSManojkiran Eda
267af6298daSManojkiran Edasystemd = dependency('systemd')
268af6298daSManojkiran Edazlib = dependency('zlib')
269ceb8ddc1SJason M. Billsbmcweb_dependencies += [systemd, zlib]
270af6298daSManojkiran Eda
271af6298daSManojkiran Edaif cxx.has_header('nlohmann/json.hpp')
272af6298daSManojkiran Eda    nlohmann_json = declare_dependency()
273af6298daSManojkiran Edaelse
274259df359SJosh Lehan    nlohmann_json_proj = subproject('nlohmann', required: true)
275259df359SJosh Lehan    nlohmann_json = nlohmann_json_proj.get_variable('nlohmann_json_dep')
276b00dcc27SEd Tanous    nlohmann_json = nlohmann_json.as_system('system')
277af6298daSManojkiran Edaendif
278ceb8ddc1SJason M. Billsbmcweb_dependencies += nlohmann_json
279af6298daSManojkiran Eda
2806bbda2caSNan Zhouboost = dependency('boost',version : '>=1.78.0', required : false, include_type: 'system')
281af6298daSManojkiran Edaif not boost.found()
282af6298daSManojkiran Eda  subproject('boost', required: false)
2836bbda2caSNan Zhou  boost_inc = include_directories('subprojects/boost_1_78_0/', is_system:true)
284af6298daSManojkiran Eda  boost  = declare_dependency(include_directories : boost_inc)
285b00dcc27SEd Tanous  boost = boost.as_system('system')
286af6298daSManojkiran Edaendif
287ceb8ddc1SJason M. Billsbmcweb_dependencies += boost
288af6298daSManojkiran Eda
289af6298daSManojkiran Edaif cxx.has_header('boost/url/url_view.hpp')
290af6298daSManojkiran Eda  boost_url = declare_dependency()
291af6298daSManojkiran Edaelse
292af6298daSManojkiran Eda  subproject('boost-url', required: false)
293af6298daSManojkiran Eda  boost_url_inc = include_directories('subprojects/boost-url/include', is_system:true)
294af6298daSManojkiran Eda  boost_url= declare_dependency(include_directories : boost_url_inc)
295b00dcc27SEd Tanous  boost_url = boost_url.as_system('system')
296af6298daSManojkiran Edaendif
297ceb8ddc1SJason M. Billsbmcweb_dependencies += boost_url
298af6298daSManojkiran Eda
299af6298daSManojkiran Edaif get_option('tests').enabled()
300af6298daSManojkiran Eda  gtest = dependency('gtest', main: true,disabler: true, required : false)
301af6298daSManojkiran Eda  gmock = dependency('gmock', required : false)
302af6298daSManojkiran Eda  if not gtest.found() and get_option('tests').enabled()
303af6298daSManojkiran Eda    gtest_proj = subproject('gtest', required: true)
304af6298daSManojkiran Eda    gtest = gtest_proj.get_variable('gtest_main_dep')
305af6298daSManojkiran Eda    gmock = gtest_proj.get_variable('gmock_dep')
306af6298daSManojkiran Eda  endif
307b00dcc27SEd Tanous  gtest = gtest.as_system('system')
308b00dcc27SEd Tanous  gmock = gmock.as_system('system')
309af6298daSManojkiran Edaendif
310af6298daSManojkiran Eda
311af6298daSManojkiran Eda# Gather the Configuration data
312af6298daSManojkiran Eda
313af6298daSManojkiran Edaconf_data = configuration_data()
314af6298daSManojkiran Edaconf_data.set('BMCWEB_HTTP_REQ_BODY_LIMIT_MB', get_option('http-body-limit'))
3150260d9d6SEd Tanousxss_enabled = get_option('insecure-disable-xss')
316feaf1500SEd Tanousconf_data.set10('BMCWEB_INSECURE_DISABLE_XSS_PREVENTION', xss_enabled.enabled())
317fa0b217fSEd Tanousenable_redfish_query = get_option('insecure-enable-redfish-query')
318fa0b217fSEd Tanousconf_data.set10('BMCWEB_INSECURE_ENABLE_QUERY_PARAMS', enable_redfish_query.enabled())
3197fb33566SCarson Labrado# enable_redfish_aggregation = get_option('redfish-aggregation')
3207fb33566SCarson Labrado# conf_data.set10('BMCWEB_ENABLE_REDFISH_AGGREGATION', enable_redfish_aggregation.enabled())
321eb1c47d3SEd Tanousinsecure_push_style_notification = get_option('insecure-push-style-notification')
322eb1c47d3SEd Tanousconf_data.set10('BMCWEB_INSECURE_ENABLE_HTTP_PUSH_STYLE_EVENTING', insecure_push_style_notification.enabled())
323af6298daSManojkiran Edaconf_data.set('MESON_INSTALL_PREFIX', get_option('prefix'))
32454d1355fSVivekanand Veeracholanconf_data.set('HTTPS_PORT', get_option('https_port'))
32575312981SEd Tanousconfigure_file(input: 'bmcweb_config.h.in',
32675312981SEd Tanous               output: 'bmcweb_config.h',
327af6298daSManojkiran Eda               configuration: conf_data)
328af6298daSManojkiran Eda
329af6298daSManojkiran Eda# Configure and install systemd unit files
330af6298daSManojkiran Eda
3316a779931SPatrick Williamssystemd_system_unit_dir = systemd.get_variable(pkgconfig: 'systemdsystemunitdir')
332af6298daSManojkiran Eda
333af6298daSManojkiran Edabindir = get_option('prefix') + '/' +get_option('bindir')
334af6298daSManojkiran Eda
335af6298daSManojkiran Edasummary({
336af6298daSManojkiran Eda          'prefix' : get_option('prefix'),
337af6298daSManojkiran Eda          'bindir' : bindir,
338af6298daSManojkiran Eda          'systemd unit directory' : systemd_system_unit_dir
339af6298daSManojkiran Eda        }, section : 'Directories')
340af6298daSManojkiran Eda
34154d1355fSVivekanand Veeracholanconfigure_file(input : 'bmcweb.socket.in',
342af6298daSManojkiran Eda               output : 'bmcweb.socket',
343af6298daSManojkiran Eda               install_dir: systemd_system_unit_dir,
34454d1355fSVivekanand Veeracholan               configuration: conf_data,
345af6298daSManojkiran Eda               install : true)
346af6298daSManojkiran Eda
347af6298daSManojkiran Edaconfigure_file(input : 'bmcweb.service.in',
348af6298daSManojkiran Eda               output : 'bmcweb.service',
349af6298daSManojkiran Eda               install_dir: systemd_system_unit_dir,
350af6298daSManojkiran Eda               configuration: conf_data,
351af6298daSManojkiran Eda               install : true)
352af6298daSManojkiran Eda
353af6298daSManojkiran Eda# Copy pam-webserver to etc/pam.d
354af6298daSManojkiran Edaconfigure_file(input : 'pam-webserver',
355af6298daSManojkiran Eda               output : 'webserver',
356af6298daSManojkiran Eda               copy : true,
357af6298daSManojkiran Eda               install_dir: '/etc/pam.d',
358af6298daSManojkiran Eda               install : true)
359af6298daSManojkiran Eda
360af6298daSManojkiran Edainstall_subdir('static', install_dir : 'share/www', strip_directory : true)
361af6298daSManojkiran Eda
36202f1cd9bSEd Tanous# Source files
363af6298daSManojkiran Eda
36402f1cd9bSEd Tanoussrcfiles_bmcweb = [
36502f1cd9bSEd Tanous  'redfish-core/src/error_messages.cpp',
36602f1cd9bSEd Tanous  'redfish-core/src/utils/json_utils.cpp',
36702f1cd9bSEd Tanous  'src/boost_asio_ssl.cpp',
368f523c324SEd Tanous  'src/boost_asio.cpp',
369f523c324SEd Tanous  'src/boost_beast.cpp',
370f523c324SEd Tanous  'src/boost_url.cpp',
371*6384e323SNan Zhou  'src/dbus_singleton.cpp',
37202f1cd9bSEd Tanous]
37302f1cd9bSEd Tanous
37402f1cd9bSEd Tanous# Generate the bmcweb executable
37502f1cd9bSEd Tanousexecutable(
37602f1cd9bSEd Tanous  'bmcweb',
37702f1cd9bSEd Tanous  srcfiles_bmcweb + ['src/webserver_main.cpp'],
378af6298daSManojkiran Eda  include_directories : incdir,
379ceb8ddc1SJason M. Bills  dependencies: bmcweb_dependencies,
3805e34b67aSEd Tanous  link_args: '-Wl,--gc-sections',
381af6298daSManojkiran Eda  install: true,
38202f1cd9bSEd Tanous  install_dir:bindir
38302f1cd9bSEd Tanous)
38402f1cd9bSEd Tanous
38502f1cd9bSEd Tanoussrcfiles_unittest = [
386f523c324SEd Tanous  'http/ut/utility_test.cpp',
38788a03c55SEd Tanous  'http/ut/router_test.cpp',
38802f1cd9bSEd Tanous  'include/ut/dbus_utility_test.cpp',
38902f1cd9bSEd Tanous  'include/ut/http_utility_test.cpp',
39002f1cd9bSEd Tanous  'include/ut/human_sort_test.cpp',
391c5ba4c27SEd Tanous  'include/ut/multipart_test.cpp',
392482c45a5SJosh Lehan  'include/ut/openbmc_dbus_rest_test.cpp',
3937cf436c9SEd Tanous  'redfish-core/include/utils/query_param_test.cpp',
3947cf436c9SEd Tanous  'redfish-core/lib/ut/service_root_test.cpp',
39502f1cd9bSEd Tanous  'redfish-core/ut/configfile_test.cpp',
39602f1cd9bSEd Tanous  'redfish-core/ut/hex_utils_test.cpp',
397774258e1SNan Zhou  'redfish-core/ut/ip_utils_test.cpp',
39815ed6780SWilly Tu  'redfish-core/ut/json_utils_test.cpp',
399f523c324SEd Tanous  'redfish-core/ut/lock_test.cpp',
400f523c324SEd Tanous  'redfish-core/ut/privileges_test.cpp',
401c5ba4c27SEd Tanous  'redfish-core/ut/registries_test.cpp',
402f523c324SEd Tanous  'redfish-core/ut/stl_utils_test.cpp',
403f523c324SEd Tanous  'redfish-core/ut/time_utils_test.cpp',
4045ad77207SNan Zhou  'src/crow_getroutes_test.cpp',
40502f1cd9bSEd Tanous]
406af6298daSManojkiran Eda
407af6298daSManojkiran Edaif(get_option('tests').enabled())
40802f1cd9bSEd Tanous    # generate the test executable
40902f1cd9bSEd Tanous    ut_bin = executable(
41002f1cd9bSEd Tanous      'bmcweb_unit_test',
41102f1cd9bSEd Tanous      srcfiles_unittest + srcfiles_bmcweb,
412af6298daSManojkiran Eda      include_directories : incdir,
413af6298daSManojkiran Eda      install_dir: bindir,
41402f1cd9bSEd Tanous      dependencies: bmcweb_dependencies + [
415cf2f932eSEd Tanous        gtest,
416cf2f932eSEd Tanous        gmock,
41702f1cd9bSEd Tanous      ]
41802f1cd9bSEd Tanous    )
41902f1cd9bSEd Tanous    test('bmcweb_unit_test', ut_bin)
420af6298daSManojkiran Edaendif
421