Skip to content

Commit 7e97d8e

Browse files
authored
Add basic CMake support for the iceberg library (#3)
1 parent 384fae3 commit 7e97d8e

18 files changed

+721
-0
lines changed

CMakeLists.txt

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
cmake_minimum_required(VERSION 3.25)
19+
20+
if(NOT CMAKE_BUILD_TYPE)
21+
set(CMAKE_BUILD_TYPE Debug)
22+
endif()
23+
24+
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules")
25+
26+
project(
27+
iceberg
28+
VERSION 0.1.0
29+
DESCRIPTION "Iceberg C++ Project"
30+
LANGUAGES CXX)
31+
32+
set(CMAKE_CXX_STANDARD 20)
33+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
34+
set(CMAKE_CXX_EXTENSIONS OFF)
35+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
36+
37+
option(ICEBERG_BUILD_STATIC "Build static library" ON)
38+
option(ICEBERG_BUILD_SHARED "Build shared library" OFF)
39+
option(ICEBERG_BUILD_TESTS "Build tests" ON)
40+
41+
include(CMakePackageConfigHelpers)
42+
include(CMakeParseArguments)
43+
include(BuildUtils)
44+
include(ExternalProject)
45+
include(FindPackageHandleStandardArgs)
46+
include(GNUInstallDirs)
47+
48+
set(ICEBERG_API_DIR "${CMAKE_SOURCE_DIR}/api")
49+
set(ICEBERG_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}")
50+
set(ICEBERG_INSTALL_BINDIR "${CMAKE_INSTALL_BINDIR}")
51+
set(ICEBERG_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}")
52+
set(ICEBERG_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake")
53+
set(ICEBERG_INSTALL_DOCDIR "share/doc/${PROJECT_NAME}")
54+
55+
add_subdirectory(api)
56+
add_subdirectory(src)
57+
58+
if(ICEBERG_BUILD_TESTS)
59+
enable_testing()
60+
add_subdirectory(test)
61+
endif()
62+
63+
install(FILES LICENSE NOTICE DESTINATION ${ICEBERG_INSTALL_DOCDIR})

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,34 @@
2121

2222
C++ implementation of [Apache Iceberg™](https://iceberg.apache.org/).
2323

24+
## Requirements
25+
26+
- CMake 3.25 or higher
27+
- C++20 compliant compiler
28+
29+
## Build
30+
31+
### Build and Install Core Libraries
32+
33+
```bash
34+
cd iceberg-cpp
35+
mkdir build && cd build
36+
cmake .. -DCMAKE_INSTALL_PREFIX=/tmp/iceberg -DICEBERG_BUILD_STATIC=ON -DICEBERG_BUILD_SHARED=ON
37+
cmake --build .
38+
cmake --install .
39+
```
40+
41+
### Build Examples
42+
43+
After installing the core libraries, you can build the examples:
44+
45+
```bash
46+
cd iceberg-cpp/example
47+
mkdir build && cd build
48+
cmake .. -DCMAKE_PREFIX_PATH=/tmp/iceberg
49+
cmake --build .
50+
```
51+
2452
## Contribute
2553

2654
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:

api/CMakeLists.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
install(
19+
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/iceberg"
20+
DESTINATION "${ICEBERG_INSTALL_INCLUDEDIR}"
21+
FILES_MATCHING
22+
PATTERN "*.h")

api/iceberg/puffin.h

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
#pragma once
21+
22+
#include <memory>
23+
#include <string_view>
24+
25+
namespace iceberg {
26+
27+
class Puffin {
28+
public:
29+
virtual ~Puffin() = default;
30+
virtual std::string_view print() const = 0;
31+
static std::unique_ptr<Puffin> create();
32+
};
33+
34+
} // namespace iceberg

api/iceberg/table.h

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
#pragma once
21+
22+
#include <memory>
23+
#include <string_view>
24+
25+
namespace iceberg {
26+
27+
class Table {
28+
public:
29+
virtual ~Table() = default;
30+
virtual std::string_view print() const = 0;
31+
static std::unique_ptr<Table> create();
32+
};
33+
34+
} // namespace iceberg

0 commit comments

Comments
 (0)