Skip to content

Commit

Permalink
link zstd
Browse files Browse the repository at this point in the history
  • Loading branch information
lnkuiper committed Oct 29, 2024
1 parent 51dfefd commit 4e52278
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 40 deletions.
36 changes: 3 additions & 33 deletions extension/parquet/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,8 @@ cmake_minimum_required(VERSION 3.5...3.29)
project(ParquetExtension)

include_directories(
include
../../third_party/lz4
../../third_party/parquet
../../third_party/thrift
../../third_party/snappy
../../third_party/zstd/include
../../third_party/mbedtls
../../third_party/mbedtls/include
include ../../third_party/lz4 ../../third_party/parquet
../../third_party/thrift ../../third_party/snappy
../../third_party/brotli/include)

set(PARQUET_EXTENSION_FILES
Expand Down Expand Up @@ -40,30 +34,6 @@ if(NOT CLANG_TIDY)
# lz4
set(PARQUET_EXTENSION_FILES ${PARQUET_EXTENSION_FILES}
../../third_party/lz4/lz4.cpp)
# zstd
set(PARQUET_EXTENSION_FILES
${PARQUET_EXTENSION_FILES}
../../third_party/zstd/common/entropy_common.cpp
../../third_party/zstd/common/fse_decompress.cpp
../../third_party/zstd/common/zstd_common.cpp
../../third_party/zstd/common/error_private.cpp
../../third_party/zstd/common/xxhash.cpp
../../third_party/zstd/decompress/zstd_ddict.cpp
../../third_party/zstd/decompress/huf_decompress.cpp
../../third_party/zstd/decompress/zstd_decompress.cpp
../../third_party/zstd/decompress/zstd_decompress_block.cpp
../../third_party/zstd/compress/fse_compress.cpp
../../third_party/zstd/compress/hist.cpp
../../third_party/zstd/compress/huf_compress.cpp
../../third_party/zstd/compress/zstd_compress.cpp
../../third_party/zstd/compress/zstd_compress_literals.cpp
../../third_party/zstd/compress/zstd_compress_sequences.cpp
../../third_party/zstd/compress/zstd_compress_superblock.cpp
../../third_party/zstd/compress/zstd_double_fast.cpp
../../third_party/zstd/compress/zstd_fast.cpp
../../third_party/zstd/compress/zstd_lazy.cpp
../../third_party/zstd/compress/zstd_ldm.cpp
../../third_party/zstd/compress/zstd_opt.cpp)
# brotli
set(PARQUET_EXTENSION_FILES
${PARQUET_EXTENSION_FILES}
Expand Down Expand Up @@ -103,7 +73,7 @@ endif()
build_static_extension(parquet ${PARQUET_EXTENSION_FILES})
set(PARAMETERS "-warnings")
build_loadable_extension(parquet ${PARAMETERS} ${PARQUET_EXTENSION_FILES})
target_link_libraries(parquet_loadable_extension duckdb_mbedtls)
target_link_libraries(parquet_loadable_extension duckdb_mbedtls duckdb_zstd)

install(
TARGETS parquet_extension
Expand Down
3 changes: 2 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ else()
duckdb_fastpforlib
duckdb_skiplistlib
duckdb_mbedtls
duckdb_yyjson)
duckdb_yyjson
duckdb_zstd)

add_library(duckdb SHARED ${ALL_OBJECT_FILES})

Expand Down
4 changes: 2 additions & 2 deletions third_party/zstd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ set(ZSTD_FILES
add_library(duckdb_zstd STATIC ${ZSTD_FILES})

target_include_directories(
duckdb_zstd
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
duckdb_zstd
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
set_target_properties(duckdb_zstd PROPERTIES EXPORT_NAME duckdb_duckdb_zstd)

install(TARGETS duckdb_zstd
Expand Down
2 changes: 2 additions & 0 deletions third_party/zstd/include/zstd.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
#define ZSTD_H_235446

// DuckDB: just enable everything for amalgamation
#ifdef DUCKDB_AMALGAMATION
#define ZSTD_STATIC_LINKING_ONLY
#endif

/* ====== Dependencies ======*/
#include <limits.h> /* INT_MAX */
Expand Down
3 changes: 0 additions & 3 deletions third_party/zstd/include/zstd/common/fse.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@
* Dependencies
******************************************/

// DuckDB: just enable everything for amalgamation
#define FSE_STATIC_LINKING_ONLY

#include "zstd/common/zstd_deps.h" /* size_t, ptrdiff_t */

namespace duckdb_zstd {
Expand Down
1 change: 1 addition & 0 deletions third_party/zstd/include/zstd/common/zstd_deps.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#define ZSTD_DEPS_NEED_IO
#define ZSTD_DEPS_NEED_STDINT
#define ZSTD_MULTITHREAD
#define FSE_STATIC_LINKING_ONLY
#endif

#if defined(__GNUC__) && __GNUC__ >= 4
Expand Down
2 changes: 1 addition & 1 deletion third_party/zstd/include/zstd/deprecated/zbuff.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
/* *************************************
* Dependencies
***************************************/
// DuckDB: just enable everything for amalgamation
// DuckDB: just enable everything
#define ZSTD_STATIC_LINKING_ONLY

#include <stddef.h> /* size_t */
Expand Down

0 comments on commit 4e52278

Please sign in to comment.