Skip to content

Commit 0033317

Browse files
WillAydzanmato1984
authored andcommitted
apacheGH-46092: [C++] Add filesystem related options to Meson (apache#46101)
### Rationale for this change This continues adding support for the Meson build system by adding filesystem support ### What changes are included in this PR? This implements the filesystem directory and adds support for Azure. GCS and S3 are stubbed out but will raise an error when a user attempts to enable them, strictly because they look like larger integrations to get the dependency chain properly configured. ### Are these changes tested? Locally yes ### Are there any user-facing changes? No * GitHub Issue: apache#46092 Authored-by: Will Ayd <[email protected]> Signed-off-by: Sutou Kouhei <[email protected]>
1 parent 2a24f15 commit 0033317

File tree

7 files changed

+213
-4
lines changed

7 files changed

+213
-4
lines changed

cpp/cmake_modules/DefineOptions.cmake

+2-1
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,8 @@ takes precedence over ccache if a storage backend is configured" ON)
346346
ARROW_WITH_UTF8PROC)
347347

348348
define_option(ARROW_GCS
349-
"Build Arrow with GCS support (requires the GCloud SDK for C++)"
349+
"Build Arrow with GCS support (requires the Google Cloud Platform "
350+
"C++ Client Libraries)"
350351
OFF
351352
DEPENDS
352353
ARROW_FILESYSTEM)

cpp/meson.build

+4-1
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,11 @@ endif
5858

5959
needs_benchmarks = get_option('benchmarks')
6060
needs_csv = get_option('csv')
61+
needs_azure = get_option('azure')
62+
needs_gcs = get_option('gcs')
6163
needs_hdfs = get_option('hdfs')
62-
needs_filesystem = false or needs_hdfs
64+
needs_s3 = get_option('s3')
65+
needs_filesystem = get_option('filesystem') or needs_azure or needs_gcs or needs_hdfs or needs_s3
6366
needs_integration = get_option('integration')
6467
needs_tests = get_option('tests')
6568
needs_ipc = get_option('ipc') or needs_tests or needs_benchmarks

cpp/meson.options

