Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[VL] Support custom cmake deps download url #3652

Merged
merged 1 commit into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions cpp/CMake/BuildGTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ set(GLUTEN_GTEST_SOURCE_URL
"https://github.com/google/googletest/archive/refs/tags/v${GLUTEN_GTEST_VERSION}.tar.gz"
)

if(DEFINED ENV{GLUTEN_GTEST_SOURCE_URL})
set(GLUTEN_GTEST_SOURCE_URL "$ENV{GLUTEN_GTEST_SOURCE_URL}")
endif()
resolve_dependency_url(GTEST)

message(STATUS "Building gtest from source")
FetchContent_Declare(
Expand Down
2 changes: 2 additions & 0 deletions cpp/CMake/BuildGflags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ string(CONCAT GLUTEN_GFLAGS_SOURCE_URL
"https://github.com/gflags/gflags/archive/refs/tags/"
"v${GLUTEN_GFLAGS_VERSION}.tar.gz")

resolve_dependency_url(GFLAGS)

message(STATUS "Building gflags from source")
FetchContent_Declare(
gflags
Expand Down
2 changes: 2 additions & 0 deletions cpp/CMake/BuildGlog.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ set(GLUTEN_GLOG_SOURCE_URL
"https://github.com/google/glog/archive/refs/tags/v${GLUTEN_GLOG_VERSION}.tar.gz"
)

resolve_dependency_url(GLOG)

message(STATUS "Building glog from source")
FetchContent_Declare(
glog
Expand Down
6 changes: 2 additions & 4 deletions cpp/CMake/BuildGoogleBenchmark.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,15 @@ set(GLUTEN_GBENCHMARK_SOURCE_URL
"https://github.com/ursa-labs/thirdparty/releases/download/latest/gbenchmark-${GLUTEN_GBENCHMARK_BUILD_VERSION}.tar.gz")
set(GLUTEN_GBENCHMARK_BUILD_SHA256_CHECKSUM "1f71c72ce08d2c1310011ea6436b31e39ccab8c2db94186d26657d41747c85d6")

if(DEFINED ENV{GLUTEN_GBENCHMARK_SOURCE_URL})
set(GLUTEN_GBENCHMARK_SOURCE_URL "$ENV{GLUTEN_GBENCHMARK_SOURCE_URL}")
endif()
resolve_dependency_url(GBENCHMARK)

set(GBENCHMARK_CMAKE_ARGS "-fPIC -w")

message(STATUS "Building google benchmark from source")
FetchContent_Declare(
gbenchmark
URL ${GLUTEN_GBENCHMARK_SOURCE_URL}
URL_HASH "SHA256=${GLUTEN_GBENCHMARK_BUILD_SHA256_CHECKSUM}"
URL_HASH "${GLUTEN_GBENCHMARK_BUILD_SHA256_CHECKSUM}"
)

if (NOT gbenchmark_POPULATED)
Expand Down
44 changes: 44 additions & 0 deletions cpp/CMake/ResolveDependency.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

function(set_with_default var_name envvar_name default)
if(DEFINED ENV{${envvar_name}})
set(${var_name}
$ENV{${envvar_name}}
PARENT_SCOPE)
else()
set(${var_name}
${default}
PARENT_SCOPE)
endif()
endfunction()

macro(resolve_dependency_url dependency_name)
# Prepend prefix for default checksum.
string(PREPEND GLUTEN_${dependency_name}_BUILD_SHA256_CHECKSUM "SHA256=")

set_with_default(
GLUTEN_${dependency_name}_SOURCE_URL GLUTEN_${dependency_name}_URL
${GLUTEN_${dependency_name}_SOURCE_URL})
if(DEFINED ENV{GLUTEN_${dependency_name}_URL})
set_with_default(GLUTEN_${dependency_name}_BUILD_SHA256_CHECKSUM
GLUTEN_${dependency_name}_SHA256 "")
if(DEFINED ENV{GLUTEN_${dependency_name}_SHA256})
string(PREPEND GLUTEN_${dependency_name}_BUILD_SHA256_CHECKSUM "SHA256=")
endif()
endif()
endmacro()
27 changes: 0 additions & 27 deletions cpp/CMake/Simdjson.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,33 +17,6 @@

include_guard(GLOBAL)
include(FetchContent)
function(set_with_default var_name envvar_name default)
if(DEFINED ENV{${envvar_name}})
set(${var_name}
$ENV{${envvar_name}}
PARENT_SCOPE)
else()
set(${var_name}
${default}
PARENT_SCOPE)
endif()
endfunction()

macro(resolve_dependency_url dependency_name)
# Prepend prefix for default checksum.
string(PREPEND GLUTEN_${dependency_name}_BUILD_SHA256_CHECKSUM "SHA256=")

set_with_default(
GLUTEN_${dependency_name}_SOURCE_URL GLUTEN_${dependency_name}_URL
${GLUTEN_${dependency_name}_SOURCE_URL})
if(DEFINED ENV{GLUTEN_${dependency_name}_URL})
set_with_default(GLUTEN_${dependency_name}_BUILD_SHA256_CHECKSUM
GLUTEN_${dependency_name}_SHA256 "")
if(DEFINED ENV{GLUTEN_${dependency_name}_SHA256})
string(PREPEND GLUTEN_${dependency_name}_BUILD_SHA256_CHECKSUM "SHA256=")
endif()
endif()
endmacro()

set(GLUTEN_SIMDJSON_VERSION 3.1.5)
set(GLUTEN_SIMDJSON_BUILD_SHA256_CHECKSUM
Expand Down
2 changes: 2 additions & 0 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ else()
set(ARROW_HOME ${VELOX_HOME}/_build/release/third_party/arrow_ep)
endif()

include(ResolveDependency)

#
# Compiler flags
#
Expand Down
Loading