xref: /openbmc/openpower-vpd-parser/meson.build (revision 945a02d3dfb05cff83f01863ce1157502f43dbad)
1project(
2     'openpower-vpd-parser',
3     'c',
4     'cpp',
5     default_options: [
6     'cpp_std=c++17'
7     ],
8     version: '1.0'
9)
10
11build_tests = get_option('tests')
12
13sdbusplus = dependency('sdbusplus')
14phosphor_logging = dependency('phosphor-logging')
15phosphor_dbus_interfaces = dependency('phosphor-dbus-interfaces')
16
17compiler = meson.get_compiler('cpp')
18python = find_program('python3', required:true)
19
20compiler.has_header('CLI/CLI.hpp')
21compiler.has_header('nlohmann/json.hpp')
22add_global_arguments('-Wno-psabi', language : ['c', 'cpp'])
23configure_file(output: 'config.h',
24                       configuration :{
25                       'INVENTORY_JSON': '"'+get_option('INVENTORY_JSON')+'"',
26                       'INVENTORY_PATH': '"'+get_option('INVENTORY_PATH')+'"',
27                       'IPZ_INTERFACE': '"'+get_option('IPZ_INTERFACE')+'"',
28                       'INVENTORY_MANAGER_SERVICE': '"'+get_option('INVENTORY_MANAGER_SERVICE')+'"',
29                       'BUSNAME' : '"' + get_option('BUSNAME') + '"',
30                       'OBJPATH' : '"' + get_option('OBJPATH') + '"',
31                       'IFACE' : '"' + get_option('IFACE') + '"',
32                       'OBJECT_MAPPER_SERVICE' : '"'+get_option('OBJECT_MAPPER_SERVICE')+'"',
33                       'OBJECT_MAPPER_OBJECT' : '"'+get_option('OBJECT_MAPPER_OBJECT')+'"',
34                       'POWER_SUPPLY_TYPE_INTERFACE' : '"'+get_option('POWER_SUPPLY_TYPE_INTERFACE')+'"',
35                       'INVENTORY_MANAGER_CACHE' : '"'+get_option('INVENTORY_MANAGER_CACHE')+'"',
36		       'INVENTORY_JSON_SYM_LINK': '"'+get_option('INVENTORY_JSON_SYM_LINK')+'"',
37		       'INVENTORY_JSON_2U': '"'+get_option('INVENTORY_JSON_2U')+'"',
38		       'INVENTORY_JSON_4U': '"'+get_option('INVENTORY_JSON_4U')+'"'
39                       }
40  )
41
42if get_option('ibm-parser').enabled()
43        ibm_read_vpd_SOURCES = ['ibm_vpd_app.cpp',
44                                'parser.cpp',
45                                'impl.cpp',
46                                'utils.cpp',
47                                'keyword_vpd_parser.cpp',
48                                'vpdecc/vpdecc.c',
49                                'vpdecc/vpdecc_support.c'
50                               ]
51
52        ibm_vpd_exe = executable(
53                                'ibm-read-vpd',
54                                ibm_read_vpd_SOURCES,
55                                dependencies: [
56                                        sdbusplus,
57                                        phosphor_logging,
58                                ],
59                                install: true,
60                                cpp_args : '-DIPZ_PARSER'
61                            )
62
63        vpd_tool_SOURCES = ['vpd_tool.cpp',
64                            'vpd_tool_impl.cpp'
65                           ]
66
67        vpd_tool_exe = executable(
68                                 'vpd-tool',
69                                 vpd_tool_SOURCES,
70                                 dependencies: [
71                                   sdbusplus
72                                   ],
73                                 install: true
74                                 )
75if get_option('vpd-manager').enabled()
76    subdir('vpd-manager')
77endif
78
79else
80        FRUGEN = '$srcdir/extra-properties.py -e' + get_option('FRU_YAML')
81        PROPGEN = '$srcdir/extra-properties.py -e' + get_option('PROP_YAML')
82
83        src_dir = meson.source_root()
84        FRU_GEN_SCRIPT = src_dir + '/writefru.py'
85        FRU_GEN_SCRIPT_FILES = src_dir + '/writefru.yaml'
86
87        PROP_GEN_SCRIPT = src_dir + '/extra-properties.py'
88        PROP_GEN_SCRIPT_FILES = src_dir + '/extra-properties-example.yaml'
89
90        writefru_hpp = custom_target('writefru.hpp',
91                                     command:[python,
92                                              FRU_GEN_SCRIPT,
93                                              '-i',
94                                              get_option('FRU_YAML')
95                                     ],
96                                     depend_files :['writefru.mako.hpp',
97                                                    'writefru.py',
98                                                    get_option('FRU_YAML')
99                                     ],
100                                     output:'writefru.hpp'
101        )
102
103        extra_properties_gen_hpp = custom_target(
104                                        'extra-properties-gen.hpp',
105                                        command:[
106                                                python,
107                                                PROP_GEN_SCRIPT,
108                                                '-e',
109                                                get_option('PROP_YAML')
110                                        ],
111                                        depend_files : ['extra-properties.mako.hpp',
112                                                        'extra-properties.py',
113                                                        get_option('PROP_YAML')
114                                        ],
115                                        output:'extra-properties-gen.hpp'
116        )
117
118        openpower_read_vpd_SOURCES = ['app.cpp',
119                                      'args.cpp',
120                                      'impl.cpp',
121                                      'parser.cpp',
122                                      'write.cpp',
123                                      'utils.cpp',
124                                      writefru_hpp,
125                                      extra_properties_gen_hpp
126        ]
127
128        openpower_read_vpd_exe= executable(
129                'openpower-read-vpd',
130                openpower_read_vpd_SOURCES,
131                dependencies: [
132                        sdbusplus,
133                        phosphor_logging,
134                ],
135                install: true,
136        )
137endif
138subdir('test')
139