chore[script]: add rebuild and clean for build

Change-Id: I73b2d2e9ed11c5aef8c773323b2ab8c5f08b0dc3
Signed-off-by: xueman.ruan <xueman.ruan@rock-chips.com>
This commit is contained in:
xueman.ruan
2024-01-04 18:04:20 +08:00
parent 56bff5ed8c
commit 1766466864
6 changed files with 103 additions and 3 deletions

View File

@@ -16,6 +16,8 @@ for ARG in "$@"; do
fi
done
MPP_PWD=`pwd`
source ../env_setup.sh
${CMAKE_PROGRAM} -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} \

View File

@@ -15,6 +15,8 @@ for ARG in "$@"; do
fi
done
MPP_PWD=`pwd`
source ../env_setup.sh
${CMAKE_PROGRAM} -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} \

View File

@@ -1,5 +1,26 @@
#!/bin/bash
# Run this from within a bash shell
MAKE_PROGRAM=`which make`
# delete list
FILES_TO_DELETE=(
"CMakeCache.txt"
"Makefile"
"cmake_install.cmake"
"compile_commands.json"
"rockchip_mpp.pc"
"rockchip_vpu.pc"
)
DIRS_TO_DELETE=(
"CMakeFiles"
"mpp"
"osal"
"test"
"utils"
)
#################################################
# Arguments
#################################################
@@ -10,6 +31,8 @@ while [ $# -gt 0 ]; do
echo " use --ndk to set ANDROID_NDK"
echo " use --cmake to specify which cmake to use"
echo " use --debug to enable debug build"
echo " use --rebuild to rebuild after clean"
echo " use --clean to clean all build file"
exit 1
;;
--debug)
@@ -28,15 +51,32 @@ while [ $# -gt 0 ]; do
CMAKE_PROGRAM=$2
shift
;;
--rebuild)
${MAKE_PROGRAM} clean
if [ -f "CMakeCache.txt" ]; then
rm CMakeCache.txt
fi
shift
;;
--clean)
for FILE_TO_DELETE in "${FILES_TO_DELETE[@]}"; do
if [ -f ${FILE_TO_DELETE} ]; then
rm ${FILE_TO_DELETE}
fi
done
for DIR_TO_DELETE in "${DIRS_TO_DELETE[@]}"; do
if [ -d ${DIR_TO_DELETE} ]; then
rm -rf ${DIR_TO_DELETE}
fi
done
exit 1
;;
esac
shift
done
CMAKE_PARALLEL_ENABLE=0
# Run this from within a bash shell
MAKE_PROGRAM=`which make`
#################################################
# Detect cmake version
#################################################

View File

@@ -14,6 +14,8 @@ check_system_arm_linux_gcc(){
check_cmd aarch64-linux-gnu-gcc -v
}
source ../opt_proc.sh
check_system_arm_linux_gcc
if [ $? -eq 127 ];then
MPP_TOOLCHAIN=/usr/bin

View File

@@ -14,6 +14,8 @@ check_system_arm_linux_gcc(){
check_cmd arm-linux-gcc -v
}
source ../opt_proc.sh
check_system_arm_linux_gcc
if [ $? -eq 127 ];then
MPP_TOOLCHAIN=${MPP_TOP}/../prebuilts/toolschain/usr/bin

52
build/linux/opt_proc.sh Executable file
View File

@@ -0,0 +1,52 @@
# Run this from within a bash shell
MAKE_PROGRAM=`which make`
# delete list
FILES_TO_DELETE=(
"CMakeCache.txt"
"Makefile"
"cmake_install.cmake"
"compile_commands.json"
"rockchip_mpp.pc"
"rockchip_vpu.pc"
)
DIRS_TO_DELETE=(
"CMakeFiles"
"mpp"
"osal"
"test"
"utils"
)
while [ $# -gt 0 ]; do
case $1 in
--help | -h)
echo "Execute make-Makefiles.sh in *arm/* or *aarch64/* with some args."
echo " use --rebuild to rebuild after clean"
echo " use --clean to clean all build file"
exit 1
;;
--rebuild)
${MAKE_PROGRAM} clean
if [ -f "CMakeCache.txt" ]; then
rm CMakeCache.txt
fi
shift
;;
--clean)
for FILE_TO_DELETE in "${FILES_TO_DELETE[@]}"; do
if [ -f ${FILE_TO_DELETE} ]; then
rm ${FILE_TO_DELETE}
fi
done
for DIR_TO_DELETE in "${DIRS_TO_DELETE[@]}"; do
if [ -d ${DIR_TO_DELETE} ]; then
rm -rf ${DIR_TO_DELETE}
fi
done
exit 1
;;
esac
shift
done