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 151a908984SAndrew Adriancelibrary_is_share = get_option('default_library') == 'shared' 161a908984SAndrew Adriance 17197ea120SJohn Chungproject_description = 'libcper library' 18197ea120SJohn Chung 19197ea120SJohn ChungSectionSources = files( 20197ea120SJohn Chung 'sections/cper-section-arm.c', 21197ea120SJohn Chung 'sections/cper-section-ccix-per.c', 22197ea120SJohn Chung 'sections/cper-section-cxl-component.c', 23197ea120SJohn Chung 'sections/cper-section-cxl-protocol.c', 24197ea120SJohn Chung 'sections/cper-section-dmar-generic.c', 25197ea120SJohn Chung 'sections/cper-section-dmar-iommu.c', 26197ea120SJohn Chung 'sections/cper-section-dmar-vtd.c', 27197ea120SJohn Chung 'sections/cper-section-firmware.c', 28197ea120SJohn Chung 'sections/cper-section-generic.c', 29197ea120SJohn Chung 'sections/cper-section-ia32x64.c', 30197ea120SJohn Chung 'sections/cper-section-ipf.c', 31197ea120SJohn Chung 'sections/cper-section-memory.c', 32197ea120SJohn Chung 'sections/cper-section-pci-bus.c', 33197ea120SJohn Chung 'sections/cper-section-pci-dev.c', 34a5b3d49bSEd Tanous 'sections/cper-section-pcie.c', 35a5b3d49bSEd Tanous 'sections/cper-section.c', 36197ea120SJohn Chung) 37197ea120SJohn Chung 38a5b3d49bSEd TanousEDKSources = files('edk/Cper.c') 39197ea120SJohn Chung 40197ea120SJohn ChungGeneratorSectionSources = files( 41197ea120SJohn Chung 'generator/sections/gen-section-arm.c', 42197ea120SJohn Chung 'generator/sections/gen-section-ccix-per.c', 43197ea120SJohn Chung 'generator/sections/gen-section-cxl-component.c', 44197ea120SJohn Chung 'generator/sections/gen-section-cxl-protocol.c', 45197ea120SJohn Chung 'generator/sections/gen-section-dmar.c', 46197ea120SJohn Chung 'generator/sections/gen-section-firmware.c', 47197ea120SJohn Chung 'generator/sections/gen-section-generic.c', 48197ea120SJohn Chung 'generator/sections/gen-section-ia32x64.c', 49197ea120SJohn Chung 'generator/sections/gen-section-memory.c', 50197ea120SJohn Chung 'generator/sections/gen-section-pci-bus.c', 51197ea120SJohn Chung 'generator/sections/gen-section-pci-dev.c', 52a5b3d49bSEd Tanous 'generator/sections/gen-section-pcie.c', 53a5b3d49bSEd Tanous 'generator/sections/gen-section.c', 54197ea120SJohn Chung) 55197ea120SJohn Chung 56197ea120SJohn Chungcmake = import('cmake') 57abc62b89SJohn Chungcc = meson.get_compiler('c') 58197ea120SJohn Chung 59a5b3d49bSEd Tanousjson_c_dep = dependency('json-c', required: true, fallback: ['json-c', 'json_c_dep']) 60197ea120SJohn Chung 61197ea120SJohn Chunglibcper_parse_sources = [ 62*a7d2cdddSEd Tanous 'base64.c', 63197ea120SJohn Chung 'cper-parse.c', 64197ea120SJohn Chung 'ir-parse.c', 65197ea120SJohn Chung 'cper-utils.c', 66197ea120SJohn Chung 'common-utils.c', 67a5b3d49bSEd Tanous 'json-schema.c', 68197ea120SJohn Chung] 69197ea120SJohn Chung 70197ea120SJohn Chunglibcper_include = ['.'] 71197ea120SJohn Chung 72197ea120SJohn Chunglibcper_parse = library( 73197ea120SJohn Chung 'cper-parse', 74197ea120SJohn Chung libcper_parse_sources, 75197ea120SJohn Chung SectionSources, 76197ea120SJohn Chung EDKSources, 77197ea120SJohn Chung version: meson.project_version(), 78197ea120SJohn Chung include_directories: include_directories(libcper_include), 79197ea120SJohn Chung c_args: '-Wno-address-of-packed-member', 80197ea120SJohn Chung dependencies: [ 81197ea120SJohn Chung json_c_dep, 82197ea120SJohn Chung ], 83197ea120SJohn Chung install: true, 84a5b3d49bSEd Tanous install_dir: get_option('libdir'), 85197ea120SJohn Chung) 86197ea120SJohn Chunglibcper_parse = declare_dependency( 87197ea120SJohn Chung include_directories: include_directories(libcper_include), 88a5b3d49bSEd Tanous link_with: libcper_parse, 89197ea120SJohn Chung) 90197ea120SJohn Chung 91a5b3d49bSEd Tanouslibcper_generate_sources = ['generator/cper-generate.c', 'generator/gen-utils.c', 'common-utils.c'] 92197ea120SJohn Chung 93197ea120SJohn Chunglibcper_generate = library( 94197ea120SJohn Chung 'cper-generate', 95197ea120SJohn Chung libcper_generate_sources, 96197ea120SJohn Chung GeneratorSectionSources, 97197ea120SJohn Chung version: meson.project_version(), 98197ea120SJohn Chung include_directories: include_directories(libcper_include), 99197ea120SJohn Chung dependencies: [ 100197ea120SJohn Chung libcper_parse, 101197ea120SJohn Chung json_c_dep, 102197ea120SJohn Chung ], 103197ea120SJohn Chung install: true, 104a5b3d49bSEd Tanous install_dir: get_option('libdir'), 105197ea120SJohn Chung) 106197ea120SJohn Chunglibcper_generate = declare_dependency( 107197ea120SJohn Chung include_directories: include_directories(libcper_include), 108a5b3d49bSEd Tanous link_with: libcper_generate, 109197ea120SJohn Chung) 110197ea120SJohn Chung 111abc62b89SJohn Chunginstall_headers('cper-parse.h') 112abc62b89SJohn Chunginstall_headers('cper-utils.h') 113abc62b89SJohn Chunginstall_headers('common-utils.h') 114abc62b89SJohn Chunginstall_headers('generator/cper-generate.h', subdir: 'generator') 115abc62b89SJohn Chunginstall_headers('edk/Cper.h', subdir: 'edk') 116abc62b89SJohn Chunginstall_headers('edk/BaseTypes.h', subdir: 'edk') 117abc62b89SJohn Chung 118abc62b89SJohn Chungif get_option('utility').allowed() 119197ea120SJohn Chung executable( 120197ea120SJohn Chung 'cper-convert', 121197ea120SJohn Chung 'cli-app/cper-convert.c', 122197ea120SJohn Chung include_directories: include_directories(libcper_include), 123197ea120SJohn Chung dependencies: [ 124197ea120SJohn Chung libcper_parse, 125197ea120SJohn Chung json_c_dep, 126197ea120SJohn Chung ], 127abc62b89SJohn Chung install: true, 128a5b3d49bSEd Tanous install_dir: get_option('bindir'), 129197ea120SJohn Chung ) 130197ea120SJohn Chung 131197ea120SJohn Chung executable( 132197ea120SJohn Chung 'cper-generate', 133197ea120SJohn Chung 'generator/cper-generate-cli.c', 134197ea120SJohn Chung EDKSources, 135197ea120SJohn Chung include_directories: include_directories(libcper_include), 136197ea120SJohn Chung dependencies: [ 137197ea120SJohn Chung libcper_generate, 138197ea120SJohn Chung ], 139abc62b89SJohn Chung install: true, 140a5b3d49bSEd Tanous install_dir: get_option('bindir'), 141197ea120SJohn Chung ) 142abc62b89SJohn Chungendif 143197ea120SJohn Chung 1441e267b64SEd Tanousrun_command('cp', '-r', 'specification/json/', meson.current_build_dir(), check: true) 145a5b3d49bSEd Tanousrun_command( 146a5b3d49bSEd Tanous 'mv', 147a5b3d49bSEd Tanous meson.current_build_dir() / 'json', 148a5b3d49bSEd Tanous meson.current_build_dir() / 'specification', 149a5b3d49bSEd Tanous) 150197ea120SJohn Chung 151197ea120SJohn Chungif get_option('tests').allowed() 152197ea120SJohn Chung subdir('tests') 153197ea120SJohn Chungendif 154