SunnySrivastava1984 | 7ef5442 | 2019-12-03 02:47:37 -0600 | [diff] [blame] | 1 | project( |
| 2 | 'openpower-vpd-parser', |
| 3 | 'c', |
| 4 | 'cpp', |
| 5 | default_options: [ |
Priyanga Ramasamy | 9d14934 | 2020-07-16 23:41:26 +0530 | [diff] [blame] | 6 | 'warning_level=3', |
| 7 | 'werror=true', |
PriyangaRamasamy | f8f9c86 | 2021-02-22 22:53:35 -0600 | [diff] [blame] | 8 | 'cpp_std=c++17', |
PriyangaRamasamy | f272efc | 2021-03-03 23:24:31 -0600 | [diff] [blame] | 9 | 'buildtype=debugoptimized' |
SunnySrivastava1984 | 7ef5442 | 2019-12-03 02:47:37 -0600 | [diff] [blame] | 10 | ], |
| 11 | version: '1.0' |
| 12 | ) |
| 13 | |
| 14 | build_tests = get_option('tests') |
| 15 | |
| 16 | sdbusplus = dependency('sdbusplus') |
| 17 | phosphor_logging = dependency('phosphor-logging') |
SunnySrivastava1984 | 97f8df0 | 2020-05-30 12:05:53 -0500 | [diff] [blame] | 18 | phosphor_dbus_interfaces = dependency('phosphor-dbus-interfaces') |
SunnySrivastava1984 | 7ef5442 | 2019-12-03 02:47:37 -0600 | [diff] [blame] | 19 | |
| 20 | compiler = meson.get_compiler('cpp') |
| 21 | python = find_program('python3', required:true) |
| 22 | |
SunnySrivastava1984 | 7ef5442 | 2019-12-03 02:47:37 -0600 | [diff] [blame] | 23 | compiler.has_header('CLI/CLI.hpp') |
| 24 | compiler.has_header('nlohmann/json.hpp') |
Santosh Puranik | b665c55 | 2020-10-29 14:23:04 +0530 | [diff] [blame] | 25 | add_global_arguments('-Wno-psabi', language : ['c', 'cpp']) |
PriyangaRamasamy | f8f9c86 | 2021-02-22 22:53:35 -0600 | [diff] [blame] | 26 | |
| 27 | # Disable FORTIFY_SOURCE when compiling with no optimization |
| 28 | if(get_option('optimization') == '0') |
| 29 | add_project_arguments('-U_FORTIFY_SOURCE',language:['cpp','c']) |
| 30 | message('Disabling FORTIFY_SOURCE as optimization is set to 0') |
| 31 | endif |
| 32 | |
SunnySrivastava1984 | 7ef5442 | 2019-12-03 02:47:37 -0600 | [diff] [blame] | 33 | configure_file(output: 'config.h', |
| 34 | configuration :{ |
Santosh Puranik | 0246a4d | 2020-11-04 16:57:39 +0530 | [diff] [blame] | 35 | 'INVENTORY_JSON_DEFAULT': '"'+get_option('INVENTORY_JSON_DEFAULT')+'"', |
| 36 | 'VPD_FILES_PATH': '"'+get_option('VPD_FILES_PATH')+'"', |
PriyangaRamasamy | 1f0b1e6 | 2020-02-20 20:48:25 +0530 | [diff] [blame] | 37 | 'INVENTORY_PATH': '"'+get_option('INVENTORY_PATH')+'"', |
SunnySrivastava1984 | 4330654 | 2020-04-01 02:50:20 -0500 | [diff] [blame] | 38 | 'IPZ_INTERFACE': '"'+get_option('IPZ_INTERFACE')+'"', |
| 39 | 'INVENTORY_MANAGER_SERVICE': '"'+get_option('INVENTORY_MANAGER_SERVICE')+'"', |
SunnySrivastava1984 | a739259 | 2020-03-09 10:19:33 -0500 | [diff] [blame] | 40 | 'BUSNAME' : '"' + get_option('BUSNAME') + '"', |
| 41 | 'OBJPATH' : '"' + get_option('OBJPATH') + '"', |
| 42 | 'IFACE' : '"' + get_option('IFACE') + '"', |
SunnySrivastava1984 | 4330654 | 2020-04-01 02:50:20 -0500 | [diff] [blame] | 43 | 'OBJECT_MAPPER_SERVICE' : '"'+get_option('OBJECT_MAPPER_SERVICE')+'"', |
| 44 | 'OBJECT_MAPPER_OBJECT' : '"'+get_option('OBJECT_MAPPER_OBJECT')+'"', |
| 45 | 'POWER_SUPPLY_TYPE_INTERFACE' : '"'+get_option('POWER_SUPPLY_TYPE_INTERFACE')+'"', |
PriyangaRamasamy | 83a1d5d | 2020-04-30 19:15:43 +0530 | [diff] [blame] | 46 | 'INVENTORY_MANAGER_CACHE' : '"'+get_option('INVENTORY_MANAGER_CACHE')+'"', |
Santosh Puranik | 0246a4d | 2020-11-04 16:57:39 +0530 | [diff] [blame] | 47 | 'INVENTORY_JSON_SYM_LINK': '"'+get_option('INVENTORY_JSON_SYM_LINK')+'"', |
| 48 | 'INVENTORY_JSON_2U': '"'+get_option('INVENTORY_JSON_2U')+'"', |
Santosh Puranik | 4641bff | 2020-11-30 20:26:44 +0530 | [diff] [blame] | 49 | 'INVENTORY_JSON_4U': '"'+get_option('INVENTORY_JSON_4U')+'"', |
PriyangaRamasamy | c0a534f | 2020-08-24 21:29:18 +0530 | [diff] [blame] | 50 | 'INVENTORY_JSON_EVEREST': '"'+get_option('INVENTORY_JSON_EVEREST')+'"', |
Alpana Kumari | f05effd | 2021-04-07 07:32:53 -0500 | [diff] [blame] | 51 | 'DBUS_PROP_JSON': '"'+get_option('DBUS_PROP_JSON')+'"', |
PriyangaRamasamy | c2fe40f | 2021-03-02 06:27:33 -0600 | [diff] [blame] | 52 | 'SYSTEM_JSON' : '"'+get_option('SYSTEM_JSON')+'"', |
| 53 | 'BAD_VPD_DIR': '"'+get_option('BAD_VPD_DIR')+'"' |
SunnySrivastava1984 | 7ef5442 | 2019-12-03 02:47:37 -0600 | [diff] [blame] | 54 | } |
PriyangaRamasamy | 1f0b1e6 | 2020-02-20 20:48:25 +0530 | [diff] [blame] | 55 | ) |
SunnySrivastava1984 | 4330654 | 2020-04-01 02:50:20 -0500 | [diff] [blame] | 56 | |
Sunny Srivastava | 6c71c9d | 2021-04-15 04:43:54 -0500 | [diff] [blame] | 57 | common_SOURCES =['common_utility.cpp', |
PriyangaRamasamy | c0a534f | 2020-08-24 21:29:18 +0530 | [diff] [blame] | 58 | 'vpd-parser/parser_factory.cpp', |
| 59 | 'vpd-parser/memory_vpd_parser.cpp', |
| 60 | 'vpd-parser/keyword_vpd_parser.cpp', |
Sunny Srivastava | 6c71c9d | 2021-04-15 04:43:54 -0500 | [diff] [blame] | 61 | 'vpd-parser/ipz_parser.cpp', 'impl.cpp', 'ibm_vpd_utils.cpp', |
PriyangaRamasamy | c0a534f | 2020-08-24 21:29:18 +0530 | [diff] [blame] | 62 | 'vpdecc/vpdecc.c', 'vpdecc/vpdecc_support.c' |
| 63 | ] |
| 64 | |
SunnySrivastava1984 | 4330654 | 2020-04-01 02:50:20 -0500 | [diff] [blame] | 65 | if get_option('ibm-parser').enabled() |
Alpana Kumari | 2f79304 | 2020-08-18 05:51:03 -0500 | [diff] [blame] | 66 | libgpiodcxx = dependency('libgpiodcxx') |
PriyangaRamasamy | c0a534f | 2020-08-24 21:29:18 +0530 | [diff] [blame] | 67 | ibm_read_vpd_SOURCES = ['ibm_vpd_app.cpp' |
| 68 | ]+common_SOURCES |
SunnySrivastava1984 | 7ef5442 | 2019-12-03 02:47:37 -0600 | [diff] [blame] | 69 | |
| 70 | ibm_vpd_exe = executable( |
| 71 | 'ibm-read-vpd', |
| 72 | ibm_read_vpd_SOURCES, |
| 73 | dependencies: [ |
| 74 | sdbusplus, |
| 75 | phosphor_logging, |
Alpana Kumari | 2f79304 | 2020-08-18 05:51:03 -0500 | [diff] [blame] | 76 | libgpiodcxx, |
SunnySrivastava1984 | 7ef5442 | 2019-12-03 02:47:37 -0600 | [diff] [blame] | 77 | ], |
SunnySrivastava1984 | e12b181 | 2020-05-26 02:23:11 -0500 | [diff] [blame] | 78 | include_directories : 'vpd-parser/', |
SunnySrivastava1984 | 7ef5442 | 2019-12-03 02:47:37 -0600 | [diff] [blame] | 79 | install: true, |
| 80 | cpp_args : '-DIPZ_PARSER' |
| 81 | ) |
PriyangaRamasamy | 1f0b1e6 | 2020-02-20 20:48:25 +0530 | [diff] [blame] | 82 | |
| 83 | vpd_tool_SOURCES = ['vpd_tool.cpp', |
PriyangaRamasamy | c0a534f | 2020-08-24 21:29:18 +0530 | [diff] [blame] | 84 | 'vpd_tool_impl.cpp', |
| 85 | 'vpd-manager/editor_impl.cpp', |
| 86 | ]+common_SOURCES |
| 87 | |
| 88 | vpd_tool_INCLUDE = include_directories('vpd-parser/', 'vpd-manager') |
PriyangaRamasamy | 1f0b1e6 | 2020-02-20 20:48:25 +0530 | [diff] [blame] | 89 | |
| 90 | vpd_tool_exe = executable( |
| 91 | 'vpd-tool', |
| 92 | vpd_tool_SOURCES, |
| 93 | dependencies: [ |
| 94 | sdbusplus |
| 95 | ], |
PriyangaRamasamy | c0a534f | 2020-08-24 21:29:18 +0530 | [diff] [blame] | 96 | install: true, |
| 97 | include_directories : vpd_tool_INCLUDE |
PriyangaRamasamy | 1f0b1e6 | 2020-02-20 20:48:25 +0530 | [diff] [blame] | 98 | ) |
SunnySrivastava1984 | a739259 | 2020-03-09 10:19:33 -0500 | [diff] [blame] | 99 | if get_option('vpd-manager').enabled() |
| 100 | subdir('vpd-manager') |
| 101 | endif |
| 102 | |
SunnySrivastava1984 | 7ef5442 | 2019-12-03 02:47:37 -0600 | [diff] [blame] | 103 | else |
| 104 | FRUGEN = '$srcdir/extra-properties.py -e' + get_option('FRU_YAML') |
| 105 | PROPGEN = '$srcdir/extra-properties.py -e' + get_option('PROP_YAML') |
| 106 | |
| 107 | src_dir = meson.source_root() |
| 108 | FRU_GEN_SCRIPT = src_dir + '/writefru.py' |
| 109 | FRU_GEN_SCRIPT_FILES = src_dir + '/writefru.yaml' |
| 110 | |
| 111 | PROP_GEN_SCRIPT = src_dir + '/extra-properties.py' |
| 112 | PROP_GEN_SCRIPT_FILES = src_dir + '/extra-properties-example.yaml' |
| 113 | |
| 114 | writefru_hpp = custom_target('writefru.hpp', |
| 115 | command:[python, |
| 116 | FRU_GEN_SCRIPT, |
| 117 | '-i', |
| 118 | get_option('FRU_YAML') |
| 119 | ], |
| 120 | depend_files :['writefru.mako.hpp', |
| 121 | 'writefru.py', |
| 122 | get_option('FRU_YAML') |
| 123 | ], |
| 124 | output:'writefru.hpp' |
| 125 | ) |
| 126 | |
| 127 | extra_properties_gen_hpp = custom_target( |
| 128 | 'extra-properties-gen.hpp', |
| 129 | command:[ |
| 130 | python, |
| 131 | PROP_GEN_SCRIPT, |
| 132 | '-e', |
| 133 | get_option('PROP_YAML') |
| 134 | ], |
| 135 | depend_files : ['extra-properties.mako.hpp', |
| 136 | 'extra-properties.py', |
| 137 | get_option('PROP_YAML') |
| 138 | ], |
| 139 | output:'extra-properties-gen.hpp' |
| 140 | ) |
| 141 | |
| 142 | openpower_read_vpd_SOURCES = ['app.cpp', |
| 143 | 'args.cpp', |
| 144 | 'impl.cpp', |
SunnySrivastava1984 | e12b181 | 2020-05-26 02:23:11 -0500 | [diff] [blame] | 145 | 'vpd-parser/ipz_parser.cpp', |
SunnySrivastava1984 | 7ef5442 | 2019-12-03 02:47:37 -0600 | [diff] [blame] | 146 | 'write.cpp', |
Sunny Srivastava | 6c71c9d | 2021-04-15 04:43:54 -0500 | [diff] [blame] | 147 | 'common_utility.cpp', |
SunnySrivastava1984 | 7ef5442 | 2019-12-03 02:47:37 -0600 | [diff] [blame] | 148 | writefru_hpp, |
| 149 | extra_properties_gen_hpp |
| 150 | ] |
| 151 | |
| 152 | openpower_read_vpd_exe= executable( |
| 153 | 'openpower-read-vpd', |
| 154 | openpower_read_vpd_SOURCES, |
| 155 | dependencies: [ |
| 156 | sdbusplus, |
| 157 | phosphor_logging, |
| 158 | ], |
SunnySrivastava1984 | e12b181 | 2020-05-26 02:23:11 -0500 | [diff] [blame] | 159 | include_directories : 'vpd-parser/', |
SunnySrivastava1984 | 7ef5442 | 2019-12-03 02:47:37 -0600 | [diff] [blame] | 160 | install: true, |
| 161 | ) |
| 162 | endif |
| 163 | subdir('test') |