Skip to content

Instantly share code, notes, and snippets.

@Zren
Created January 21, 2018 23:35
Show Gist options
  • Save Zren/55ef7c10088ee69480ae73a594e00456 to your computer and use it in GitHub Desktop.
Save Zren/55ef7c10088ee69480ae73a594e00456 to your computer and use it in GitHub Desktop.
#!/bin/bash
doClean=false
doInstall=false
buildDir="build"
for i in "$@"; do
opt="$i"
shift
case $opt in
c|clean)
doClean=true
;;
i|install)
doInstall=true
;;
h|-h|--help|*)
echo "kmake [clean] [install]"
echo " kmake [c | clean] Delete build directory before build"
echo " kmake [i | install] Run 'sudo make install' after build"
exit 0
;;
esac
done
if $doClean && [ -d $buildDir ]; then
rm -r $buildDir
fi
if [ ! -d $buildDir ]; then
mkdir $buildDir
fi
success=false
# && cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DKDE_INSTALL_USE_QT_SYS_PATHS=ON \
( cd $buildDir \
&& cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=ON -DKDE_INSTALL_USE_QT_SYS_PATHS=ON \
&& make \
)
if [ $? -eq 0 ]; then
success=true
fi
if $success; then
if $doInstall; then
(cd $buildDir && sudo make install)
exit $?
else
exit 0
fi
else
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment