xref: /openbmc/libcper/meson.build (revision 197ea120)
1*197ea120SJohn Chungproject(
2*197ea120SJohn Chung  'libcper', ['c', 'cpp'],
3*197ea120SJohn Chung  version: '0.1',
4*197ea120SJohn Chung  meson_version: '>=1.1.1',
5*197ea120SJohn Chung  default_options: [
6*197ea120SJohn Chung    'c_std=c18',
7*197ea120SJohn Chung    'cpp_std=c++23',
8*197ea120SJohn Chung    'tests=' + (meson.is_subproject() ? 'disabled' : 'enabled'),
9*197ea120SJohn Chung    'werror=true',
10*197ea120SJohn Chung    'warning_level=2',
11*197ea120SJohn Chung  ])
12*197ea120SJohn Chung
13*197ea120SJohn Chungproject_description = 'libcper library'
14*197ea120SJohn Chung
15*197ea120SJohn ChungSectionSources = files(
16*197ea120SJohn Chung  'sections/cper-section-arm.c',
17*197ea120SJohn Chung  'sections/cper-section.c',
18*197ea120SJohn Chung  'sections/cper-section-ccix-per.c',
19*197ea120SJohn Chung  'sections/cper-section-cxl-component.c',
20*197ea120SJohn Chung  'sections/cper-section-cxl-protocol.c',
21*197ea120SJohn Chung  'sections/cper-section-dmar-generic.c',
22*197ea120SJohn Chung  'sections/cper-section-dmar-iommu.c',
23*197ea120SJohn Chung  'sections/cper-section-dmar-vtd.c',
24*197ea120SJohn Chung  'sections/cper-section-firmware.c',
25*197ea120SJohn Chung  'sections/cper-section-generic.c',
26*197ea120SJohn Chung  'sections/cper-section-ia32x64.c',
27*197ea120SJohn Chung  'sections/cper-section-ipf.c',
28*197ea120SJohn Chung  'sections/cper-section-memory.c',
29*197ea120SJohn Chung  'sections/cper-section-pci-bus.c',
30*197ea120SJohn Chung  'sections/cper-section-pci-dev.c',
31*197ea120SJohn Chung  'sections/cper-section-pcie.c'
32*197ea120SJohn Chung)
33*197ea120SJohn Chung
34*197ea120SJohn ChungEDKSources = files(
35*197ea120SJohn Chung  'edk/Cper.c'
36*197ea120SJohn Chung)
37*197ea120SJohn Chung
38*197ea120SJohn ChungGeneratorSectionSources = files(
39*197ea120SJohn Chung  'generator/sections/gen-section-arm.c',
40*197ea120SJohn Chung  'generator/sections/gen-section.c',
41*197ea120SJohn Chung  'generator/sections/gen-section-ccix-per.c',
42*197ea120SJohn Chung  'generator/sections/gen-section-cxl-component.c',
43*197ea120SJohn Chung  'generator/sections/gen-section-cxl-protocol.c',
44*197ea120SJohn Chung  'generator/sections/gen-section-dmar.c',
45*197ea120SJohn Chung  'generator/sections/gen-section-firmware.c',
46*197ea120SJohn Chung  'generator/sections/gen-section-generic.c',
47*197ea120SJohn Chung  'generator/sections/gen-section-ia32x64.c',
48*197ea120SJohn Chung  'generator/sections/gen-section-memory.c',
49*197ea120SJohn Chung  'generator/sections/gen-section-pci-bus.c',
50*197ea120SJohn Chung  'generator/sections/gen-section-pci-dev.c',
51*197ea120SJohn Chung  'generator/sections/gen-section-pcie.c'
52*197ea120SJohn Chung)
53*197ea120SJohn Chung
54*197ea120SJohn Chungcmake = import('cmake')
55*197ea120SJohn Chung
56*197ea120SJohn Chungjson_c_dep = dependency(
57*197ea120SJohn Chung              'json-c',
58*197ea120SJohn Chung              required: true,
59*197ea120SJohn Chung              fallback : ['json-c', 'json_c_dep'])
60*197ea120SJohn Chung
61*197ea120SJohn Chunglibb64 = dependency('base64', required: false)
62*197ea120SJohn Chungif not libb64.found()
63*197ea120SJohn Chung  opt_var = cmake.subproject_options()
64*197ea120SJohn Chung  opt_var.add_cmake_defines({
65*197ea120SJohn Chung        'BUILD_SHARED_LIBS': true,
66*197ea120SJohn Chung        'BASE64_WITH_AVX': false,
67*197ea120SJohn Chung        'BASE64_WITH_AVX2': false,
68*197ea120SJohn Chung        'BASE64_WITH_AVX512': false,
69*197ea120SJohn Chung        'BASE64_WITH_SSSE3': false,
70*197ea120SJohn Chung        'BASE64_WITH_SSE41': false,
71*197ea120SJohn Chung        'BASE64_WITH_SSE42': false})
72*197ea120SJohn Chung
73*197ea120SJohn Chung  libb64_ex = cmake.subproject('libb64', options: opt_var)
74*197ea120SJohn Chung  libb64 = libb64_ex.dependency('base64')
75*197ea120SJohn Chungendif
76*197ea120SJohn Chung
77*197ea120SJohn Chunglibcper_parse_sources = [
78*197ea120SJohn Chung  'cper-parse.c',
79*197ea120SJohn Chung  'ir-parse.c',
80*197ea120SJohn Chung  'cper-utils.c',
81*197ea120SJohn Chung  'common-utils.c',
82*197ea120SJohn Chung  'json-schema.c'
83*197ea120SJohn Chung]
84*197ea120SJohn Chung
85*197ea120SJohn Chunglibcper_include = ['.']
86*197ea120SJohn Chung
87*197ea120SJohn Chunglibcper_parse = library(
88*197ea120SJohn Chung  'cper-parse',
89*197ea120SJohn Chung  libcper_parse_sources,
90*197ea120SJohn Chung  SectionSources,
91*197ea120SJohn Chung  EDKSources,
92*197ea120SJohn Chung  version: meson.project_version(),
93*197ea120SJohn Chung  include_directories:include_directories(libcper_include),
94*197ea120SJohn Chung  c_args: '-Wno-address-of-packed-member',
95*197ea120SJohn Chung  dependencies: [
96*197ea120SJohn Chung    json_c_dep,
97*197ea120SJohn Chung    libb64,
98*197ea120SJohn Chung  ],
99*197ea120SJohn Chung  install: true,
100*197ea120SJohn Chung  install_dir: get_option('libdir')
101*197ea120SJohn Chung)
102*197ea120SJohn Chunglibcper_parse = declare_dependency(
103*197ea120SJohn Chung  include_directories: include_directories(libcper_include),
104*197ea120SJohn Chung  link_with: libcper_parse
105*197ea120SJohn Chung)
106*197ea120SJohn Chung
107*197ea120SJohn Chung
108*197ea120SJohn Chunglibcper_generate_sources = [
109*197ea120SJohn Chung  'generator/cper-generate.c',
110*197ea120SJohn Chung  'generator/gen-utils.c',
111*197ea120SJohn Chung  'common-utils.c'
112*197ea120SJohn Chung]
113*197ea120SJohn Chung
114*197ea120SJohn Chunglibcper_generate = library(
115*197ea120SJohn Chung  'cper-generate',
116*197ea120SJohn Chung  libcper_generate_sources,
117*197ea120SJohn Chung  GeneratorSectionSources,
118*197ea120SJohn Chung  version: meson.project_version(),
119*197ea120SJohn Chung  include_directories:include_directories(libcper_include),
120*197ea120SJohn Chung  dependencies: [
121*197ea120SJohn Chung    libcper_parse,
122*197ea120SJohn Chung    json_c_dep,
123*197ea120SJohn Chung    libb64,
124*197ea120SJohn Chung  ],
125*197ea120SJohn Chung  install: true,
126*197ea120SJohn Chung  install_dir: get_option('libdir')
127*197ea120SJohn Chung)
128*197ea120SJohn Chunglibcper_generate = declare_dependency(
129*197ea120SJohn Chung  include_directories: include_directories(libcper_include),
130*197ea120SJohn Chung  link_with: libcper_generate
131*197ea120SJohn Chung)
132*197ea120SJohn Chung
133*197ea120SJohn Chungexecutable(
134*197ea120SJohn Chung  'cper-convert',
135*197ea120SJohn Chung  'cli-app/cper-convert.c',
136*197ea120SJohn Chung  include_directories:include_directories(libcper_include),
137*197ea120SJohn Chung  dependencies: [
138*197ea120SJohn Chung    libcper_parse,
139*197ea120SJohn Chung    json_c_dep,
140*197ea120SJohn Chung  ],
141*197ea120SJohn Chung  install: true
142*197ea120SJohn Chung)
143*197ea120SJohn Chung
144*197ea120SJohn Chungexecutable(
145*197ea120SJohn Chung  'cper-generate',
146*197ea120SJohn Chung  'generator/cper-generate-cli.c',
147*197ea120SJohn Chung  EDKSources,
148*197ea120SJohn Chung  include_directories:include_directories(libcper_include),
149*197ea120SJohn Chung  dependencies: [
150*197ea120SJohn Chung    libcper_generate,
151*197ea120SJohn Chung  ],
152*197ea120SJohn Chung  install: true
153*197ea120SJohn Chung)
154*197ea120SJohn Chung
155*197ea120SJohn Chungrun_command('cp', '-r', 'specification/json/', meson.current_build_dir())
156*197ea120SJohn Chungrun_command('mv', meson.current_build_dir() / 'json', meson.current_build_dir() / 'specification')
157*197ea120SJohn Chung
158*197ea120SJohn Chungif get_option('tests').allowed()
159*197ea120SJohn Chung  subdir('tests')
160*197ea120SJohn Chungendif
161*197ea120SJohn Chung
162