代码拉取完成,页面将自动刷新
#!/usr/bin/env bash
build_cmake() {
mkdir $PWD/_build && cd $PWD/_build
cmake .. -DCMAKE_INSTALL_PREFIX=$PWD/../_install -DCMAKE_C_FLAGS="-Wall -Wextra -Wstrict-prototypes -Wno-unused-function -Wno-implicit-fallthrough -Werror"
cmake --build . --target install
ctest -V .
}
build_macos() {
mkdir $PWD/_build && cd $PWD/_build
cmake .. -DCMAKE_INSTALL_PREFIX=$PWD/../_install -DCMAKE_C_FLAGS="-Wall -Wextra -Wstrict-prototypes -Wno-unused-function -Werror" \
-DOPENSSL_ROOT_DIR="/usr/local/opt/openssl@1.1"
cmake --build . --target install
ctest -V .
}
build_format() {
sudo apt-get install -y clang-format
./travis/run-clang-format/run-clang-format.py \
--clang-format-executable="${PWD}/travis/clang-format.sh" \
--recursive examples librabbitmq tests tools
}
build_coverage() {
mkdir $PWD/_build && cd $PWD/_build
cmake .. -DCMAKE_BUILD_TYPE=Coverage -DCMAKE_INSTALL_PREFIX=$PWD/../_install \
-DCMAKE_C_FLAGS="-Wall -Wextra -Wstrict-prototypes -Wno-unused-function -Werror -fprofile-arcs -ftest-coverage"
cmake --build . --target install
ctest -V .
pip install --user cpp-coveralls
coveralls --exclude tests --build-root . --root .. --gcov-options '\-lp'
}
build_asan() {
mkdir $PWD/_build && cd $PWD/_build
cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$PWD/../_install \
-DCMAKE_C_FLAGS="-Wall -Wextra -Wstrict-prototypes -Wno-unused-function -Werror -fsanitize=address,undefined -O1"
cmake --build . --target install
ctest -V .
}
build_tsan() {
mkdir $PWD/_build && cd $PWD/_build
cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$PWD/../_install \
-DCMAKE_C_FLAGS="-Wall -Wextra -Wstrict-prototypes -Wno-unused-function -Werror -fsanitize=thread,undefined -O1"
cmake --build . --target install
ctest -V .
}
build_scan-build() {
sudo apt-get install -y clang-tools
mkdir $PWD/_build && cd $PWD/_build
scan-build cmake .. -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_INSTALL_PREFIX=$PWD/../_install \
-DCMAKE_C_FLAGS="-Wall -Wextra -Wstrict-prototypes -Wno-unused-function -Werror"
scan-build make install
}
if [ "$#" -ne 1 ]; then
echo "Usage: $0 {cmake|macos|format|coverage|asan|tsan|scan-build}"
exit 1
fi
set -e # exit on error.
set -x # echo commands.
eval "build_$1"
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。