From bc75e6031be351395027748a3289e8ffa66a5241 Mon Sep 17 00:00:00 2001 From: Will Ayd Date: Tue, 16 Sep 2025 10:37:09 -0400 Subject: [PATCH 01/14] feat: Add support for Meson build system --- .github/workflows/test.yml | 33 ++++++ .gitignore | 6 ++ .pre-commit-config.yaml | 12 +++ CMakeLists.txt | 1 - cmake_modules/IcebergBuildUtils.cmake | 12 --- meson.build | 32 ++++++ meson.options | 18 ++++ src/iceberg/CMakeLists.txt | 30 ++++-- src/iceberg/catalog/meson.build | 18 ++++ src/iceberg/expression/meson.build | 18 ++++ src/iceberg/iceberg_bundle_export.h | 34 ++++++ src/iceberg/iceberg_export.h | 34 ++++++ src/iceberg/json_internal.h | 85 ++++++++------- src/iceberg/meson.build | 143 ++++++++++++++++++++++++++ src/iceberg/name_mapping.h | 4 +- src/iceberg/test/CMakeLists.txt | 2 +- src/iceberg/test/meson.build | 74 +++++++++++++ src/iceberg/util/decimal.h | 16 +-- src/iceberg/util/meson.build | 35 +++++++ src/meson.build | 18 ++++ subprojects/gtest.wrap | 33 ++++++ subprojects/nanoarrow.wrap | 27 +++++ subprojects/nlohmann_json.wrap | 28 +++++ subprojects/spdlog.wrap | 30 ++++++ subprojects/zlib.wrap | 30 ++++++ 25 files changed, 704 insertions(+), 69 deletions(-) create mode 100644 meson.build create mode 100644 meson.options create mode 100644 src/iceberg/catalog/meson.build create mode 100644 src/iceberg/expression/meson.build create mode 100644 src/iceberg/iceberg_bundle_export.h create mode 100644 src/iceberg/iceberg_export.h create mode 100644 src/iceberg/meson.build create mode 100644 src/iceberg/test/meson.build create mode 100644 src/iceberg/util/meson.build create mode 100644 src/meson.build create mode 100644 subprojects/gtest.wrap create mode 100644 subprojects/nanoarrow.wrap create mode 100644 subprojects/nlohmann_json.wrap create mode 100644 subprojects/spdlog.wrap create mode 100644 subprojects/zlib.wrap diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 15daa874..1cb4017c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -99,3 +99,36 @@ jobs: run: | call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 bash -c "ci/scripts/build_example.sh $(pwd)/example" + meson: + name: Meson - ${{ matrix.title }} + runs-on: ${{ matrix.runs-on }} + strategy: + fail-fast: false + matrix: + include: + - title: AMD64 Ubuntu 24.04 + runs-on: ubuntu-24.04 + - title: AMD64 Windows 2022 + runs-on: windows-2022 + meson-setup-args: --vsenv + - title: AArch64 macOS 15 + runs-on: macos-15 + steps: + - uses: actions/setup-python@v5 + with: + python-version: '3.x' + - name: Checkout iceberg-cpp + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + with: + fetch-depth: 0 + - name: Install build dependencies + run: | + python3 -m pip install --upgrade pip + python3 -m pip install meson ninja + - name: Build Iceberg + run: | + meson setup builddir ${{ matrix.meson-setup-args || '' }} + meson compile -C builddir + - name: Test Iceberg + run: | + meson test -C builddir diff --git a/.gitignore b/.gitignore index 74df5bd6..8cd4f4e1 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,9 @@ cmake-build-release/ # vscode files .vscode + +# meson subprojects - wrap files need to be kept to let meson download +# dependencies as needed, but dependencies themselves should not be versioned +/subprojects/* +!/subprojects/packagefiles +!/subprojects/*.wrap diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 193d69a1..4ee4a0b8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -39,3 +39,15 @@ repos: rev: v0.6.10 hooks: - id: cmake-format + + - repo: https://github.com/trim21/pre-commit-mirror-meson + rev: v1.9.0 + hooks: + - id: meson-fmt + alias: cpp + args: ['--inplace'] + files: >- + ( + ?.*meson\.build$| + ?.*meson\.options$| + ) diff --git a/CMakeLists.txt b/CMakeLists.txt index dea6b46f..d5ee3db7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,7 +64,6 @@ include(CMakeParseArguments) include(IcebergBuildUtils) include(IcebergSanitizer) include(IcebergThirdpartyToolchain) -include(GenerateExportHeader) if(ICEBERG_BUILD_TESTS) enable_testing() diff --git a/cmake_modules/IcebergBuildUtils.cmake b/cmake_modules/IcebergBuildUtils.cmake index 8b892597..b02359a9 100644 --- a/cmake_modules/IcebergBuildUtils.cmake +++ b/cmake_modules/IcebergBuildUtils.cmake @@ -217,18 +217,6 @@ function(add_iceberg_lib LIB_NAME) DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) endif() - # generate export header file - if(BUILD_SHARED) - generate_export_header(${LIB_NAME}_shared BASE_NAME ${LIB_NAME}) - if(BUILD_STATIC) - string(TOUPPER ${LIB_NAME} LIB_NAME_UPPER) - target_compile_definitions(${LIB_NAME}_static - PUBLIC ${LIB_NAME_UPPER}_STATIC_DEFINE) - endif() - elseif(BUILD_STATIC) - generate_export_header(${LIB_NAME}_static BASE_NAME ${LIB_NAME}) - endif() - # Modify variable in calling scope if(ARG_OUTPUTS) set(${ARG_OUTPUTS} diff --git a/meson.build b/meson.build new file mode 100644 index 00000000..59e6a1c4 --- /dev/null +++ b/meson.build @@ -0,0 +1,32 @@ +# 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. + +project( + 'iceberg', + 'cpp', + version: '0.2.0', + license: 'Apache-2.0', + meson_version: '>=1.3.0', + default_options: ['cpp_std=c++23,c++latest', 'warning_level=2'], +) + +subdir('src') + +install_data( + ['LICENSE', 'NOTICE'], + install_dir: get_option('datadir') / 'doc/Iceberg', +) diff --git a/meson.options b/meson.options new file mode 100644 index 00000000..fb27c705 --- /dev/null +++ b/meson.options @@ -0,0 +1,18 @@ +# 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. + +option('tests', type: 'feature', description: 'Build tests', value: 'enabled') diff --git a/src/iceberg/CMakeLists.txt b/src/iceberg/CMakeLists.txt index 8327b590..09cdbf49 100644 --- a/src/iceberg/CMakeLists.txt +++ b/src/iceberg/CMakeLists.txt @@ -106,7 +106,17 @@ add_iceberg_lib(iceberg STATIC_INSTALL_INTERFACE_LIBS ${ICEBERG_STATIC_INSTALL_INTERFACE_LIBS} SHARED_INSTALL_INTERFACE_LIBS - ${ICEBERG_SHARED_INSTALL_INTERFACE_LIBS}) + ${ICEBERG_SHARED_INSTALL_INTERFACE_LIBS} + OUTPUTS + ICEBERG_LIBRARIES) + +foreach(LIB_TARGET ${ICEBERG_LIBRARIES}) + target_compile_definitions(${LIB_TARGET} PRIVATE ICEBERG_EXPORTING) +endforeach() + +if(ICEBERG_BUILD_STATIC) + target_compile_definitions(iceberg_static PUBLIC ICEBERG_STATIC) +endif() iceberg_install_all_headers(iceberg) @@ -115,9 +125,6 @@ add_subdirectory(expression) add_subdirectory(row) add_subdirectory(util) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/iceberg_export.h - DESTINATION ${ICEBERG_INSTALL_INCLUDEDIR}/iceberg) - if(ICEBERG_BUILD_BUNDLE) set(ICEBERG_BUNDLE_SOURCES arrow/arrow_fs_file_io.cc @@ -179,14 +186,21 @@ if(ICEBERG_BUILD_BUNDLE) STATIC_INSTALL_INTERFACE_LIBS ${ICEBERG_BUNDLE_STATIC_INSTALL_INTERFACE_LIBS} SHARED_INSTALL_INTERFACE_LIBS - ${ICEBERG_BUNDLE_SHARED_INSTALL_INTERFACE_LIBS}) + ${ICEBERG_BUNDLE_SHARED_INSTALL_INTERFACE_LIBS} + OUTPUTS + ICEBERG_BUNDLE_LIBRARIES) + + foreach(LIB_TARGET ${ICEBERG_BUNDLE_LIBRARIES}) + target_compile_definitions(${LIB_TARGET} PRIVATE ICEBERG_BUNDLE_EXPORTING) + endforeach() + + if(ICEBERG_BUILD_STATIC) + target_compile_definitions(iceberg_bundle_static PUBLIC ICEBERG_BUNDLE_STATIC) + endif() add_subdirectory(arrow) add_subdirectory(avro) add_subdirectory(parquet) - - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/iceberg_bundle_export.h - DESTINATION ${ICEBERG_INSTALL_INCLUDEDIR}/iceberg) endif() iceberg_install_cmake_package(Iceberg iceberg_targets) diff --git a/src/iceberg/catalog/meson.build b/src/iceberg/catalog/meson.build new file mode 100644 index 00000000..a32fa9df --- /dev/null +++ b/src/iceberg/catalog/meson.build @@ -0,0 +1,18 @@ +# 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(['in_memory_catalog.h'], subdir: 'iceberg/catalog') diff --git a/src/iceberg/expression/meson.build b/src/iceberg/expression/meson.build new file mode 100644 index 00000000..722057ce --- /dev/null +++ b/src/iceberg/expression/meson.build @@ -0,0 +1,18 @@ +# 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(['expression.h', 'literal.h'], subdir: 'iceberg/expression') diff --git a/src/iceberg/iceberg_bundle_export.h b/src/iceberg/iceberg_bundle_export.h new file mode 100644 index 00000000..c63f8811 --- /dev/null +++ b/src/iceberg/iceberg_bundle_export.h @@ -0,0 +1,34 @@ +/* + * 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. + */ + +#pragma once + +#if defined(_WIN32) || defined(__CYGWIN__) +# ifdef ICEBERG_BUNDLE_STATIC +# define ICEBERG_BUNDLE_EXPORT +# elif defined(ICEBERG_BUNDLE_EXPORTING) +# define ICEBERG_BUNDLE_EXPORT __declspec(dllexport) +# else +# define ICEBERG_BUNDLE_EXPORT __declspec(dllimport) +# endif +#else // Not Windows +# ifndef ICEBERG_BUNDLE_EXPORT +# define ICEBERG_BUNDLE_EXPORT __attribute__((visibility("default"))) +# endif +#endif diff --git a/src/iceberg/iceberg_export.h b/src/iceberg/iceberg_export.h new file mode 100644 index 00000000..64ed7dff --- /dev/null +++ b/src/iceberg/iceberg_export.h @@ -0,0 +1,34 @@ +/* + * 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. + */ + +#pragma once + +#if defined(_WIN32) || defined(__CYGWIN__) +# ifdef ICEBERG_STATIC +# define ICEBERG_EXPORT +# elif defined(ICEBERG_EXPORTING) +# define ICEBERG_EXPORT __declspec(dllexport) +# else +# define ICEBERG_EXPORT __declspec(dllimport) +# endif +#else // Not Windows +# ifndef ICEBERG_EXPORT +# define ICEBERG_EXPORT __attribute__((visibility("default"))) +# endif +#endif diff --git a/src/iceberg/json_internal.h b/src/iceberg/json_internal.h index 4479a31f..7d13459b 100644 --- a/src/iceberg/json_internal.h +++ b/src/iceberg/json_internal.h @@ -38,7 +38,7 @@ namespace iceberg { /// /// \param sort_field The `SortField` object to be serialized. /// \return A JSON object representing the `SortField` in the form of key-value pairs. -nlohmann::json ToJson(const SortField& sort_field); +ICEBERG_EXPORT nlohmann::json ToJson(const SortField& sort_field); /// \brief Deserializes a JSON object into a `SortField` object. /// @@ -49,7 +49,8 @@ nlohmann::json ToJson(const SortField& sort_field); /// \param json The JSON object representing a `SortField`. /// \return An `expected` value containing either a `SortField` object or an error. If the /// JSON is malformed or missing expected fields, an error will be returned. -Result> SortFieldFromJson(const nlohmann::json& json); +ICEBERG_EXPORT Result> SortFieldFromJson( + const nlohmann::json& json); /// \brief Serializes a `SortOrder` object to JSON. /// @@ -59,7 +60,7 @@ Result> SortFieldFromJson(const nlohmann::json& json) /// /// \param sort_order The `SortOrder` object to be serialized. /// \return A JSON object representing the `SortOrder` with its order ID and fields array. -nlohmann::json ToJson(const SortOrder& sort_order); +ICEBERG_EXPORT nlohmann::json ToJson(const SortOrder& sort_order); /// \brief Deserializes a JSON object into a `SortOrder` object. /// @@ -70,43 +71,45 @@ nlohmann::json ToJson(const SortOrder& sort_order); /// \param json The JSON object representing a `SortOrder`. /// \return An `expected` value containing either a `SortOrder` object or an error. If the /// JSON is malformed or missing expected fields, an error will be returned. -Result> SortOrderFromJson(const nlohmann::json& json); +ICEBERG_EXPORT Result> SortOrderFromJson( + const nlohmann::json& json); /// \brief Convert an Iceberg Schema to JSON. /// /// \param[in] schema The Iceberg schema to convert. /// \return The JSON representation of the schema. -nlohmann::json ToJson(const Schema& schema); +ICEBERG_EXPORT nlohmann::json ToJson(const Schema& schema); /// \brief Convert JSON to an Iceberg Schema. /// /// \param[in] json The JSON representation of the schema. /// \return The Iceberg schema or an error if the conversion fails. -Result> SchemaFromJson(const nlohmann::json& json); +ICEBERG_EXPORT Result> SchemaFromJson(const nlohmann::json& json); /// \brief Convert an Iceberg Type to JSON. /// /// \param[in] type The Iceberg type to convert. /// \return The JSON representation of the type. -nlohmann::json ToJson(const Type& type); +ICEBERG_EXPORT nlohmann::json ToJson(const Type& type); /// \brief Convert JSON to an Iceberg Type. /// /// \param[in] json The JSON representation of the type. /// \return The Iceberg type or an error if the conversion fails. -Result> TypeFromJson(const nlohmann::json& json); +ICEBERG_EXPORT Result> TypeFromJson(const nlohmann::json& json); /// \brief Convert an Iceberg SchemaField to JSON. /// /// \param[in] field The Iceberg field to convert. /// \return The JSON representation of the field. -nlohmann::json ToJson(const SchemaField& field); +ICEBERG_EXPORT nlohmann::json ToJson(const SchemaField& field); /// \brief Convert JSON to an Iceberg SchemaField. /// /// \param[in] json The JSON representation of the field. /// \return The Iceberg field or an error if the conversion fails. -Result> FieldFromJson(const nlohmann::json& json); +ICEBERG_EXPORT Result> FieldFromJson( + const nlohmann::json& json); /// \brief Serializes a `PartitionField` object to JSON. /// @@ -117,7 +120,7 @@ Result> FieldFromJson(const nlohmann::json& json); /// \param partition_field The `PartitionField` object to be serialized. /// \return A JSON object representing the `PartitionField` in the form of key-value /// pairs. -nlohmann::json ToJson(const PartitionField& partition_field); +ICEBERG_EXPORT nlohmann::json ToJson(const PartitionField& partition_field); /// \brief Deserializes a JSON object into a `PartitionField` object. /// @@ -130,7 +133,7 @@ nlohmann::json ToJson(const PartitionField& partition_field); /// happen when deserializing partition fields from V1 metadata files. /// \return An `expected` value containing either a `PartitionField` object or an error. /// If the JSON is malformed or missing expected fields, an error will be returned. -Result> PartitionFieldFromJson( +ICEBERG_EXPORT Result> PartitionFieldFromJson( const nlohmann::json& json, bool allow_field_id_missing = false); /// \brief Serializes a `PartitionSpec` object to JSON. @@ -143,7 +146,7 @@ Result> PartitionFieldFromJson( /// \param partition_spec The `PartitionSpec` object to be serialized. /// \return A JSON object representing the `PartitionSpec` with its order ID and fields /// array. -nlohmann::json ToJson(const PartitionSpec& partition_spec); +ICEBERG_EXPORT nlohmann::json ToJson(const PartitionSpec& partition_spec); /// \brief Deserializes a JSON object into a `PartitionSpec` object. /// @@ -155,141 +158,149 @@ nlohmann::json ToJson(const PartitionSpec& partition_spec); /// \param json The JSON object representing a `PartitionSpec`. /// \return An `expected` value containing either a `PartitionSpec` object or an error. If /// the JSON is malformed or missing expected fields, an error will be returned. -Result> PartitionSpecFromJson( +ICEBERG_EXPORT Result> PartitionSpecFromJson( const std::shared_ptr& schema, const nlohmann::json& json); /// \brief Serializes a `SnapshotRef` object to JSON. /// /// \param[in] snapshot_ref The `SnapshotRef` object to be serialized. /// \return A JSON object representing the `SnapshotRef`. -nlohmann::json ToJson(const SnapshotRef& snapshot_ref); +ICEBERG_EXPORT nlohmann::json ToJson(const SnapshotRef& snapshot_ref); /// \brief Deserializes a JSON object into a `SnapshotRef` object. /// /// \param[in] json The JSON object representing a `SnapshotRef`. /// \return A `SnapshotRef` object or an error if the conversion fails. -Result> SnapshotRefFromJson(const nlohmann::json& json); +ICEBERG_EXPORT Result> SnapshotRefFromJson( + const nlohmann::json& json); /// \brief Serializes a `Snapshot` object to JSON. /// /// \param[in] snapshot The `Snapshot` object to be serialized. /// \return A JSON object representing the `snapshot`. -nlohmann::json ToJson(const Snapshot& snapshot); +ICEBERG_EXPORT nlohmann::json ToJson(const Snapshot& snapshot); /// \brief Deserializes a JSON object into a `Snapshot` object. /// /// \param[in] json The JSON representation of the snapshot. /// \return A `Snapshot` object or an error if the conversion fails. -Result> SnapshotFromJson(const nlohmann::json& json); +ICEBERG_EXPORT Result> SnapshotFromJson( + const nlohmann::json& json); /// \brief Serializes a `StatisticsFile` object to JSON. /// /// \param statistics_file The `StatisticsFile` object to be serialized. /// \return A JSON object representing the `StatisticsFile`. -nlohmann::json ToJson(const StatisticsFile& statistics_file); +ICEBERG_EXPORT nlohmann::json ToJson(const StatisticsFile& statistics_file); /// \brief Deserializes a JSON object into a `StatisticsFile` object. /// /// \param json The JSON object representing a `StatisticsFile`. /// \return A `StatisticsFile` object or an error if the conversion fails. -Result> StatisticsFileFromJson( +ICEBERG_EXPORT Result> StatisticsFileFromJson( const nlohmann::json& json); /// \brief Serializes a `PartitionStatisticsFile` object to JSON. /// /// \param partition_statistics_file The `PartitionStatisticsFile` object to be /// serialized. \return A JSON object representing the `PartitionStatisticsFile`. -nlohmann::json ToJson(const PartitionStatisticsFile& partition_statistics_file); +ICEBERG_EXPORT nlohmann::json ToJson( + const PartitionStatisticsFile& partition_statistics_file); /// \brief Deserializes a JSON object into a `PartitionStatisticsFile` object. /// /// \param json The JSON object representing a `PartitionStatisticsFile`. /// \return A `PartitionStatisticsFile` object or an error if the conversion fails. -Result> PartitionStatisticsFileFromJson( - const nlohmann::json& json); +ICEBERG_EXPORT Result> +PartitionStatisticsFileFromJson(const nlohmann::json& json); /// \brief Serializes a `SnapshotLogEntry` object to JSON. /// /// \param snapshot_log_entry The `SnapshotLogEntry` object to be serialized. /// \return A JSON object representing the `SnapshotLogEntry`. -nlohmann::json ToJson(const SnapshotLogEntry& snapshot_log_entry); +ICEBERG_EXPORT nlohmann::json ToJson(const SnapshotLogEntry& snapshot_log_entry); /// \brief Deserializes a JSON object into a `SnapshotLogEntry` object. /// /// \param json The JSON object representing a `SnapshotLogEntry`. /// \return A `SnapshotLogEntry` object or an error if the conversion fails. -Result SnapshotLogEntryFromJson(const nlohmann::json& json); +ICEBERG_EXPORT Result SnapshotLogEntryFromJson( + const nlohmann::json& json); /// \brief Serializes a `MetadataLogEntry` object to JSON. /// /// \param metadata_log_entry The `MetadataLogEntry` object to be serialized. /// \return A JSON object representing the `MetadataLogEntry`. -nlohmann::json ToJson(const MetadataLogEntry& metadata_log_entry); +ICEBERG_EXPORT nlohmann::json ToJson(const MetadataLogEntry& metadata_log_entry); /// \brief Deserializes a JSON object into a `MetadataLogEntry` object. /// /// \param json The JSON object representing a `MetadataLogEntry`. /// \return A `MetadataLogEntry` object or an error if the conversion fails. -Result MetadataLogEntryFromJson(const nlohmann::json& json); +ICEBERG_EXPORT Result MetadataLogEntryFromJson( + const nlohmann::json& json); /// \brief Serializes a `TableMetadata` object to JSON. /// /// \param table_metadata The `TableMetadata` object to be serialized. /// \return A JSON object representing the `TableMetadata`. -nlohmann::json ToJson(const TableMetadata& table_metadata); +ICEBERG_EXPORT nlohmann::json ToJson(const TableMetadata& table_metadata); /// \brief Deserializes a JSON object into a `TableMetadata` object. /// /// \param json The JSON object representing a `TableMetadata`. /// \return A `TableMetadata` object or an error if the conversion fails. -Result> TableMetadataFromJson(const nlohmann::json& json); +ICEBERG_EXPORT Result> TableMetadataFromJson( + const nlohmann::json& json); /// \brief Deserialize a JSON string into a `nlohmann::json` object. /// /// \param json_string The JSON string to deserialize. /// \return A `nlohmann::json` object or an error if the deserialization fails. -Result FromJsonString(const std::string& json_string); +ICEBERG_EXPORT Result FromJsonString(const std::string& json_string); /// \brief Serialize a `nlohmann::json` object into a JSON string. /// /// \param json The `nlohmann::json` object to serialize. /// \return A JSON string or an error if the serialization fails. -Result ToJsonString(const nlohmann::json& json); +ICEBERG_EXPORT Result ToJsonString(const nlohmann::json& json); /// \brief Serializes a `MappedField` object to JSON. /// /// \param[in] field The `MappedField` object to be serialized. /// \return A JSON object representing the `MappedField`. -nlohmann::json ToJson(const MappedField& field); +ICEBERG_EXPORT nlohmann::json ToJson(const MappedField& field); /// \brief Deserializes a JSON object into a `MappedField` object. /// /// \param[in] json The JSON object representing a `MappedField`. /// \return A `MappedField` object or an error if the conversion fails. -Result MappedFieldFromJson(const nlohmann::json& json); +ICEBERG_EXPORT Result MappedFieldFromJson(const nlohmann::json& json); /// \brief Serializes a `MappedFields` object to JSON. /// /// \param[in] mapped_fields The `MappedFields` object to be serialized. /// \return A JSON object representing the `MappedFields`. -nlohmann::json ToJson(const MappedFields& mapped_fields); +ICEBERG_EXPORT nlohmann::json ToJson(const MappedFields& mapped_fields); /// \brief Deserializes a JSON object into a `MappedFields` object. /// /// \param[in] json The JSON object representing a `MappedFields`. /// \return A `MappedFields` object or an error if the conversion fails. -Result> MappedFieldsFromJson(const nlohmann::json& json); +ICEBERG_EXPORT Result> MappedFieldsFromJson( + const nlohmann::json& json); /// \brief Serializes a `NameMapping` object to JSON. /// /// \param[in] name_mapping The `NameMapping` object to be serialized. /// \return A JSON object representing the `NameMapping`. -nlohmann::json ToJson(const NameMapping& name_mapping); +ICEBERG_EXPORT nlohmann::json ToJson(const NameMapping& name_mapping); /// \brief Deserializes a JSON object into a `NameMapping` object. /// /// \param[in] json The JSON object representing a `NameMapping`. /// \return A `NameMapping` object or an error if the conversion fails. -Result> NameMappingFromJson(const nlohmann::json& json); +ICEBERG_EXPORT Result> NameMappingFromJson( + const nlohmann::json& json); } // namespace iceberg diff --git a/src/iceberg/meson.build b/src/iceberg/meson.build new file mode 100644 index 00000000..2b50e762 --- /dev/null +++ b/src/iceberg/meson.build @@ -0,0 +1,143 @@ +# 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. + +iceberg_include_dir = include_directories('..') +iceberg_sources = files( + 'arrow_c_data_guard_internal.cc', + 'catalog/in_memory_catalog.cc', + 'expression/expression.cc', + 'expression/literal.cc', + 'file_reader.cc', + 'file_writer.cc', + 'inheritable_metadata.cc', + 'json_internal.cc', + 'manifest_entry.cc', + 'manifest_list.cc', + 'manifest_reader.cc', + 'manifest_reader_internal.cc', + 'manifest_writer.cc', + 'metadata_columns.cc', + 'name_mapping.cc', + 'partition_field.cc', + 'partition_spec.cc', + 'schema.cc', + 'schema_field.cc', + 'schema_internal.cc', + 'schema_util.cc', + 'snapshot.cc', + 'sort_field.cc', + 'sort_order.cc', + 'statistics_file.cc', + 'table.cc', + 'table_metadata.cc', + 'table_scan.cc', + 'transform.cc', + 'transform_function.cc', + 'type.cc', + 'util/decimal.cc', + 'util/gzip_internal.cc', + 'util/murmurhash3_internal.cc', + 'util/timepoint.cc', +) + +nanoarrow_dep = dependency('nanoarrow') +nlohmann_json_dep = dependency('nlohmann_json') +spdlog_dep = dependency('spdlog') +zlib_dep = dependency('zlib') + +iceberg_deps = [nanoarrow_dep, nlohmann_json_dep, spdlog_dep, zlib_dep] + +iceberg_lib = library( + 'iceberg', + sources: iceberg_sources, + dependencies: iceberg_deps, + include_directories: iceberg_include_dir, + install: true, + gnu_symbol_visibility: 'inlineshidden', + cpp_shared_args: ['-DICEBERG_EXPORTING'], + cpp_static_args: ['-DICEBERG_STATIC'], +) + +iceberg_interface_args = [] +if get_option('default_library') != 'shared' + iceberg_interface_args += ['-DICEBERG_STATIC'] +endif + +iceberg_dep = declare_dependency( + link_with: iceberg_lib, + dependencies: iceberg_deps, + include_directories: iceberg_include_dir, + compile_args: iceberg_interface_args, +) +meson.override_dependency('iceberg', iceberg_dep) +pkg = import('pkgconfig') +pkg.generate(iceberg_lib) + +install_headers( + [ + 'arrow_c_data.h', + 'catalog.h', + 'constants.h', + 'exception.h', + 'file_format.h', + 'file_io.h', + 'file_reader.h', + 'file_writer.h', + 'iceberg_export.h', + 'inheritable_metadata.h', + 'location_provider.h', + 'manifest_adapter.h', + 'manifest_entry.h', + 'manifest_list.h', + 'manifest_reader.h', + 'manifest_writer.h', + 'metadata_columns.h', + 'metrics.h', + 'name_mapping.h', + 'partition_field.h', + 'partition_spec.h', + 'result.h', + 'schema_field.h', + 'schema.h', + 'schema_util.h', + 'snapshot.h', + 'sort_field.h', + 'sort_order.h', + 'statistics_file.h', + 'table.h', + 'table_identifier.h', + 'table_metadata.h', + 'table_scan.h', + 'transaction.h', + 'transform_function.h', + 'transform.h', + 'type_fwd.h', + 'type.h', + 'v1_metadata.h', + 'v2_metadata.h', + 'v3_metadata.h', + ], + subdir: 'iceberg', +) + +subdir('catalog') +subdir('expression') +subdir('util') + +if get_option('tests').enabled() + subdir('test') +endif diff --git a/src/iceberg/name_mapping.h b/src/iceberg/name_mapping.h index 3a66be07..41ff2d14 100644 --- a/src/iceberg/name_mapping.h +++ b/src/iceberg/name_mapping.h @@ -75,7 +75,7 @@ class ICEBERG_EXPORT MappedFields { /// \brief Get the list of field mappings. std::span fields() const; - friend bool operator==(const MappedFields& lhs, const MappedFields& rhs); + ICEBERG_EXPORT friend bool operator==(const MappedFields& lhs, const MappedFields& rhs); private: explicit MappedFields(std::vector fields); @@ -115,7 +115,7 @@ class ICEBERG_EXPORT NameMapping { /// \brief Get the underlying MappedFields instance. const MappedFields& AsMappedFields() const; - friend bool operator==(const NameMapping& lhs, const NameMapping& rhs); + ICEBERG_EXPORT friend bool operator==(const NameMapping& lhs, const NameMapping& rhs); private: explicit NameMapping(std::unique_ptr mapping); diff --git a/src/iceberg/test/CMakeLists.txt b/src/iceberg/test/CMakeLists.txt index 0a54a57c..e687f97c 100644 --- a/src/iceberg/test/CMakeLists.txt +++ b/src/iceberg/test/CMakeLists.txt @@ -48,7 +48,7 @@ function(add_iceberg_test test_name) ${ARGN}) add_executable(${test_name}) - target_include_directories(${test_name} PRIVATE "${CMAKE_BINARY_DIR}") + target_include_directories(${test_name} PRIVATE "${CMAKE_BINARY_DIR}/iceberg/test/") target_sources(${test_name} PRIVATE ${ARG_SOURCES}) diff --git a/src/iceberg/test/meson.build b/src/iceberg/test/meson.build new file mode 100644 index 00000000..bbd5571b --- /dev/null +++ b/src/iceberg/test/meson.build @@ -0,0 +1,74 @@ +# 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. + +gmock_main_dep = dependency('gmock_main') + +conf_data = configuration_data() +conf_data.set('ICEBERG_TEST_RESOURCES', meson.current_source_dir() / 'resources') +configure_file( + input: 'test_config.h.in', + output: 'test_config.h', + configuration: conf_data, + install: true, + install_dir: get_option('includedir') / 'iceberg/test', +) + +iceberg_tests = { + 'schema_test': files( + 'name_mapping_test.cc', + 'partition_field_test.cc', + 'partition_spec_test.cc', + 'schema_field_test.cc', + 'schema_test.cc', + 'schema_util_test.cc', + 'snapshot_test.cc', + 'sort_field_test.cc', + 'sort_order_test.cc', + 'transform_test.cc', + 'type_test.cc', + ), + 'table_test': files( + 'json_internal_test.cc', + 'schema_json_test.cc', + 'table_test.cc', + 'test_common.cc', + ), + 'expression_test': files('expression_test.cc', 'literal_test.cc'), + 'json_serde_test': files( + 'json_internal_test.cc', + 'metadata_serde_test.cc', + 'schema_json_test.cc', + 'test_common.cc', + ), + 'util_test': files( + 'config_test.cc', + 'decimal_test.cc', + 'endian_test.cc', + 'formatter_test.cc', + 'string_util_test.cc', + 'visit_type_test.cc', + ), +} + +foreach test_name, sources : iceberg_tests + exc = executable( + test_name, + sources: sources, + dependencies: [iceberg_dep, gmock_main_dep], + ) + test(test_name, exc) +endforeach diff --git a/src/iceberg/util/decimal.h b/src/iceberg/util/decimal.h index f118bde6..7e9cd7ce 100644 --- a/src/iceberg/util/decimal.h +++ b/src/iceberg/util/decimal.h @@ -203,14 +203,14 @@ class ICEBERG_EXPORT Decimal : public util::Formattable { return lhs.data_ != rhs.data_; } - friend Decimal operator-(const Decimal& operand); - friend Decimal operator~(const Decimal& operand); - - friend Decimal operator+(const Decimal& lhs, const Decimal& rhs); - friend Decimal operator-(const Decimal& lhs, const Decimal& rhs); - friend Decimal operator*(const Decimal& lhs, const Decimal& rhs); - friend Decimal operator/(const Decimal& lhs, const Decimal& rhs); - friend Decimal operator%(const Decimal& lhs, const Decimal& rhs); + ICEBERG_EXPORT friend Decimal operator-(const Decimal& operand); + ICEBERG_EXPORT friend Decimal operator~(const Decimal& operand); + + ICEBERG_EXPORT friend Decimal operator+(const Decimal& lhs, const Decimal& rhs); + ICEBERG_EXPORT friend Decimal operator-(const Decimal& lhs, const Decimal& rhs); + ICEBERG_EXPORT friend Decimal operator*(const Decimal& lhs, const Decimal& rhs); + ICEBERG_EXPORT friend Decimal operator/(const Decimal& lhs, const Decimal& rhs); + ICEBERG_EXPORT friend Decimal operator%(const Decimal& lhs, const Decimal& rhs); private: int128_t data_{0}; diff --git a/src/iceberg/util/meson.build b/src/iceberg/util/meson.build new file mode 100644 index 00000000..06984a47 --- /dev/null +++ b/src/iceberg/util/meson.build @@ -0,0 +1,35 @@ +# 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( + [ + 'checked_cast.h', + 'config.h', + 'decimal.h', + 'endian.h', + 'formattable.h', + 'formatter.h', + 'int128.h', + 'macros.h', + 'string_util.h', + 'timepoint.h', + 'truncate_util.h', + 'visitor_generate.h', + 'visit_type.h', + ], + subdir: 'iceberg/util', +) diff --git a/src/meson.build b/src/meson.build new file mode 100644 index 00000000..c96ab2ca --- /dev/null +++ b/src/meson.build @@ -0,0 +1,18 @@ +# 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. + +subdir('iceberg') diff --git a/subprojects/gtest.wrap b/subprojects/gtest.wrap new file mode 100644 index 00000000..e6ecdda0 --- /dev/null +++ b/subprojects/gtest.wrap @@ -0,0 +1,33 @@ +# 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. + +[wrap-file] +directory = googletest-1.17.0 +source_url = https://github.com/google/googletest/archive/refs/tags/v1.17.0.tar.gz +source_filename = googletest-1.17.0.tar.gz +source_hash = 65fab701d9829d38cb77c14acdc431d2108bfdbf8979e40eb8ae567edf10b27c +patch_filename = gtest_1.17.0-4_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/gtest_1.17.0-4/get_patch +patch_hash = 3abf7662d09db706453a5b064a1e914678c74b9d9b0b19382747ca561d0d8750 +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/gtest_1.17.0-4/googletest-1.17.0.tar.gz +wrapdb_version = 1.17.0-4 + +[provide] +gtest = gtest_dep +gtest_main = gtest_main_dep +gmock = gmock_dep +gmock_main = gmock_main_dep diff --git a/subprojects/nanoarrow.wrap b/subprojects/nanoarrow.wrap new file mode 100644 index 00000000..407d245b --- /dev/null +++ b/subprojects/nanoarrow.wrap @@ -0,0 +1,27 @@ +# 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. + +[wrap-file] +directory = apache-arrow-nanoarrow-0.7.0 +source_url = https://www.apache.org/dyn/closer.lua?action=download&filename=arrow/apache-arrow-nanoarrow-0.7.0/apache-arrow-nanoarrow-0.7.0.tar.gz +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/nanoarrow_0.7.0-1/apache-arrow-nanoarrow-0.7.0.tar.gz +source_filename = apache-arrow-nanoarrow-0.7.0.tar.gz +source_hash = d60b49dfaa5a27614075c6c61ec2fdea3bc70f5e52aefce592f994d2ee6330ea +wrapdb_version = 0.7.0-1 + +[provide] +nanoarrow = nanoarrow_dep diff --git a/subprojects/nlohmann_json.wrap b/subprojects/nlohmann_json.wrap new file mode 100644 index 00000000..3c6ccb64 --- /dev/null +++ b/subprojects/nlohmann_json.wrap @@ -0,0 +1,28 @@ +# 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. + +[wrap-file] +directory = nlohmann_json-3.12.0 +lead_directory_missing = true +source_url = https://github.com/nlohmann/json/releases/download/v3.12.0/include.zip +source_filename = nlohmann_json-3.12.0.zip +source_hash = b8cb0ef2dd7f57f18933997c9934bb1fa962594f701cd5a8d3c2c80541559372 +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/nlohmann_json_3.12.0-1/nlohmann_json-3.12.0.zip +wrapdb_version = 3.12.0-1 + +[provide] +nlohmann_json = nlohmann_json_dep diff --git a/subprojects/spdlog.wrap b/subprojects/spdlog.wrap new file mode 100644 index 00000000..f17351f9 --- /dev/null +++ b/subprojects/spdlog.wrap @@ -0,0 +1,30 @@ +# 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. + +[wrap-file] +directory = spdlog-1.15.3 +source_url = https://github.com/gabime/spdlog/archive/refs/tags/v1.15.3.tar.gz +source_filename = spdlog-1.15.3.tar.gz +source_hash = 15a04e69c222eb6c01094b5c7ff8a249b36bb22788d72519646fb85feb267e67 +patch_filename = spdlog_1.15.3-4_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/spdlog_1.15.3-4/get_patch +patch_hash = ccdc72f3d965980d5edd1a56129a9b7fa5f7c86f31e4ecf2dba6a6068829d4e2 +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/spdlog_1.15.3-4/spdlog-1.15.3.tar.gz +wrapdb_version = 1.15.3-4 + +[provide] +spdlog = spdlog_dep diff --git a/subprojects/zlib.wrap b/subprojects/zlib.wrap new file mode 100644 index 00000000..d6ae82dc --- /dev/null +++ b/subprojects/zlib.wrap @@ -0,0 +1,30 @@ +# 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. + +[wrap-file] +directory = zlib-1.3.1 +source_url = http://zlib.net/fossils/zlib-1.3.1.tar.gz +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/zlib_1.3.1-2/zlib-1.3.1.tar.gz +source_filename = zlib-1.3.1.tar.gz +source_hash = 9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23 +patch_filename = zlib_1.3.1-2_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/zlib_1.3.1-2/get_patch +patch_hash = 9cacea02e1119964bc51e92dd2359b14df723a36cfe0df1c78d55d9c9f2763ae +wrapdb_version = 1.3.1-2 + +[provide] +zlib = zlib_dep From be41c9b0c2f53afd6ea6a860fb2eed783fc179f7 Mon Sep 17 00:00:00 2001 From: Will Ayd Date: Mon, 29 Sep 2025 13:33:23 -0400 Subject: [PATCH 02/14] Add croaring dependency --- src/iceberg/meson.build | 9 ++++++++- src/iceberg/test/meson.build | 3 +++ subprojects/croaring.wrap | 30 ++++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 subprojects/croaring.wrap diff --git a/src/iceberg/meson.build b/src/iceberg/meson.build index 2b50e762..45a6edb7 100644 --- a/src/iceberg/meson.build +++ b/src/iceberg/meson.build @@ -54,12 +54,19 @@ iceberg_sources = files( 'util/timepoint.cc', ) +# CRoaring does not export symbols, so on Windows it must +# be used as a static lib +croaring_needs_static = ( + get_option('default_library') == 'static' or + host_machine.system() == 'windows' +) +croaring_dep = dependency('croaring', static: croaring_needs_static) nanoarrow_dep = dependency('nanoarrow') nlohmann_json_dep = dependency('nlohmann_json') spdlog_dep = dependency('spdlog') zlib_dep = dependency('zlib') -iceberg_deps = [nanoarrow_dep, nlohmann_json_dep, spdlog_dep, zlib_dep] +iceberg_deps = [croaring_dep, nanoarrow_dep, nlohmann_json_dep, spdlog_dep, zlib_dep] iceberg_lib = library( 'iceberg', diff --git a/src/iceberg/test/meson.build b/src/iceberg/test/meson.build index bbd5571b..2a38f42c 100644 --- a/src/iceberg/test/meson.build +++ b/src/iceberg/test/meson.build @@ -62,6 +62,9 @@ iceberg_tests = { 'string_util_test.cc', 'visit_type_test.cc', ), + 'roaring_test': files( + 'roaring_test.cc', + ) } foreach test_name, sources : iceberg_tests diff --git a/subprojects/croaring.wrap b/subprojects/croaring.wrap new file mode 100644 index 00000000..47a853a4 --- /dev/null +++ b/subprojects/croaring.wrap @@ -0,0 +1,30 @@ +# 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. + +[wrap-file] +directory = CRoaring-4.3.11 +source_url = https://github.com/RoaringBitmap/CRoaring/archive/refs/tags/v4.3.11.tar.gz +source_filename = CRoaring-4.3.11.tar.gz +source_hash = acd3a17e6c95acf3154d60c38c90e927e6c531805bc740a040fa111819af380e +patch_filename = croaring_4.3.11-1_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/croaring_4.3.11-1/get_patch +patch_hash = ff26efa0b7e7bc24963e169ab1a4e15598fdfcb5f0b6db9f28eca9e26c22bb4a +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/croaring_4.3.11-1/CRoaring-4.3.11.tar.gz +wrapdb_version = 4.3.11-1 + +[provide] +dependency_names = croaring From 390f32158c57d36d3093d74ee6c00e43127fd8bc Mon Sep 17 00:00:00 2001 From: Will Ayd Date: Mon, 29 Sep 2025 13:52:02 -0400 Subject: [PATCH 03/14] Add cpr dependency for rest catalog client --- meson.build | 8 ++- meson.options | 1 + src/iceberg/catalog/meson.build | 4 ++ .../catalog/rest/iceberg_rest_export.h | 34 +++++++++++++ src/iceberg/catalog/rest/meson.build | 49 +++++++++++++++++++ subprojects/cpr.wrap | 13 +++++ subprojects/curl.wrap | 13 +++++ 7 files changed, 121 insertions(+), 1 deletion(-) create mode 100644 src/iceberg/catalog/rest/iceberg_rest_export.h create mode 100644 src/iceberg/catalog/rest/meson.build create mode 100644 subprojects/cpr.wrap create mode 100644 subprojects/curl.wrap diff --git a/meson.build b/meson.build index 59e6a1c4..00fe7fec 100644 --- a/meson.build +++ b/meson.build @@ -21,7 +21,13 @@ project( version: '0.2.0', license: 'Apache-2.0', meson_version: '>=1.3.0', - default_options: ['cpp_std=c++23,c++latest', 'warning_level=2'], + default_options: [ + 'cpp_std=c++23,c++latest', + 'warning_level=2', + # Don't build any tests for curl + 'curl:tests=disabled', + 'curl:unittests=disabled', + ], ) subdir('src') diff --git a/meson.options b/meson.options index fb27c705..84746a8c 100644 --- a/meson.options +++ b/meson.options @@ -15,4 +15,5 @@ # specific language governing permissions and limitations # under the License. +option('rest', type: 'feature', description: 'Build rest catalog client', value: 'enabled') option('tests', type: 'feature', description: 'Build tests', value: 'enabled') diff --git a/src/iceberg/catalog/meson.build b/src/iceberg/catalog/meson.build index a32fa9df..55dc5744 100644 --- a/src/iceberg/catalog/meson.build +++ b/src/iceberg/catalog/meson.build @@ -16,3 +16,7 @@ # under the License. install_headers(['in_memory_catalog.h'], subdir: 'iceberg/catalog') + +if get_option('rest').enabled() + subdir('rest') +endif diff --git a/src/iceberg/catalog/rest/iceberg_rest_export.h b/src/iceberg/catalog/rest/iceberg_rest_export.h new file mode 100644 index 00000000..7e8836f8 --- /dev/null +++ b/src/iceberg/catalog/rest/iceberg_rest_export.h @@ -0,0 +1,34 @@ +/* + * 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. + */ + +#pragma once + +#if defined(_WIN32) || defined(__CYGWIN__) +# ifdef ICEBERG_REST_STATIC +# define ICEBERG_REST_EXPORT +# elif defined(ICEBERG_REST_EXPORTING) +# define ICEBERG_REST_EXPORT __declspec(dllexport) +# else +# define ICEBERG_REST_EXPORT __declspec(dllimport) +# endif +#else // Not Windows +# ifndef ICEBERG_REST_EXPORT +# define ICEBERG_REST_EXPORT __attribute__((visibility("default"))) +# endif +#endif diff --git a/src/iceberg/catalog/rest/meson.build b/src/iceberg/catalog/rest/meson.build new file mode 100644 index 00000000..0c32cb62 --- /dev/null +++ b/src/iceberg/catalog/rest/meson.build @@ -0,0 +1,49 @@ +# 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. + +iceberg_rest_sources = files('rest_catalog.cc') +# cpr does not export symbols, so on Windows it must +# be used as a static lib +cpr_needs_static = ( + get_option('default_library') == 'static' or + host_machine.system() == 'windows' +) +cpr_dep = dependency('cpr', static: cpr_needs_static) + +iceberg_rest_build_deps = [iceberg_dep, cpr_dep] +iceberg_rest_lib = library( + 'iceberg_rest', + sources: iceberg_rest_sources, + dependencies: iceberg_rest_build_deps, + gnu_symbol_visibility: 'hidden', + cpp_shared_args: ['-DICEBERG_REST_EXPORTING'], + cpp_static_args: ['-DICEBERG_REST_STATIC'], +) + +iceberg_rest_compile_args = [] +if get_option('default_library') == 'static' + iceberg_rest_compile_args += ['-DICEBERG_REST_STATIC'] +endif +iceberg_rest_dep = declare_dependency( + link_with: [iceberg_rest_lib], + dependencies: iceberg_rest_build_deps, + compile_args: iceberg_rest_compile_args, +) +meson.override_dependency('iceberg-rest', iceberg_rest_dep) +pkg.generate(iceberg_rest_lib) + +install_headers(['rest_catalog.h'], subdir: 'iceberg/catalog/rest') diff --git a/subprojects/cpr.wrap b/subprojects/cpr.wrap new file mode 100644 index 00000000..af1b9939 --- /dev/null +++ b/subprojects/cpr.wrap @@ -0,0 +1,13 @@ +[wrap-file] +directory = cpr-1.12.0 +source_url = https://github.com/libcpr/cpr/archive/1.12.0.tar.gz +source_filename = cpr-1.12.0.tar.gz +source_hash = f64b501de66e163d6a278fbb6a95f395ee873b7a66c905dd785eae107266a709 +patch_filename = cpr_1.12.0-1_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/cpr_1.12.0-1/get_patch +patch_hash = 16404431dd8b2dbb49afc78a07b3bbe3c84c9f83ce1f45c3510934fadab99e72 +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/cpr_1.12.0-1/cpr-1.12.0.tar.gz +wrapdb_version = 1.12.0-1 + +[provide] +cpr = cpr_dep diff --git a/subprojects/curl.wrap b/subprojects/curl.wrap new file mode 100644 index 00000000..f7e384b8 --- /dev/null +++ b/subprojects/curl.wrap @@ -0,0 +1,13 @@ +[wrap-file] +directory = curl-8.10.1 +source_url = https://github.com/curl/curl/releases/download/curl-8_10_1/curl-8.10.1.tar.xz +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/curl_8.10.1-1/curl-8.10.1.tar.xz +source_filename = curl-8.10.1.tar.xz +source_hash = 73a4b0e99596a09fa5924a4fb7e4b995a85fda0d18a2c02ab9cf134bebce04ee +patch_filename = curl_8.10.1-1_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/curl_8.10.1-1/get_patch +patch_hash = 707c28f35fc9b0e8d68c0c2800712007612f922a31da9637ce706a2159f3ddd8 +wrapdb_version = 8.10.1-1 + +[provide] +dependency_names = libcurl From d1e5b8bd977443ccd46af8ab426c1d1d62a8177f Mon Sep 17 00:00:00 2001 From: Will Ayd Date: Mon, 29 Sep 2025 13:56:21 -0400 Subject: [PATCH 04/14] Add version header generation support --- src/iceberg/meson.build | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/iceberg/meson.build b/src/iceberg/meson.build index 45a6edb7..5ab7c128 100644 --- a/src/iceberg/meson.build +++ b/src/iceberg/meson.build @@ -15,6 +15,29 @@ # specific language governing permissions and limitations # under the License. +conf_data = configuration_data() +version = meson.project_version() +components = version.split('.') +assert( + components.length() >= 3, + 'The version does not contain major, minor and patch', +) +ver_major = components[0] +ver_minor = components[1] +ver_patch = components[2] +conf_data.set('PROJECT_VERSION_MAJOR', ver_major) +conf_data.set('PROJECT_VERSION_MINOR', ver_minor) +conf_data.set('PROJECT_VERSION_PATCH', ver_patch) +conf_data.set('PROJECT_VERSION', version) +conf_data.set('PROJECT_NAME', meson.project_name()) +configure_file( + input: 'version.h.in', + output: 'version.h', + configuration: conf_data, + install: true, + install_dir: get_option('includedir') / 'iceberg', +) + iceberg_include_dir = include_directories('..') iceberg_sources = files( 'arrow_c_data_guard_internal.cc', From 87c6f22145cba2126c9fb484a117d601f89e1e43 Mon Sep 17 00:00:00 2001 From: Will Ayd Date: Mon, 29 Sep 2025 14:08:03 -0400 Subject: [PATCH 05/14] License and formatter fixup --- meson.options | 7 ++++++- src/iceberg/meson.build | 8 +++++++- src/iceberg/test/meson.build | 4 +--- subprojects/cpr.wrap | 17 +++++++++++++++++ subprojects/curl.wrap | 17 +++++++++++++++++ 5 files changed, 48 insertions(+), 5 deletions(-) diff --git a/meson.options b/meson.options index 84746a8c..7b5272e5 100644 --- a/meson.options +++ b/meson.options @@ -15,5 +15,10 @@ # specific language governing permissions and limitations # under the License. -option('rest', type: 'feature', description: 'Build rest catalog client', value: 'enabled') +option( + 'rest', + type: 'feature', + description: 'Build rest catalog client', + value: 'enabled', +) option('tests', type: 'feature', description: 'Build tests', value: 'enabled') diff --git a/src/iceberg/meson.build b/src/iceberg/meson.build index 5ab7c128..c4be3e76 100644 --- a/src/iceberg/meson.build +++ b/src/iceberg/meson.build @@ -89,7 +89,13 @@ nlohmann_json_dep = dependency('nlohmann_json') spdlog_dep = dependency('spdlog') zlib_dep = dependency('zlib') -iceberg_deps = [croaring_dep, nanoarrow_dep, nlohmann_json_dep, spdlog_dep, zlib_dep] +iceberg_deps = [ + croaring_dep, + nanoarrow_dep, + nlohmann_json_dep, + spdlog_dep, + zlib_dep, +] iceberg_lib = library( 'iceberg', diff --git a/src/iceberg/test/meson.build b/src/iceberg/test/meson.build index 2a38f42c..141583d4 100644 --- a/src/iceberg/test/meson.build +++ b/src/iceberg/test/meson.build @@ -62,9 +62,7 @@ iceberg_tests = { 'string_util_test.cc', 'visit_type_test.cc', ), - 'roaring_test': files( - 'roaring_test.cc', - ) + 'roaring_test': files('roaring_test.cc'), } foreach test_name, sources : iceberg_tests diff --git a/subprojects/cpr.wrap b/subprojects/cpr.wrap index af1b9939..a52ebadf 100644 --- a/subprojects/cpr.wrap +++ b/subprojects/cpr.wrap @@ -1,3 +1,20 @@ +# 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. + [wrap-file] directory = cpr-1.12.0 source_url = https://github.com/libcpr/cpr/archive/1.12.0.tar.gz diff --git a/subprojects/curl.wrap b/subprojects/curl.wrap index f7e384b8..ccff3bbd 100644 --- a/subprojects/curl.wrap +++ b/subprojects/curl.wrap @@ -1,3 +1,20 @@ +# 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. + [wrap-file] directory = curl-8.10.1 source_url = https://github.com/curl/curl/releases/download/curl-8_10_1/curl-8.10.1.tar.xz From 873615bcc59f02ba3d6d29291349b5623338241e Mon Sep 17 00:00:00 2001 From: Will Ayd Date: Mon, 29 Sep 2025 14:38:45 -0400 Subject: [PATCH 06/14] CMake Configuration updates --- cmake_modules/IcebergBuildUtils.cmake | 5 +++ .../IcebergThirdpartyToolchain.cmake | 2 +- example/CMakeLists.txt | 6 +-- src/iceberg/CMakeLists.txt | 42 ++++++++----------- src/iceberg/catalog/rest/CMakeLists.txt | 8 ++-- ...Config.cmake.in => icebergConfig.cmake.in} | 40 +++++++++--------- 6 files changed, 50 insertions(+), 53 deletions(-) rename src/iceberg/{IcebergConfig.cmake.in => icebergConfig.cmake.in} (77%) diff --git a/cmake_modules/IcebergBuildUtils.cmake b/cmake_modules/IcebergBuildUtils.cmake index b02359a9..28909aea 100644 --- a/cmake_modules/IcebergBuildUtils.cmake +++ b/cmake_modules/IcebergBuildUtils.cmake @@ -150,6 +150,9 @@ function(add_iceberg_lib LIB_NAME) target_link_libraries(${LIB_NAME}_shared PUBLIC "$") + string(TOUPPER ${LIB_NAME} VISIBILITY_NAME) + target_compile_definitions(${LIB_NAME}_shared PRIVATE ${VISIBILITY_NAME}_EXPORTING) + install(TARGETS ${LIB_NAME}_shared EXPORT iceberg_targets ARCHIVE DESTINATION ${INSTALL_ARCHIVE_DIR} @@ -208,6 +211,8 @@ function(add_iceberg_lib LIB_NAME) target_link_libraries(${LIB_NAME}_static PUBLIC "$") + string(TOUPPER ${LIB_NAME} VISIBILITY_NAME) + target_compile_definitions(${LIB_NAME}_static PUBLIC ${VISIBILITY_NAME}_STATIC) install(TARGETS ${LIB_NAME}_static EXPORT iceberg_targets ARCHIVE DESTINATION ${INSTALL_ARCHIVE_DIR} diff --git a/cmake_modules/IcebergThirdpartyToolchain.cmake b/cmake_modules/IcebergThirdpartyToolchain.cmake index 793af7f9..af714393 100644 --- a/cmake_modules/IcebergThirdpartyToolchain.cmake +++ b/cmake_modules/IcebergThirdpartyToolchain.cmake @@ -461,7 +461,7 @@ function(resolve_cpr_dependency) set(CPR_VENDORED TRUE) set_target_properties(cpr PROPERTIES OUTPUT_NAME "iceberg_vendored_cpr" POSITION_INDEPENDENT_CODE ON) - add_library(Iceberg::cpr ALIAS cpr) + add_library(iceberg::cpr ALIAS cpr) install(TARGETS cpr EXPORT iceberg_targets RUNTIME DESTINATION "${ICEBERG_INSTALL_BINDIR}" diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index d120d504..837ed7d7 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -22,9 +22,9 @@ project(example) set(CMAKE_CXX_STANDARD 23) -find_package(Iceberg CONFIG REQUIRED) +find_package(iceberg CONFIG REQUIRED) add_executable(demo_example demo_example.cc) -target_link_libraries(demo_example PRIVATE Iceberg::iceberg_bundle_static - Iceberg::iceberg_rest_static) +target_link_libraries(demo_example PRIVATE iceberg::iceberg_bundle_static + iceberg::iceberg_rest_static) diff --git a/src/iceberg/CMakeLists.txt b/src/iceberg/CMakeLists.txt index 09cdbf49..c15373da 100644 --- a/src/iceberg/CMakeLists.txt +++ b/src/iceberg/CMakeLists.txt @@ -83,16 +83,16 @@ list(APPEND ZLIB::ZLIB) list(APPEND ICEBERG_STATIC_INSTALL_INTERFACE_LIBS - "$,Iceberg::nanoarrow_static,$,nanoarrow::nanoarrow_static,nanoarrow::nanoarrow_shared>>" - "$,Iceberg::nlohmann_json,$,nlohmann_json::nlohmann_json,nlohmann_json::nlohmann_json>>" - "$,Iceberg::roaring,roaring::roaring>" - "$,Iceberg::spdlog,spdlog::spdlog>") + "$,iceberg::nanoarrow_static,$,nanoarrow::nanoarrow_static,nanoarrow::nanoarrow_shared>>" + "$,iceberg::nlohmann_json,$,nlohmann_json::nlohmann_json,nlohmann_json::nlohmann_json>>" + "$,iceberg::roaring,roaring::roaring>" + "$,iceberg::spdlog,spdlog::spdlog>") list(APPEND ICEBERG_SHARED_INSTALL_INTERFACE_LIBS - "$,Iceberg::nanoarrow_shared,$,nanoarrow::nanoarrow_shared,nanoarrow::nanoarrow_static>>" - "$,Iceberg::nlohmann_json,$,nlohmann_json::nlohmann_json,nlohmann_json::nlohmann_json>>" - "$,Iceberg::roaring,roaring::roaring>" - "$,Iceberg::spdlog,spdlog::spdlog>") + "$,iceberg::nanoarrow_shared,$,nanoarrow::nanoarrow_shared,nanoarrow::nanoarrow_static>>" + "$,iceberg::nlohmann_json,$,nlohmann_json::nlohmann_json,nlohmann_json::nlohmann_json>>" + "$,iceberg::roaring,roaring::roaring>" + "$,iceberg::spdlog,spdlog::spdlog>") add_iceberg_lib(iceberg SOURCES @@ -163,17 +163,17 @@ if(ICEBERG_BUILD_BUNDLE) list(APPEND ICEBERG_BUNDLE_STATIC_INSTALL_INTERFACE_LIBS - "$,Iceberg::iceberg_static,Iceberg::iceberg_shared>" - "$,Iceberg::arrow_static,$,Arrow::arrow_static,Arrow::arrow_shared>>" - "$,Iceberg::parquet_static,$,Parquet::parquet_static,Parquet::parquet_shared>>" - "$,Iceberg::avrocpp_s,$,avro-cpp::avrocpp_static,avro-cpp::avrocpp_shared>>" + "$,iceberg::iceberg_static,iceberg::iceberg_shared>" + "$,iceberg::arrow_static,$,Arrow::arrow_static,Arrow::arrow_shared>>" + "$,iceberg::parquet_static,$,Parquet::parquet_static,Parquet::parquet_shared>>" + "$,iceberg::avrocpp_s,$,avro-cpp::avrocpp_static,avro-cpp::avrocpp_shared>>" ) list(APPEND ICEBERG_BUNDLE_SHARED_INSTALL_INTERFACE_LIBS - "$,Iceberg::iceberg_shared,Iceberg::iceberg_static>" - "$,Iceberg::arrow_static,$,Arrow::arrow_shared,Arrow::arrow_static>>" - "$,Iceberg::parquet_static,$,Parquet::parquet_shared,Parquet::parquet_static>>" - "$,Iceberg::avrocpp_s,$,avro-cpp::avrocpp_shared,avro-cpp::avrocpp_static>>" + "$,iceberg::iceberg_shared,iceberg::iceberg_static>" + "$,iceberg::arrow_static,$,Arrow::arrow_shared,Arrow::arrow_static>>" + "$,iceberg::parquet_static,$,Parquet::parquet_shared,Parquet::parquet_static>>" + "$,iceberg::avrocpp_s,$,avro-cpp::avrocpp_shared,avro-cpp::avrocpp_static>>" ) add_iceberg_lib(iceberg_bundle @@ -190,20 +190,12 @@ if(ICEBERG_BUILD_BUNDLE) OUTPUTS ICEBERG_BUNDLE_LIBRARIES) - foreach(LIB_TARGET ${ICEBERG_BUNDLE_LIBRARIES}) - target_compile_definitions(${LIB_TARGET} PRIVATE ICEBERG_BUNDLE_EXPORTING) - endforeach() - - if(ICEBERG_BUILD_STATIC) - target_compile_definitions(iceberg_bundle_static PUBLIC ICEBERG_BUNDLE_STATIC) - endif() - add_subdirectory(arrow) add_subdirectory(avro) add_subdirectory(parquet) endif() -iceberg_install_cmake_package(Iceberg iceberg_targets) +iceberg_install_cmake_package(iceberg iceberg_targets) if(ICEBERG_BUILD_TESTS) add_subdirectory(test) diff --git a/src/iceberg/catalog/rest/CMakeLists.txt b/src/iceberg/catalog/rest/CMakeLists.txt index f18859cf..2f9c2f05 100644 --- a/src/iceberg/catalog/rest/CMakeLists.txt +++ b/src/iceberg/catalog/rest/CMakeLists.txt @@ -28,12 +28,12 @@ list(APPEND ICEBERG_REST_SHARED_BUILD_INTERFACE_LIBS "$,iceberg_shared,iceberg_static>" cpr::cpr) list(APPEND ICEBERG_REST_STATIC_INSTALL_INTERFACE_LIBS - "$,Iceberg::iceberg_static,Iceberg::iceberg_shared>" - "$,Iceberg::cpr,cpr::cpr>") + "$,iceberg::iceberg_static,iceberg::iceberg_shared>" + "$,iceberg::cpr,cpr::cpr>") list(APPEND ICEBERG_REST_SHARED_INSTALL_INTERFACE_LIBS - "$,Iceberg::iceberg_shared,Iceberg::iceberg_static>" - "$,Iceberg::cpr,cpr::cpr>") + "$,iceberg::iceberg_shared,iceberg::iceberg_static>" + "$,iceberg::cpr,cpr::cpr>") add_iceberg_lib(iceberg_rest SOURCES diff --git a/src/iceberg/IcebergConfig.cmake.in b/src/iceberg/icebergConfig.cmake.in similarity index 77% rename from src/iceberg/IcebergConfig.cmake.in rename to src/iceberg/icebergConfig.cmake.in index 5858566a..b1e33f01 100644 --- a/src/iceberg/IcebergConfig.cmake.in +++ b/src/iceberg/icebergConfig.cmake.in @@ -22,12 +22,12 @@ # # This config sets the following targets (if built) in your project:: # -# Iceberg::iceberg_shared -# Iceberg::iceberg_static -# Iceberg::iceberg_bundle_shared -# Iceberg::iceberg_bundle_static -# Iceberg::iceberg_rest_shared -# Iceberg::iceberg_rest_static +# iceberg::iceberg_shared +# iceberg::iceberg_static +# iceberg::iceberg_bundle_shared +# iceberg::iceberg_bundle_static +# iceberg::iceberg_rest_shared +# iceberg::iceberg_rest_static @PACKAGE_INIT@ @@ -59,12 +59,12 @@ endmacro() macro(iceberg_find_components components) foreach(comp ${components}) string(TOLOWER "${comp}" _comp_lower_case) - if(TARGET "Iceberg::iceberg_${_comp_lower_case}_shared" OR - TARGET "Iceberg::iceberg_${_comp_lower_case}_static") - set(Iceberg_${comp}_FOUND TRUE) + if(TARGET "iceberg::iceberg_${_comp_lower_case}_shared" OR + TARGET "iceberg::iceberg_${_comp_lower_case}_static") + set(iceberg_${comp}_FOUND TRUE) else() - set(Iceberg_${comp}_FOUND FALSE) - set(Iceberg_NOT_FOUND_MESSAGE "Component ${comp} was not installed") + set(iceberg_${comp}_FOUND FALSE) + set(iceberg_NOT_FOUND_MESSAGE "Component ${comp} was not installed") endif() endforeach() endmacro() @@ -85,17 +85,17 @@ if(NOT TARGET CURL::libcurl) add_library(CURL::libcurl INTERFACE IMPORTED) endif() -include("${CMAKE_CURRENT_LIST_DIR}/IcebergTargets.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/icebergTargets.cmake") -if(TARGET Iceberg::arrow_static) - add_library(Arrow::arrow_static ALIAS Iceberg::arrow_static) +if(TARGET iceberg::arrow_static) + add_library(Arrow::arrow_static ALIAS iceberg::arrow_static) add_library(Arrow::arrow_bundled_dependencies STATIC IMPORTED) - get_target_property(arrow_static_configurations Iceberg::arrow_static + get_target_property(arrow_static_configurations iceberg::arrow_static IMPORTED_CONFIGURATIONS) foreach(CONFIGURATION ${arrow_static_configurations}) string(TOUPPER "${CONFIGURATION}" CONFIGURATION) - get_target_property(arrow_static_location Iceberg::arrow_static + get_target_property(arrow_static_location iceberg::arrow_static LOCATION_${CONFIGURATION}) get_filename_component(arrow_lib_dir "${arrow_static_location}" DIRECTORY) set_property(TARGET Arrow::arrow_bundled_dependencies @@ -108,11 +108,11 @@ if(TARGET Iceberg::arrow_static) endforeach() endif() -if(TARGET Iceberg::parquet_static) - add_library(Parquet::parquet_static ALIAS Iceberg::parquet_static) +if(TARGET iceberg::parquet_static) + add_library(Parquet::parquet_static ALIAS iceberg::parquet_static) endif() # Find required components -iceberg_find_components("${Iceberg_FIND_COMPONENTS}") +iceberg_find_components("${iceberg_FIND_COMPONENTS}") -check_required_components(Iceberg) +check_required_components(iceberg) From f0f104e6e415ca04dc3493ad8d50d73d5807a621 Mon Sep 17 00:00:00 2001 From: Will Ayd Date: Mon, 29 Sep 2025 14:38:54 -0400 Subject: [PATCH 07/14] Bump to Windows 2025 --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1cb4017c..31d6c5b1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -108,8 +108,8 @@ jobs: include: - title: AMD64 Ubuntu 24.04 runs-on: ubuntu-24.04 - - title: AMD64 Windows 2022 - runs-on: windows-2022 + - title: AMD64 Windows 2025 + runs-on: windows-2025 meson-setup-args: --vsenv - title: AArch64 macOS 15 runs-on: macos-15 From f580dbe9a3f85aa8c7e1869d4c4091c539c33e01 Mon Sep 17 00:00:00 2001 From: Will Ayd Date: Tue, 30 Sep 2025 12:29:06 -0400 Subject: [PATCH 08/14] feat: add UUID representation --- src/iceberg/meson.build | 2 ++ src/iceberg/test/meson.build | 1 + 2 files changed, 3 insertions(+) diff --git a/src/iceberg/meson.build b/src/iceberg/meson.build index c4be3e76..9c809a0b 100644 --- a/src/iceberg/meson.build +++ b/src/iceberg/meson.build @@ -73,8 +73,10 @@ iceberg_sources = files( 'type.cc', 'util/decimal.cc', 'util/gzip_internal.cc', + 'util/gzip_internal.cc', 'util/murmurhash3_internal.cc', 'util/timepoint.cc', + 'util/uuid.cc', ) # CRoaring does not export symbols, so on Windows it must diff --git a/src/iceberg/test/meson.build b/src/iceberg/test/meson.build index 141583d4..c4f1e0b9 100644 --- a/src/iceberg/test/meson.build +++ b/src/iceberg/test/meson.build @@ -60,6 +60,7 @@ iceberg_tests = { 'endian_test.cc', 'formatter_test.cc', 'string_util_test.cc', + 'uuid_test.cc', 'visit_type_test.cc', ), 'roaring_test': files('roaring_test.cc'), From a80066d77ddf286f5c3044aac8399a13fae09e0a Mon Sep 17 00:00:00 2001 From: Will Ayd Date: Fri, 10 Oct 2025 10:54:01 -0400 Subject: [PATCH 09/14] wgtmac feedback --- CMakeLists.txt | 2 +- cmake_modules/IcebergBuildUtils.cmake | 7 ++++--- meson.build | 2 +- meson.options | 15 +++++++++++++++ src/iceberg/CMakeLists.txt | 8 -------- ...ergConfig.cmake.in => iceberg-config.cmake.in} | 2 +- 6 files changed, 22 insertions(+), 14 deletions(-) rename src/iceberg/{icebergConfig.cmake.in => iceberg-config.cmake.in} (98%) diff --git a/CMakeLists.txt b/CMakeLists.txt index d5ee3db7..0d6f3806 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,7 +52,7 @@ set(ICEBERG_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}") set(ICEBERG_INSTALL_BINDIR "${CMAKE_INSTALL_BINDIR}") set(ICEBERG_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}") set(ICEBERG_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake") -set(ICEBERG_INSTALL_DOCDIR "share/doc/Iceberg") +set(ICEBERG_INSTALL_DOCDIR "share/doc/iceberg") if(WIN32 AND NOT MINGW) set(MSVC_TOOLCHAIN TRUE) diff --git a/cmake_modules/IcebergBuildUtils.cmake b/cmake_modules/IcebergBuildUtils.cmake index 28909aea..edcb1d93 100644 --- a/cmake_modules/IcebergBuildUtils.cmake +++ b/cmake_modules/IcebergBuildUtils.cmake @@ -21,18 +21,18 @@ include(CMakePackageConfigHelpers) function(iceberg_install_cmake_package PACKAGE_NAME EXPORT_NAME) - set(CONFIG_CMAKE "${PACKAGE_NAME}Config.cmake") + set(CONFIG_CMAKE "${PACKAGE_NAME}-config.cmake") set(BUILT_CONFIG_CMAKE "${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_CMAKE}") configure_package_config_file("${CONFIG_CMAKE}.in" "${BUILT_CONFIG_CMAKE}" INSTALL_DESTINATION "${ICEBERG_INSTALL_CMAKEDIR}/${PACKAGE_NAME}" ) - set(CONFIG_VERSION_CMAKE "${PACKAGE_NAME}ConfigVersion.cmake") + set(CONFIG_VERSION_CMAKE "${PACKAGE_NAME}config-version.cmake") set(BUILT_CONFIG_VERSION_CMAKE "${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_VERSION_CMAKE}") write_basic_package_version_file("${BUILT_CONFIG_VERSION_CMAKE}" COMPATIBILITY SameMajorVersion) install(FILES "${BUILT_CONFIG_CMAKE}" "${BUILT_CONFIG_VERSION_CMAKE}" DESTINATION "${ICEBERG_INSTALL_CMAKEDIR}/${PACKAGE_NAME}") - set(TARGETS_CMAKE "${PACKAGE_NAME}Targets.cmake") + set(TARGETS_CMAKE "${PACKAGE_NAME}-targets.cmake") install(EXPORT ${EXPORT_NAME} DESTINATION "${ICEBERG_INSTALL_CMAKEDIR}/${PACKAGE_NAME}" NAMESPACE "${PACKAGE_NAME}::" @@ -213,6 +213,7 @@ function(add_iceberg_lib LIB_NAME) string(TOUPPER ${LIB_NAME} VISIBILITY_NAME) target_compile_definitions(${LIB_NAME}_static PUBLIC ${VISIBILITY_NAME}_STATIC) + install(TARGETS ${LIB_NAME}_static EXPORT iceberg_targets ARCHIVE DESTINATION ${INSTALL_ARCHIVE_DIR} diff --git a/meson.build b/meson.build index 00fe7fec..eaeeda4c 100644 --- a/meson.build +++ b/meson.build @@ -34,5 +34,5 @@ subdir('src') install_data( ['LICENSE', 'NOTICE'], - install_dir: get_option('datadir') / 'doc/Iceberg', + install_dir: get_option('datadir') / 'doc/iceberg', ) diff --git a/meson.options b/meson.options index 7b5272e5..943f1e46 100644 --- a/meson.options +++ b/meson.options @@ -15,6 +15,21 @@ # specific language governing permissions and limitations # under the License. +# Many of the options that CMake provides do not need to be implemented +# in this configuration, as Meson offers built-in support for them. +# For instance, instead of ICEBERG_BUILD_STATIC and ICEBERG_BUILD_SHARED +# you can pass the `--default_library=