kou commented on code in PR #46101:
URL: https://github.com/apache/arrow/pull/46101#discussion_r2038390930


##########
cpp/meson.options:
##########
@@ -29,6 +36,20 @@ option(
     value: false,
 )
 
+option(
+    'filesystem',
+    type: 'boolean',
+    description: 'Build the Arrow Filesystem Layer',
+    value: false,
+)
+
+option(
+    'gcs',
+    type: 'boolean',
+    description: 'Build Arrow with GCS support (requires the GCloud SDK for 
C++)',

Review Comment:
   Based on its README: 
https://github.com/googleapis/google-cloud-cpp?tab=readme-ov-file#google-cloud-platform-c-client-libraries
   
   ```suggestion
       description: 'Build Arrow with GCS support (requires the Google Cloud 
Platform C++ Client Libraries)',
   ```



##########
cpp/src/arrow/filesystem/meson.build:
##########
@@ -0,0 +1,87 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+install_headers(
+    [
+        'api.h',
+        'azurefs.h',
+        'filesystem.h',
+        'filesystem_library.h',
+        'gcsfs.h',
+        'hdfs.h',
+        'localfs.h',
+        'mockfs.h',
+        'path_util.h',
+        's3fs.h',
+        's3_test_util.h',
+        'test_util.h',
+        'type_fwd.h',
+    ],
+    subdir: 'arrow/filesystem',
+)
+
+pkg.generate(
+    filebase: 'arrow-filesystem',
+    name: 'Apache Arrow Filesystem',
+    description: 'Filesystem API for accessing local and remote filesystems',
+    requires: ['arrow'],
+)
+
+test_cpp_arg = '-DARROW_FILESYSTEM_EXAMPLE_LIBPATH="@0@"'.format(
+    arrow_filesystem_example.full_path(),
+)
+exc = executable(
+    'arrow-filesystem-test',
+    sources: ['filesystem_test.cc', 'localfs_test.cc'],
+    dependencies: [arrow_test_dep],
+    cpp_args: test_cpp_arg,
+)
+test('arrow-filesystem-test', exc)
+
+exc = executable(
+    'arrow-filesystem-localfs-benchmark',
+    sources: ['localfs_benchmark.cc'],
+    dependencies: [arrow_benchmark_dep],
+)
+benchmark('arrow-filesystem-localfs-benchmark', exc)
+
+exc = executable(
+    'arrow-gcsfs-test',
+    sources: ['gcsfs_test.cc'],
+    dependencies: [arrow_test_dep, gcs_dep],
+)
+test('arrow-gcsfs-test', exc)
+
+exc = executable(
+    'arrow-azurefs-test',
+    sources: ['azurefs_test.cc'],
+    dependencies: [arrow_test_dep, azure_dep],
+)
+test('arrow-azurefs-test', exc)
+
+
+if needs_s3
+endif
+

Review Comment:
   ```suggestion
   ```



##########
cpp/src/arrow/meson.build:
##########
@@ -264,6 +264,79 @@ else
     rapidjson_dep = disabler()
 endif
 
