| # 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. | |
| cmake_minimum_required(VERSION 3.25) | |
| if(NOT CMAKE_BUILD_TYPE) | |
| set(CMAKE_BUILD_TYPE Debug) | |
| endif() | |
| list(PREPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules") | |
| project(Iceberg | |
| VERSION 0.5.0 | |
| DESCRIPTION "Iceberg C++ Project" | |
| LANGUAGES CXX) | |
| include(IcebergBuildUtils) | |
| iceberg_configure_version_header("${CMAKE_CURRENT_SOURCE_DIR}/src/iceberg/version.h.in" | |
| "${PROJECT_BINARY_DIR}/src/iceberg/version.h") | |
| set(CMAKE_CXX_STANDARD 23) | |
| set(CMAKE_CXX_STANDARD_REQUIRED ON) | |
| set(CMAKE_CXX_EXTENSIONS OFF) | |
| set(CMAKE_EXPORT_COMPILE_COMMANDS ON) | |
| option(ICEBERG_CXX20_COMPAT "Expose the C++20-compatible public API" OFF) | |
| if(ICEBERG_CXX20_COMPAT) | |
| set(ICEBERG_PUBLIC_CXX_STANDARD 20) | |
| set(ICEBERG_CXX20_COMPAT_VALUE 1) | |
| else() | |
| set(ICEBERG_PUBLIC_CXX_STANDARD 23) | |
| set(ICEBERG_CXX20_COMPAT_VALUE 0) | |
| endif() | |
| configure_file("${PROJECT_SOURCE_DIR}/src/iceberg/compat/build_config.h.in" | |
| "${PROJECT_BINARY_DIR}/src/iceberg/compat/build_config.h" @ONLY) | |
| option(ICEBERG_BUILD_STATIC "Build static library" ON) | |
| option(ICEBERG_BUILD_SHARED "Build shared library" OFF) | |
| option(ICEBERG_BUILD_TESTS "Build tests" ON) | |
| option(ICEBERG_BUILD_BENCHMARKS "Build benchmarks" OFF) | |
| option(ICEBERG_BUILD_BUNDLE "Build the battery included library" ON) | |
| option(ICEBERG_ENCRYPTION | |
| "Build table encryption support (Parquet modular encryption, AES GCM streams)" OFF) | |
| option(ICEBERG_BUILD_REST "Build rest catalog client" ON) | |
| option(ICEBERG_BUILD_REST_INTEGRATION_TESTS "Build rest catalog integration tests" OFF) | |
| option(ICEBERG_BUILD_HIVE "Build hive (HMS) catalog client" OFF) | |
| option(ICEBERG_BUILD_SQL_CATALOG "Build SQL catalog client" OFF) | |
| # Built-in SQL catalog database connectors. Disable all of them to build a SQL | |
| # catalog that only works with a user-supplied CatalogStore. | |
| option(ICEBERG_SQL_SQLITE "Build SQLite connector for SQL catalog" OFF) | |
| option(ICEBERG_SQL_POSTGRESQL "Build PostgreSQL connector for SQL catalog" OFF) | |
| option(ICEBERG_SQL_MYSQL "Build MySQL connector for SQL catalog" OFF) | |
| option(ICEBERG_S3 "Build with S3 support" OFF) | |
| option(ICEBERG_SIGV4 "Build with SigV4 support" OFF) | |
| option(ICEBERG_BUNDLE_AWSSDK "Bundle AWS SDK for S3/SigV4 support" ON) | |
| option(ICEBERG_BUNDLE_THRIFT "Bundle Thrift (from Arrow) for Hive catalog" ON) | |
| option(ICEBERG_SPDLOG "Use spdlog as the default logging backend" ON) | |
| option(ICEBERG_ENABLE_ASAN "Enable Address Sanitizer" OFF) | |
| option(ICEBERG_ENABLE_UBSAN "Enable Undefined Behavior Sanitizer" OFF) | |
| include(GNUInstallDirs) | |
| include(FetchContent) | |
| 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") | |
| if(WIN32 AND NOT MINGW) | |
| set(MSVC_TOOLCHAIN TRUE) | |
| else() | |
| set(MSVC_TOOLCHAIN FALSE) | |
| endif() | |
| if(ICEBERG_BUILD_REST_INTEGRATION_TESTS AND WIN32) | |
| set(ICEBERG_BUILD_REST_INTEGRATION_TESTS OFF) | |
| message(WARNING "Cannot build rest integration test on Windows, turning it off.") | |
| endif() | |
| include(CMakeParseArguments) | |
| include(IcebergSanitizer) | |
| include(IcebergSccache) | |
| include(IcebergThirdpartyToolchain) | |
| if(ICEBERG_BUILD_TESTS) | |
| enable_testing() | |
| endif() | |
| add_subdirectory(src) | |
| install(FILES LICENSE NOTICE DESTINATION ${ICEBERG_INSTALL_DOCDIR}) |