Add snippets from bulding a huge cmake pile
This commit is contained in:
parent
17909c374e
commit
7159f41ba1
|
@ -0,0 +1,270 @@
|
|||
#!/bin/bash
|
||||
|
||||
MAIN_FOLDER="$(readlink -f .)"
|
||||
|
||||
printStep()
|
||||
{
|
||||
local comment=$1
|
||||
echo " "
|
||||
echo " !! !! ${comment} !! !! "
|
||||
}
|
||||
|
||||
buildPackage()
|
||||
{
|
||||
cd ${MAIN_FOLDER}
|
||||
|
||||
echo "cp -rf packages/$1/include/$1 ./include/"
|
||||
cp -rf packages/$1/include/$1 ./include/ 2>/dev/null
|
||||
|
||||
local headers=`ls include/*.h`
|
||||
for header in ${headers}
|
||||
do
|
||||
if [ -d packages/$1/include/ ]
|
||||
then
|
||||
cp -fr ${header} packages/$1/include/ 2>/dev/null
|
||||
fi
|
||||
done
|
||||
|
||||
printstep "MAKE $1"
|
||||
|
||||
echo "mkdir ./packages/$1/build"
|
||||
mkdir -p ./packages/$1/build
|
||||
|
||||
echo "cd ./packages/$1/build"
|
||||
cd ./packages/$1/build
|
||||
|
||||
cmake ..
|
||||
|
||||
make -j$(nproc)
|
||||
local libs=`ls *.so`
|
||||
for lib in ${libs}
|
||||
do
|
||||
echo "cp ${lib} ${MAIN_FOLDER}/lib"
|
||||
cp ${lib} ${MAIN_FOLDER}/lib
|
||||
done
|
||||
|
||||
cd ${MAIN_FOLDER}
|
||||
}
|
||||
|
||||
clean()
|
||||
{
|
||||
local packages=`ls packages/`
|
||||
for package in ${packages}
|
||||
do
|
||||
rm -rf packages/${package}/build
|
||||
rm -rf packages/${package}/lib
|
||||
done
|
||||
rm -rf ./build
|
||||
rm -rf ./lib
|
||||
}
|
||||
|
||||
taskqueue()
|
||||
{
|
||||
echo "cp -rf packages/tools/include/tools packages/taskqueue/include/"
|
||||
cp -rf packages/tools/include/tools packages/taskqueue/include/
|
||||
buildPackage "taskqueue"
|
||||
}
|
||||
|
||||
types()
|
||||
{
|
||||
echo "cp -rf packages/tools/include/tools packages/types/include/"
|
||||
cp -rf packages/tools/include/tools packages/types/include/
|
||||
buildPackage "types"
|
||||
}
|
||||
|
||||
logger()
|
||||
{
|
||||
echo "cp -rf packages/types/include/types packages/logger/include/"
|
||||
cp -rf packages/types/include/types packages/logger/include/
|
||||
buildPackage "logger"
|
||||
}
|
||||
|
||||
settings()
|
||||
{
|
||||
echo "cp -rf packages/inithelper/include/inithelper packages/settings/include/"
|
||||
cp -rf packages/inithelper/include/inithelper packages/settings/include/
|
||||
echo "cp -rf packages/logger/include/logger packages/settings/include/"
|
||||
cp -rf packages/logger/include/logger packages/settings/include/
|
||||
buildPackage "settings"
|
||||
}
|
||||
|
||||
cash()
|
||||
{
|
||||
echo "cp -rf packages/settings/include/settings packages/cash/include/"
|
||||
cp -rf packages/settings/include/settings packages/cash/include/
|
||||
echo "cp -rf packages/inithelper/include/inithelper packages/cash/include/"
|
||||
cp -rf packages/inithelper/include/inithelper packages/cash/include/
|
||||
echo "cp -rf packages/logger/include/logger packages/cash/include/"
|
||||
cp -rf packages/logger/include/logger packages/cash/include/
|
||||
echo "cp -rf packages/tools/include/tools packages/cash/include/"
|
||||
cp -rf packages/tools/include/tools packages/cash/include/
|
||||
buildPackage "cash"
|
||||
}
|
||||
|
||||
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/
|
||||
|
||||
echo "cp -rf packages/inithelper/include/inithelper/ packages/legacy/legacy/include/"
|
||||
cp -rf packages/inithelper/include/inithelper/ packages/legacy/legacy/include/
|
||||
echo "cp -rf packages/settings/include/settings/ packages/legacy/legacy/include/"
|
||||
cp -rf packages/settings/include/settings/ packages/legacy/legacy/include/
|
||||
|
||||
cp -rf packages/legacy/legacy/include ./include/legacy 2>/dev/null
|
||||
|
||||
buildPackage "legacy"
|
||||
|
||||
mv -f packages/legacy/build/selector ${MAIN_FOLDER}/lib/
|
||||
}
|
||||
|
||||
mfc()
|
||||
{
|
||||
echo "cp -rf packages/logger/include/logger packages/mfc/include/"
|
||||
cp -rf packages/logger/include/logger packages/mfc/include/
|
||||
buildPackage "mfc"
|
||||
}
|
||||
|
||||
td()
|
||||
{
|
||||
echo "cp -rf packages/tools/include/tools packages/td/include/"
|
||||
cp -rf packages/tools/include/tools packages/td/include/
|
||||
echo "cp -rf packages/taskqueue/include/taskqueue packages/td/include/"
|
||||
cp -rf packages/taskqueue/include/taskqueue packages/td/include/
|
||||
buildPackage "td"
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
echo "cp -rf packages/settings/include/settings packages/wdm/include/"
|
||||
cp -rf packages/settings/include/settings packages/wdm/include/
|
||||
echo "cp -rf packages/logger/include/logger packages/wdm/include/"
|
||||
cp -rf packages/logger/include/logger packages/wdm/include/
|
||||
echo "cp -rf packages/inithelper/include/inithelper/ packages/wdm/include/"
|
||||
cp -rf packages/inithelper/include/inithelper/ packages/wdm/include/
|
||||
echo "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"
|
||||
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/
|
||||
buildPackage "wdm"
|
||||
}
|
||||
|
||||
buildLibraries()
|
||||
{
|
||||
buildPackage "math"
|
||||
buildPackage "inithelper"
|
||||
buildPackage "tools"
|
||||
taskqueue
|
||||
types
|
||||
logger
|
||||
settings
|
||||
cash
|
||||
curtains
|
||||
legacy
|
||||
mfc
|
||||
td
|
||||
wdm
|
||||
}
|
||||
|
||||
core()
|
||||
{
|
||||
echo "mkdir ./build"
|
||||
mkdir ./build
|
||||
|
||||
echo "cd ./build"
|
||||
cd ./build
|
||||
|
||||
cmake ..
|
||||
|
||||
make -j$(nproc)
|
||||
}
|
||||
|
||||
buildAll()
|
||||
{
|
||||
buildLibraries
|
||||
cd ${MAIN_FOLDER}
|
||||
|
||||
echo " "
|
||||
echo " "
|
||||
echo " !! !! !! !! CORE !! !! !! !! "
|
||||
echo " "
|
||||
echo " "
|
||||
|
||||
core $2
|
||||
}
|
||||
|
||||
main()
|
||||
{
|
||||
# Expecting either 'virt' or 'real' in $2 for core
|
||||
# 'virt' proceeds to build virtual version with emulators
|
||||
# 'real' proceeds to build production version with real stuff
|
||||
#
|
||||
# !! isn't implemented here !!
|
||||
|
||||
mkdir -p ./lib/
|
||||
|
||||
flag=$1
|
||||
if [ -z ${flag} ]
|
||||
then
|
||||
buildAll $2
|
||||
elif [ "$flag" == "libs" ]
|
||||
then
|
||||
buildLibraries
|
||||
elif [ "$flag" == "core" ]
|
||||
then
|
||||
core $2
|
||||
elif [ "$flag" == "clean" ]
|
||||
then
|
||||
clean
|
||||
elif [ "$flag" == "taskqueue" ]
|
||||
then
|
||||
taskqueue
|
||||
elif [ "$flag" == "types" ]
|
||||
then
|
||||
types
|
||||
elif [ "$flag" == "logger" ]
|
||||
then
|
||||
logger
|
||||
elif [ "$flag" == "settings" ]
|
||||
then
|
||||
settings
|
||||
elif [ "$flag" == "cash" ]
|
||||
then
|
||||
cash
|
||||
elif [ "$flag" == "legacy" ]
|
||||
then
|
||||
legacy
|
||||
elif [ "$flag" == "mfc" ]
|
||||
then
|
||||
mfc
|
||||
elif [ "$flag" == "td" ]
|
||||
then
|
||||
td
|
||||
elif [ "$flag" == "wdm" ]
|
||||
then
|
||||
wdm
|
||||
elif [ -d "./packages/${flag}" ]
|
||||
then
|
||||
buildPackage $flag
|
||||
fi
|
||||
}
|
||||
|
||||
main $1 $2
|
Loading…
Reference in New Issue