diff --git a/build/android/aarch64/make-Android.bash b/build/android/aarch64/make-Android.bash index 7951ea50..eb2bf0b2 100755 --- a/build/android/aarch64/make-Android.bash +++ b/build/android/aarch64/make-Android.bash @@ -16,6 +16,8 @@ for ARG in "$@"; do fi done +MPP_PWD=`pwd` + source ../env_setup.sh ${CMAKE_PROGRAM} -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} \ diff --git a/build/android/arm/make-Android.bash b/build/android/arm/make-Android.bash index 7bc548b4..343ad06c 100755 --- a/build/android/arm/make-Android.bash +++ b/build/android/arm/make-Android.bash @@ -15,6 +15,8 @@ for ARG in "$@"; do fi done +MPP_PWD=`pwd` + source ../env_setup.sh ${CMAKE_PROGRAM} -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} \ diff --git a/build/android/env_setup.sh b/build/android/env_setup.sh index b14a2a13..a30eb6b9 100755 --- a/build/android/env_setup.sh +++ b/build/android/env_setup.sh @@ -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 ################################################# diff --git a/build/linux/aarch64/make-Makefiles.bash b/build/linux/aarch64/make-Makefiles.bash index 2571b093..a648bc4a 100755 --- a/build/linux/aarch64/make-Makefiles.bash +++ b/build/linux/aarch64/make-Makefiles.bash @@ -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 diff --git a/build/linux/arm/make-Makefiles.bash b/build/linux/arm/make-Makefiles.bash index ce5ffaaf..b5777033 100755 --- a/build/linux/arm/make-Makefiles.bash +++ b/build/linux/arm/make-Makefiles.bash @@ -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 diff --git a/build/linux/opt_proc.sh b/build/linux/opt_proc.sh new file mode 100755 index 00000000..29d7bd4c --- /dev/null +++ b/build/linux/opt_proc.sh @@ -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 \ No newline at end of file