diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..417b9719 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,63 @@ +# 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(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules") + +project( + iceberg + VERSION 0.1.0 + DESCRIPTION "Iceberg C++ Project" + LANGUAGES CXX) + +set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) +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) + +include(CMakePackageConfigHelpers) +include(CMakeParseArguments) +include(BuildUtils) +include(ExternalProject) +include(FindPackageHandleStandardArgs) +include(GNUInstallDirs) + +set(ICEBERG_API_DIR "${CMAKE_SOURCE_DIR}/api") +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}") + +add_subdirectory(api) +add_subdirectory(src) + +if(ICEBERG_BUILD_TESTS) + enable_testing() + add_subdirectory(test) +endif() + +install(FILES LICENSE NOTICE DESTINATION ${ICEBERG_INSTALL_DOCDIR}) diff --git a/README.md b/README.md index 0ab8581f..81966cac 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,34 @@ C++ implementation of [Apache Iceberg™](https://iceberg.apache.org/). +## Requirements + +- CMake 3.25 or higher +- C++20 compliant compiler + +## Build + +### Build and Install Core Libraries + +```bash +cd iceberg-cpp +mkdir build && cd build +cmake .. -DCMAKE_INSTALL_PREFIX=/tmp/iceberg -DICEBERG_BUILD_STATIC=ON -DICEBERG_BUILD_SHARED=ON +cmake --build . +cmake --install . +``` + +### Build Examples + +After installing the core libraries, you can build the examples: + +```bash +cd iceberg-cpp/example +mkdir build && cd build +cmake .. -DCMAKE_PREFIX_PATH=/tmp/iceberg +cmake --build . +``` + ## Contribute Apache Iceberg is an active open-source project, governed under the Apache Software Foundation (ASF). Iceberg-cpp is open to people who want to contribute to it. Here are some ways to get involved: diff --git a/api/CMakeLists.txt b/api/CMakeLists.txt new file mode 100644 index 00000000..47ebd142 --- /dev/null +++ b/api/CMakeLists.txt @@ -0,0 +1,22 @@ +# 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( + DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/iceberg" + DESTINATION "${ICEBERG_INSTALL_INCLUDEDIR}" + FILES_MATCHING + PATTERN "*.h") diff --git a/api/iceberg/puffin.h b/api/iceberg/puffin.h new file mode 100644 index 00000000..b9b5f193 --- /dev/null +++ b/api/iceberg/puffin.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 + +#include +#include + +namespace iceberg { + +class Puffin { +public: + virtual ~Puffin() = default; + virtual std::string_view print() const = 0; + static std::unique_ptr create(); +}; + +} // namespace iceberg diff --git a/api/iceberg/table.h b/api/iceberg/table.h new file mode 100644 index 00000000..93f6a0f9 --- /dev/null +++ b/api/iceberg/table.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 + +#include +#include + +namespace iceberg { + +class Table { +public: + virtual ~Table() = default; + virtual std::string_view print() const = 0; + static std::unique_ptr create(); +}; + +} // namespace iceberg diff --git a/cmake_modules/BuildUtils.cmake b/cmake_modules/BuildUtils.cmake new file mode 100644 index 00000000..416f59ce --- /dev/null +++ b/cmake_modules/BuildUtils.cmake @@ -0,0 +1,222 @@ +# 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. + +# Borrowed the file from Apache Arrow: +# https://github.com/apache/arrow/blob/main/cpp/cmake_modules/BuildUtils.cmake + +function(iceberg_install_cmake_package PACKAGE_NAME EXPORT_NAME) + 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(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") + install(EXPORT ${EXPORT_NAME} + DESTINATION "${ICEBERG_INSTALL_CMAKEDIR}/${PACKAGE_NAME}" + NAMESPACE "${PACKAGE_NAME}::" + FILE "${TARGETS_CMAKE}") +endfunction() + +function(ADD_ICEBERG_LIB LIB_NAME) + set(options) + set(one_value_args + BUILD_SHARED + BUILD_STATIC + CMAKE_PACKAGE_NAME + INSTALL_ARCHIVE_DIR + INSTALL_LIBRARY_DIR + INSTALL_RUNTIME_DIR + SHARED_LINK_FLAGS) + set(multi_value_args + SOURCES + OUTPUTS + STATIC_LINK_LIBS + SHARED_LINK_LIBS + SHARED_PRIVATE_LINK_LIBS + EXTRA_INCLUDES + PRIVATE_INCLUDES + DEPENDENCIES + DEFINITIONS + SHARED_INSTALL_INTERFACE_LIBS + STATIC_INSTALL_INTERFACE_LIBS) + cmake_parse_arguments(ARG + "${options}" + "${one_value_args}" + "${multi_value_args}" + ${ARGN}) + if(ARG_UNPARSED_ARGUMENTS) + message(SEND_ERROR "Error: unrecognized arguments: ${ARG_UNPARSED_ARGUMENTS}") + endif() + + if(ARG_OUTPUTS) + set(${ARG_OUTPUTS}) + endif() + + # Allow overriding ICEBERG_BUILD_SHARED and ICEBERG_BUILD_STATIC + if(DEFINED ARG_BUILD_SHARED) + set(BUILD_SHARED ${ARG_BUILD_SHARED}) + else() + set(BUILD_SHARED ${ICEBERG_BUILD_SHARED}) + endif() + if(DEFINED ARG_BUILD_STATIC) + set(BUILD_STATIC ${ARG_BUILD_STATIC}) + else() + set(BUILD_STATIC ${ICEBERG_BUILD_STATIC}) + endif() + + # Prepare arguments for separate compilation of static and shared libs below + set(LIB_DEPS ${ARG_SOURCES}) + set(EXTRA_DEPS ${ARG_DEPENDENCIES}) + + if(ARG_EXTRA_INCLUDES) + set(LIB_INCLUDES ${ARG_EXTRA_INCLUDES}) + else() + set(LIB_INCLUDES "") + endif() + + if(ARG_INSTALL_ARCHIVE_DIR) + set(INSTALL_ARCHIVE_DIR ${ARG_INSTALL_ARCHIVE_DIR}) + else() + set(INSTALL_ARCHIVE_DIR ${CMAKE_INSTALL_LIBDIR}) + endif() + if(ARG_INSTALL_LIBRARY_DIR) + set(INSTALL_LIBRARY_DIR ${ARG_INSTALL_LIBRARY_DIR}) + else() + set(INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}) + endif() + if(ARG_INSTALL_RUNTIME_DIR) + set(INSTALL_RUNTIME_DIR ${ARG_INSTALL_RUNTIME_DIR}) + else() + set(INSTALL_RUNTIME_DIR bin) + endif() + + if(BUILD_SHARED) + add_library(${LIB_NAME}_shared SHARED) + + if(LIB_DEPS) + target_sources(${LIB_NAME}_shared PRIVATE ${LIB_DEPS}) + endif() + + if(EXTRA_DEPS) + add_dependencies(${LIB_NAME}_shared ${EXTRA_DEPS}) + endif() + + if(ARG_DEFINITIONS) + target_compile_definitions(${LIB_NAME}_shared PRIVATE ${ARG_DEFINITIONS}) + endif() + + if(ARG_OUTPUTS) + list(APPEND ${ARG_OUTPUTS} ${LIB_NAME}_shared) + endif() + + if(LIB_INCLUDES) + target_include_directories(${LIB_NAME}_shared SYSTEM PUBLIC ${ARG_EXTRA_INCLUDES}) + endif() + + if(ARG_PRIVATE_INCLUDES) + target_include_directories(${LIB_NAME}_shared PRIVATE ${ARG_PRIVATE_INCLUDES}) + endif() + + set_target_properties(${LIB_NAME}_shared + PROPERTIES LINK_FLAGS "${ARG_SHARED_LINK_FLAGS}" + OUTPUT_NAME ${LIB_NAME}) + + target_link_libraries(${LIB_NAME}_shared + PUBLIC "$" + "$" + PRIVATE ${ARG_SHARED_PRIVATE_LINK_LIBS}) + + install(TARGETS ${LIB_NAME}_shared ${INSTALL_IS_OPTIONAL} + EXPORT ${LIB_NAME}_targets + ARCHIVE DESTINATION ${INSTALL_ARCHIVE_DIR} + LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} + RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR} + INCLUDES + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + endif() + + if(BUILD_STATIC) + add_library(${LIB_NAME}_static STATIC) + + if(LIB_DEPS) + target_sources(${LIB_NAME}_static PRIVATE ${LIB_DEPS}) + endif() + + if(EXTRA_DEPS) + add_dependencies(${LIB_NAME}_static ${EXTRA_DEPS}) + endif() + + if(ARG_DEFINITIONS) + target_compile_definitions(${LIB_NAME}_static PRIVATE ${ARG_DEFINITIONS}) + endif() + + if(ARG_OUTPUTS) + list(APPEND ${ARG_OUTPUTS} ${LIB_NAME}_static) + endif() + + if(LIB_INCLUDES) + target_include_directories(${LIB_NAME}_static SYSTEM PUBLIC ${ARG_EXTRA_INCLUDES}) + endif() + + if(ARG_PRIVATE_INCLUDES) + target_include_directories(${LIB_NAME}_static PRIVATE ${ARG_PRIVATE_INCLUDES}) + endif() + + if(MSVC_TOOLCHAIN) + set(LIB_NAME_STATIC ${LIB_NAME}_static) + else() + set(LIB_NAME_STATIC ${LIB_NAME}) + endif() + + set_target_properties(${LIB_NAME}_static + PROPERTIES OUTPUT_NAME ${LIB_NAME_STATIC}) + + if(ARG_STATIC_INSTALL_INTERFACE_LIBS) + target_link_libraries(${LIB_NAME}_static + INTERFACE "$") + endif() + + if(ARG_STATIC_LINK_LIBS) + target_link_libraries(${LIB_NAME}_static + PUBLIC "$") + endif() + + install(TARGETS ${LIB_NAME}_static ${INSTALL_IS_OPTIONAL} + EXPORT ${LIB_NAME}_targets + ARCHIVE DESTINATION ${INSTALL_ARCHIVE_DIR} + LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} + RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR} + INCLUDES + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + endif() + + if(ARG_CMAKE_PACKAGE_NAME) + iceberg_install_cmake_package(${ARG_CMAKE_PACKAGE_NAME} ${LIB_NAME}_targets) + endif() + + # Modify variable in calling scope + if(ARG_OUTPUTS) + set(${ARG_OUTPUTS} + ${${ARG_OUTPUTS}} + PARENT_SCOPE) + endif() +endfunction() diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt new file mode 100644 index 00000000..5c337a3a --- /dev/null +++ b/example/CMakeLists.txt @@ -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. + +# Please set CMAKE_PREFIX_PATH to the install prefix of iceberg. +cmake_minimum_required(VERSION 3.25) + +project(example) + +find_package(iceberg CONFIG REQUIRED) +find_package(puffin CONFIG REQUIRED) + +add_executable(demo_example demo_example.cc) + +target_link_libraries(demo_example iceberg::iceberg_core_static puffin::iceberg_puffin_static) diff --git a/example/demo_example.cc b/example/demo_example.cc new file mode 100644 index 00000000..4f35bd30 --- /dev/null +++ b/example/demo_example.cc @@ -0,0 +1,29 @@ +/* + * 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.h" +#include "iceberg/table.h" + +#include + +int main() { + std::cout << iceberg::Table::create()->print() << std::endl; + std::cout << iceberg::Puffin::create()->print() << std::endl; + return 0; +} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 00000000..bec76222 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,19 @@ +# 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_subdirectory(core) +add_subdirectory(puffin) diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt new file mode 100644 index 00000000..41d455f3 --- /dev/null +++ b/src/core/CMakeLists.txt @@ -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. + +set(ICEBERG_CORE_SOURCES demo_table.cc) +set(ICEBERG_CORE_INCLUDES "${ICEBERG_API_DIR}") + +ADD_ICEBERG_LIB( + iceberg_core + CMAKE_PACKAGE_NAME + iceberg + SOURCES + ${ICEBERG_CORE_SOURCES} + PRIVATE_INCLUDES + ${ICEBERG_CORE_INCLUDES}) diff --git a/src/core/demo_table.cc b/src/core/demo_table.cc new file mode 100644 index 00000000..628ee256 --- /dev/null +++ b/src/core/demo_table.cc @@ -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. + */ + +#include "demo_table.h" + +namespace iceberg { + +std::string_view DemoTable::print() const { return "DemoTable"; } + +std::unique_ptr
Table::create() { return std::make_unique(); } + +} // namespace iceberg diff --git a/src/core/demo_table.h b/src/core/demo_table.h new file mode 100644 index 00000000..f68f9ac1 --- /dev/null +++ b/src/core/demo_table.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 + +#include "iceberg/table.h" + +namespace iceberg { + +class DemoTable : public Table { +public: + DemoTable() = default; + ~DemoTable() override = default; + + std::string_view print() const override; +}; + +} // namespace iceberg diff --git a/src/core/icebergConfig.cmake.in b/src/core/icebergConfig.cmake.in new file mode 100644 index 00000000..2e12a8f0 --- /dev/null +++ b/src/core/icebergConfig.cmake.in @@ -0,0 +1,22 @@ +# 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. +# + +@PACKAGE_INIT@ + +include("${CMAKE_CURRENT_LIST_DIR}/icebergTargets.cmake") +check_required_components(iceberg) diff --git a/src/puffin/CMakeLists.txt b/src/puffin/CMakeLists.txt new file mode 100644 index 00000000..40df0a7d --- /dev/null +++ b/src/puffin/CMakeLists.txt @@ -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. + +set(ICEBERG_PUFFIN_SOURCES demo_puffin.cc) +set(ICEBERG_PUFFIN_INCLUDES "${ICEBERG_API_DIR}") + +ADD_ICEBERG_LIB( + iceberg_puffin + CMAKE_PACKAGE_NAME + puffin + SOURCES + ${ICEBERG_PUFFIN_SOURCES} + PRIVATE_INCLUDES + ${ICEBERG_PUFFIN_INCLUDES}) diff --git a/src/puffin/demo_puffin.cc b/src/puffin/demo_puffin.cc new file mode 100644 index 00000000..12e8ddf3 --- /dev/null +++ b/src/puffin/demo_puffin.cc @@ -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. + */ + +#include "demo_puffin.h" + +namespace iceberg { + +std::string_view DemoPuffin::print() const { return "DemoPuffin"; } + +std::unique_ptr Puffin::create() { + return std::make_unique(); +} + +} // namespace iceberg diff --git a/src/puffin/demo_puffin.h b/src/puffin/demo_puffin.h new file mode 100644 index 00000000..b5cfffcf --- /dev/null +++ b/src/puffin/demo_puffin.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 + +#include "iceberg/puffin.h" + +namespace iceberg { + +class DemoPuffin : public Puffin { +public: + DemoPuffin() = default; + ~DemoPuffin() override = default; + + std::string_view print() const override; +}; + +} // namespace iceberg diff --git a/src/puffin/puffinConfig.cmake.in b/src/puffin/puffinConfig.cmake.in new file mode 100644 index 00000000..c55b0182 --- /dev/null +++ b/src/puffin/puffinConfig.cmake.in @@ -0,0 +1,22 @@ +# 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. +# + +@PACKAGE_INIT@ + +include("${CMAKE_CURRENT_LIST_DIR}/puffinTargets.cmake") +check_required_components(puffin) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 00000000..13a83393 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,16 @@ +# 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.