blob: 4736ea0b6b46a1cbf42b92c1edb4f894414cc43d [file] [log] [blame]
Willy Tue39f9392022-06-15 13:24:20 -07001project(
2 'fb-ipmi-oem',
3 'cpp',
4 version: '0.1',
5 meson_version: '>=0.57.0',
6 default_options: [
7 'werror=true',
8 'warning_level=3',
9 'cpp_std=c++20',
10 ])
11
12# Project Arguments
13cpp = meson.get_compiler('cpp')
14add_project_arguments(
15 cpp.get_supported_arguments([
16 '-DBOOST_ERROR_CODE_HEADER_ONLY',
17 '-DBOOST_SYSTEM_NO_DEPRECATED',
18 '-DBOOST_ALL_NO_LIB',
19 '-DBOOST_NO_RTTI',
20 '-DBOOST_NO_TYPEID',
21 '-DBOOST_ASIO_DISABLE_THREADS',
22 '-DBOOST_COROUTINES_NO_DEPRECATION_WARNING',
23 '-Wno-psabi',
24 '-Wno-pedantic',
25 ]),
26 language : 'cpp')
27
Patrick Williams708286a2022-07-25 09:49:50 -050028fs = import('fs')
29
Willy Tue39f9392022-06-15 13:24:20 -070030host_instances = '0'
31if get_option('host-instances') != ''
32 host_instances = get_option('host-instances')
33endif
34
Jayashree Dhanapal4ec80562022-06-28 15:41:47 +053035conf_data = configuration_data()
36conf_data.set_quoted('INSTANCES',host_instances)
37
38configure_file(input: 'meson_config.h.in',
39 output: 'config.h',
40 configuration: conf_data)
Willy Tue39f9392022-06-15 13:24:20 -070041
42if not get_option('bic').disabled()
43 add_project_arguments(
44 cpp.get_supported_arguments([
45 '-DBIC_ENABLED',
46 ]),
47 language : 'cpp')
48endif
49
Potin Lai2ad53982022-10-27 17:02:51 +080050if get_option('me_support')
51 add_project_arguments(
52 cpp.get_supported_arguments([
53 '-DME_SUPPORT',
54 ]),
55 language : 'cpp')
56endif
57
Willy Tue39f9392022-06-15 13:24:20 -070058root_inc = include_directories('.', 'include')
59
60# Dependencies
Patrick Williams2e9921c2022-07-25 10:17:05 -050061sdbusplus_dep = dependency('sdbusplus')
62phosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces')
Willy Tue39f9392022-06-15 13:24:20 -070063phosphor_logging_dep = dependency('phosphor-logging')
Willy Tue39f9392022-06-15 13:24:20 -070064ipmid_dep = dependency('libipmid')
Patrick Williams2e9921c2022-07-25 10:17:05 -050065channellayer_dep = dependency('libchannellayer')
66userlayer_dep = dependency('libuserlayer')
67
68if cpp.has_header_symbol(
69 'nlohmann/json.hpp',
70 'nlohmann::json::string_t',
71 required:false)
72 nlohmann_json_dep = declare_dependency()
73else
74 nlohmann_json_dep = dependency('nlohmann-json')
75endif
Willy Tue39f9392022-06-15 13:24:20 -070076
77zfboemcmds_pre = declare_dependency(
78 include_directories: root_inc,
79 dependencies: [
Patrick Williams2e9921c2022-07-25 10:17:05 -050080 channellayer_dep,
81 ipmid_dep,
82 nlohmann_json_dep,
83 phosphor_dbus_interfaces_dep,
Willy Tue39f9392022-06-15 13:24:20 -070084 phosphor_logging_dep,
85 sdbusplus_dep,
Willy Tue39f9392022-06-15 13:24:20 -070086 userlayer_dep,
87 ])
88
Patrick Williams17bd2ea2022-06-24 16:44:51 -050089zfboemcmds_lib = library(
Willy Tue39f9392022-06-15 13:24:20 -070090 'zfboemcmds',
91 'src/oemcommands.cpp',
92 'src/appcommands.cpp',
93 'src/storagecommands.cpp',
94 'src/usb-dbg.cpp',
95 'src/selcommands.cpp',
96 'src/transportcommands.cpp',
97 'src/biccommands.cpp',
98 implicit_include_directories: false,
99 dependencies: zfboemcmds_pre,
Patrick Williams17bd2ea2022-06-24 16:44:51 -0500100 version: meson.project_version(),
101 override_options: ['b_lundef=false'],
Willy Tue39f9392022-06-15 13:24:20 -0700102 install: true,
103 install_dir: get_option('libdir') / 'ipmid-providers')
Karthikeyan Pasupathi3048dd52022-06-30 21:51:11 +0530104
105if get_option('machine') != ''
106 configfile = [
107 'cri_sensors.json',
108 'gpio_desc.json',
109 'post_desc.json'
110 ]
111 foreach c : configfile
Patrick Williams708286a2022-07-25 09:49:50 -0500112 file = join_paths('configs', get_option('machine'), c)
113 if not fs.is_file(file)
114 warning('Missing config file: ' + file)
115 else
116 install_data(
117 sources : file,
118 install_dir : get_option('datadir') / 'lcd-debug'
119 )
120 endif
Karthikeyan Pasupathi3048dd52022-06-30 21:51:11 +0530121 endforeach
122endif