Исправления разбора аргументов через массивы
This commit is contained in:
parent
9b0f1c3b75
commit
6c31d9f67e
25
cmake.sh
25
cmake.sh
@ -89,8 +89,8 @@ while true; do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
CMAKE_ARGS=" "
|
CMAKE_ARGS=()
|
||||||
[ ! -z "${@}" ] && CMAKE_ARGS="${@}"
|
[ ${#@} -gt 0 ] && CMAKE_ARGS=("${@}")
|
||||||
|
|
||||||
[ ! -f "${SOURCE_DIR}/CMakeLists.txt" ] && { echo "Source directory does not contain CMakeLists.txt"; exit 4; }
|
[ ! -f "${SOURCE_DIR}/CMakeLists.txt" ] && { echo "Source directory does not contain CMakeLists.txt"; exit 4; }
|
||||||
|
|
||||||
@ -129,7 +129,6 @@ QTCREATOR_BUILD_TYPES=(qtNone qtDebug qtRelease qtProfile)
|
|||||||
generate_configuration() {
|
generate_configuration() {
|
||||||
local BUILD_TYPE="${!#}"
|
local BUILD_TYPE="${!#}"
|
||||||
local BUILD="$BUILD_TYPE"
|
local BUILD="$BUILD_TYPE"
|
||||||
echo $BUILD_TYPE
|
|
||||||
|
|
||||||
if [ "x$QTCREATOR" == "xy" ]; then
|
if [ "x$QTCREATOR" == "xy" ]; then
|
||||||
case "$BUILD_TYPE" in
|
case "$BUILD_TYPE" in
|
||||||
@ -157,7 +156,7 @@ generate_configuration() {
|
|||||||
[ -d "${GEN_DIR}" ] && return 0
|
[ -d "${GEN_DIR}" ] && return 0
|
||||||
mkdir -p "${GEN_DIR}"
|
mkdir -p "${GEN_DIR}"
|
||||||
pushd "${GEN_DIR}" 2>/dev/null
|
pushd "${GEN_DIR}" 2>/dev/null
|
||||||
cmake -G "${GENERATOR}" -DCMAKE_INSTALL_PREFIX="${OUTPUT_DIR}" -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" ${CMAKE_ARGS} "${SOURCE_DIR}"
|
cmake -G "${GENERATOR}" -DCMAKE_INSTALL_PREFIX="${OUTPUT_DIR}" -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" "${CMAKE_ARGS[@]}" "${SOURCE_DIR}"
|
||||||
if [ "x$GENERATOR" == "xNinja" ]; then
|
if [ "x$GENERATOR" == "xNinja" ]; then
|
||||||
# Generate fake Makefile, so make can run ninja build
|
# Generate fake Makefile, so make can run ninja build
|
||||||
cat > Makefile <<EOF
|
cat > Makefile <<EOF
|
||||||
@ -173,16 +172,16 @@ EOF
|
|||||||
|
|
||||||
export -f generate_configuration
|
export -f generate_configuration
|
||||||
|
|
||||||
BUILD_TYPES=""
|
BUILD_TYPES=()
|
||||||
|
|
||||||
if [ "x$SINGLE_TYPE" != "xn" ]; then
|
if [ "x$SINGLE_TYPE" != "xn" ]; then
|
||||||
BUILD_TYPES="${SINGLE_TYPE}"
|
BUILD_TYPES=("${SINGLE_TYPE}")
|
||||||
else
|
else
|
||||||
[ "x$QTCREATOR" == "xy" ] && BUILD_TYPES+=" ${QTCREATOR_BUILD_TYPES[@]}"
|
[ "x$QTCREATOR" == "xy" ] && BUILD_TYPES=("${BUILD_TYPES[@]}" "${QTCREATOR_BUILD_TYPES[@]}")
|
||||||
[ "x$CMAKE" == "xy" ] && BUILD_TYPES+=" ${CMAKE_BUILD_TYPES[@]}"
|
[ "x$CMAKE" == "xy" ] && BUILD_TYPES=("${BUILD_TYPES[@]}" "${CMAKE_BUILD_TYPES[@]}")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "x${BUILD_TYPES}" == "x" ]; then
|
if [ ${#BUILD_TYPES[@]} -eq 0 ]; then
|
||||||
echo "No build type selected."
|
echo "No build type selected."
|
||||||
echo "Use -c for default CMake build types"
|
echo "Use -c for default CMake build types"
|
||||||
echo "Use -q for build types for QtCreator"
|
echo "Use -q for build types for QtCreator"
|
||||||
@ -194,13 +193,13 @@ fi
|
|||||||
if [ -x "$(command -v parallel)" ]; then
|
if [ -x "$(command -v parallel)" ]; then
|
||||||
PV=$(parallel --version | head -n 1 | awk '{ print $3; }')
|
PV=$(parallel --version | head -n 1 | awk '{ print $3; }')
|
||||||
if [ "$PV" -lt "20131121" ]; then
|
if [ "$PV" -lt "20131121" ]; then
|
||||||
parallel generate_configuration ::: ${BUILD_TYPES}
|
parallel generate_configuration ::: "${BUILD_TYPES[@]}"
|
||||||
elif [ "$PV" -lt "20141023" ]; then
|
elif [ "$PV" -lt "20141023" ]; then
|
||||||
parallel --no-notice generate_configuration ::: ${BUILD_TYPES}
|
parallel --no-notice generate_configuration ::: "${BUILD_TYPES[@]}"
|
||||||
else
|
else
|
||||||
parallel --will-cite generate_configuration ::: ${BUILD_TYPES}
|
parallel --will-cite generate_configuration ::: "${BUILD_TYPES[@]}"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
for T in ${BUILD_TYPES}; do generate_configuration "${T}"; done
|
for T in "${BUILD_TYPES[@]}"; do generate_configuration "${T}"; done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user