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