Skip to content

Commit

Permalink
Enable building libcurl with zstd support
Browse files Browse the repository at this point in the history
This adds support for curl to enable zstd compression in linux/macos builds.
Windows uses cmake for building and the curl cmake does not allow for
setting the library paths for zstd. This means the windows superbuild is
not supported. For now we just enable on linux/macos.

The goal of enable zstd to is to allow this as an option for http compression.
  • Loading branch information
Shelnutt2 committed Aug 20, 2022
1 parent dae5d97 commit e47ab64
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
16 changes: 16 additions & 0 deletions cmake/Modules/FindCurl_EP.cmake
Expand Up @@ -88,6 +88,9 @@ if (NOT CURL_FOUND AND TILEDB_SUPERBUILD)
-DCURL_STATICLIB=ON
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
-DHTTP_ONLY=ON
# NOTE: as of Curl 7.74 there is no way to set ZSTD paths for cmake
# ZSTD is not enabled until curl support being able to point to superbuild
#-DCURL_ZSTD=ON
"${WITH_SSL}"
"-DCMAKE_C_FLAGS=${CFLAGS_DEF}"
UPDATE_COMMAND ""
Expand Down Expand Up @@ -129,6 +132,18 @@ if (NOT CURL_FOUND AND TILEDB_SUPERBUILD)
set(WITH_ZLIB "--with-zlib")
endif()

if (TARGET ep_zstd)
list(APPEND DEPENDS ep_zstd)
set(WITH_ZLIB "--with-zstd=${TILEDB_EP_INSTALL_PREFIX}")
elseif (TILEDB_ZSTD_DIR)
# ensure that curl links against the same libz
set(WITH_ZSTD "--with-zstd=${TILEDB_ZSTD_DIR}")
else()
message(WARNING "TileDB FindZstd_EP did not set TILEDB_ZSTD_DIR. Falling back to autotools detection.")
# ensure that curl config errors out if SSL not available
set(WITH_ZSTD "--with-zstd")
endif()

# Support cross compilation of MacOS
if (CMAKE_OSX_ARCHITECTURES STREQUAL arm64)
set(CURL_CROSS_COMPILATION_FLAGS "CFLAGS=${CFLAGS} -arch arm64" "LDFLAGS=${LDFLAGS} -arch arm64" --host=aarch64-apple-darwin)
Expand Down Expand Up @@ -181,6 +196,7 @@ if (NOT CURL_FOUND AND TILEDB_SUPERBUILD)
--disable-tftp
${WITH_SSL}
${WITH_ZLIB}
${WITH_ZSTD}
${CURL_CROSS_COMPILATION_FLAGS}
BUILD_IN_SOURCE TRUE
BUILD_COMMAND $(MAKE)
Expand Down
1 change: 1 addition & 0 deletions cmake/Modules/FindZstd_EP.cmake
Expand Up @@ -107,6 +107,7 @@ if (NOT ZSTD_FOUND)
LOG_OUTPUT_ON_FAILURE ${TILEDB_LOG_OUTPUT_ON_FAILURE}
)
list(APPEND TILEDB_EXTERNAL_PROJECTS ep_zstd)
set(TILEDB_ZSTD_DIR "${TILEDB_EP_INSTALL_PREFIX}")
else()
message(FATAL_ERROR "Unable to find Zstd")
endif()
Expand Down

0 comments on commit e47ab64

Please sign in to comment.