Skip to content

Commit

Permalink
add proxygen
Browse files Browse the repository at this point in the history
  • Loading branch information
Joe-Abraham committed Sep 3, 2024
1 parent 5398196 commit 6c95ea8
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 42 deletions.
77 changes: 35 additions & 42 deletions scripts/setup-macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.

# This script documents setting up a macOS host for Velox
# development. Running it should make you ready to compile.
# development. Running it should make you ready to compile.
#
# Environment variables:
# * INSTALL_PREREQUISITES="N": Skip installation of brew/pip deps.
Expand All @@ -35,62 +35,55 @@ PYTHON_VENV=${PYHTON_VENV:-"${SCRIPTDIR}/../.venv"}
NPROC=$(getconf _NPROCESSORS_ONLN)

DEPENDENCY_DIR=${DEPENDENCY_DIR:-$(pwd)}
MACOS_VELOX_DEPS="bison boost double-conversion flex fmt gflags glog googletest icu4c libevent libsodium lz4 lzo openssl protobuf@21 simdjson snappy thrift xz xsimd zstd"
MACOS_BUILD_DEPS="ninja cmake ccache"
MACOS_VELOX_DEPS="bison double-conversion flex gflags glog googletest icu4c libevent libsodium lz4 lzo openssl protobuf@21 simdjson snappy thrift xz zstd"
MACOS_BUILD_DEPS="ninja cmake"
FB_OS_VERSION="v2024.05.20.00"
FMT_VERSION="10.1.1"

function update_brew {
DEFAULT_BREW_PATH=/usr/local/bin/brew
if [ `arch` == "arm64" ] ;
then
DEFAULT_BREW_PATH=$(which brew) ;
fi
BREW_PATH=${BREW_PATH:-$DEFAULT_BREW_PATH}
$BREW_PATH update --auto-update --verbose
$BREW_PATH developer off
}

function install_from_brew {
pkg=$1
if [[ "${pkg}" =~ ^([0-9a-z-]*):([0-9](\.[0-9\])*)$ ]];
then
pkg=${BASH_REMATCH[1]}
ver=${BASH_REMATCH[2]}
echo "Installing '${pkg}' at '${ver}'"
tap="velox/local-${pkg}"
brew tap-new "${tap}"
brew extract "--version=${ver}" "${pkg}" "${tap}"
brew install "${tap}/${pkg}@${ver}" || ( echo "Failed to install ${tap}/${pkg}@${ver}" ; exit 1 )
else
( brew install --formula "${pkg}" && echo "Installation of ${pkg} is successful" || brew upgrade --formula "$pkg" ) || ( echo "Failed to install ${pkg}" ; exit 1 )
fi
}
BOOST_VERSION="boost-1.84.0"
XSIMD_VERSION="10.0.0"

function install_build_prerequisites {
for pkg in ${MACOS_BUILD_DEPS}
do
install_from_brew ${pkg}
done
if [ ! -f ${PYTHON_VENV}/pyvenv.cfg ]; then
echo "Creating Python Virtual Environment at ${PYTHON_VENV}"
python3 -m venv ${PYTHON_VENV}
fi
source ${PYTHON_VENV}/bin/activate; pip3 install cmake-format regex pyyaml
source ${PYTHON_VENV}/bin/activate
pip3 install cmake-format regex pyyaml
}

function install_velox_deps_from_brew {
for pkg in ${MACOS_VELOX_DEPS}
do
install_from_brew ${pkg}
done
function install_xsimd {
wget_and_untar https://github.com/xtensor-stack/xsimd/archive/refs/tags/${XSIMD_VERSION}.tar.gz xsimd
cmake_install xsimd
}

function install_fmt {
wget_and_untar https://github.com/fmtlib/fmt/archive/${FMT_VERSION}.tar.gz fmt
cmake_install fmt -DFMT_TEST=OFF
}

function install_proxygen {
wget_and_untar https://github.com/facebook/proxygen/archive/refs/tags/${FB_OS_VERSION}.tar.gz proxygen
cmake_install proxygen -DBUILD_TESTS=OFF
}

function install_boost {
wget_and_untar https://github.com/boostorg/boost/releases/download/${BOOST_VERSION}/${BOOST_VERSION}.tar.gz boost
(
cd boost
if [[ ${USE_CLANG} != "false" ]]; then
./bootstrap.sh --prefix=/usr/local --with-toolset="clang-15"
# Switch the compiler from the clang-15 toolset which doesn't exist (clang-15.jam) to
# clang of version 15 when toolset clang-15 is used.
# This reconciles the project-config.jam generation with what the b2 build system allows for customization.
sed -i 's/using clang-15/using clang : 15/g' project-config.jam
${SUDO} ./b2 "-j${NPROC}" -d0 install threading=multi toolset=clang-15 --without-python
else
./bootstrap.sh --prefix=/usr/local
${SUDO} ./b2 "-j${NPROC}" -d0 install threading=multi --without-python
fi
)
}

function install_folly {
wget_and_untar https://github.com/facebook/folly/archive/refs/tags/${FB_OS_VERSION}.tar.gz folly
cmake_install folly -DBUILD_TESTS=OFF -DFOLLY_HAVE_INT128_T=ON
Expand Down Expand Up @@ -132,7 +125,6 @@ function install_re2 {
}

function install_velox_deps {
run_and_time install_velox_deps_from_brew
run_and_time install_ranges_v3
run_and_time install_double_conversion
run_and_time install_re2
Expand All @@ -142,12 +134,13 @@ function install_velox_deps {
run_and_time install_wangle
run_and_time install_mvfst
run_and_time install_fbthrift
run_and_time install_xsimd
run_and_time install_proxygen
}

(return 2> /dev/null) && return # If script was sourced, don't run commands.

(
update_brew
if [[ $# -ne 0 ]]; then
for cmd in "$@"; do
run_and_time "${cmd}"
Expand Down
12 changes: 12 additions & 0 deletions velox/functions/remote/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,22 @@

if(NOT DEFINED PROXYGEN_LIBRARIES)
find_package(Sodium REQUIRED)

find_library(PROXYGEN proxygen)
find_library(PROXYGEN_HTTP_SERVER proxygenhttpserver)
find_library(FIZZ fizz)
find_library(WANGLE wangle)

if(NOT PROXYGEN
OR NOT PROXYGEN_HTTP_SERVER
OR NOT FIZZ
OR NOT WANGLE)
message(
FATAL_ERROR
"One or more proxygen libraries were not found. Please ensure proxygen, proxygenhttpserver, fizz, and wangle are installed."
)
endif()

set(PROXYGEN_LIBRARIES ${PROXYGEN_HTTP_SERVER} ${PROXYGEN} ${WANGLE} ${FIZZ})
endif()

Expand Down

0 comments on commit 6c95ea8

Please sign in to comment.