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 15358c7e16SEd Tanousadd_global_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' 23*4482c48bSAndrew Adrianceadd_global_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', 40197ea120SJohn Chung 'sections/cper-section-pci-bus.c', 41197ea120SJohn Chung 'sections/cper-section-pci-dev.c', 42a5b3d49bSEd Tanous 'sections/cper-section-pcie.c', 43a5b3d49bSEd Tanous 'sections/cper-section.c', 44197ea120SJohn Chung) 45197ea120SJohn Chung 46a84fc937SEd Tanousedk_sources = files('edk/Cper.c') 47197ea120SJohn Chung 48a84fc937SEd Tanousgenerator_section_sources = files( 49197ea120SJohn Chung 'generator/sections/gen-section-arm.c', 50197ea120SJohn Chung 'generator/sections/gen-section-ccix-per.c', 51197ea120SJohn Chung 'generator/sections/gen-section-cxl-component.c', 52197ea120SJohn Chung 'generator/sections/gen-section-cxl-protocol.c', 53197ea120SJohn Chung 'generator/sections/gen-section-dmar.c', 54197ea120SJohn Chung 'generator/sections/gen-section-firmware.c', 55197ea120SJohn Chung 'generator/sections/gen-section-generic.c', 56197ea120SJohn Chung 'generator/sections/gen-section-ia32x64.c', 57197ea120SJohn Chung 'generator/sections/gen-section-memory.c', 58197ea120SJohn Chung 'generator/sections/gen-section-pci-bus.c', 59197ea120SJohn Chung 'generator/sections/gen-section-pci-dev.c', 60a5b3d49bSEd Tanous 'generator/sections/gen-section-pcie.c', 61a5b3d49bSEd Tanous 'generator/sections/gen-section.c', 62197ea120SJohn Chung) 63197ea120SJohn Chung 64abc62b89SJohn Chungcc = meson.get_compiler('c') 65197ea120SJohn Chung 66a5b3d49bSEd Tanousjson_c_dep = dependency('json-c', required: true, fallback: ['json-c', 'json_c_dep']) 67197ea120SJohn Chung 68197ea120SJohn Chunglibcper_parse_sources = [ 69a7d2cdddSEd Tanous 'base64.c', 70197ea120SJohn Chung 'cper-parse.c', 71197ea120SJohn Chung 'ir-parse.c', 72197ea120SJohn Chung 'cper-utils.c', 73197ea120SJohn Chung 'common-utils.c', 74a5b3d49bSEd Tanous 'json-schema.c', 75197ea120SJohn Chung] 76197ea120SJohn Chung 77197ea120SJohn Chunglibcper_include = ['.'] 78197ea120SJohn Chung 79197ea120SJohn Chunglibcper_parse = library( 80197ea120SJohn Chung 'cper-parse', 81197ea120SJohn Chung libcper_parse_sources, 82a84fc937SEd Tanous section_sources, 83a84fc937SEd Tanous edk_sources, 84197ea120SJohn Chung version: meson.project_version(), 85197ea120SJohn Chung include_directories: include_directories(libcper_include), 86197ea120SJohn Chung c_args: '-Wno-address-of-packed-member', 87197ea120SJohn Chung dependencies: [ 88197ea120SJohn Chung json_c_dep, 89197ea120SJohn Chung ], 90197ea120SJohn Chung install: true, 91a5b3d49bSEd Tanous install_dir: get_option('libdir'), 92197ea120SJohn Chung) 93197ea120SJohn Chunglibcper_parse = declare_dependency( 94197ea120SJohn Chung include_directories: include_directories(libcper_include), 95a5b3d49bSEd Tanous link_with: libcper_parse, 96197ea120SJohn Chung) 97197ea120SJohn Chung 98a5b3d49bSEd Tanouslibcper_generate_sources = ['generator/cper-generate.c', 'generator/gen-utils.c', 'common-utils.c'] 99197ea120SJohn Chung 100197ea120SJohn Chunglibcper_generate = library( 101197ea120SJohn Chung 'cper-generate', 102197ea120SJohn Chung libcper_generate_sources, 103a84fc937SEd Tanous generator_section_sources, 104197ea120SJohn Chung version: meson.project_version(), 105197ea120SJohn Chung include_directories: include_directories(libcper_include), 106197ea120SJohn Chung dependencies: [ 107197ea120SJohn Chung libcper_parse, 108197ea120SJohn Chung json_c_dep, 109197ea120SJohn Chung ], 110197ea120SJohn Chung install: true, 111a5b3d49bSEd Tanous install_dir: get_option('libdir'), 112197ea120SJohn Chung) 113197ea120SJohn Chunglibcper_generate = declare_dependency( 114197ea120SJohn Chung include_directories: include_directories(libcper_include), 115a5b3d49bSEd Tanous link_with: libcper_generate, 116197ea120SJohn Chung) 117197ea120SJohn Chung 118abc62b89SJohn Chunginstall_headers('cper-parse.h') 119abc62b89SJohn Chunginstall_headers('cper-utils.h') 120abc62b89SJohn Chunginstall_headers('common-utils.h') 121abc62b89SJohn Chunginstall_headers('generator/cper-generate.h', subdir: 'generator') 122abc62b89SJohn Chunginstall_headers('edk/Cper.h', subdir: 'edk') 123abc62b89SJohn Chunginstall_headers('edk/BaseTypes.h', subdir: 'edk') 124abc62b89SJohn Chung 125abc62b89SJohn Chungif get_option('utility').allowed() 126197ea120SJohn Chung executable( 127197ea120SJohn Chung 'cper-convert', 128197ea120SJohn Chung 'cli-app/cper-convert.c', 129197ea120SJohn Chung include_directories: include_directories(libcper_include), 130197ea120SJohn Chung dependencies: [ 131197ea120SJohn Chung libcper_parse, 132197ea120SJohn Chung json_c_dep, 133197ea120SJohn Chung ], 134abc62b89SJohn Chung install: true, 135a5b3d49bSEd Tanous install_dir: get_option('bindir'), 136197ea120SJohn Chung ) 137197ea120SJohn Chung 138197ea120SJohn Chung executable( 139197ea120SJohn Chung 'cper-generate', 140197ea120SJohn Chung 'generator/cper-generate-cli.c', 141a84fc937SEd Tanous edk_sources, 142197ea120SJohn Chung include_directories: include_directories(libcper_include), 143197ea120SJohn Chung dependencies: [ 144197ea120SJohn Chung libcper_generate, 145197ea120SJohn Chung ], 146abc62b89SJohn Chung install: true, 147a5b3d49bSEd Tanous install_dir: get_option('bindir'), 148197ea120SJohn Chung ) 149abc62b89SJohn Chungendif 150197ea120SJohn Chung 151197ea120SJohn Chungif get_option('tests').allowed() 152197ea120SJohn Chung subdir('tests') 153197ea120SJohn Chungendif