compilerPath=/home/xxxx/BiSheng #设置毕昇编译器路径
readonly SHELL_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" #获取当前路径
options="-O3 -mcpu=tsv110 -flto=thin -fuse-ld=lld -Wl,-q " #设置编译选项,其中“-flto=thin -fuse-ld=lld”是LTO相关的。
pgoGenOpt="-fprofile-generate=$SHELL_PATH/pgo_gen" #设置PGO generate 路径,此处设为pgo_gen
pgoUseOpt="-fprofile-use=$SHELL_PATH/pgo_use" #设置PGO use路径,此处设为pgo_use
cmake .. -DWITH_BOOST=$SHELL_PATH/boost \
-DCMAKE_C_COMPILER=$compilerPath/bin/clang -DCMAKE_CXX_COMPILER=$compilerPath/bin/clang++ -DENABLE_DOWNLOADS=1 \
-DCMAKE_BUILD_TYPE=RELEASE \
-DBUILD_CONFIG=mysql_release \
-DCMAKE_INSTALL_PREFIX=$SHELL_PATH/install \
-DCMAKE_C_FLAGS=' $options $pgoGenOpt ' \
-DCMAKE_CXX_FLAGS=' $options $pgoGenOpt ' \
-DCMAKE_EXE_LINKER_FLAGS=' $options $pgoGenOpt ' \
-DCMAKE_AR='$compilerPath/bin/llvm-ar' \ # 开启LTO时, AR and RANLIB 需要换成毕昇的
-DCMAKE_RANLIB=`$compilerPath/bin/llvm-ranlib`