+28
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18+
option(
19+
'azure',
20+
type: 'boolean',
21+
description: 'Build Arrow with Azure support (requires the Azure SDK for C++)',
22+
value: false,
23+
)
24+
1825
option(
1926
'benchmarks',
2027
type: 'boolean',
@@ -29,6 +36,20 @@ option(
2936
value: false,
3037
)
3138

39+
option(
40+
'filesystem',
41+
type: 'boolean',
42+
description: 'Build the Arrow Filesystem Layer',
43+
value: false,
44+
)
45+
46+
option(
47+
'gcs',
48+
type: 'boolean',
49+
description: 'Build Arrow with GCS support (requires the Google Cloud Platform C++ Client Libraries)',
50+
value: false,
51+
)
52+
3253
option(
3354
'hdfs',
3455
type: 'boolean',
@@ -73,6 +94,13 @@ option(
7394
description: 'Arbitrary string that identifies the kind of package (for informational purposes)',
7495
)
7596

97+
option(
98+
's3',
99+
type: 'boolean',
100+
description: 'Build Arrow with S3 support (requires the AWS SDK for C++)',
101+
value: false,
102+
)
103+
76104
option(
77105
'testing',
78106
type: 'boolean',

cpp/src/arrow/filesystem/meson.build

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
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+
install_headers(
19+
[
20+
'api.h',
21+
'azurefs.h',
22+
'filesystem.h',
23+
'filesystem_library.h',
24+
'gcsfs.h',
25+
'hdfs.h',
26+
'localfs.h',
27+
'mockfs.h',
28+
'path_util.h',
29+
's3fs.h',
30+
's3_test_util.h',
31+
'test_util.h',
32+
'type_fwd.h',
33+
],
34+
subdir: 'arrow/filesystem',
35+
)
36+
37+
pkg.generate(
38+
filebase: 'arrow-filesystem',
39+
name: 'Apache Arrow Filesystem',
40+
description: 'Filesystem API for accessing local and remote filesystems',
41+
requires: ['arrow'],
42+
)
43+
44+
test_cpp_arg = '-DARROW_FILESYSTEM_EXAMPLE_LIBPATH="@0@"'.format(
45+
arrow_filesystem_example.full_path(),
46+
)
47+
exc = executable(
48+
'arrow-filesystem-test',
49+
sources: ['filesystem_test.cc', 'localfs_test.cc'],
50+
dependencies: [arrow_test_dep],
51+
cpp_args: test_cpp_arg,
52+
)
53+
test('arrow-filesystem-test', exc)
54+
55+
exc = executable(
56+
'arrow-filesystem-localfs-benchmark',
57+
sources: ['localfs_benchmark.cc'],
58+
dependencies: [arrow_benchmark_dep],
59+
)
60+
benchmark('arrow-filesystem-localfs-benchmark', exc)
61+
62+
exc = executable(
63+
'arrow-gcsfs-test',
64+
sources: ['gcsfs_test.cc'],
65+
dependencies: [arrow_test_dep, gcs_dep],
66+
)
67+
test('arrow-gcsfs-test', exc)
68+
69+
exc = executable(
70+
'arrow-azurefs-test',
71+
sources: ['azurefs_test.cc'],
72+
dependencies: [arrow_test_dep, azure_dep],
73+
)
74+
test('arrow-azurefs-test', exc)
75+
76+
if needs_hdfs
77+
exc = executable(
78+
'arrow-hdfs-test',
79+
sources: ['hdfs_test.cc'],
80+
dependencies: [arrow_test_dep],
81+
)
82+
test('arrow-hdfs-test', exc)
83+
endif

cpp/src/arrow/meson.build

+70-1
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,71 @@ else
264264
rapidjson_dep = disabler()
265265
endif
266266

267+
azure_dep = disabler()
268+
gcs_dep = disabler()
269+
s3_dep = disabler()
270+
if needs_filesystem
271+
arrow_filesystem_srcs = [
272+
'filesystem/filesystem.cc',
273+
'filesystem/localfs.cc',
274+
'filesystem/mockfs.cc',
275+
'filesystem/path_util.cc',
276+
'filesystem/util_internal.cc',
277+
]
278+
279+
arrow_filesystem_deps = []
280+
281+
if needs_azure
282+
arrow_filesystem_srcs += ['filesystem/azurefs.cc']
283+
cmake = import('cmake')
284+
azure_opt = cmake.subproject_options()
285+
azure_opt.add_cmake_defines(
286+
{'BUILD_PERFORMANCE_TESTS': 'FALSE'},
287+
{'BUILD_SAMPLES': 'FALSE'},
288+
{'BUILD_TESTING': 'FALSE'},
289+
{'BUILD_WINDOWS_UWP': 'TRUE'},
290+
{'CMAKE_UNITY_BUILD': 'FALSE'},
291+
{'DISABLE_AZURE_CORE_OPENTELEMETRY': 'TRUE'},
292+
{'ENV{AZURE_SDK_DISABLE_AUTO_VCPKG}': 'TRUE'},
293+
{'WARNINGS_AS_ERRORS': 'FALSE'},
294+
)
295+
azure_opt.append_compile_args('cpp', '-fPIC')
296+
azure_proj = cmake.subproject('azure', options: azure_opt)
297+
298+
azure_dep = declare_dependency(
299+
dependencies: [
300+
azure_proj.dependency('azure-core'),
301+
azure_proj.dependency('azure-identity'),
302+
azure_proj.dependency('azure-storage-blobs'),
303+
azure_proj.dependency('azure-storage-common'),
304+
azure_proj.dependency('azure-storage-files-datalake'),
305+
],
306+
)
307+
arrow_filesystem_deps += [azure_dep]
308+
endif
309+
310+
if needs_gcs
311+
error('gcs filesystem support is not yet implemented in Meson')
312+
endif
313+
314+
if needs_hdfs
315+
arrow_filesystem_srcs += ['filesystem/hdfs.cc']
316+
endif
317+
318+
if needs_s3
319+
error('s3 filesystem support is not yet implemented in Meson')
320+
endif
321+
322+
arrow_components += {
323+
'arrow_filesystem': {
324+
'sources': arrow_filesystem_srcs,
325+
'dependencies': arrow_filesystem_deps,
326+
},
327+
}
328+
329+
arrow_testing_srcs += ['filesystem/test_util.cc']
330+
endif
331+
267332
if needs_ipc
268333
arrow_ipc_srcs = [
269334
'ipc/dictionary.cc',
@@ -406,7 +471,7 @@ endif
406471
arrow_test_lib = static_library(
407472
'arrow_testing',
408473
sources: arrow_testing_srcs,
409-
dependencies: [arrow_dep, filesystem_dep, gtest_main_dep],
474+
dependencies: [arrow_dep, filesystem_dep, gmock_dep, gtest_main_dep],
410475
)
411476

412477
if needs_tests
@@ -555,3 +620,7 @@ endif
555620
if needs_csv
556621
subdir('csv')
557622
endif
623+
624+
if needs_filesystem
625+
subdir('filesystem')
626+
endif

cpp/src/arrow/testing/meson.build

+3-1
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,11 @@ foreach key, val : testing_tests
5454
endforeach
5555

5656
if needs_tests and needs_filesystem
57-
shared_module(
57+
arrow_filesystem_example = shared_module(
5858
'arrow-filesystem-example',
5959
sources: ['examplefs.cc'],
6060
dependencies: [arrow_dep, gtest_dep],
6161
)
62+
else
63+
arrow_filesystem_example = disabler()
6264
endif

cpp/subprojects/azure.wrap

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+
[wrap-file]
19+
source_url = https://github.com/Azure/azure-sdk-for-cpp/archive/azure-identity_1.9.0.tar.gz
20+
source_filename = azure-sdk-for-cpp-azure-identity_1.9.0.tar.gz
21+
source_hash = 97065bfc971ac8df450853ce805f820f52b59457bd7556510186a1569502e4a1
22+
directory = azure-sdk-for-cpp-azure-identity_1.9.0
23+
method = cmake

0 commit comments

Comments
 (0)