Files
H100PowerManger/build_debug.sh
T

61 lines
2.4 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
INVOCATION_ABS_DIR=`pwd`
# 默认设为Debug模式,避免无符号编译(核心修改1)
BUILD_TYPE="Debug"
CMD_LINE_ARGS=""
#-------------------------------------------------------------------
# Part 1: Check for and handle command-line arguments
#-------------------------------------------------------------------
for ARGI; do
if [ "${ARGI}" = "--help" -o "${ARGI}" = "-h" ] ; then
printf "%s [SWITCHES] \n" $0
printf "Switches: \n"
printf " --help, -h \n"
printf " --debug, -d \n"
printf " --release, -r \n"
printf "Notes: \n"
printf " (1) All other command line args will be passed as args \n"
printf " to \"make\" when it is eventually invoked. \n"
printf " (2) For example -k will continue making when/if a failure \n"
printf " is encountered in building one of the subdirectories. \n"
printf " (3) For example -j2 will utilize a 2nd core in the build \n"
printf " if your machine has two cores. -j4 etc for quad core. \n"
exit 0;
elif [ "${ARGI}" = "--debug" -o "${ARGI}" = "-d" ] ; then
BUILD_TYPE="Debug"
elif [ "${ARGI}" = "--release" -o "${ARGI}" = "-r" ] ; then
BUILD_TYPE="Release"
else
CMD_LINE_ARGS=$CMD_LINE_ARGS" "$ARGI
fi
done
#-------------------------------------------------------------------
# Part 2: Invoke the call to make in the build directory
#-------------------------------------------------------------------
mkdir -p build
cd build
# 核心修改2:添加RK3588 ARM64编译选项+强制调试符号
# -DCMAKE_CXX_FLAGS:全局C++编译选项,适配RK3588的cortex-a76架构
# -DCMAKE_BUILD_TYPE:指定编译模式
# -DCMAKE_CXX_FLAGS_DEBUG:Debug模式强制-O0 + 完整调试符号
# -DCMAKE_CXX_FLAGS_RELEASE:Release模式保留-g(调试符号),仅优化级别-O2
cmake \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DCMAKE_CXX_FLAGS="-march=armv8-a -mtune=cortex-a76 -mstrict-align -fPIC" \
-DCMAKE_CXX_FLAGS_DEBUG="-O0 -g -ggdb" \
-DCMAKE_CXX_FLAGS_RELEASE="-O2 -g -ggdb" \
../
# 核心修改3:添加-j参数加速编译(适配RK3588多核),默认用4核(可根据板卡调整)
# 若你传了-j参数,会覆盖默认的-j4
# if [[ ! $CMD_LINE_ARGS =~ "-j" ]]; then
# CMD_LINE_ARGS="-j4 ${CMD_LINE_ARGS}"
# fi
make ${CMD_LINE_ARGS}
cd ${INVOCATION_ABS_DIR}