1project('berkeley-testfloat-3',  'c',
2        default_options: ['warning_level=1', 'c_std=gnu99'])
3
4fpcflags = get_option('defines')
5
6platform_data = configuration_data()
7platform_data.set('INLINE', 'static inline')
8platform_data.set('LITTLEENDIAN', host_machine.endian() == 'little')
9configure_file(output: 'platform.h', configuration: platform_data)
10
11tfdir = 'source'
12tfinc = include_directories('.', tfdir)
13
14add_project_arguments(
15  [
16    '-Wno-implicit-fallthrough',
17    '-Wno-strict-prototypes',
18    '-Wno-unknown-pragmas',
19    '-Wno-uninitialized',
20    '-Wno-missing-prototypes',
21    '-Wno-return-type',
22    '-Wno-unused-function',
23    '-Wno-missing-format-attribute',
24    '-Wno-error',
25  ] + meson.get_compiler('c').get_supported_arguments('-Wno-ignored-pragmas'),
26  native: false, language: 'c')
27
28tfgencases = [
29  tfdir / 'genCases_ui32.c',
30  tfdir / 'genCases_ui64.c',
31  tfdir / 'genCases_i32.c',
32  tfdir / 'genCases_i64.c',
33  tfdir / 'genCases_f16.c',
34  tfdir / 'genCases_f32.c',
35  tfdir / 'genCases_f64.c',
36  tfdir / 'genCases_extF80.c',
37  tfdir / 'genCases_f128.c',
38]
39
40tfwritecase = [
41  tfdir / 'writeCase_a_ui32.c',
42  tfdir / 'writeCase_a_ui64.c',
43  tfdir / 'writeCase_a_f16.c',
44  tfdir / 'writeCase_ab_f16.c',
45  tfdir / 'writeCase_abc_f16.c',
46  tfdir / 'writeCase_a_f32.c',
47  tfdir / 'writeCase_ab_f32.c',
48  tfdir / 'writeCase_abc_f32.c',
49  tfdir / 'writeCase_a_f64.c',
50  tfdir / 'writeCase_ab_f64.c',
51  tfdir / 'writeCase_abc_f64.c',
52  tfdir / 'writeCase_a_extF80M.c',
53  tfdir / 'writeCase_ab_extF80M.c',
54  tfdir / 'writeCase_a_f128M.c',
55  tfdir / 'writeCase_ab_f128M.c',
56  tfdir / 'writeCase_abc_f128M.c',
57  tfdir / 'writeCase_z_bool.c',
58  tfdir / 'writeCase_z_ui32.c',
59  tfdir / 'writeCase_z_ui64.c',
60  tfdir / 'writeCase_z_f16.c',
61  tfdir / 'writeCase_z_f32.c',
62  tfdir / 'writeCase_z_f64.c',
63  tfdir / 'writeCase_z_extF80M.c',
64  tfdir / 'writeCase_z_f128M.c',
65]
66
67tftest = [
68  tfdir / 'test_a_ui32_z_f16.c',
69  tfdir / 'test_a_ui32_z_f32.c',
70  tfdir / 'test_a_ui32_z_f64.c',
71  tfdir / 'test_a_ui32_z_extF80.c',
72  tfdir / 'test_a_ui32_z_f128.c',
73  tfdir / 'test_a_ui64_z_f16.c',
74  tfdir / 'test_a_ui64_z_f32.c',
75  tfdir / 'test_a_ui64_z_f64.c',
76  tfdir / 'test_a_ui64_z_extF80.c',
77  tfdir / 'test_a_ui64_z_f128.c',
78  tfdir / 'test_a_i32_z_f16.c',
79  tfdir / 'test_a_i32_z_f32.c',
80  tfdir / 'test_a_i32_z_f64.c',
81  tfdir / 'test_a_i32_z_extF80.c',
82  tfdir / 'test_a_i32_z_f128.c',
83  tfdir / 'test_a_i64_z_f16.c',
84  tfdir / 'test_a_i64_z_f32.c',
85  tfdir / 'test_a_i64_z_f64.c',
86  tfdir / 'test_a_i64_z_extF80.c',
87  tfdir / 'test_a_i64_z_f128.c',
88  tfdir / 'test_a_f16_z_ui32_rx.c',
89  tfdir / 'test_a_f16_z_ui64_rx.c',
90  tfdir / 'test_a_f16_z_i32_rx.c',
91  tfdir / 'test_a_f16_z_i64_rx.c',
92  tfdir / 'test_a_f16_z_ui32_x.c',
93  tfdir / 'test_a_f16_z_ui64_x.c',
94  tfdir / 'test_a_f16_z_i32_x.c',
95  tfdir / 'test_a_f16_z_i64_x.c',
96  tfdir / 'test_a_f16_z_f32.c',
97  tfdir / 'test_a_f16_z_f64.c',
98  tfdir / 'test_a_f16_z_extF80.c',
99  tfdir / 'test_a_f16_z_f128.c',
100  tfdir / 'test_az_f16.c',
101  tfdir / 'test_az_f16_rx.c',
102  tfdir / 'test_abz_f16.c',
103  tfdir / 'test_abcz_f16.c',
104  tfdir / 'test_ab_f16_z_bool.c',
105  tfdir / 'test_a_f32_z_ui32_rx.c',
106  tfdir / 'test_a_f32_z_ui64_rx.c',
107  tfdir / 'test_a_f32_z_i32_rx.c',
108  tfdir / 'test_a_f32_z_i64_rx.c',
109  tfdir / 'test_a_f32_z_ui32_x.c',
110  tfdir / 'test_a_f32_z_ui64_x.c',
111  tfdir / 'test_a_f32_z_i32_x.c',
112  tfdir / 'test_a_f32_z_i64_x.c',
113  tfdir / 'test_a_f32_z_f16.c',
114  tfdir / 'test_a_f32_z_f64.c',
115  tfdir / 'test_a_f32_z_extF80.c',
116  tfdir / 'test_a_f32_z_f128.c',
117  tfdir / 'test_az_f32.c',
118  tfdir / 'test_az_f32_rx.c',
119  tfdir / 'test_abz_f32.c',
120  tfdir / 'test_abcz_f32.c',
121  tfdir / 'test_ab_f32_z_bool.c',
122  tfdir / 'test_a_f64_z_ui32_rx.c',
123  tfdir / 'test_a_f64_z_ui64_rx.c',
124  tfdir / 'test_a_f64_z_i32_rx.c',
125  tfdir / 'test_a_f64_z_i64_rx.c',
126  tfdir / 'test_a_f64_z_ui32_x.c',
127  tfdir / 'test_a_f64_z_ui64_x.c',
128  tfdir / 'test_a_f64_z_i32_x.c',
129  tfdir / 'test_a_f64_z_i64_x.c',
130  tfdir / 'test_a_f64_z_f16.c',
131  tfdir / 'test_a_f64_z_f32.c',
132  tfdir / 'test_a_f64_z_extF80.c',
133  tfdir / 'test_a_f64_z_f128.c',
134  tfdir / 'test_az_f64.c',
135  tfdir / 'test_az_f64_rx.c',
136  tfdir / 'test_abz_f64.c',
137  tfdir / 'test_abcz_f64.c',
138  tfdir / 'test_ab_f64_z_bool.c',
139  tfdir / 'test_a_extF80_z_ui32_rx.c',
140  tfdir / 'test_a_extF80_z_ui64_rx.c',
141  tfdir / 'test_a_extF80_z_i32_rx.c',
142  tfdir / 'test_a_extF80_z_i64_rx.c',
143  tfdir / 'test_a_extF80_z_ui32_x.c',
144  tfdir / 'test_a_extF80_z_ui64_x.c',
145  tfdir / 'test_a_extF80_z_i32_x.c',
146  tfdir / 'test_a_extF80_z_i64_x.c',
147  tfdir / 'test_a_extF80_z_f16.c',
148  tfdir / 'test_a_extF80_z_f32.c',
149  tfdir / 'test_a_extF80_z_f64.c',
150  tfdir / 'test_a_extF80_z_f128.c',
151  tfdir / 'test_az_extF80.c',
152  tfdir / 'test_az_extF80_rx.c',
153  tfdir / 'test_abz_extF80.c',
154  tfdir / 'test_ab_extF80_z_bool.c',
155  tfdir / 'test_a_f128_z_ui32_rx.c',
156  tfdir / 'test_a_f128_z_ui64_rx.c',
157  tfdir / 'test_a_f128_z_i32_rx.c',
158  tfdir / 'test_a_f128_z_i64_rx.c',
159  tfdir / 'test_a_f128_z_ui32_x.c',
160  tfdir / 'test_a_f128_z_ui64_x.c',
161  tfdir / 'test_a_f128_z_i32_x.c',
162  tfdir / 'test_a_f128_z_i64_x.c',
163  tfdir / 'test_a_f128_z_f16.c',
164  tfdir / 'test_a_f128_z_f32.c',
165  tfdir / 'test_a_f128_z_f64.c',
166  tfdir / 'test_a_f128_z_extF80.c',
167  tfdir / 'test_az_f128.c',
168  tfdir / 'test_az_f128_rx.c',
169  tfdir / 'test_abz_f128.c',
170  tfdir / 'test_abcz_f128.c',
171  tfdir / 'test_ab_f128_z_bool.c',
172]
173
174libsoftfloat_proj = subproject('berkeley-softfloat-3', required: true)
175libsoftfloat = libsoftfloat_proj.get_variable('libsoftfloat_dep')
176
177libtestfloat = static_library(
178  'testfloat',
179  files(
180    tfdir / 'uint128_inline.c',
181    tfdir / 'uint128.c',
182    tfdir / 'fail.c',
183    tfdir / 'functions_common.c',
184    tfdir / 'functionInfos.c',
185    tfdir / 'standardFunctionInfos.c',
186    tfdir / 'random.c',
187    tfdir / 'genCases_common.c',
188    tfgencases,
189    tfdir / 'genCases_writeTestsTotal.c',
190    tfdir / 'verCases_inline.c',
191    tfdir / 'verCases_common.c',
192    tfdir / 'verCases_writeFunctionName.c',
193    tfdir / 'readHex.c',
194    tfdir / 'writeHex.c',
195    tfwritecase,
196    tfdir / 'testLoops_common.c',
197    tftest,
198  ),
199  dependencies: libsoftfloat.partial_dependency(includes: true, compile_args: true),
200  c_args: fpcflags,
201)
202
203libtestfloat_dep = declare_dependency(
204    link_with: libtestfloat,
205    dependencies: libsoftfloat,
206    include_directories: tfinc,
207    compile_args: fpcflags)
208
209libslowfloat = static_library(
210  'slowfloat',
211  tfdir / 'slowfloat.c',
212  dependencies: libsoftfloat.partial_dependency(includes: true, compile_args: true),
213  c_args: fpcflags,
214)
215
216libslowfloat_dep = declare_dependency(
217    link_with: libslowfloat,
218    dependencies: libsoftfloat,
219    include_directories: tfinc,
220    compile_args: fpcflags)
221