diff --git a/CMakeLists.txt b/CMakeLists.txt index dd983a807..b1fc22cab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,8 +36,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) 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_ARROW "Build Arrow" ON) -option(ICEBERG_AVRO "Build Avro" ON) +option(ICEBERG_BUILD_BUNDLE "Build the battery included library" ON) include(GNUInstallDirs) include(FetchContent) @@ -46,7 +45,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/${PROJECT_NAME}") +set(ICEBERG_INSTALL_DOCDIR "share/doc/Iceberg") if(WIN32 AND NOT MINGW) set(MSVC_TOOLCHAIN TRUE) diff --git a/README.md b/README.md index baf46b461..1c42a5725 100644 --- a/README.md +++ b/README.md @@ -38,12 +38,12 @@ ctest --test-dir build --output-on-failure cmake --install build ``` -### Build and Install Iceberg Arrow Library +### Build and Install Iceberg Bundle Library #### Vendored Apache Arrow (default) ```bash -cmake -S . -B build -DCMAKE_INSTALL_PREFIX=/path/to/install -DICEBERG_ARROW=ON +cmake -S . -B build -DCMAKE_INSTALL_PREFIX=/path/to/install -DICEBERG_BUILD_BUNDLE=ON cmake --build build ctest --test-dir build --output-on-failure cmake --install build @@ -52,7 +52,7 @@ cmake --install build #### Provided Apache Arrow ```bash -cmake -S . -B build -DCMAKE_INSTALL_PREFIX=/path/to/install -DCMAKE_PREFIX_PATH=/path/to/arrow -DICEBERG_ARROW=ON +cmake -S . -B build -DCMAKE_INSTALL_PREFIX=/path/to/install -DCMAKE_PREFIX_PATH=/path/to/arrow -DICEBERG_BUILD_BUNDLE=ON cmake --build build ctest --test-dir build --output-on-failure cmake --install build diff --git a/cmake_modules/IcebergThirdpartyToolchain.cmake b/cmake_modules/IcebergThirdpartyToolchain.cmake index 53b20c188..f962ae6da 100644 --- a/cmake_modules/IcebergThirdpartyToolchain.cmake +++ b/cmake_modules/IcebergThirdpartyToolchain.cmake @@ -127,7 +127,7 @@ function(resolve_arrow_dependency) PARENT_SCOPE) endfunction() -if(ICEBERG_ARROW) +if(ICEBERG_BUILD_BUNDLE) resolve_arrow_dependency() endif() @@ -199,7 +199,7 @@ function(resolve_avro_dependency) PARENT_SCOPE) endfunction() -if(ICEBERG_AVRO) +if(ICEBERG_BUILD_BUNDLE) resolve_avro_dependency() endif() diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index c2c7a9ccf..c36afa44f 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -26,6 +26,4 @@ find_package(Iceberg CONFIG REQUIRED) add_executable(demo_example demo_example.cc) -target_link_libraries(demo_example - PRIVATE Iceberg::iceberg_puffin_static - Iceberg::iceberg_arrow_static Iceberg::iceberg_avro_static) +target_link_libraries(demo_example PRIVATE Iceberg::iceberg_bundle_static) diff --git a/example/demo_example.cc b/example/demo_example.cc index ef492bc17..79e5b99e3 100644 --- a/example/demo_example.cc +++ b/example/demo_example.cc @@ -22,11 +22,9 @@ #include "iceberg/arrow/demo_arrow.h" #include "iceberg/avro/demo_avro.h" #include "iceberg/demo.h" -#include "iceberg/puffin/demo_puffin.h" int main() { std::cout << iceberg::Demo().print() << std::endl; - std::cout << iceberg::puffin::DemoPuffin().print() << std::endl; std::cout << iceberg::arrow::DemoArrow().print() << std::endl; std::cout << iceberg::avro::DemoAvro().print() << std::endl; return 0; diff --git a/src/iceberg/CMakeLists.txt b/src/iceberg/CMakeLists.txt index a182ac3a4..64bc0efc2 100644 --- a/src/iceberg/CMakeLists.txt +++ b/src/iceberg/CMakeLists.txt @@ -50,11 +50,63 @@ add_iceberg_lib(iceberg iceberg_install_all_headers(iceberg) +add_subdirectory(util) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/iceberg_export.h DESTINATION ${ICEBERG_INSTALL_INCLUDEDIR}/iceberg) -add_subdirectory(arrow) -add_subdirectory(avro) -add_subdirectory(puffin) +if(ICEBERG_BUILD_BUNDLE) + set(ICEBERG_BUNDLE_SOURCES arrow/demo_arrow.cc avro/demo_avro.cc) + + # Libraries to link with exported libiceberg_bundle.{so,a}. + set(ICEBERG_BUNDLE_STATIC_BUILD_INTERFACE_LIBS) + set(ICEBERG_BUNDLE_SHARED_BUILD_INTERFACE_LIBS) + set(ICEBERG_BUNDLE_STATIC_INSTALL_INTERFACE_LIBS) + set(ICEBERG_BUNDLE_SHARED_INSTALL_INTERFACE_LIBS) + + list(APPEND + ICEBERG_BUNDLE_STATIC_BUILD_INTERFACE_LIBS + "$,iceberg_static,iceberg_shared>" + "$,Arrow::arrow_static,Arrow::arrow_shared>" + "$,Avro::avrocpp_static,Avro::avrocpp_shared>" + ) + list(APPEND + ICEBERG_BUNDLE_SHARED_BUILD_INTERFACE_LIBS + "$,iceberg_shared,iceberg_static>" + "$,Arrow::arrow_shared,Arrow::arrow_static>" + "$,Avro::avrocpp_shared,Avro::avrocpp_static>" + ) + + list(APPEND + ICEBERG_BUNDLE_STATIC_INSTALL_INTERFACE_LIBS + "$,Iceberg::iceberg_static,Iceberg::iceberg_shared>" + "$,Iceberg::arrow_static,$,Arrow::arrow_static,Arrow::arrow_shared>>" + "$,Iceberg::avrocpp_s,$,Avro::avrocpp_static,Avro::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::avrocpp_s,$,Avro::avrocpp_shared,Avro::avrocpp_static>>" + ) + + add_iceberg_lib(iceberg_bundle + SOURCES + ${ICEBERG_BUNDLE_SOURCES} + SHARED_LINK_LIBS + ${ICEBERG_BUNDLE_SHARED_BUILD_INTERFACE_LIBS} + STATIC_LINK_LIBS + ${ICEBERG_BUNDLE_STATIC_BUILD_INTERFACE_LIBS} + STATIC_INSTALL_INTERFACE_LIBS + ${ICEBERG_BUNDLE_STATIC_INSTALL_INTERFACE_LIBS} + SHARED_INSTALL_INTERFACE_LIBS + ${ICEBERG_BUNDLE_SHARED_INSTALL_INTERFACE_LIBS}) + + add_subdirectory(arrow) + add_subdirectory(avro) + + 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/IcebergConfig.cmake.in b/src/iceberg/IcebergConfig.cmake.in index e0b690d1f..a466a628c 100644 --- a/src/iceberg/IcebergConfig.cmake.in +++ b/src/iceberg/IcebergConfig.cmake.in @@ -24,10 +24,8 @@ # # Iceberg::iceberg_shared # Iceberg::iceberg_static -# Iceberg::iceberg_puffin_shared -# Iceberg::iceberg_puffin_static -# Iceberg::iceberg_arrow_shared -# Iceberg::iceberg_arrow_static +# Iceberg::iceberg_bundle_shared +# Iceberg::iceberg_bundle_static @PACKAGE_INIT@ diff --git a/src/iceberg/arrow/CMakeLists.txt b/src/iceberg/arrow/CMakeLists.txt index 51d1811ba..3416d5e95 100644 --- a/src/iceberg/arrow/CMakeLists.txt +++ b/src/iceberg/arrow/CMakeLists.txt @@ -15,61 +15,4 @@ # specific language governing permissions and limitations # under the License. -if(NOT ICEBERG_ARROW) - return() -endif() - -set(ICEBERG_ARROW_SOURCES demo_arrow.cc) - -# Libraries to link with exported libiceberg_arrow.{so,a}. -set(ICEBERG_ARROW_STATIC_BUILD_INTERFACE_LIBS) -set(ICEBERG_ARROW_SHARED_BUILD_INTERFACE_LIBS) -set(ICEBERG_ARROW_STATIC_INSTALL_INTERFACE_LIBS) -set(ICEBERG_ARROW_SHARED_INSTALL_INTERFACE_LIBS) - -list(APPEND ICEBERG_ARROW_STATIC_BUILD_INTERFACE_LIBS - "$,iceberg_static,iceberg_shared>" - "$,Arrow::arrow_static,Arrow::arrow_shared>") -list(APPEND ICEBERG_ARROW_SHARED_BUILD_INTERFACE_LIBS - "$,iceberg_shared,iceberg_static>" - "$,Arrow::arrow_shared,Arrow::arrow_static>") - -if(ARROW_VENDORED) - list(APPEND ICEBERG_ARROW_STATIC_INSTALL_INTERFACE_LIBS Iceberg::arrow_static) - list(APPEND ICEBERG_ARROW_SHARED_INSTALL_INTERFACE_LIBS Iceberg::arrow_static) -else() - list(APPEND - ICEBERG_ARROW_STATIC_INSTALL_INTERFACE_LIBS - "$,Arrow::arrow_static,Arrow::arrow_shared>" - ) - list(APPEND - ICEBERG_ARROW_SHARED_INSTALL_INTERFACE_LIBS - "$,Arrow::arrow_shared,Arrow::arrow_static>" - ) -endif() - -list(APPEND - ICEBERG_ARROW_STATIC_INSTALL_INTERFACE_LIBS - "$,Iceberg::iceberg_static,Iceberg::iceberg_shared>" -) -list(APPEND - ICEBERG_ARROW_SHARED_INSTALL_INTERFACE_LIBS - "$,Iceberg::iceberg_shared,Iceberg::iceberg_static>" -) - -add_iceberg_lib(iceberg_arrow - SOURCES - ${ICEBERG_ARROW_SOURCES} - SHARED_LINK_LIBS - ${ICEBERG_ARROW_SHARED_BUILD_INTERFACE_LIBS} - STATIC_LINK_LIBS - ${ICEBERG_ARROW_STATIC_BUILD_INTERFACE_LIBS} - STATIC_INSTALL_INTERFACE_LIBS - ${ICEBERG_ARROW_STATIC_INSTALL_INTERFACE_LIBS} - SHARED_INSTALL_INTERFACE_LIBS - ${ICEBERG_ARROW_SHARED_INSTALL_INTERFACE_LIBS}) - iceberg_install_all_headers(iceberg/arrow) - -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/iceberg_arrow_export.h - DESTINATION ${ICEBERG_INSTALL_INCLUDEDIR}/iceberg/arrow) diff --git a/src/iceberg/arrow/demo_arrow.h b/src/iceberg/arrow/demo_arrow.h index 569458fa3..c50429e89 100644 --- a/src/iceberg/arrow/demo_arrow.h +++ b/src/iceberg/arrow/demo_arrow.h @@ -21,12 +21,12 @@ #include -#include "iceberg/arrow/iceberg_arrow_export.h" #include "iceberg/demo.h" +#include "iceberg/iceberg_bundle_export.h" namespace iceberg::arrow { -class ICEBERG_ARROW_EXPORT DemoArrow : public Demo { +class ICEBERG_BUNDLE_EXPORT DemoArrow : public Demo { public: DemoArrow() = default; ~DemoArrow() override = default; diff --git a/src/iceberg/avro/CMakeLists.txt b/src/iceberg/avro/CMakeLists.txt index 315d39c2d..f82130386 100644 --- a/src/iceberg/avro/CMakeLists.txt +++ b/src/iceberg/avro/CMakeLists.txt @@ -15,65 +15,4 @@ # specific language governing permissions and limitations # under the License. -if(NOT ICEBERG_AVRO) - return() -endif() - -set(ICEBERG_AVRO_SOURCES demo_avro.cc) - -# Libraries to link with exported libiceberg_avro.{so,a}. -set(ICEBERG_AVRO_STATIC_BUILD_INTERFACE_LIBS) -set(ICEBERG_AVRO_SHARED_BUILD_INTERFACE_LIBS) -set(ICEBERG_AVRO_STATIC_INSTALL_INTERFACE_LIBS) -set(ICEBERG_AVRO_SHARED_INSTALL_INTERFACE_LIBS) - -list(APPEND - ICEBERG_AVRO_STATIC_BUILD_INTERFACE_LIBS - "$,iceberg_static,iceberg_shared>" - "$,Avro::avrocpp_static,Avro::avrocpp_shared>" -) -list(APPEND - ICEBERG_AVRO_SHARED_BUILD_INTERFACE_LIBS - "$,iceberg_shared,iceberg_static>" - "$,Avro::avrocpp_shared,Avro::avrocpp_static>" -) - -if(AVRO_VENDORED) - list(APPEND ICEBERG_AVRO_STATIC_INSTALL_INTERFACE_LIBS Iceberg::avrocpp_s) - list(APPEND ICEBERG_AVRO_SHARED_INSTALL_INTERFACE_LIBS Iceberg::avrocpp_s) -else() - list(APPEND - ICEBERG_AVRO_STATIC_INSTALL_INTERFACE_LIBS - "$,Avro::avrocpp_static,Avro::avrocpp_shared>" - ) - list(APPEND - ICEBERG_AVRO_SHARED_INSTALL_INTERFACE_LIBS - "$,Avro::avrocpp_shared,Avro::avrocpp_static>" - ) -endif() - -list(APPEND - ICEBERG_AVRO_STATIC_INSTALL_INTERFACE_LIBS - "$,Iceberg::iceberg_static,Iceberg::iceberg_shared>" -) -list(APPEND - ICEBERG_AVRO_SHARED_INSTALL_INTERFACE_LIBS - "$,Iceberg::iceberg_shared,Iceberg::iceberg_static>" -) - -add_iceberg_lib(iceberg_avro - SOURCES - ${ICEBERG_AVRO_SOURCES} - SHARED_LINK_LIBS - ${ICEBERG_AVRO_SHARED_BUILD_INTERFACE_LIBS} - STATIC_LINK_LIBS - ${ICEBERG_AVRO_STATIC_BUILD_INTERFACE_LIBS} - STATIC_INSTALL_INTERFACE_LIBS - ${ICEBERG_AVRO_STATIC_INSTALL_INTERFACE_LIBS} - SHARED_INSTALL_INTERFACE_LIBS - ${ICEBERG_AVRO_SHARED_INSTALL_INTERFACE_LIBS}) - iceberg_install_all_headers(iceberg/avro) - -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/iceberg_avro_export.h - DESTINATION ${ICEBERG_INSTALL_INCLUDEDIR}/iceberg/avro) diff --git a/src/iceberg/avro/demo_avro.h b/src/iceberg/avro/demo_avro.h index 6abf969a3..d143dccc9 100644 --- a/src/iceberg/avro/demo_avro.h +++ b/src/iceberg/avro/demo_avro.h @@ -22,11 +22,11 @@ #include #include "iceberg/avro.h" -#include "iceberg/avro/iceberg_avro_export.h" +#include "iceberg/iceberg_bundle_export.h" namespace iceberg::avro { -class ICEBERG_AVRO_EXPORT DemoAvro : public Avro { +class ICEBERG_BUNDLE_EXPORT DemoAvro : public Avro { public: DemoAvro() = default; ~DemoAvro() override = default; diff --git a/src/iceberg/demo.cc b/src/iceberg/demo.cc index c967915fb..a9c0a031c 100644 --- a/src/iceberg/demo.cc +++ b/src/iceberg/demo.cc @@ -22,7 +22,6 @@ #include "iceberg/avro.h" // include to export symbols #include "iceberg/catalog.h" #include "iceberg/location_provider.h" -#include "iceberg/puffin.h" #include "iceberg/table.h" #include "iceberg/transaction.h" diff --git a/src/iceberg/puffin.h b/src/iceberg/puffin.h deleted file mode 100644 index 52514f76f..000000000 --- a/src/iceberg/puffin.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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 - -#include - -#include "iceberg/iceberg_export.h" - -namespace iceberg { - -class ICEBERG_EXPORT Puffin { - public: - virtual ~Puffin() = default; - virtual std::string print() const = 0; -}; - -} // namespace iceberg diff --git a/src/iceberg/puffin/CMakeLists.txt b/src/iceberg/puffin/CMakeLists.txt deleted file mode 100644 index 440ff8442..000000000 --- a/src/iceberg/puffin/CMakeLists.txt +++ /dev/null @@ -1,53 +0,0 @@ -# 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. - -set(ICEBERG_PUFFIN_SOURCES demo_puffin.cc) - -set(ICEBERG_PUFFIN_STATIC_BUILD_INTERFACE_LIBS) -set(ICEBERG_PUFFIN_SHARED_BUILD_INTERFACE_LIBS) -set(ICEBERG_PUFFIN_STATIC_INSTALL_INTERFACE_LIBS) -set(ICEBERG_PUFFIN_SHARED_INSTALL_INTERFACE_LIBS) - -list(APPEND ICEBERG_PUFFIN_STATIC_BUILD_INTERFACE_LIBS - "$,iceberg_static,iceberg_shared>") -list(APPEND ICEBERG_PUFFIN_SHARED_BUILD_INTERFACE_LIBS - "$,iceberg_shared,iceberg_static>") -list(APPEND - ICEBERG_PUFFIN_STATIC_INSTALL_INTERFACE_LIBS - "$,Iceberg::iceberg_static,Iceberg::iceberg_shared>" -) -list(APPEND - ICEBERG_PUFFIN_SHARED_INSTALL_INTERFACE_LIBS - "$,Iceberg::iceberg_shared,Iceberg::iceberg_static>" -) - -add_iceberg_lib(iceberg_puffin - SOURCES - ${ICEBERG_PUFFIN_SOURCES} - SHARED_LINK_LIBS - ${ICEBERG_PUFFIN_SHARED_BUILD_INTERFACE_LIBS} - STATIC_LINK_LIBS - ${ICEBERG_PUFFIN_STATIC_BUILD_INTERFACE_LIBS} - STATIC_INSTALL_INTERFACE_LIBS - ${ICEBERG_PUFFIN_STATIC_INSTALL_INTERFACE_LIBS} - SHARED_INSTALL_INTERFACE_LIBS - ${ICEBERG_PUFFIN_SHARED_INSTALL_INTERFACE_LIBS}) - -iceberg_install_all_headers(iceberg/puffin) - -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/iceberg_puffin_export.h - DESTINATION ${ICEBERG_INSTALL_INCLUDEDIR}/iceberg/puffin) diff --git a/src/iceberg/puffin/demo_puffin.cc b/src/iceberg/puffin/demo_puffin.cc deleted file mode 100644 index 51aa08c74..000000000 --- a/src/iceberg/puffin/demo_puffin.cc +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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. - */ - -#include "iceberg/puffin/demo_puffin.h" - -namespace iceberg::puffin { - -std::string DemoPuffin::print() const { return "DemoPuffin"; } - -} // namespace iceberg::puffin diff --git a/src/iceberg/puffin/demo_puffin.h b/src/iceberg/puffin/demo_puffin.h deleted file mode 100644 index 3544b7c10..000000000 --- a/src/iceberg/puffin/demo_puffin.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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 - -#include "iceberg/puffin.h" -#include "iceberg/puffin/iceberg_puffin_export.h" - -namespace iceberg::puffin { - -class ICEBERG_PUFFIN_EXPORT DemoPuffin : public Puffin { - public: - DemoPuffin() = default; - ~DemoPuffin() override = default; - std::string print() const override; -}; - -} // namespace iceberg::puffin diff --git a/test/avro/CMakeLists.txt b/src/iceberg/util/CMakeLists.txt similarity index 76% rename from test/avro/CMakeLists.txt rename to src/iceberg/util/CMakeLists.txt index c32fbf8be..2e349b5d9 100644 --- a/test/avro/CMakeLists.txt +++ b/src/iceberg/util/CMakeLists.txt @@ -15,9 +15,4 @@ # specific language governing permissions and limitations # under the License. -if(ICEBERG_AVRO) - add_executable(avro_unittest) - target_sources(avro_unittest PRIVATE avro_test.cc) - target_link_libraries(avro_unittest PRIVATE iceberg_avro_static GTest::gtest_main) - add_test(NAME avro_unittest COMMAND avro_unittest) -endif() +iceberg_install_all_headers(iceberg/util) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index e29a76ec7..5fbff2015 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -23,6 +23,25 @@ fetchcontent_declare(googletest GTest) fetchcontent_makeavailable(googletest) -add_subdirectory(arrow) -add_subdirectory(avro) -add_subdirectory(core) +add_executable(schema_test) +target_sources(schema_test PRIVATE schema_test.cc schema_field_test.cc type_test.cc) +target_link_libraries(schema_test PRIVATE iceberg_static GTest::gtest_main GTest::gmock) +add_test(NAME schema_test COMMAND schema_test) + +add_executable(expected_test) +target_sources(expected_test PRIVATE expected_test.cc) +target_link_libraries(expected_test PRIVATE iceberg_static GTest::gtest_main) +add_test(NAME expected_test COMMAND expected_test) + +if(ICEBERG_BUILD_BUNDLE) + add_executable(avro_test) + target_sources(avro_test PRIVATE avro_test.cc) + target_link_libraries(avro_test PRIVATE iceberg_bundle_static GTest::gtest_main) + add_test(NAME avro_test COMMAND avro_test) + + add_executable(arrow_test) + target_sources(arrow_test PRIVATE arrow_test.cc) + target_link_libraries(arrow_test PRIVATE iceberg_bundle_static Arrow::arrow_static + GTest::gtest_main) + add_test(NAME arrow_test COMMAND arrow_test) +endif() diff --git a/test/arrow/CMakeLists.txt b/test/arrow/CMakeLists.txt deleted file mode 100644 index 043ecf4be..000000000 --- a/test/arrow/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -# 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. - -if(ICEBERG_ARROW) - add_executable(arrow_unittest) - target_sources(arrow_unittest PRIVATE arrow_test.cc) - target_link_libraries(arrow_unittest PRIVATE iceberg_arrow_static Arrow::arrow_static - GTest::gtest_main) - add_test(NAME arrow_unittest COMMAND arrow_unittest) -endif() diff --git a/test/arrow/arrow_test.cc b/test/arrow_test.cc similarity index 100% rename from test/arrow/arrow_test.cc rename to test/arrow_test.cc diff --git a/test/avro/avro_test.cc b/test/avro_test.cc similarity index 100% rename from test/avro/avro_test.cc rename to test/avro_test.cc diff --git a/test/core/CMakeLists.txt b/test/core/CMakeLists.txt deleted file mode 100644 index 3bed59baa..000000000 --- a/test/core/CMakeLists.txt +++ /dev/null @@ -1,27 +0,0 @@ -# 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. - -add_executable(core_unittest) -target_sources(core_unittest PRIVATE core_unittest.cc schema_test.cc schema_field_test.cc - type_test.cc) -target_link_libraries(core_unittest PRIVATE iceberg_static GTest::gtest_main GTest::gmock) -add_test(NAME core_unittest COMMAND core_unittest) - -add_executable(expected_test) -target_sources(expected_test PRIVATE expected_test.cc) -target_link_libraries(expected_test PRIVATE iceberg_static GTest::gtest_main) -add_test(NAME expected_test COMMAND expected_test) diff --git a/test/core/core_unittest.cc b/test/core/core_unittest.cc deleted file mode 100644 index ddd9d509a..000000000 --- a/test/core/core_unittest.cc +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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. - */ - -#include - -#include "iceberg/demo.h" - -TEST(TableTest, TestTableCons) { - auto table = iceberg::Demo(); - EXPECT_EQ(table.print(), "Demo"); -} diff --git a/test/core/expected_test.cc b/test/expected_test.cc similarity index 100% rename from test/core/expected_test.cc rename to test/expected_test.cc diff --git a/test/core/schema_field_test.cc b/test/schema_field_test.cc similarity index 100% rename from test/core/schema_field_test.cc rename to test/schema_field_test.cc diff --git a/test/core/schema_test.cc b/test/schema_test.cc similarity index 100% rename from test/core/schema_test.cc rename to test/schema_test.cc diff --git a/test/core/type_test.cc b/test/type_test.cc similarity index 100% rename from test/core/type_test.cc rename to test/type_test.cc