File tree Expand file tree Collapse file tree 7 files changed +67
-2
lines changed Expand file tree Collapse file tree 7 files changed +67
-2
lines changed Original file line number Diff line number Diff line change @@ -39,11 +39,14 @@ option(ICEBERG_BUILD_TESTS "Build tests" ON)
3939option (ICEBERG_ARROW "Build Arrow" ON )
4040
4141include (GNUInstallDirs)
42+ include (FetchContent)
43+
4244set (ICEBERG_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR} " )
4345set (ICEBERG_INSTALL_BINDIR "${CMAKE_INSTALL_BINDIR} " )
4446set (ICEBERG_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR} " )
4547set (ICEBERG_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR} /cmake" )
4648set (ICEBERG_INSTALL_DOCDIR "share/doc/${PROJECT_NAME} " )
49+ set (ICEBERG_INCLUDES "${CMAKE_SOURCE_DIR} /src" "${CMAKE_BINARY_DIR} /src" )
4750
4851if (WIN32 AND NOT MINGW)
4952 set (MSVC_TOOLCHAIN TRUE )
Original file line number Diff line number Diff line change @@ -28,12 +28,13 @@ C++ implementation of [Apache Iceberg™](https://iceberg.apache.org/).
2828
2929## Build
3030
31- ### Build and Install Core Libraries
31+ ### Build, Run Test and Install Core Libraries
3232
3333``` bash
3434cd iceberg-cpp
3535cmake -S . -B build -DCMAKE_INSTALL_PREFIX=/path/to/install -DICEBERG_BUILD_STATIC=ON -DICEBERG_BUILD_SHARED=ON
3636cmake --build build
37+ ctest --test-dir build --output-on-failure
3738cmake --install build
3839```
3940
@@ -44,6 +45,7 @@ cmake --install build
4445``` bash
4546cmake -S . -B build -DCMAKE_INSTALL_PREFIX=/path/to/install -DICEBERG_ARROW=ON
4647cmake --build build
48+ ctest --test-dir build --output-on-failure
4749cmake --install build
4850```
4951
@@ -52,6 +54,7 @@ cmake --install build
5254``` bash
5355cmake -S . -B build -DCMAKE_INSTALL_PREFIX=/path/to/install -DCMAKE_PREFIX_PATH=/path/to/arrow -DICEBERG_ARROW=ON
5456cmake --build build
57+ ctest --test-dir build --output-on-failure
5558cmake --install build
5659```
5760
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ cmake \
3131 -DICEBERG_BUILD_SHARED=ON \
3232 ${source_dir}
3333cmake --build . --target install
34+ ctest --output-on-failure -C Debug
3435
3536popd
3637
Original file line number Diff line number Diff line change 1616# under the License.
1717
1818set (ICEBERG_SOURCES demo_table.cc)
19- set (ICEBERG_INCLUDES "${CMAKE_SOURCE_DIR} /src" "${CMAKE_BINARY_DIR} /src" )
2019
2120add_iceberg_lib(iceberg
2221 SOURCES
Original file line number Diff line number Diff line change 1414# KIND, either express or implied. See the License for the
1515# specific language governing permissions and limitations
1616# under the License.
17+
18+ fetchcontent_declare(googletest
19+ GIT_REPOSITORY https://github.com/google/googletest.git
20+ GIT_TAG b514bdc898e2951020cbdca1304b75f5950d1f59 # release-1.15.2
21+ FIND_PACKAGE_ARGS
22+ NAMES
23+ GTest)
24+ fetchcontent_makeavailable(googletest)
25+
26+ add_subdirectory (core)
Original file line number Diff line number Diff line change 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+ add_executable (core_unittest)
19+ target_sources (core_unittest PRIVATE core_unittest.cc)
20+ target_link_libraries (core_unittest PRIVATE iceberg_static GTest::gtest_main)
21+ target_include_directories (core_unittest PRIVATE "${ICEBERG_INCLUDES} " )
22+ add_test (NAME core_unittest COMMAND core_unittest)
Original file line number Diff line number Diff line change 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+ #include < gtest/gtest.h>
21+
22+ #include " iceberg/demo_table.h"
23+
24+ TEST (TableTest, TestTableCons) {
25+ auto table = iceberg::DemoTable ();
26+ EXPECT_EQ (table.print (), " DemoTable" );
27+ }
You can’t perform that action at this time.
0 commit comments