Last active
May 22, 2025 03:15
-
-
Save lix19937/6ea9f22ec6075706350dcdcd65a69b1f to your computer and use it in GitHub Desktop.
build_proto_cc.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# by ljw 20250521 | |
# | |
#!/bin/bash | |
if [ -z "$#" ];then | |
echo -e "\nUsage ./scripts/build_proto.sh Pb_ROOT_DIR\n" | |
exit 1 | |
fi | |
if [ $# -eq 1 ];then | |
echo "-- Pb_ROOT_DIR:$1" | |
Pb_ROOT_DIR=$1 | |
else | |
echo -e "\nUsage ./scripts/build_proto.sh Pb_ROOT_DIR\n" | |
exit 1 | |
fi | |
arch=$(uname -m) | |
echo "-- This is" $arch "os arch!" | |
SHELL_FOLDER=$(cd "$(dirname "$0")";pwd) | |
echo "-- Current shell path is" $SHELL_FOLDER | |
base_dir=./interface/proto | |
build_dir=${base_dir}/build | |
if [ ! -d ${build_dir} ]; then | |
mkdir -m 777 ${build_dir} | |
fi | |
echo "-- Will rm" $build_dir"/*" | |
rm -rf ${build_dir}/* | |
cd ${build_dir} | |
export LD_LIBRARY_PATH=$Pb_ROOT_DIR/lib:$LD_LIBRARY_PATH | |
export PATH=$Pb_ROOT_DIR/bin/:$PATH | |
Pb_LIBRARIES=$Pb_ROOT_DIR/lib/libprotobuf.so | |
Pb_INCLUDE_DIR=$Pb_ROOT_DIR/include | |
cmake ../ -D Protobuf_LIBRARIES=$Pb_LIBRARIES \ | |
-D Protobuf_INCLUDE_DIR=$Pb_INCLUDE_DIR \ | |
-D RUN_PLATFORM=x86_64 | |
make -j${nproc} | |
make -j$(nproc) install | |
echo " | |
--------------------------------------------------------------------------------------- | |
bash ./scripts/build_proto.sh \ | |
/home/gwm/workspaces/gitlab/adc20/nni/third_party/third_party/release/x86_2204/protobuf-3.14.0 | |
--------------------------------------------------------------------------------------- | |
" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment