Skip to content

Commit

Permalink
Fix gRPC static build script
Browse files Browse the repository at this point in the history
Signed-off-by: owent <admin@owent.net>
  • Loading branch information
owent committed Mar 6, 2023
1 parent d167bcc commit 0f6b412
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ jobs:
sudo ./ci/setup_ci_environment.sh
- name: run otlp exporter tests
run: |
sudo ./ci/setup_grpc.sh -b OFF
sudo ./ci/setup_grpc.sh -T
./ci/do_ci.sh cmake.exporter.otprotocol.shared_libs.with_static_grpc.test
plugin_test:
Expand Down
35 changes: 23 additions & 12 deletions ci/setup_grpc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ install_dir='/usr/local/'
build_shared_libs=''
usage() { echo "Usage: $0 [-v <gcc-version>] [-i <install_dir>"] 1>&2; exit 1;}

while getopts ":v:i:r:s:b:" o; do
while getopts ":v:i:r:s:TH" o; do
case "${o}" in
v)
gcc_version=${OPTARG}
Expand All @@ -28,8 +28,11 @@ while getopts ":v:i:r:s:b:" o; do
s)
std_version=${OPTARG}
;;
b)
build_shared_libs=${OPTARG}
T)
build_shared_libs="OFF"
;;
H)
build_shared_libs="ON"
;;
*)
usage
Expand Down Expand Up @@ -57,26 +60,34 @@ pushd grpc
git submodule init
git submodule update --depth 1
mkdir -p "third_party/abseil-cpp/build" && pushd "third_party/abseil-cpp/build"
cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_POSITION_INDEPENDENT_CODE=TRUE \
-DCMAKE_INSTALL_PREFIX=$INSTALL_DIR ..
make -j${nproc} install && popd
set -x

ABSEIL_CPP_BUILD_OPTIONS=(
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_POSITION_INDEPENDENT_CODE=TRUE
-DCMAKE_INSTALL_PREFIX=$INSTALL_DIR
)
if [ ! -z "$build_shared_libs" ]; then
ABSEIL_CPP_BUILD_OPTIONS=(${ABSEIL_CPP_BUILD_OPTIONS[@]} "-DBUILD_SHARED_LIBS=$build_shared_libs"})
fi
cmake ${ABSEIL_CPP_BUILD_OPTIONS[@]} ..
cmake --build . -j${nproc} --target install && popd
mkdir -p build && pushd build

BUILD_OPTIONS=(
GRPC_BUILD_OPTIONS=(
-DgRPC_INSTALL=ON
-DCMAKE_CXX_STANDARD=${std_version}
-DgRPC_BUILD_TESTS=OFF
-DCMAKE_INSTALL_PREFIX=$INSTALL_DIR
-DCMAKE_PREFIX_PATH=$INSTALL_DIR
)
if [ ! -z "$build_shared_libs" ]; then
BUILD_OPTIONS=(${BUILD_OPTIONS[@]} "-DBUILD_SHARED_LIBS=$build_shared_libs"})
GRPC_BUILD_OPTIONS=(${GRPC_BUILD_OPTIONS[@]} "-DBUILD_SHARED_LIBS=$build_shared_libs"})
fi

cmake ${BUILD_OPTIONS[@]} ..
make -j $(nproc)
make install
cmake ${GRPC_BUILD_OPTIONS[@]} ..
cmake --build . -j$(nproc)
cmake --install .
popd
popd

Expand Down

0 comments on commit 0f6b412

Please sign in to comment.