Compare commits
6 Commits
6c31d9f67e
...
9217079b4a
Author | SHA1 | Date | |
---|---|---|---|
9217079b4a | |||
1ff29c5c87 | |||
565f79f5ba | |||
36487b07d2 | |||
e15e1fb505 | |||
dc15c6ea8b |
42
cmake.sh
42
cmake.sh
@@ -94,15 +94,6 @@ 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; }
|
||||||
|
|
||||||
if [ -d "${BUILD_DIR}" ]; then
|
|
||||||
if [ "x${FORCE}" == "xy" ]; then
|
|
||||||
rm -rf "${BUILD_DIR}"
|
|
||||||
else
|
|
||||||
echo "Build directory already exists. Use --force to remove this directory or do it manually"
|
|
||||||
exit 5
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "x${SINGLE_TYPE}" != "xn" ]; then
|
if [ "x${SINGLE_TYPE}" != "xn" ]; then
|
||||||
case "${SINGLE_TYPE}" in
|
case "${SINGLE_TYPE}" in
|
||||||
None|Debug|Release|Profile|RelWithDebInfo|MinSizeRel)
|
None|Debug|Release|Profile|RelWithDebInfo|MinSizeRel)
|
||||||
@@ -122,8 +113,10 @@ export SOURCE_DIR
|
|||||||
export BUILD_DIR
|
export BUILD_DIR
|
||||||
export OUTPUT_DIR
|
export OUTPUT_DIR
|
||||||
export CMAKE_ARGS
|
export CMAKE_ARGS
|
||||||
|
export SINGLE_TYPE
|
||||||
|
export FORCE
|
||||||
|
|
||||||
CMAKE_BUILD_TYPES=(None Debug Release RelWithDebInfo MinSizeRel)
|
CMAKE_BUILD_TYPES=(None Debug Release Profile RelWithDebInfo MinSizeRel)
|
||||||
QTCREATOR_BUILD_TYPES=(qtNone qtDebug qtRelease qtProfile)
|
QTCREATOR_BUILD_TYPES=(qtNone qtDebug qtRelease qtProfile)
|
||||||
|
|
||||||
generate_configuration() {
|
generate_configuration() {
|
||||||
@@ -152,8 +145,21 @@ generate_configuration() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
GEN_DIR="${BUILD_DIR}"
|
GEN_DIR="${BUILD_DIR}"
|
||||||
[ "x${SINGLE_TYPE}" == "xn" ] && GEN_DIR="${BUILD_DIR}/${BUILD}"
|
if [ "x${SINGLE_TYPE}" == "xn" ]; then
|
||||||
[ -d "${GEN_DIR}" ] && return 0
|
GEN_DIR="${BUILD_DIR}/${BUILD}"
|
||||||
|
else
|
||||||
|
GEN_DIR="${BUILD_DIR}/${SINGLE_TYPE}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -d "${GEN_DIR}" ]; then
|
||||||
|
if [ "x${FORCE}" == "xy" ]; then
|
||||||
|
rm -rf "${GEN_DIR}"
|
||||||
|
else
|
||||||
|
echo "Build directory '${GEN_DIR}' already exists. Use --force to remove this directory or do it manually"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
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}"
|
||||||
@@ -172,13 +178,11 @@ EOF
|
|||||||
|
|
||||||
export -f generate_configuration
|
export -f generate_configuration
|
||||||
|
|
||||||
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=("${BUILD_TYPES[@]}" "${QTCREATOR_BUILD_TYPES[@]}")
|
[ "x$QTCREATOR" == "xy" ] && BUILD_TYPES=("${QTCREATOR_BUILD_TYPES[@]}")
|
||||||
[ "x$CMAKE" == "xy" ] && BUILD_TYPES=("${BUILD_TYPES[@]}" "${CMAKE_BUILD_TYPES[@]}")
|
[ "x$CMAKE" == "xy" ] && BUILD_TYPES=("${CMAKE_BUILD_TYPES[@]}")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ${#BUILD_TYPES[@]} -eq 0 ]; then
|
if [ ${#BUILD_TYPES[@]} -eq 0 ]; then
|
||||||
@@ -193,11 +197,11 @@ 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 --delay 2 -r generate_configuration ::: "${BUILD_TYPES[@]}"
|
||||||
elif [ "$PV" -lt "20141023" ]; then
|
elif [ "$PV" -lt "20141023" ]; then
|
||||||
parallel --no-notice generate_configuration ::: "${BUILD_TYPES[@]}"
|
parallel --delay 2 -r --no-notice generate_configuration ::: "${BUILD_TYPES[@]}"
|
||||||
else
|
else
|
||||||
parallel --will-cite generate_configuration ::: "${BUILD_TYPES[@]}"
|
parallel --delay 2 -r --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
|
||||||
|
Reference in New Issue
Block a user