Skip to content

Commit 07805e4

Browse files
committed
refactor: simplify library management
Libraries are consolidated to libiceberg and libiceberg-bundle
1 parent 0358d7f commit 07805e4

27 files changed

+92
-377
lines changed

CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
3636
option(ICEBERG_BUILD_STATIC "Build static library" ON)
3737
option(ICEBERG_BUILD_SHARED "Build shared library" OFF)
3838
option(ICEBERG_BUILD_TESTS "Build tests" ON)
39-
option(ICEBERG_ARROW "Build Arrow" ON)
40-
option(ICEBERG_AVRO "Build Avro" ON)
39+
option(ICEBERG_BUILD_BUNDLE "Build the battery included library" ON)
4140

4241
include(GNUInstallDirs)
4342
include(FetchContent)
@@ -46,7 +45,7 @@ set(ICEBERG_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}")
4645
set(ICEBERG_INSTALL_BINDIR "${CMAKE_INSTALL_BINDIR}")
4746
set(ICEBERG_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}")
4847
set(ICEBERG_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake")
49-
set(ICEBERG_INSTALL_DOCDIR "share/doc/${PROJECT_NAME}")
48+
set(ICEBERG_INSTALL_DOCDIR "share/doc/Iceberg")
5049

5150
if(WIN32 AND NOT MINGW)
5251
set(MSVC_TOOLCHAIN TRUE)

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ ctest --test-dir build --output-on-failure
3838
cmake --install build
3939
```
4040

41-
### Build and Install Iceberg Arrow Library
41+
### Build and Install Iceberg Bundle Library
4242

4343
#### Vendored Apache Arrow (default)
4444

4545
```bash
46-
cmake -S . -B build -DCMAKE_INSTALL_PREFIX=/path/to/install -DICEBERG_ARROW=ON
46+
cmake -S . -B build -DCMAKE_INSTALL_PREFIX=/path/to/install -DICEBERG_BUILD_BUNDLE=ON
4747
cmake --build build
4848
ctest --test-dir build --output-on-failure
4949
cmake --install build
@@ -52,7 +52,7 @@ cmake --install build
5252
#### Provided Apache Arrow
5353

5454
```bash
55-
cmake -S . -B build -DCMAKE_INSTALL_PREFIX=/path/to/install -DCMAKE_PREFIX_PATH=/path/to/arrow -DICEBERG_ARROW=ON
55+
cmake -S . -B build -DCMAKE_INSTALL_PREFIX=/path/to/install -DCMAKE_PREFIX_PATH=/path/to/arrow -DICEBERG_BUILD_BUNDLE=ON
5656
cmake --build build
5757
ctest --test-dir build --output-on-failure
5858
cmake --install build

cmake_modules/IcebergThirdpartyToolchain.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ function(resolve_arrow_dependency)
127127
PARENT_SCOPE)
128128
endfunction()
129129

130-
if(ICEBERG_ARROW)
130+
if(ICEBERG_BUILD_BUNDLE)
131131
resolve_arrow_dependency()
132132
endif()
133133

@@ -199,7 +199,7 @@ function(resolve_avro_dependency)
199199
PARENT_SCOPE)
200200
endfunction()
201201

202-
if(ICEBERG_AVRO)
202+
if(ICEBERG_BUILD_BUNDLE)
203203
resolve_avro_dependency()
204204
endif()
205205

example/CMakeLists.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,4 @@ find_package(Iceberg CONFIG REQUIRED)
2626

2727
add_executable(demo_example demo_example.cc)
2828

29-
target_link_libraries(demo_example
30-
PRIVATE Iceberg::iceberg_puffin_static
31-
Iceberg::iceberg_arrow_static Iceberg::iceberg_avro_static)
29+
target_link_libraries(demo_example PRIVATE Iceberg::iceberg_bundle_static)

example/demo_example.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,9 @@
2222
#include "iceberg/arrow/demo_arrow.h"
2323
#include "iceberg/avro/demo_avro.h"
2424
#include "iceberg/demo.h"
25-
#include "iceberg/puffin/demo_puffin.h"
2625

2726
int main() {
2827
std::cout << iceberg::Demo().print() << std::endl;
29-
std::cout << iceberg::puffin::DemoPuffin().print() << std::endl;
3028
std::cout << iceberg::arrow::DemoArrow().print() << std::endl;
3129
std::cout << iceberg::avro::DemoAvro().print() << std::endl;
3230
return 0;

src/iceberg/CMakeLists.txt

Lines changed: 55 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,63 @@ add_iceberg_lib(iceberg
5050

5151
iceberg_install_all_headers(iceberg)
5252

53+
add_subdirectory(util)
54+
5355
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/iceberg_export.h
5456
DESTINATION ${ICEBERG_INSTALL_INCLUDEDIR}/iceberg)
5557

56-
add_subdirectory(arrow)
57-
add_subdirectory(avro)
58-
add_subdirectory(puffin)
58+
if(ICEBERG_BUILD_BUNDLE)
59+
set(ICEBERG_BUNDLE_SOURCES arrow/demo_arrow.cc avro/demo_avro.cc)
60+
61+
# Libraries to link with exported libiceberg_bundle.{so,a}.
62+
set(ICEBERG_BUNDLE_STATIC_BUILD_INTERFACE_LIBS)
63+
set(ICEBERG_BUNDLE_SHARED_BUILD_INTERFACE_LIBS)
64+
set(ICEBERG_BUNDLE_STATIC_INSTALL_INTERFACE_LIBS)
65+
set(ICEBERG_BUNDLE_SHARED_INSTALL_INTERFACE_LIBS)
66+
67+
list(APPEND
68+
ICEBERG_BUNDLE_STATIC_BUILD_INTERFACE_LIBS
69+
"$<IF:$<TARGET_EXISTS:iceberg_static>,iceberg_static,iceberg_shared>"
70+
"$<IF:$<TARGET_EXISTS:Arrow::arrow_static>,Arrow::arrow_static,Arrow::arrow_shared>"
71+
"$<IF:$<TARGET_EXISTS:Avro::avrocpp_static>,Avro::avrocpp_static,Avro::avrocpp_shared>"
72+
)
73+
list(APPEND
74+
ICEBERG_BUNDLE_SHARED_BUILD_INTERFACE_LIBS
75+
"$<IF:$<TARGET_EXISTS:iceberg_shared>,iceberg_shared,iceberg_static>"
76+
"$<IF:$<TARGET_EXISTS:Arrow::arrow_shared>,Arrow::arrow_shared,Arrow::arrow_static>"
77+
"$<IF:$<TARGET_EXISTS:Avro::avrocpp_shared>,Avro::avrocpp_shared,Avro::avrocpp_static>"
78+
)
79+
80+
list(APPEND
81+
ICEBERG_BUNDLE_STATIC_INSTALL_INTERFACE_LIBS
82+
"$<IF:$<TARGET_EXISTS:Iceberg::iceberg_static>,Iceberg::iceberg_static,Iceberg::iceberg_shared>"
83+
"$<IF:$<BOOL:${ARROW_VENDORED}>,Iceberg::arrow_static,$<IF:$<TARGET_EXISTS:Arrow::arrow_static>,Arrow::arrow_static,Arrow::arrow_shared>>"
84+
"$<IF:$<BOOL:${AVRO_VENDORED}>,Iceberg::avrocpp_s,$<IF:$<TARGET_EXISTS:Avro::avrocpp_static>,Avro::avrocpp_static,Avro::avrocpp_shared>>"
85+
)
86+
list(APPEND
87+
ICEBERG_BUNDLE_SHARED_INSTALL_INTERFACE_LIBS
88+
"$<IF:$<TARGET_EXISTS:Iceberg::iceberg_shared>,Iceberg::iceberg_shared,Iceberg::iceberg_static>"
89+
"$<IF:$<BOOL:${ARROW_VENDORED}>,Iceberg::arrow_static,$<IF:$<TARGET_EXISTS:Arrow::arrow_shared>,Arrow::arrow_shared,Arrow::arrow_static>>"
90+
"$<IF:$<BOOL:${AVRO_VENDORED}>,Iceberg::avrocpp_s,$<IF:$<TARGET_EXISTS:Avro::avrocpp_shared>,Avro::avrocpp_shared,Avro::avrocpp_static>>"
91+
)
92+
93+
add_iceberg_lib(iceberg_bundle
94+
SOURCES
95+
${ICEBERG_BUNDLE_SOURCES}
96+
SHARED_LINK_LIBS
97+
${ICEBERG_BUNDLE_SHARED_BUILD_INTERFACE_LIBS}
98+
STATIC_LINK_LIBS
99+
${ICEBERG_BUNDLE_STATIC_BUILD_INTERFACE_LIBS}
100+
STATIC_INSTALL_INTERFACE_LIBS
101+
${ICEBERG_BUNDLE_STATIC_INSTALL_INTERFACE_LIBS}
102+
SHARED_INSTALL_INTERFACE_LIBS
103+
${ICEBERG_BUNDLE_SHARED_INSTALL_INTERFACE_LIBS})
104+
105+
add_subdirectory(arrow)
106+
add_subdirectory(avro)
107+
108+
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/iceberg_bundle_export.h
109+
DESTINATION ${ICEBERG_INSTALL_INCLUDEDIR}/iceberg)
110+
endif()
59111

60112
iceberg_install_cmake_package(Iceberg iceberg_targets)

src/iceberg/IcebergConfig.cmake.in

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,8 @@
2424
#
2525
# Iceberg::iceberg_shared
2626
# Iceberg::iceberg_static
27-
# Iceberg::iceberg_puffin_shared
28-
# Iceberg::iceberg_puffin_static
29-
# Iceberg::iceberg_arrow_shared
30-
# Iceberg::iceberg_arrow_static
27+
# Iceberg::iceberg_bundle_shared
28+
# Iceberg::iceberg_bundle_static
3129

3230
@PACKAGE_INIT@
3331

src/iceberg/arrow/CMakeLists.txt

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -15,61 +15,4 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18-
if(NOT ICEBERG_ARROW)
19-
return()
20-
endif()
21-
22-
set(ICEBERG_ARROW_SOURCES demo_arrow.cc)
23-
24-
# Libraries to link with exported libiceberg_arrow.{so,a}.
25-
set(ICEBERG_ARROW_STATIC_BUILD_INTERFACE_LIBS)
26-
set(ICEBERG_ARROW_SHARED_BUILD_INTERFACE_LIBS)
27-
set(ICEBERG_ARROW_STATIC_INSTALL_INTERFACE_LIBS)
28-
set(ICEBERG_ARROW_SHARED_INSTALL_INTERFACE_LIBS)
29-
30-
list(APPEND ICEBERG_ARROW_STATIC_BUILD_INTERFACE_LIBS
31-
"$<IF:$<TARGET_EXISTS:iceberg_static>,iceberg_static,iceberg_shared>"
32-
"$<IF:$<TARGET_EXISTS:Arrow::arrow_static>,Arrow::arrow_static,Arrow::arrow_shared>")
33-
list(APPEND ICEBERG_ARROW_SHARED_BUILD_INTERFACE_LIBS
34-
"$<IF:$<TARGET_EXISTS:iceberg_shared>,iceberg_shared,iceberg_static>"
35-
"$<IF:$<TARGET_EXISTS:Arrow::arrow_shared>,Arrow::arrow_shared,Arrow::arrow_static>")
36-
37-
if(ARROW_VENDORED)
38-
list(APPEND ICEBERG_ARROW_STATIC_INSTALL_INTERFACE_LIBS Iceberg::arrow_static)
39-
list(APPEND ICEBERG_ARROW_SHARED_INSTALL_INTERFACE_LIBS Iceberg::arrow_static)
40-
else()
41-
list(APPEND
42-
ICEBERG_ARROW_STATIC_INSTALL_INTERFACE_LIBS
43-
"$<IF:$<TARGET_EXISTS:Arrow::arrow_static>,Arrow::arrow_static,Arrow::arrow_shared>"
44-
)
45-
list(APPEND
46-
ICEBERG_ARROW_SHARED_INSTALL_INTERFACE_LIBS
47-
"$<IF:$<TARGET_EXISTS:Arrow::arrow_shared>,Arrow::arrow_shared,Arrow::arrow_static>"
48-
)
49-
endif()
50-
51-
list(APPEND
52-
ICEBERG_ARROW_STATIC_INSTALL_INTERFACE_LIBS
53-
"$<IF:$<TARGET_EXISTS:Iceberg::iceberg_static>,Iceberg::iceberg_static,Iceberg::iceberg_shared>"
54-
)
55-
list(APPEND
56-
ICEBERG_ARROW_SHARED_INSTALL_INTERFACE_LIBS
57-
"$<IF:$<TARGET_EXISTS:Iceberg::iceberg_shared>,Iceberg::iceberg_shared,Iceberg::iceberg_static>"
58-
)
59-
60-
add_iceberg_lib(iceberg_arrow
61-
SOURCES
62-
${ICEBERG_ARROW_SOURCES}
63-
SHARED_LINK_LIBS
64-
${ICEBERG_ARROW_SHARED_BUILD_INTERFACE_LIBS}
65-
STATIC_LINK_LIBS
66-
${ICEBERG_ARROW_STATIC_BUILD_INTERFACE_LIBS}
67-
STATIC_INSTALL_INTERFACE_LIBS
68-
${ICEBERG_ARROW_STATIC_INSTALL_INTERFACE_LIBS}
69-
SHARED_INSTALL_INTERFACE_LIBS
70-
${ICEBERG_ARROW_SHARED_INSTALL_INTERFACE_LIBS})
71-
7218
iceberg_install_all_headers(iceberg/arrow)
73-
74-
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/iceberg_arrow_export.h
75-
DESTINATION ${ICEBERG_INSTALL_INCLUDEDIR}/iceberg/arrow)

src/iceberg/arrow/demo_arrow.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@
2121

2222
#include <string>
2323

24-
#include "iceberg/arrow/iceberg_arrow_export.h"
2524
#include "iceberg/demo.h"
25+
#include "iceberg/iceberg_bundle_export.h"
2626

2727
namespace iceberg::arrow {
2828

29-
class ICEBERG_ARROW_EXPORT DemoArrow : public Demo {
29+
class ICEBERG_BUNDLE_EXPORT DemoArrow : public Demo {
3030
public:
3131
DemoArrow() = default;
3232
~DemoArrow() override = default;

src/iceberg/avro/CMakeLists.txt

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -15,65 +15,4 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18-
if(NOT ICEBERG_AVRO)
19-
return()
20-
endif()
21-
22-
set(ICEBERG_AVRO_SOURCES demo_avro.cc)
23-
24-
# Libraries to link with exported libiceberg_avro.{so,a}.
25-
set(ICEBERG_AVRO_STATIC_BUILD_INTERFACE_LIBS)
26-
set(ICEBERG_AVRO_SHARED_BUILD_INTERFACE_LIBS)
27-
set(ICEBERG_AVRO_STATIC_INSTALL_INTERFACE_LIBS)
28-
set(ICEBERG_AVRO_SHARED_INSTALL_INTERFACE_LIBS)
29-
30-
list(APPEND
31-
ICEBERG_AVRO_STATIC_BUILD_INTERFACE_LIBS
32-
"$<IF:$<TARGET_EXISTS:iceberg_static>,iceberg_static,iceberg_shared>"
33-
"$<IF:$<TARGET_EXISTS:Avro::avrocpp_static>,Avro::avrocpp_static,Avro::avrocpp_shared>"
34-
)
35-
list(APPEND
36-
ICEBERG_AVRO_SHARED_BUILD_INTERFACE_LIBS
37-
"$<IF:$<TARGET_EXISTS:iceberg_shared>,iceberg_shared,iceberg_static>"
38-
"$<IF:$<TARGET_EXISTS:Avro::avrocpp_shared>,Avro::avrocpp_shared,Avro::avrocpp_static>"
39-
)
40-
41-
if(AVRO_VENDORED)
42-
list(APPEND ICEBERG_AVRO_STATIC_INSTALL_INTERFACE_LIBS Iceberg::avrocpp_s)
43-
list(APPEND ICEBERG_AVRO_SHARED_INSTALL_INTERFACE_LIBS Iceberg::avrocpp_s)
44-
else()
45-
list(APPEND
46-
ICEBERG_AVRO_STATIC_INSTALL_INTERFACE_LIBS
47-
"$<IF:$<TARGET_EXISTS:Avro::avrocpp_static>,Avro::avrocpp_static,Avro::avrocpp_shared>"
48-
)
49-
list(APPEND
50-
ICEBERG_AVRO_SHARED_INSTALL_INTERFACE_LIBS
51-
"$<IF:$<TARGET_EXISTS:Avro::avrocpp_shared>,Avro::avrocpp_shared,Avro::avrocpp_static>"
52-
)
53-
endif()
54-
55-
list(APPEND
56-
ICEBERG_AVRO_STATIC_INSTALL_INTERFACE_LIBS
57-
"$<IF:$<TARGET_EXISTS:Iceberg::iceberg_static>,Iceberg::iceberg_static,Iceberg::iceberg_shared>"
58-
)
59-
list(APPEND
60-
ICEBERG_AVRO_SHARED_INSTALL_INTERFACE_LIBS
61-
"$<IF:$<TARGET_EXISTS:Iceberg::iceberg_shared>,Iceberg::iceberg_shared,Iceberg::iceberg_static>"
62-
)
63-
64-
add_iceberg_lib(iceberg_avro
65-
SOURCES
66-
${ICEBERG_AVRO_SOURCES}
67-
SHARED_LINK_LIBS
68-
${ICEBERG_AVRO_SHARED_BUILD_INTERFACE_LIBS}
69-
STATIC_LINK_LIBS
70-
${ICEBERG_AVRO_STATIC_BUILD_INTERFACE_LIBS}
71-
STATIC_INSTALL_INTERFACE_LIBS
72-
${ICEBERG_AVRO_STATIC_INSTALL_INTERFACE_LIBS}
73-
SHARED_INSTALL_INTERFACE_LIBS
74-
${ICEBERG_AVRO_SHARED_INSTALL_INTERFACE_LIBS})
75-
7618
iceberg_install_all_headers(iceberg/avro)
77-
78-
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/iceberg_avro_export.h
79-
DESTINATION ${ICEBERG_INSTALL_INCLUDEDIR}/iceberg/avro)

0 commit comments

Comments
 (0)