1197ea120SJohn Chungproject( 2a5b3d49bSEd Tanous 'libcper', 3a5b3d49bSEd Tanous ['c', 'cpp'], 4197ea120SJohn Chung version: '0.1', 5197ea120SJohn Chung meson_version: '>=1.1.1', 6197ea120SJohn Chung default_options: [ 7197ea120SJohn Chung 'c_std=c18', 8197ea120SJohn Chung 'cpp_std=c++23', 9197ea120SJohn Chung 'tests=' + (meson.is_subproject() ? 'disabled' : 'enabled'), 10197ea120SJohn Chung 'werror=true', 11197ea120SJohn Chung 'warning_level=2', 12a5b3d49bSEd Tanous ], 13a5b3d49bSEd Tanous) 14197ea120SJohn Chung 1545e7332fSKarthik Rajagopalanadd_project_arguments( 16358c7e16SEd Tanous '-DLIBCPER_JSON_SPEC="' 17358c7e16SEd Tanous + meson.current_source_dir() 18358c7e16SEd Tanous + '/specification/json/cper-json.json"', 19358c7e16SEd Tanous language: ['c', 'cpp'], 20358c7e16SEd Tanous) 21358c7e16SEd Tanous 221a908984SAndrew Adriancelibrary_is_share = get_option('default_library') == 'shared' 2345e7332fSKarthik Rajagopalanadd_project_arguments('-D_POSIX_C_SOURCE=200809L', language : 'c') 241a908984SAndrew Adriance 25197ea120SJohn Chungproject_description = 'libcper library' 26197ea120SJohn Chung 27a84fc937SEd Tanoussection_sources = files( 28197ea120SJohn Chung 'sections/cper-section-arm.c', 29197ea120SJohn Chung 'sections/cper-section-ccix-per.c', 30197ea120SJohn Chung 'sections/cper-section-cxl-component.c', 31197ea120SJohn Chung 'sections/cper-section-cxl-protocol.c', 32197ea120SJohn Chung 'sections/cper-section-dmar-generic.c', 33197ea120SJohn Chung 'sections/cper-section-dmar-iommu.c', 34197ea120SJohn Chung 'sections/cper-section-dmar-vtd.c', 35197ea120SJohn Chung 'sections/cper-section-firmware.c', 36197ea120SJohn Chung 'sections/cper-section-generic.c', 37197ea120SJohn Chung 'sections/cper-section-ia32x64.c', 38197ea120SJohn Chung 'sections/cper-section-ipf.c', 39197ea120SJohn Chung 'sections/cper-section-memory.c', 40683e0550SKarthik Rajagopalan 'sections/cper-section-nvidia.c', 41197ea120SJohn Chung 'sections/cper-section-pci-bus.c', 42197ea120SJohn Chung 'sections/cper-section-pci-dev.c', 43a5b3d49bSEd Tanous 'sections/cper-section-pcie.c', 44a5b3d49bSEd Tanous 'sections/cper-section.c', 45197ea120SJohn Chung) 46197ea120SJohn Chung 47a84fc937SEd Tanousedk_sources = files('edk/Cper.c') 48197ea120SJohn Chung 49a84fc937SEd Tanousgenerator_section_sources = files( 50197ea120SJohn Chung 'generator/sections/gen-section-arm.c', 51197ea120SJohn Chung 'generator/sections/gen-section-ccix-per.c', 52197ea120SJohn Chung 'generator/sections/gen-section-cxl-component.c', 53197ea120SJohn Chung 'generator/sections/gen-section-cxl-protocol.c', 54197ea120SJohn Chung 'generator/sections/gen-section-dmar.c', 55197ea120SJohn Chung 'generator/sections/gen-section-firmware.c', 56197ea120SJohn Chung 'generator/sections/gen-section-generic.c', 57197ea120SJohn Chung 'generator/sections/gen-section-ia32x64.c', 58197ea120SJohn Chung 'generator/sections/gen-section-memory.c', 59683e0550SKarthik Rajagopalan 'generator/sections/gen-section-nvidia.c', 60197ea120SJohn Chung 'generator/sections/gen-section-pci-bus.c', 61197ea120SJohn Chung 'generator/sections/gen-section-pci-dev.c', 62a5b3d49bSEd Tanous 'generator/sections/gen-section-pcie.c', 63a5b3d49bSEd Tanous 'generator/sections/gen-section.c', 64197ea120SJohn Chung) 65197ea120SJohn Chung 66abc62b89SJohn Chungcc = meson.get_compiler('c') 67197ea120SJohn Chung 68a5b3d49bSEd Tanousjson_c_dep = dependency('json-c', required: true, fallback: ['json-c', 'json_c_dep']) 69197ea120SJohn Chung 70197ea120SJohn Chunglibcper_parse_sources = [ 71a7d2cdddSEd Tanous 'base64.c', 72197ea120SJohn Chung 'cper-parse.c', 73197ea120SJohn Chung 'ir-parse.c', 74197ea120SJohn Chung 'cper-utils.c', 75197ea120SJohn Chung 'common-utils.c', 76a5b3d49bSEd Tanous 'json-schema.c', 77197ea120SJohn Chung] 78197ea120SJohn Chung 79197ea120SJohn Chunglibcper_include = ['.'] 80197ea120SJohn Chung 81197ea120SJohn Chunglibcper_parse = library( 82197ea120SJohn Chung 'cper-parse', 83197ea120SJohn Chung libcper_parse_sources, 84a84fc937SEd Tanous section_sources, 85a84fc937SEd Tanous edk_sources, 86197ea120SJohn Chung version: meson.project_version(), 87197ea120SJohn Chung include_directories: include_directories(libcper_include), 88197ea120SJohn Chung c_args: '-Wno-address-of-packed-member', 89197ea120SJohn Chung dependencies: [ 90197ea120SJohn Chung json_c_dep, 91197ea120SJohn Chung ], 92197ea120SJohn Chung install: true, 93a5b3d49bSEd Tanous install_dir: get_option('libdir'), 94197ea120SJohn Chung) 959fe2cb5fSKarthik Rajagopalanlibcper_parse_dep = declare_dependency( 96197ea120SJohn Chung include_directories: include_directories(libcper_include), 97a5b3d49bSEd Tanous link_with: libcper_parse, 98197ea120SJohn Chung) 99197ea120SJohn Chung 100a5b3d49bSEd Tanouslibcper_generate_sources = ['generator/cper-generate.c', 'generator/gen-utils.c', 'common-utils.c'] 101197ea120SJohn Chung 102197ea120SJohn Chunglibcper_generate = library( 103197ea120SJohn Chung 'cper-generate', 104197ea120SJohn Chung libcper_generate_sources, 105a84fc937SEd Tanous generator_section_sources, 106197ea120SJohn Chung version: meson.project_version(), 107197ea120SJohn Chung include_directories: include_directories(libcper_include), 108197ea120SJohn Chung dependencies: [ 1099fe2cb5fSKarthik Rajagopalan libcper_parse_dep, 110197ea120SJohn Chung json_c_dep, 111197ea120SJohn Chung ], 112197ea120SJohn Chung install: true, 113a5b3d49bSEd Tanous install_dir: get_option('libdir'), 114197ea120SJohn Chung) 1159fe2cb5fSKarthik Rajagopalanlibcper_generate_dep = declare_dependency( 116197ea120SJohn Chung include_directories: include_directories(libcper_include), 117a5b3d49bSEd Tanous link_with: libcper_generate, 118197ea120SJohn Chung) 119197ea120SJohn Chung 1209fe2cb5fSKarthik Rajagopalanimport('pkgconfig').generate( 1219fe2cb5fSKarthik Rajagopalan libcper_parse, 1229fe2cb5fSKarthik Rajagopalan name: meson.project_name(), 1239fe2cb5fSKarthik Rajagopalan version: meson.project_version(), 1249fe2cb5fSKarthik Rajagopalan description: 'C bindings for parsing CPER' 1259fe2cb5fSKarthik Rajagopalan) 1269fe2cb5fSKarthik Rajagopalan 127abc62b89SJohn Chunginstall_headers('cper-parse.h') 128*5220c9bdSKarthik Rajagopalaninstall_headers('cper-parse-str.h') 129abc62b89SJohn Chunginstall_headers('cper-utils.h') 130abc62b89SJohn Chunginstall_headers('common-utils.h') 131abc62b89SJohn Chunginstall_headers('generator/cper-generate.h', subdir: 'generator') 132abc62b89SJohn Chunginstall_headers('edk/Cper.h', subdir: 'edk') 133abc62b89SJohn Chunginstall_headers('edk/BaseTypes.h', subdir: 'edk') 134abc62b89SJohn Chung 135abc62b89SJohn Chungif get_option('utility').allowed() 136197ea120SJohn Chung executable( 137197ea120SJohn Chung 'cper-convert', 138197ea120SJohn Chung 'cli-app/cper-convert.c', 139197ea120SJohn Chung include_directories: include_directories(libcper_include), 140197ea120SJohn Chung dependencies: [ 1419fe2cb5fSKarthik Rajagopalan libcper_parse_dep, 142197ea120SJohn Chung json_c_dep, 143197ea120SJohn Chung ], 144abc62b89SJohn Chung install: true, 145a5b3d49bSEd Tanous install_dir: get_option('bindir'), 146197ea120SJohn Chung ) 147197ea120SJohn Chung 148197ea120SJohn Chung executable( 149197ea120SJohn Chung 'cper-generate', 150197ea120SJohn Chung 'generator/cper-generate-cli.c', 151a84fc937SEd Tanous edk_sources, 152197ea120SJohn Chung include_directories: include_directories(libcper_include), 153197ea120SJohn Chung dependencies: [ 1549fe2cb5fSKarthik Rajagopalan libcper_generate_dep, 155197ea120SJohn Chung ], 156abc62b89SJohn Chung install: true, 157a5b3d49bSEd Tanous install_dir: get_option('bindir'), 158197ea120SJohn Chung ) 159abc62b89SJohn Chungendif 160197ea120SJohn Chung 161197ea120SJohn Chungif get_option('tests').allowed() 162197ea120SJohn Chung subdir('tests') 163197ea120SJohn Chungendif 164