Improve cmake building script

This commit is contained in:
NaiJi ✨ 2022-04-13 15:45:19 +03:00
parent 6dc2352b0e
commit a1b0ce3ed6
1 changed files with 27 additions and 30 deletions

View File

@ -1,6 +1,8 @@
#!/bin/bash
MAIN_FOLDER="$(readlink -f .)"
if [ -z ${P_BUILD} ]; then "Please set P_BUILD variable."; exit 1; fi;
if [ -z ${P_OUT} ]; then "Please set P_OUT variable."; exit 1; fi;
printStep()
{
@ -25,7 +27,7 @@ buildPackage()
fi
done
printstep "MAKE $1"
printStep "MAKE $1"
echo "mkdir ./packages/$1/build"
mkdir -p ./packages/$1/build
@ -39,8 +41,8 @@ buildPackage()
local libs=`ls *.so`
for lib in ${libs}
do
echo "cp ${lib} ${MAIN_FOLDER}/lib"
cp ${lib} ${MAIN_FOLDER}/lib
echo "cp ${lib} ${P_OUT}"
cp ${lib} ${P_OUT}
done
cd ${MAIN_FOLDER}
@ -52,10 +54,8 @@ clean()
for package in ${packages}
do
rm -rf packages/${package}/build
rm -rf packages/${package}/lib
done
rm -rf ./build
rm -rf ./lib
rm -rf ${P_BUILD}
}
taskqueue()
@ -106,11 +106,11 @@ legacy()
mkdir -p packages/legacy/lib
echo "Resolve .so legacy dependecies"
cp ./lib/libsettings.so ./packages/legacy/lib/
cp ./lib/liblogger.so ./packages/legacy/lib/
cp ./lib/libinithelper.so ./packages/legacy/lib/
cp ./lib/libtools.so ./packages/legacy/lib/
cp ./lib/libtypes.so ./packages/legacy/lib/
cp ${P_OUT}/libsettings.so ./packages/legacy/lib/
cp ${P_OUT}/liblogger.so ./packages/legacy/lib/
cp ${P_OUT}/libinithelper.so ./packages/legacy/lib/
cp ${P_OUT}/libtools.so ./packages/legacy/lib/
cp ${P_OUT}/libtypes.so ./packages/legacy/lib/
echo "cp -rf packages/inithelper/include/inithelper/ packages/legacy/legacy/include/"
cp -rf packages/inithelper/include/inithelper/ packages/legacy/legacy/include/
@ -121,7 +121,7 @@ legacy()
buildPackage "legacy"
mv -f packages/legacy/build/selector ${MAIN_FOLDER}/lib/
mv -f packages/legacy/build/selector ${P_OUT}
}
mfc()
@ -145,12 +145,12 @@ wdm()
mkdir -p packages/wdm/lib
echo "Resolve .so wdm dependecies"
cp lib/libsettings.so packages/wdm/lib
cp lib/liblogger.so packages/wdm/lib
cp lib/libinithelper.so packages/wdm/lib
cp lib/libtools.so packages/wdm/lib
cp lib/libtypes.so packages/wdm/lib
cp lib/libintface.so packages/wdm/lib
cp ${P_OUT}/libsettings.so packages/wdm/lib
cp ${P_OUT}/liblogger.so packages/wdm/lib
cp ${P_OUT}/libinithelper.so packages/wdm/lib
cp ${P_OUT}/libtools.so packages/wdm/lib
cp ${P_OUT}/libtypes.so packages/wdm/lib
cp ${P_OUT}/libintface.so packages/wdm/lib
echo "cp -rf packages/settings/include/settings packages/wdm/include/"
cp -rf packages/settings/include/settings packages/wdm/include/
@ -162,14 +162,14 @@ wdm()
cp -rf packages/settings/include/settings/ packages/wdm/include/
echo "cp -rf packages/legacy/legacy/include/ packages/wdm/include/legacy"
cp -rf packages/legacy/legacy/include/ packages/wdm/include/legacy
echo "cp -rf packages/math/include/math packages/wdm/include/"
cp -rf packages/math/include/math packages/wdm/include/
echo "cp -rf packages/round/include/round packages/wdm/include/"
cp -rf packages/round/include/round packages/wdm/include/
buildPackage "wdm"
}
buildLibraries()
{
buildPackage "math"
buildPackage "round"
buildPackage "inithelper"
buildPackage "tools"
taskqueue
@ -177,7 +177,6 @@ buildLibraries()
logger
settings
cash
curtains
legacy
mfc
td
@ -186,14 +185,11 @@ buildLibraries()
core()
{
echo "mkdir ./build"
mkdir ./build
mkdir -p ${P_BUILD}
echo "cd ./build"
cd ./build
cmake ..
cmake -B ${P_BUILD} -DP_OUT=${P_OUT}
cd ${P_BUILD}
make -j$(nproc)
}
@ -204,7 +200,7 @@ buildAll()
echo " "
echo " "
echo " !! !! !! !! CORE !! !! !! !! "
printStep "CORE"
echo " "
echo " "
@ -219,7 +215,8 @@ main()
#
# !! isn't implemented here !!
mkdir -p ./lib/
mkdir -p ${P_BUILD}
mkdir -p ${P_OUT}
flag=$1
if [ -z ${flag} ]