Skip to content

Commit 877e315

Browse files
committed
apacheGH-45831: [C++] Add CSV directory to Meson configuration
1 parent bc0b858 commit 877e315

File tree

4 files changed

+102
-0
lines changed

4 files changed

+102
-0
lines changed

cpp/meson.build

+1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ if git_description == ''
5757
endif
5858

5959
needs_benchmarks = get_option('benchmarks')
60+
needs_csv = get_option('csv')
6061
needs_filesystem = false
6162
needs_integration = false
6263
needs_tests = get_option('tests')

cpp/meson.options

+7
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ option(
2222
value: false,
2323
)
2424

25+
option(
26+
'csv',
27+
type: 'boolean',
28+
description: 'Build the Arrow CSV Parser Module',
29+
value: false,
30+
)
31+
2532
option(
2633
'ipc',
2734
type: 'boolean',

cpp/src/arrow/csv/meson.build

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
csv_test_sources = [
19+
'chunker_test.cc',
20+
'column_builder_test.cc',
21+
'column_decoder_test.cc',
22+
'converter_test.cc',
23+
'parser_test.cc',
24+
'reader_test.cc',
25+
'writer_test.cc',
26+
]
27+
28+
exc = executable(
29+
'arrow-csv-test',
30+
sources: csv_test_sources,
31+
dependencies: [arrow_test_dep],
32+
)
33+
test('arrow-csv-test', exc)
34+
35+
csv_benchmarks = ['converter_benchmark', 'parser_benchmark', 'writer_benchmark']
36+
37+
foreach csv_benchmark : csv_benchmarks
38+
benchmark_name = 'arrow-csv-@0@'.format(csv_benchmark.replace('_', '-'))
39+
exc = executable(
40+
benchmark_name,
41+
sources: '@0@.cc'.format(csv_benchmark),
42+
dependencies: [arrow_test_dep, benchmark_dep],
43+
)
44+
benchmark(benchmark_name, exc)
45+
endforeach
46+
47+
install_headers(
48+
[
49+
'api.h',
50+
'chunker.h',
51+
'column_builder.h',
52+
'column_decoder.h',
53+
'converter.h',
54+
'invalid_row.h',
55+
'options.h',
56+
'parser.h',
57+
'reader.h',
58+
'test_common.h',
59+
'type_fwd.h',
60+
'writer.h',
61+
],
62+
subdir: 'arrow/csv',
63+
)
64+
65+
66+
pkg.generate(
67+
filebase: 'arrow-csv',
68+
name: 'Apache Arrow CSV',
69+
description: 'CSV reader module for Apache Arrow',
70+
requires: 'arrow',
71+
)

cpp/src/arrow/meson.build

+23
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,25 @@ if needs_integration or needs_tests
238238
}
239239
endif
240240

241+
if needs_csv
242+
arrow_components += {
243+
'arrow_csv': {
244+
'sources': [
245+
'csv/converter.cc',
246+
'csv/chunker.cc',
247+
'csv/column_builder.cc',
248+
'csv/column_decoder.cc',
249+
'csv/options.cc',
250+
'csv/parser.cc',
251+
'csv/reader.cc',
252+
'csv/writer.cc',
253+
],
254+
},
255+
}
256+
257+
arrow_testing_srcs += ['csv/test_common.cc']
258+
endif
259+
241260
if needs_json
242261
rapidjson_dep = dependency('rapidjson', include_type: 'system')
243262
else
@@ -512,3 +531,7 @@ pkg.generate(
512531
subdir('testing')
513532

514533
subdir('util')
534+
535+
if needs_csv
536+
subdir('csv')
537+
endif

0 commit comments

Comments
 (0)