diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2020-07-02 22:40:28 +0200 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2020-07-06 17:43:28 +0200 |
commit | dbd3c7596542ab100a794831f1f28ea00be77a0f (patch) | |
tree | d9757c07deba88e2695202d743dd6bacd8830cd4 /configure | |
parent | ffb8464cefd661cfa3428931bd80ee262cacbe13 (diff) |
CMake: Teach configure.bat the -cmake argument
The configure scripts need to translate configure options to CMake
arguments. It is not sensible to implement this translation twice, in
sh and Windows batch language, so we're doing this once, in CMake
language.
The configure scripts write their options into config.opt and call a
CMake script that reads config.opt, does the translation to CMake
arguments and calls CMake to generate the build system.
While we're at it, implement some more translations than the sh
configure provided, like -extprefix, -top-level and -skip.
Fixes: QTBUG-85349
Fixes: QTBUG-85350
Task-number: QTBUG-85373
Change-Id: Ida5d8b2a3c178b9349d41ec76d190c69a9456e74
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 114 |
1 files changed, 10 insertions, 104 deletions
@@ -112,93 +112,6 @@ checkTopLevelBuild() fi } -CMAKE_CMDLINE= -getCMakeCmdLine() -{ -PASSTHRU= -set -f # suppress globbing in for loop -SAVED_IFS=$IFS -IFS=' -' - -if [ "$CFG_DEV" = "yes" ]; then - CMAKE_CMDLINE="$CMAKE_CMDLINE --DFEATURE_developer_build=ON" - CMAKE_CMDLINE="$CMAKE_CMDLINE --DBUILD_TESTING=ON" - CMAKE_CMDLINE="$CMAKE_CMDLINE --DBUILD_EXAMPLES=ON" -fi - -if [ "$CMAKE_MAKEFILES" = "no" ]; then - CMAKE_CMDLINE="$CMAKE_CMDLINE --G Ninja" -fi - -while [ "$#" -gt 0 ]; do - i="$1" - shift - if [ "$PASSTHRU" = "yes" ]; then - CMAKE_CMDLINE="$CMAKE_CMDLINE -$i" - else - case $i in - -nomake|--nomake) - arg_capitalized=`echo $1 | tr a-z A-Z` - shift - CMAKE_CMDLINE="$CMAKE_CMDLINE --DQT_NO_MAKE_${arg_capitalized}=ON" - ;; - -feature-*|--feature-*) - VAR=`echo $i | sed -E 's/-?-feature-(.*)/\1/'` - CMAKE_CMDLINE="$CMAKE_CMDLINE --DQT_FEATURE_${VAR}=ON" - ;; - -no-feature-*|--no-feature-*) - VAR=`echo $i | sed -E 's/-?-no-feature-(.*)/\1/'` - CMAKE_CMDLINE="$CMAKE_CMDLINE --DQT_FEATURE_${VAR}=OFF" - ;; - -no-pch|--no-pch) - "$CMAKE_CMDLINE --DBUILD_WITH_PCH=OFF" - ;; - -no-*|--no-*) - VAR=`echo $i | sed -E 's/-?-no-(.*)/\1/'` - CMAKE_CMDLINE="$CMAKE_CMDLINE --DFEATURE_${VAR}=OFF" - ;; - -system-*|--system-*) - VAR=`echo $i | sed -E 's/-?-system-(.*)/\1/'` - CMAKE_CMDLINE="$CMAKE_CMDLINE --DFEATURE_system_${VAR}=ON" - ;; - -qt-*|--qt-*) - VAR=`echo $i | sed -E 's/-?-qt-(.*)/\1/'` - CMAKE_CMDLINE="$CMAKE_CMDLINE --DFEATURE_system_${VAR}=OFF" - ;; - -sanitize=*|--sanitize=*) - VAR=`echo $i | sed -E 's/-?-sanitize=(.*)/\1/'` - CMAKE_CMDLINE="$CMAKE_CMDLINE --DECM_ENABLE_SANITIZERS=${VAR}" - ;; - -ccache|--ccache) - CMAKE_CMDLINE="$CMAKE_CMDLINE --DQT_USE_CCACHE=ON" - ;; - --) - PASSTHRU=yes - ;; - *) - ;; - esac - fi -done -set +f -IFS=$SAVED_IFS -} - OPT_CMDLINE= # expanded version for the script QMAKE_CMDLINE= # verbatim version for qmake call getOptAndQMakeCmdLines() @@ -1002,26 +915,19 @@ else fi } -runCMake() -{ -# recreate command line for cmake -set -f -SAVED_IFS=$IFS -IFS=' -' -for i in $CMAKE_CMDLINE; do - set -- $* "$i" -done -set +f -IFS=$SAVED_IFS -cmake $* "$relpath" -} - parseCommandline "$@" handleHelp if [ "$BUILD_WITH_CMAKE" = "yes" ]; then - getCMakeCmdLine $@ - runCMake + checkTopLevelBuild "$@" + getOptAndQMakeCmdLines "$@" + if [ -z "$optfile" ]; then # only write optfile if not currently redoing + optfile=${outpathPrefix}config.opt + if [ -f "$optfile" ]; then rm "$optfile"; fi + for arg in "$@"; do + echo $arg >> "$optfile" + done + fi + cmake "-DOPTFILE=$optfile" -P "$relpath/cmake/QtProcessConfigureArgs.cmake" else findPerl findAwk |