+azure_dep = disabler()
+gcs_dep = disabler()
+s3_dep = disabler()
+if needs_filesystem
+    arrow_filesystem_srcs = [
+        'filesystem/filesystem.cc',
+        'filesystem/localfs.cc',
+        'filesystem/mockfs.cc',
+        'filesystem/path_util.cc',
+        'filesystem/util_internal.cc',
+    ]
+
+    arrow_filesystem_deps = []
+
+    if needs_azure
+        arrow_filesystem_srcs += ['filesystem/azurefs.cc']
+        cmake = import('cmake')
+        azure_opt = cmake.subproject_options()
+        azure_opt.add_cmake_defines(
+            {'BUILD_PERFORMANCE_TESTS': 'FALSE'},
+            {'BUILD_SAMPLES': 'FALSE'},
+            {'BUILD_TESTING': 'FALSE'},
+            {'BUILD_WINDOWS_UWP': 'TRUE'},
+            {'CMAKE_UNITY_BUILD': 'FALSE'},
+            {'DISABLE_AZURE_CORE_OPENTELEMETRY': 'TRUE'},
+            # TODO: couldn't find any usage of this in Arrow - do we need?
+            # set(ENV{AZURE_SDK_DISABLE_AUTO_VCPKG} TRUE)
+            {'WARNINGS_AS_ERRORS': 'FALSE'},
+        )
+        azure_opt.append_compile_args('cpp', '-fPIC')
+        azure_proj = cmake.subproject('azure', options: azure_opt)
+
+        azure_dep = declare_dependency(
+            dependencies: [
+                azure_proj.dependency('azure-core'),
+                azure_proj.dependency('azure-identity'),
+                azure_proj.dependency('azure-storage-blobs'),
+                azure_proj.dependency('azure-storage-common'),
+                azure_proj.dependency('azure-storage-files-datalake'),
+            ],
+        )
+        arrow_filesystem_deps += [azure_dep]
+    endif
+
+    if needs_gcs
+        error('gcs filesystem support is not yet implemented in Meson')
+        arrow_filesystem_srcs += [
+            'filesystem/gcsfs.cc',
+            'filesystem/gcsfs_internal.cc',
+        ]
+        gcs_dep = dependency('google-cloud-cpp')
+        arrow_filesystem_deps += [gcs_dep]
+    endif
+
+    if needs_hdfs
+        arrow_filesystem_srcs += ['filesystem/hdfs.cc']
+    endif
+
+    if needs_s3
+        error('s3 filesystem support is not yet implemented in Meson')
+        arrow_filesystem_srcs += ['filesystem/s3fs.cc']

Review Comment:
   Could you remove this for now?



##########
cpp/src/arrow/filesystem/meson.build:
##########
@@ -0,0 +1,87 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+install_headers(
+    [
+        'api.h',
+        'azurefs.h',
+        'filesystem.h',
+        'filesystem_library.h',
+        'gcsfs.h',
+        'hdfs.h',
+        'localfs.h',
+        'mockfs.h',
+        'path_util.h',
+        's3fs.h',
+        's3_test_util.h',
+        'test_util.h',
+        'type_fwd.h',
+    ],
+    subdir: 'arrow/filesystem',
+)
+
+pkg.generate(
+    filebase: 'arrow-filesystem',
+    name: 'Apache Arrow Filesystem',
+    description: 'Filesystem API for accessing local and remote filesystems',
+    requires: ['arrow'],
+)
+
+test_cpp_arg = '-DARROW_FILESYSTEM_EXAMPLE_LIBPATH="@0@"'.format(
+    arrow_filesystem_example.full_path(),
+)
+exc = executable(
+    'arrow-filesystem-test',
+    sources: ['filesystem_test.cc', 'localfs_test.cc'],
+    dependencies: [arrow_test_dep],
+    cpp_args: test_cpp_arg,
+)
+test('arrow-filesystem-test', exc)
+
+exc = executable(
+    'arrow-filesystem-localfs-benchmark',
+    sources: ['localfs_benchmark.cc'],
+    dependencies: [arrow_benchmark_dep],
+)
+benchmark('arrow-filesystem-localfs-benchmark', exc)
+
+exc = executable(
+    'arrow-gcsfs-test',
+    sources: ['gcsfs_test.cc'],
+    dependencies: [arrow_test_dep, gcs_dep],
+)
+test('arrow-gcsfs-test', exc)
+
+exc = executable(
+    'arrow-azurefs-test',
+    sources: ['azurefs_test.cc'],
+    dependencies: [arrow_test_dep, azure_dep],
+)
+test('arrow-azurefs-test', exc)
+
+
+if needs_s3
+endif
+
+if needs_hdfs

Review Comment:
   Can we remove this?



##########
cpp/src/arrow/meson.build:
##########
@@ -264,6 +264,79 @@ else
     rapidjson_dep = disabler()
 endif
 
