2023-02-01 06:17:15 +00:00
|
|
|
sys=$(cat /etc/issue)
|
|
|
|
sys=${sys%% *} #操作系统
|
2023-02-01 03:58:57 +00:00
|
|
|
script_dir=$(cd $(dirname $0);pwd)
|
|
|
|
cd $script_dir
|
|
|
|
echo $script_dir
|
|
|
|
|
2023-02-01 06:17:15 +00:00
|
|
|
cp CMakeLists.txt CMakeLists.txtbkp
|
|
|
|
|
|
|
|
|
|
|
|
if [ "$sys" == "UnionTech" ];then
|
|
|
|
sed -i "s/kylin/uos/g" CMakeLists.txt
|
|
|
|
elif [ "$sys" == "Kylin" ];then
|
|
|
|
sed -i "s/uos/kylin/g" CMakeLists.txt
|
|
|
|
else
|
|
|
|
sed -i "s/uos/kylin/g" CMakeLists.txt
|
|
|
|
echo "其他操作系统"
|
|
|
|
fi
|
|
|
|
|
2023-02-01 03:58:57 +00:00
|
|
|
if [ -f ./build/CMakeCache.txt ]; then
|
|
|
|
echo ""
|
|
|
|
#rm -rf ./build/*
|
|
|
|
else
|
|
|
|
mkdir build
|
|
|
|
fi
|
|
|
|
pwd
|
|
|
|
cd build
|
|
|
|
cmake ..
|
|
|
|
make -j6
|
|
|
|
|
|
|
|
if [ $? -ne 0 ];then
|
|
|
|
|
|
|
|
err=1
|
|
|
|
echo "--------------------------------------make fail---------------------------------------"
|
|
|
|
# commented, we should restore the CMakeLists.txts...
|
|
|
|
else
|
|
|
|
err=0
|
|
|
|
echo "--------------------------------------make succeed------------------------------------"
|
|
|
|
fi
|
2023-02-01 06:17:15 +00:00
|
|
|
|
|
|
|
if [ -f ../CMakeLists.txtbkp ]; then
|
|
|
|
mv ../CMakeLists.txtbkp ../CMakeLists.txt
|
|
|
|
fi
|
|
|
|
|
2023-02-01 03:58:57 +00:00
|
|
|
exit $err
|