Skip to content

Commit 0186975

Browse files
committed
fix: build unit tests with shared library
1 parent 1a56283 commit 0186975

28 files changed

+375
-171
lines changed

CMakeLists.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,25 @@ option(ICEBERG_BUILD_REST_INTEGRATION_TESTS "Build rest catalog integration test
4646
option(ICEBERG_ENABLE_ASAN "Enable Address Sanitizer" OFF)
4747
option(ICEBERG_ENABLE_UBSAN "Enable Undefined Behavior Sanitizer" OFF)
4848

49+
if(ICEBERG_BUILD_SHARED)
50+
set(ICEBERG_TEST_LINKAGE_DEFAULT "shared")
51+
else()
52+
set(ICEBERG_TEST_LINKAGE_DEFAULT "static")
53+
endif()
54+
set(ICEBERG_TEST_LINKAGE
55+
${ICEBERG_TEST_LINKAGE_DEFAULT}
56+
CACHE STRING "Linkage of Iceberg libraries with unit tests executables")
57+
if(ICEBERG_BUILD_TESTS)
58+
if(ICEBERG_TEST_LINKAGE STREQUAL "shared" AND NOT ICEBERG_BUILD_SHARED)
59+
message(FATAL_ERROR "If using ICEBERG_TEST_LINKAGE=shared, must also pass ICEBERG_BUILD_SHARED=ON"
60+
)
61+
endif()
62+
if(ICEBERG_TEST_LINKAGE STREQUAL "static" AND NOT ICEBERG_BUILD_STATIC)
63+
message(FATAL_ERROR "If using ICEBERG_TEST_LINKAGE=static, must also pass ICEBERG_BUILD_STATIC=ON"
64+
)
65+
endif()
66+
endif()
67+
4968
include(GNUInstallDirs)
5069
include(FetchContent)
5170

cmake_modules/IcebergThirdpartyToolchain.cmake

Lines changed: 108 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ endmacro()
8383
function(resolve_arrow_dependency)
8484
prepare_fetchcontent()
8585

86-
set(ARROW_BUILD_SHARED OFF)
87-
set(ARROW_BUILD_STATIC ON)
86+
set(ARROW_BUILD_SHARED ${ICEBERG_BUILD_SHARED})
87+
set(ARROW_BUILD_STATIC ${ICEBERG_BUILD_STATIC})
8888
# Work around undefined symbol: arrow::ipc::ReadSchema(arrow::io::InputStream*, arrow::ipc::DictionaryMemo*)
8989
set(ARROW_IPC ON)
9090
set(ARROW_FILESYSTEM ON)
@@ -113,43 +113,74 @@ function(resolve_arrow_dependency)
113113
fetchcontent_makeavailable(VendoredArrow)
114114

115115
if(vendoredarrow_SOURCE_DIR)
116-
if(NOT TARGET Arrow::arrow_static)
117-
add_library(Arrow::arrow_static INTERFACE IMPORTED)
118-
target_link_libraries(Arrow::arrow_static INTERFACE arrow_static)
119-
target_include_directories(Arrow::arrow_static
120-
INTERFACE ${vendoredarrow_BINARY_DIR}/src
121-
${vendoredarrow_SOURCE_DIR}/cpp/src)
116+
if(ARROW_BUILD_STATIC)
117+
if(NOT TARGET Arrow::arrow_static)
118+
add_library(Arrow::arrow_static INTERFACE IMPORTED)
119+
target_link_libraries(Arrow::arrow_static INTERFACE arrow_static)
120+
target_include_directories(Arrow::arrow_static
121+
INTERFACE ${vendoredarrow_BINARY_DIR}/src
122+
${vendoredarrow_SOURCE_DIR}/cpp/src)
123+
endif()
124+
125+
if(NOT TARGET Parquet::parquet_static)
126+
add_library(Parquet::parquet_static INTERFACE IMPORTED)
127+
target_link_libraries(Parquet::parquet_static INTERFACE parquet_static)
128+
target_include_directories(Parquet::parquet_static
129+
INTERFACE ${vendoredarrow_BINARY_DIR}/src
130+
${vendoredarrow_SOURCE_DIR}/cpp/src)
131+
endif()
132+
133+
set_target_properties(arrow_static PROPERTIES OUTPUT_NAME
134+
"iceberg_vendored_arrow_static")
135+
set_target_properties(parquet_static PROPERTIES OUTPUT_NAME
136+
"iceberg_vendored_parquet_static")
137+
install(TARGETS arrow_static parquet_static
138+
EXPORT iceberg_targets
139+
RUNTIME DESTINATION "${ICEBERG_INSTALL_BINDIR}"
140+
ARCHIVE DESTINATION "${ICEBERG_INSTALL_LIBDIR}"
141+
LIBRARY DESTINATION "${ICEBERG_INSTALL_LIBDIR}")
142+
143+
if(TARGET arrow_bundled_dependencies)
144+
message(STATUS "arrow_bundled_dependencies found")
145+
# arrow_bundled_dependencies is only INSTALL_INTERFACE and will not be built by default.
146+
# We need to add it as a dependency to arrow_static so that it will be built.
147+
add_dependencies(arrow_static arrow_bundled_dependencies)
148+
# We cannot install an IMPORTED target, so we need to install the library manually.
149+
get_target_property(arrow_bundled_dependencies_location
150+
arrow_bundled_dependencies IMPORTED_LOCATION)
151+
install(FILES ${arrow_bundled_dependencies_location}
152+
DESTINATION ${ICEBERG_INSTALL_LIBDIR})
153+
endif()
122154
endif()
123155

124-
if(NOT TARGET Parquet::parquet_static)
125-
add_library(Parquet::parquet_static INTERFACE IMPORTED)
126-
target_link_libraries(Parquet::parquet_static INTERFACE parquet_static)
127-
target_include_directories(Parquet::parquet_static
128-
INTERFACE ${vendoredarrow_BINARY_DIR}/src
129-
${vendoredarrow_SOURCE_DIR}/cpp/src)
156+
if(ARROW_BUILD_SHARED)
157+
if(NOT TARGET Arrow::arrow_shared)
158+
add_library(Arrow::arrow_shared INTERFACE IMPORTED)
159+
target_link_libraries(Arrow::arrow_shared INTERFACE arrow_shared)
160+
target_include_directories(Arrow::arrow_shared
161+
INTERFACE ${vendoredarrow_BINARY_DIR}/src
162+
${vendoredarrow_SOURCE_DIR}/cpp/src)
163+
endif()
164+
165+
if(NOT TARGET Parquet::parquet_shared)
166+
add_library(Parquet::parquet_shared INTERFACE IMPORTED)
167+
target_link_libraries(Parquet::parquet_shared INTERFACE parquet_shared)
168+
target_include_directories(Parquet::parquet_shared
169+
INTERFACE ${vendoredarrow_BINARY_DIR}/src
170+
${vendoredarrow_SOURCE_DIR}/cpp/src)
171+
endif()
172+
173+
set_target_properties(arrow_shared PROPERTIES OUTPUT_NAME "iceberg_vendored_arrow")
174+
set_target_properties(parquet_shared PROPERTIES OUTPUT_NAME
175+
"iceberg_vendored_parquet")
176+
install(TARGETS arrow_shared parquet_shared
177+
EXPORT iceberg_targets
178+
RUNTIME DESTINATION "${ICEBERG_INSTALL_BINDIR}"
179+
ARCHIVE DESTINATION "${ICEBERG_INSTALL_LIBDIR}"
180+
LIBRARY DESTINATION "${ICEBERG_INSTALL_LIBDIR}")
130181
endif()
131182

132183
set(ARROW_VENDORED TRUE)
133-
set_target_properties(arrow_static PROPERTIES OUTPUT_NAME "iceberg_vendored_arrow")
134-
set_target_properties(parquet_static PROPERTIES OUTPUT_NAME
135-
"iceberg_vendored_parquet")
136-
install(TARGETS arrow_static parquet_static
137-
EXPORT iceberg_targets
138-
RUNTIME DESTINATION "${ICEBERG_INSTALL_BINDIR}"
139-
ARCHIVE DESTINATION "${ICEBERG_INSTALL_LIBDIR}"
140-
LIBRARY DESTINATION "${ICEBERG_INSTALL_LIBDIR}")
141-
142-
if(TARGET arrow_bundled_dependencies)
143-
message(STATUS "arrow_bundled_dependencies found")
144-
# arrow_bundled_dependencies is only INSTALL_INTERFACE and will not be built by default.
145-
# We need to add it as a dependency to arrow_static so that it will be built.
146-
add_dependencies(arrow_static arrow_bundled_dependencies)
147-
# We cannot install an IMPORTED target, so we need to install the library manually.
148-
get_target_property(arrow_bundled_dependencies_location arrow_bundled_dependencies
149-
IMPORTED_LOCATION)
150-
install(FILES ${arrow_bundled_dependencies_location}
151-
DESTINATION ${ICEBERG_INSTALL_LIBDIR})
152-
endif()
153184
else()
154185
set(ARROW_VENDORED FALSE)
155186
list(APPEND ICEBERG_SYSTEM_DEPENDENCIES Arrow)
@@ -168,6 +199,8 @@ endfunction()
168199

169200
function(resolve_avro_dependency)
170201
prepare_fetchcontent()
202+
set(BUILD_SHARED_LIBS ${ICEBERG_BUILD_SHARED})
203+
set(BUILD_STATIC_LIBS ${ICEBERG_BUILD_STATIC})
171204

172205
set(AVRO_USE_BOOST
173206
OFF
@@ -221,28 +254,50 @@ function(resolve_avro_dependency)
221254
fetchcontent_makeavailable(avro-cpp)
222255

223256
if(avro-cpp_SOURCE_DIR)
224-
if(NOT TARGET avro-cpp::avrocpp_static)
225-
add_library(avro-cpp::avrocpp_static INTERFACE IMPORTED)
226-
target_link_libraries(avro-cpp::avrocpp_static INTERFACE avrocpp_s)
227-
target_include_directories(avro-cpp::avrocpp_static
228-
INTERFACE ${avro-cpp_BINARY_DIR}
229-
${avro-cpp_SOURCE_DIR}/lang/c++)
257+
if(BUILD_STATIC_LIBS)
258+
if(NOT TARGET avro-cpp::avrocpp_static)
259+
add_library(avro-cpp::avrocpp_static INTERFACE IMPORTED)
260+
target_link_libraries(avro-cpp::avrocpp_static INTERFACE avrocpp_s)
261+
target_include_directories(avro-cpp::avrocpp_static
262+
INTERFACE ${avro-cpp_BINARY_DIR}
263+
${avro-cpp_SOURCE_DIR}/lang/c++)
264+
endif()
265+
266+
set_target_properties(avrocpp_s PROPERTIES OUTPUT_NAME
267+
"iceberg_vendored_avrocpp_static")
268+
set_target_properties(avrocpp_s PROPERTIES POSITION_INDEPENDENT_CODE ON)
269+
install(TARGETS avrocpp_s
270+
EXPORT iceberg_targets
271+
RUNTIME DESTINATION "${ICEBERG_INSTALL_BINDIR}"
272+
ARCHIVE DESTINATION "${ICEBERG_INSTALL_LIBDIR}"
273+
LIBRARY DESTINATION "${ICEBERG_INSTALL_LIBDIR}")
274+
275+
# TODO: add vendored ZLIB and Snappy support
276+
find_package(Snappy CONFIG)
277+
if(Snappy_FOUND)
278+
list(APPEND ICEBERG_SYSTEM_DEPENDENCIES Snappy)
279+
endif()
230280
endif()
231281

232-
set(AVRO_VENDORED TRUE)
233-
set_target_properties(avrocpp_s PROPERTIES OUTPUT_NAME "iceberg_vendored_avrocpp")
234-
set_target_properties(avrocpp_s PROPERTIES POSITION_INDEPENDENT_CODE ON)
235-
install(TARGETS avrocpp_s
236-
EXPORT iceberg_targets
237-
RUNTIME DESTINATION "${ICEBERG_INSTALL_BINDIR}"
238-
ARCHIVE DESTINATION "${ICEBERG_INSTALL_LIBDIR}"
239-
LIBRARY DESTINATION "${ICEBERG_INSTALL_LIBDIR}")
240-
241-
# TODO: add vendored ZLIB and Snappy support
242-
find_package(Snappy CONFIG)
243-
if(Snappy_FOUND)
244-
list(APPEND ICEBERG_SYSTEM_DEPENDENCIES Snappy)
282+
if(BUILD_SHARED_LIBS)
283+
if(NOT TARGET avro-cpp::avrocpp_shared)
284+
add_library(avro-cpp::avrocpp_shared INTERFACE IMPORTED)
285+
target_link_libraries(avro-cpp::avrocpp_shared INTERFACE avrocpp)
286+
target_include_directories(avro-cpp::avrocpp_shared
287+
INTERFACE ${avro-cpp_BINARY_DIR}
288+
${avro-cpp_SOURCE_DIR}/lang/c++)
289+
endif()
290+
291+
set_target_properties(avrocpp PROPERTIES OUTPUT_NAME "iceberg_vendored_avrocpp")
292+
set_target_properties(avrocpp PROPERTIES POSITION_INDEPENDENT_CODE ON)
293+
install(TARGETS avrocpp
294+
EXPORT iceberg_targets
295+
RUNTIME DESTINATION "${ICEBERG_INSTALL_BINDIR}"
296+
ARCHIVE DESTINATION "${ICEBERG_INSTALL_LIBDIR}"
297+
LIBRARY DESTINATION "${ICEBERG_INSTALL_LIBDIR}")
245298
endif()
299+
300+
set(AVRO_VENDORED TRUE)
246301
else()
247302
set(AVRO_VENDORED FALSE)
248303
list(APPEND ICEBERG_SYSTEM_DEPENDENCIES Avro)

src/iceberg/CMakeLists.txt

Lines changed: 27 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -91,35 +91,31 @@ set(ICEBERG_SOURCES
9191

9292
set(ICEBERG_STATIC_BUILD_INTERFACE_LIBS)
9393
set(ICEBERG_SHARED_BUILD_INTERFACE_LIBS)
94+
set(ICEBERG_SHARED_PRIVATE_BUILD_INTERFACE_LIBS)
9495
set(ICEBERG_STATIC_INSTALL_INTERFACE_LIBS)
9596
set(ICEBERG_SHARED_INSTALL_INTERFACE_LIBS)
9697

9798
list(APPEND
9899
ICEBERG_STATIC_BUILD_INTERFACE_LIBS
99-
nanoarrow::nanoarrow_static
100+
nanoarrow::nanoarrow
100101
nlohmann_json::nlohmann_json
101102
roaring::roaring
102103
spdlog::spdlog
103104
ZLIB::ZLIB)
104105
list(APPEND
105-
ICEBERG_SHARED_BUILD_INTERFACE_LIBS
106-
nanoarrow::nanoarrow_shared
106+
ICEBERG_SHARED_PRIVATE_BUILD_INTERFACE_LIBS
107+
nanoarrow::nanoarrow
107108
nlohmann_json::nlohmann_json
108109
roaring::roaring
109110
spdlog::spdlog
110111
ZLIB::ZLIB)
111112
list(APPEND
112113
ICEBERG_STATIC_INSTALL_INTERFACE_LIBS
113-
"$<IF:$<BOOL:${NANOARROW_VENDORED}>,iceberg::nanoarrow_static,$<IF:$<TARGET_EXISTS:nanoarrow::nanoarrow_static>,nanoarrow::nanoarrow_static,nanoarrow::nanoarrow_shared>>"
114-
"$<IF:$<BOOL:${NLOHMANN_JSON_VENDORED}>,iceberg::nlohmann_json,$<IF:$<TARGET_EXISTS:nlohmann_json::nlohmann_json>,nlohmann_json::nlohmann_json,nlohmann_json::nlohmann_json>>"
114+
"$<IF:$<BOOL:${NANOARROW_VENDORED}>,iceberg::nanoarrow_static,nanoarrow::nanoarrow>"
115+
"$<IF:$<BOOL:${NLOHMANN_JSON_VENDORED}>,iceberg::nlohmann_json,nlohmann_json::nlohmann_json>"
115116
"$<IF:$<BOOL:${CROARING_VENDORED}>,iceberg::roaring,roaring::roaring>"
116-
"$<IF:$<BOOL:${SPDLOG_VENDORED}>,iceberg::spdlog,spdlog::spdlog>")
117-
list(APPEND
118-
ICEBERG_SHARED_INSTALL_INTERFACE_LIBS
119-
"$<IF:$<BOOL:${NANOARROW_VENDORED}>,iceberg::nanoarrow_shared,$<IF:$<TARGET_EXISTS:nanoarrow::nanoarrow_shared>,nanoarrow::nanoarrow_shared,nanoarrow::nanoarrow_static>>"
120-
"$<IF:$<BOOL:${NLOHMANN_JSON_VENDORED}>,iceberg::nlohmann_json,$<IF:$<TARGET_EXISTS:nlohmann_json::nlohmann_json>,nlohmann_json::nlohmann_json,nlohmann_json::nlohmann_json>>"
121-
"$<IF:$<BOOL:${CROARING_VENDORED}>,iceberg::roaring,roaring::roaring>"
122-
"$<IF:$<BOOL:${SPDLOG_VENDORED}>,iceberg::spdlog,spdlog::spdlog>")
117+
"$<IF:$<BOOL:${SPDLOG_VENDORED}>,iceberg::spdlog,spdlog::spdlog>"
118+
ZLIB::ZLIB)
123119

124120
add_iceberg_lib(iceberg
125121
SOURCES
@@ -128,6 +124,8 @@ add_iceberg_lib(iceberg
128124
${ICEBERG_INCLUDES}
129125
SHARED_LINK_LIBS
130126
${ICEBERG_SHARED_BUILD_INTERFACE_LIBS}
127+
SHARED_PRIVATE_LINK_LIBS
128+
${ICEBERG_SHARED_PRIVATE_BUILD_INTERFACE_LIBS}
131129
STATIC_LINK_LIBS
132130
${ICEBERG_STATIC_BUILD_INTERFACE_LIBS}
133131
STATIC_INSTALL_INTERFACE_LIBS
@@ -165,44 +163,38 @@ if(ICEBERG_BUILD_BUNDLE)
165163
# Libraries to link with exported libiceberg_bundle.{so,a}.
166164
set(ICEBERG_BUNDLE_STATIC_BUILD_INTERFACE_LIBS)
167165
set(ICEBERG_BUNDLE_SHARED_BUILD_INTERFACE_LIBS)
166+
set(ICEBERG_BUNDLE_SHARED_PRIVATE_BUILD_INTERFACE_LIBS)
168167
set(ICEBERG_BUNDLE_STATIC_INSTALL_INTERFACE_LIBS)
169168
set(ICEBERG_BUNDLE_SHARED_INSTALL_INTERFACE_LIBS)
170169

171170
list(APPEND
172171
ICEBERG_BUNDLE_STATIC_BUILD_INTERFACE_LIBS
173-
"$<IF:$<TARGET_EXISTS:iceberg_static>,iceberg_static,iceberg_shared>"
174-
"$<IF:$<TARGET_EXISTS:Arrow::arrow_static>,Arrow::arrow_static,Arrow::arrow_shared>"
175-
"$<IF:$<TARGET_EXISTS:Parquet::parquet_static>,Parquet::parquet_static,Parquet::parquet_shared>"
176-
"$<IF:$<TARGET_EXISTS:avro-cpp::avrocpp_static>,avro-cpp::avrocpp_static,avro-cpp::avrocpp_shared>"
177-
)
172+
iceberg_static
173+
Arrow::arrow_static
174+
Parquet::parquet_static
175+
avro-cpp::avrocpp_static)
178176
list(APPEND
179177
ICEBERG_BUNDLE_SHARED_BUILD_INTERFACE_LIBS
180-
"$<IF:$<TARGET_EXISTS:iceberg_shared>,iceberg_shared,iceberg_static>"
181-
"$<IF:$<TARGET_EXISTS:Arrow::arrow_shared>,Arrow::arrow_shared,Arrow::arrow_static>"
182-
"$<IF:$<TARGET_EXISTS:Parquet::parquet_shared>,Parquet::parquet_shared,Parquet::parquet_static>"
183-
"$<IF:$<TARGET_EXISTS:avro-cpp::avrocpp_shared>,avro-cpp::avrocpp_shared,avro-cpp::avrocpp_static>"
184-
)
185-
178+
iceberg_shared
179+
Arrow::arrow_shared
180+
Parquet::parquet_shared
181+
avro-cpp::avrocpp_shared)
182+
list(APPEND ICEBERG_BUNDLE_SHARED_PRIVATE_BUILD_INTERFACE_LIBS nanoarrow::nanoarrow)
186183
list(APPEND
187184
ICEBERG_BUNDLE_STATIC_INSTALL_INTERFACE_LIBS
188-
"$<IF:$<TARGET_EXISTS:iceberg::iceberg_static>,iceberg::iceberg_static,iceberg::iceberg_shared>"
189-
"$<IF:$<BOOL:${ARROW_VENDORED}>,iceberg::arrow_static,$<IF:$<TARGET_EXISTS:Arrow::arrow_static>,Arrow::arrow_static,Arrow::arrow_shared>>"
190-
"$<IF:$<BOOL:${ARROW_VENDORED}>,iceberg::parquet_static,$<IF:$<TARGET_EXISTS:Parquet::parquet_static>,Parquet::parquet_static,Parquet::parquet_shared>>"
191-
"$<IF:$<BOOL:${AVRO_VENDORED}>,iceberg::avrocpp_s,$<IF:$<TARGET_EXISTS:avro-cpp::avrocpp_static>,avro-cpp::avrocpp_static,avro-cpp::avrocpp_shared>>"
192-
)
193-
list(APPEND
194-
ICEBERG_BUNDLE_SHARED_INSTALL_INTERFACE_LIBS
195-
"$<IF:$<TARGET_EXISTS:iceberg::iceberg_shared>,iceberg::iceberg_shared,iceberg::iceberg_static>"
196-
"$<IF:$<BOOL:${ARROW_VENDORED}>,iceberg::arrow_static,$<IF:$<TARGET_EXISTS:Arrow::arrow_shared>,Arrow::arrow_shared,Arrow::arrow_static>>"
197-
"$<IF:$<BOOL:${ARROW_VENDORED}>,iceberg::parquet_static,$<IF:$<TARGET_EXISTS:Parquet::parquet_shared>,Parquet::parquet_shared,Parquet::parquet_static>>"
198-
"$<IF:$<BOOL:${AVRO_VENDORED}>,iceberg::avrocpp_s,$<IF:$<TARGET_EXISTS:avro-cpp::avrocpp_shared>,avro-cpp::avrocpp_shared,avro-cpp::avrocpp_static>>"
199-
)
185+
iceberg::iceberg_static
186+
"$<IF:$<BOOL:${ARROW_VENDORED}>,iceberg::arrow_static,Arrow::arrow_static>"
187+
"$<IF:$<BOOL:${ARROW_VENDORED}>,iceberg::parquet_static,Parquet::parquet_static>"
188+
"$<IF:$<BOOL:${AVRO_VENDORED}>,iceberg::avrocpp_s,avro-cpp::avrocpp_static>")
189+
list(APPEND ICEBERG_BUNDLE_SHARED_INSTALL_INTERFACE_LIBS iceberg::iceberg_shared)
200190

201191
add_iceberg_lib(iceberg_bundle
202192
SOURCES
203193
${ICEBERG_BUNDLE_SOURCES}
204194
SHARED_LINK_LIBS
205195
${ICEBERG_BUNDLE_SHARED_BUILD_INTERFACE_LIBS}
196+
SHARED_PRIVATE_LINK_LIBS
197+
${ICEBERG_BUNDLE_SHARED_PRIVATE_BUILD_INTERFACE_LIBS}
206198
STATIC_LINK_LIBS
207199
${ICEBERG_BUNDLE_STATIC_BUILD_INTERFACE_LIBS}
208200
STATIC_INSTALL_INTERFACE_LIBS

src/iceberg/arrow_c_data_guard_internal.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
#include "iceberg/arrow_c_data_guard_internal.h"
2121

22+
#include <nanoarrow/nanoarrow.h>
23+
2224
namespace iceberg::internal {
2325

2426
ArrowArrayGuard::~ArrowArrayGuard() {

src/iceberg/arrow_c_data_guard_internal.h

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,16 @@
1919

2020
#pragma once
2121

22-
#include <nanoarrow/nanoarrow.h>
22+
#include "iceberg/iceberg_export.h"
2323

24-
#include "iceberg/arrow_c_data.h"
24+
struct ArrowArray;
25+
struct ArrowArrayView;
26+
struct ArrowBuffer;
27+
struct ArrowSchema;
2528

2629
namespace iceberg::internal {
2730

28-
class ArrowArrayGuard {
31+
class ICEBERG_EXPORT ArrowArrayGuard {
2932
public:
3033
explicit ArrowArrayGuard(ArrowArray* array) : array_(array) {}
3134
~ArrowArrayGuard();
@@ -34,7 +37,7 @@ class ArrowArrayGuard {
3437
ArrowArray* array_;
3538
};
3639

37-
class ArrowSchemaGuard {
40+
class ICEBERG_EXPORT ArrowSchemaGuard {
3841
public:
3942
explicit ArrowSchemaGuard(ArrowSchema* schema) : schema_(schema) {}
4043
~ArrowSchemaGuard();
@@ -43,7 +46,7 @@ class ArrowSchemaGuard {
4346
ArrowSchema* schema_;
4447
};
4548

46-
class ArrowArrayViewGuard {
49+
class ICEBERG_EXPORT ArrowArrayViewGuard {
4750
public:
4851
explicit ArrowArrayViewGuard(ArrowArrayView* view) : view_(view) {}
4952
~ArrowArrayViewGuard();
@@ -52,7 +55,7 @@ class ArrowArrayViewGuard {
5255
ArrowArrayView* view_;
5356
};
5457

55-
class ArrowArrayBufferGuard {
58+
class ICEBERG_EXPORT ArrowArrayBufferGuard {
5659
public:
5760
explicit ArrowArrayBufferGuard(ArrowBuffer* buffer) : buffer_(buffer) {}
5861
~ArrowArrayBufferGuard();

0 commit comments

Comments
 (0)