+azure_dep = disabler()
+gcs_dep = disabler()
+s3_dep = disabler()
+if needs_filesystem
+    arrow_filesystem_srcs = [
+        'filesystem/filesystem.cc',
+        'filesystem/localfs.cc',
+        'filesystem/mockfs.cc',
+        'filesystem/path_util.cc',
+        'filesystem/util_internal.cc',
+    ]
+
+    arrow_filesystem_deps = []
+
+    if needs_azure
+        arrow_filesystem_srcs += ['filesystem/azurefs.cc']
+        cmake = import('cmake')
+        azure_opt = cmake.subproject_options()
+        azure_opt.add_cmake_defines(
+            {'BUILD_PERFORMANCE_TESTS': 'FALSE'},
+            {'BUILD_SAMPLES': 'FALSE'},
+            {'BUILD_TESTING': 'FALSE'},
+            {'BUILD_WINDOWS_UWP': 'TRUE'},
+            {'CMAKE_UNITY_BUILD': 'FALSE'},
+            {'DISABLE_AZURE_CORE_OPENTELEMETRY': 'TRUE'},
+            # TODO: couldn't find any usage of this in Arrow - do we need?
+            # set(ENV{AZURE_SDK_DISABLE_AUTO_VCPKG} TRUE)

Review Comment:
   Azure SDK for C++ prepared vcpkg automatically without this: 
https://github.com/Azure/azure-sdk-for-cpp/blob/27c2e5d335c9306d08aa49bd5fe92d0cc1628fe0/cmake-modules/AzureVcpkg.cmake#L17-L41
   
   We don't want to use vcpkg here.



##########
cpp/meson.build:
##########
@@ -58,8 +58,11 @@ endif
 
 needs_benchmarks = get_option('benchmarks')
 needs_csv = get_option('csv')
+needs_azure = get_option('azure')
+needs_gcs = get_option('gcs')
 needs_hdfs = get_option('hdfs')
-needs_filesystem = false or needs_hdfs
+needs_s3 = get_option('s3')
+needs_filesystem = get_option('filesystem') or needs_azure or needs_gcs or 
needs_s3 or needs_hdfs

Review Comment:
   ```suggestion
   needs_filesystem = get_option('filesystem') or needs_azure or needs_gcs or 
needs_hdfs or needs_s3
   ```



##########
cpp/src/arrow/meson.build:
##########
@@ -264,6 +264,79 @@ else
     rapidjson_dep = disabler()
 endif
 
+azure_dep = disabler()
+gcs_dep = disabler()
+s3_dep = disabler()
+if needs_filesystem
+    arrow_filesystem_srcs = [
+        'filesystem/filesystem.cc',
+        'filesystem/localfs.cc',
+        'filesystem/mockfs.cc',
+        'filesystem/path_util.cc',
+        'filesystem/util_internal.cc',
+    ]
+
+    arrow_filesystem_deps = []
+
+    if needs_azure
+        arrow_filesystem_srcs += ['filesystem/azurefs.cc']
+        cmake = import('cmake')
+        azure_opt = cmake.subproject_options()
+        azure_opt.add_cmake_defines(
+            {'BUILD_PERFORMANCE_TESTS': 'FALSE'},
+            {'BUILD_SAMPLES': 'FALSE'},
+            {'BUILD_TESTING': 'FALSE'},
+            {'BUILD_WINDOWS_UWP': 'TRUE'},
+            {'CMAKE_UNITY_BUILD': 'FALSE'},
+            {'DISABLE_AZURE_CORE_OPENTELEMETRY': 'TRUE'},
+            # TODO: couldn't find any usage of this in Arrow - do we need?
+            # set(ENV{AZURE_SDK_DISABLE_AUTO_VCPKG} TRUE)
+            {'WARNINGS_AS_ERRORS': 'FALSE'},
+        )
+        azure_opt.append_compile_args('cpp', '-fPIC')
+        azure_proj = cmake.subproject('azure', options: azure_opt)
+
+        azure_dep = declare_dependency(
+            dependencies: [
+                azure_proj.dependency('azure-core'),
+                azure_proj.dependency('azure-identity'),
+                azure_proj.dependency('azure-storage-blobs'),
+                azure_proj.dependency('azure-storage-common'),
+                azure_proj.dependency('azure-storage-files-datalake'),
+            ],
+        )
+        arrow_filesystem_deps += [azure_dep]
+    endif
+
+    if needs_gcs
+        error('gcs filesystem support is not yet implemented in Meson')
+        arrow_filesystem_srcs += [
+            'filesystem/gcsfs.cc',
+            'filesystem/gcsfs_internal.cc',
+        ]
+        gcs_dep = dependency('google-cloud-cpp')
+        arrow_filesystem_deps += [gcs_dep]

Review Comment:
   Could you remove this for now?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to