Skip to content

Commit

Permalink
Merge branch 'facebookincubator:main' into gayangya/update_azuresdk
Browse files Browse the repository at this point in the history
  • Loading branch information
gaoyangxiaozhu authored Nov 22, 2023
2 parents ead4f49 + 4667f6d commit 8258911
Show file tree
Hide file tree
Showing 420 changed files with 16,632 additions and 5,487 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ _build/
*.swp
a.out
CMake/resolve_dependency_module/boost/FindBoost.cmake
__cmake_systeminformation/

#==============================================================================#
# Kate Swap Files
Expand Down
34 changes: 34 additions & 0 deletions CMake/resolve_dependency_modules/cpr.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright (c) Facebook, Inc. and its affiliates.
#
# Licensed 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.
include_guard(GLOBAL)

set(VELOX_CPR_VERSION 1.10.5)
set(VELOX_CPR_BUILD_SHA256_CHECKSUM
c8590568996cea918d7cf7ec6845d954b9b95ab2c4980b365f582a665dea08d8)
set(VELOX_CPR_SOURCE_URL
"https://github.com/libcpr/cpr/archive/refs/tags/${VELOX_CPR_VERSION}.tar.gz"
)

resolve_dependency_url(CPR)

message(STATUS "Building cpr from source")
FetchContent_Declare(
cpr
URL ${VELOX_CPR_SOURCE_URL}
URL_HASH ${VELOX_CPR_BUILD_SHA256_CHECKSUM}
PATCH_COMMAND git apply
${CMAKE_CURRENT_LIST_DIR}/cpr/cpr-libcurl-compatible.patch)
set(BUILD_SHARED_LIBS OFF)
set(CPR_USE_SYSTEM_CURL ON)
FetchContent_MakeAvailable(cpr)
41 changes: 41 additions & 0 deletions CMake/resolve_dependency_modules/cpr/cpr-libcurl-compatible.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright (c) Facebook, Inc. and its affiliates.
#
# Licensed 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.
#
# This can be removed once we upgrade to curl >= 7.68.0
--- a/cpr/multiperform.cpp
+++ b/cpr/multiperform.cpp
@@ -97,9 +97,9 @@ void MultiPerform::DoMultiPerform() {

if (still_running) {
const int timeout_ms{250};
- error_code = curl_multi_poll(multicurl_->handle, nullptr, 0, timeout_ms, nullptr);
+ error_code = curl_multi_wait(multicurl_->handle, nullptr, 0, timeout_ms, nullptr);
if (error_code) {
- std::cerr << "curl_multi_poll() failed, code " << static_cast<int>(error_code) << std::endl;
+ std::cerr << "curl_multi_wait() failed, code " << static_cast<int>(error_code) << std::endl;
break;
}
}

--- a/include/cpr/util.h
+++ b/include/cpr/util.h
@@ -23,7 +23,7 @@ size_t writeUserFunction(char* ptr, size_t size, size_t nmemb, const WriteCallba
template <typename T = ProgressCallback>
int progressUserFunction(const T* progress, cpr_pf_arg_t dltotal, cpr_pf_arg_t dlnow, cpr_pf_arg_t ultotal, cpr_pf_arg_t ulnow) {
const int cancel_retval{1};
- static_assert(cancel_retval != CURL_PROGRESSFUNC_CONTINUE);
+ static_assert(cancel_retval != 0x10000001);
return (*progress)(dltotal, dlnow, ultotal, ulnow) ? 0 : cancel_retval;
}
int debugUserFunction(CURL* handle, curl_infotype type, char* data, size_t size, const DebugCallback* debug);
25 changes: 23 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.
cmake_minimum_required(VERSION 3.14)

# the policy allows us to change options without caching
# The policy allows us to change options without caching.
cmake_policy(SET CMP0077 NEW)
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)

Expand All @@ -25,7 +25,7 @@ if(POLICY CMP0135)
set(CMAKE_POLICY_DEFAULT_CMP0135 NEW)
endif()

# set the project name
# Set the project name.
project(velox)

# If we are in an active conda env disable search in system paths and add env to
Expand Down Expand Up @@ -62,6 +62,7 @@ option(
VELOX_BUILD_MINIMAL
"Build a minimal set of components only. This will override other build options."
OFF)

# option() always creates a BOOL variable so we have to use a normal cache
# variable with STRING type for this option.
#
Expand Down Expand Up @@ -106,6 +107,12 @@ option(
"make buildPartitionBounds_ a vector int64 instead of int32 to avoid integer overflow when the hashtable has billions of records"
OFF)

# Explicitly force compilers to generate colored output. Compilers usually do
# this by default if they detect the output is a terminal, but this assumption
# is broken if you use ninja.
option(VELOX_FORCE_COLORED_OUTPUT
"Always produce ANSI-colored output (GNU/Clang only)." OFF)

if(${VELOX_BUILD_MINIMAL})
# Enable and disable components for velox base build
set(VELOX_BUILD_TESTING OFF)
Expand Down Expand Up @@ -194,6 +201,15 @@ if(VELOX_ENABLE_CCACHE
endif()
endif()

if(${VELOX_FORCE_COLORED_OUTPUT})
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
add_compile_options(-fdiagnostics-color=always)
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang"
OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
add_compile_options(-fcolor-diagnostics)
endif()
endif()

# At the moment we prefer static linking but by default cmake looks for shared
# libs first. This will still fallback to shared libs when static ones are not
# found
Expand Down Expand Up @@ -527,6 +543,11 @@ endif()
set(xsimd_SOURCE BUNDLED)
resolve_dependency(xsimd)

if(VELOX_BUILD_TESTING OR VELOX_BUILD_TEST_UTILS)
set(cpr_SOURCE BUNDLED)
resolve_dependency(cpr)
endif()

include(CTest) # include after project() but before add_subdirectory()

include_directories(.)
Expand Down
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@ endif
USE_NINJA ?= 1
ifeq ($(USE_NINJA), 1)
ifneq ($(shell which ninja), )
GENERATOR=-GNinja -DMAX_LINK_JOBS=$(MAX_LINK_JOBS) -DMAX_HIGH_MEM_JOBS=$(MAX_HIGH_MEM_JOBS)
GENERATOR := -GNinja
GENERATOR += -DMAX_LINK_JOBS=$(MAX_LINK_JOBS)
GENERATOR += -DMAX_HIGH_MEM_JOBS=$(MAX_HIGH_MEM_JOBS)

# Ninja makes compilers disable colored output by default.
GENERATOR += -DVELOX_FORCE_COLORED_OUTPUT=ON
endif
endif

Expand Down Expand Up @@ -84,7 +89,6 @@ cmake: #: Use CMake to create a Makefile build system
${CMAKE_FLAGS} \
$(GENERATOR) \
$(USE_CCACHE) \
$(FORCE_COLOR) \
${EXTRA_CMAKE_FLAGS}

cmake-gpu:
Expand Down
2 changes: 1 addition & 1 deletion build/deps/github_hashes/facebook/folly-rev.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Subproject commit f949ffbabaf9d8129174e70b0a019f84ac5900fd
Subproject commit 2fbd5cf24d61ed589304bd5af4ac3b19583cdd56
19 changes: 19 additions & 0 deletions build/fbcode_builder/CMake/FindLMDB.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2.

find_library(LMDB_LIBRARIES NAMES lmdb liblmdb)
mark_as_advanced(LMDB_LIBRARIES)

find_path(LMDB_INCLUDE_DIR NAMES lmdb.h)
mark_as_advanced(LMDB_INCLUDE_DIR)

find_package_handle_standard_args(
LMDB
REQUIRED_VARS LMDB_LIBRARIES LMDB_INCLUDE_DIR)

if(LMDB_FOUND)
set(LMDB_LIBRARIES ${LMDB_LIBRARIES})
set(LMDB_INCLUDE_DIR, ${LMDB_INCLUDE_DIR})
endif()
Loading

0 comments on commit 8258911

Please sign in to comment.