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