Skip to content

Commit

Permalink
feat: Avoid downloading precompiled third-party and zetasql package i…
Browse files Browse the repository at this point in the history
…n CMakeList.txt in third-party dir when envs are set.

Signed-off-by: shouren <[email protected]>
  • Loading branch information
Shouren committed Dec 19, 2024
1 parent fb5e181 commit dea0567
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ on:

jobs:
coverage:
runs-on: ubuntu-20.04
runs-on: ghcr.io/4paradigm/hybridsql:latest
env:
CTEST_PARALLEL_LEVEL: 1 # parallel test level for ctest (make test)
CMAKE_BUILD_TYPE: Debug
Expand Down
35 changes: 19 additions & 16 deletions third-party/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,23 +117,26 @@ endif()

# Fetch hybridsql asserts
if(NOT BUILD_BUNDLED)
init_hybridsql_thirdparty_urls()

message(STATUS "Download pre-compiled hybridsql assert from ${HYBRIDSQL_ASSERTS_URL}")
if(CMAKE_SYSTEM_PROCESSOR MATCHES "(arm64)|(ARM64)|(aarch64)|(AARCH64)")
message(WARNING pre-compiled hybridsql aseerts for arm64 may out-of-date, consider build from source by '-DBUILD_BUNDLED=ON')
if (DEFINED ENV{THIRDPARTY_VERSION} AND "$ENV{THIRDPARTY_VERSION}" STREQUAL "${HYBRIDSQL_ASSERTS_VERSION}")
message(STATUS "THIRDPARTY_VERSION matches HYBRIDSQL_ASSERTS_VERSION, skipping download.")
else()
init_hybridsql_thirdparty_urls()
message(STATUS "Download pre-compiled hybridsql assert from ${HYBRIDSQL_ASSERTS_URL}")
if(CMAKE_SYSTEM_PROCESSOR MATCHES "(arm64)|(ARM64)|(aarch64)|(AARCH64)")
message(WARNING pre-compiled hybridsql aseerts for arm64 may out-of-date, consider build from source by '-DBUILD_BUNDLED=ON')
endif()
ExternalProject_Add(
hybridsql-asserts
URL ${HYBRIDSQL_ASSERTS_URL}
URL_HASH SHA256=${HYBRIDSQL_ASSERTS_HASH}
PREFIX ${DEPS_BUILD_DIR}
DOWNLOAD_DIR "${DEPS_DOWNLOAD_DIR}/hybridsql-asserts"
DOWNLOAD_NO_EXTRACT True
INSTALL_DIR ${DEPS_INSTALL_DIR}
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND bash -c "tar xzf <DOWNLOADED_FILE> -C ${DEPS_INSTALL_DIR} --strip-components=1")
endif()
ExternalProject_Add(
hybridsql-asserts
URL ${HYBRIDSQL_ASSERTS_URL}
URL_HASH SHA256=${HYBRIDSQL_ASSERTS_HASH}
PREFIX ${DEPS_BUILD_DIR}
DOWNLOAD_DIR "${DEPS_DOWNLOAD_DIR}/hybridsql-asserts"
DOWNLOAD_NO_EXTRACT True
INSTALL_DIR ${DEPS_INSTALL_DIR}
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND bash -c "tar xzf <DOWNLOADED_FILE> -C ${DEPS_INSTALL_DIR} --strip-components=1")
endif()

if (BUILD_BUNDLED_GTEST)
Expand Down
31 changes: 17 additions & 14 deletions third-party/cmake/FetchZetasql.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,23 @@ endfunction()


if (NOT BUILD_BUNDLED_ZETASQL)
init_zetasql_urls()

message(STATUS "Download pre-compiled zetasql from ${ZETASQL_URL}")
# download pre-compiled zetasql from GitHub Release
ExternalProject_Add(zetasql
URL ${ZETASQL_URL}
URL_HASH SHA256=${ZETASQL_HASH}
PREFIX ${DEPS_BUILD_DIR}
DOWNLOAD_DIR "${DEPS_DOWNLOAD_DIR}/zetasql"
DOWNLOAD_NO_EXTRACT True
INSTALL_DIR ${DEPS_INSTALL_DIR}
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND bash -c "tar xzf <DOWNLOADED_FILE> -C ${DEPS_INSTALL_DIR} --strip-components=1")
if (DEFINED ENV{ZETASQL_VERSION} AND "$ENV{ZETASQL_VERSION}" STREQUAL "${ZETASQL_VERSION}")
message(STATUS "ZETASQL_VERSION from env matches ZETASQL_VERSION, skipping download.")
else()
init_zetasql_urls()
message(STATUS "Download pre-compiled zetasql from ${ZETASQL_URL}")
# download pre-compiled zetasql from GitHub Release
ExternalProject_Add(zetasql
URL ${ZETASQL_URL}
URL_HASH SHA256=${ZETASQL_HASH}
PREFIX ${DEPS_BUILD_DIR}
DOWNLOAD_DIR "${DEPS_DOWNLOAD_DIR}/zetasql"
DOWNLOAD_NO_EXTRACT True
INSTALL_DIR ${DEPS_INSTALL_DIR}
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND bash -c "tar xzf <DOWNLOADED_FILE> -C ${DEPS_INSTALL_DIR} --strip-components=1")
endif()
else()
find_program(BAZEL_EXE NAMES bazel REQUIRED DOC "Compile zetasql require bazel or bazelisk")
find_program(PYTHON_EXE NAMES python REQUIRED DOC "Compile zetasql require python")
Expand Down

0 comments on commit dea0567

Please sign in to comment.