Before we only generated a 'config.redo' script in the build dir of qtbase or a top-level build. After this change, we will also generate one when configuring repos in a per-repo build of qt. This allows quick fresh reconfiguration of a repo, without having to remember how it was configured before. To make that happen, we need to duplicate parts of the '-redo' code that was initially added in configure, into qt-configure-module, both for the Unix and Windows scripts. Slight adjustments had to be made to account for the source repo path argument, that needs to be skipped from being added into the config.opt.in file. We also need to modify the code that generates the config.redo file to do it at the start of each repo configuration, rather than just when configuring qtbase. Amends 8ffb6ce64cb0183bf6805497b398463549c1ed8d Change-Id: I76cd5296ea23ca5bfef6b8975c82416b628bc5d1 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
95 lines
3.1 KiB
Batchfile
95 lines
3.1 KiB
Batchfile
@echo off
|
|
setlocal ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
|
|
set ARGS=%*
|
|
set script_dir_path=%~dp0
|
|
set script_dir_path=%script_dir_path:~0,-1%
|
|
|
|
if "%1" == "" (
|
|
call :print_usage
|
|
exit /b 1
|
|
)
|
|
|
|
set module_root=%1
|
|
set module_root=%module_root:\=/%
|
|
shift
|
|
if not exist "%module_root%\CMakeLists.txt" (
|
|
echo Error: %module_root% is not a valid Qt module source directory. >&2
|
|
call :print_usage
|
|
exit /b 1
|
|
)
|
|
|
|
set cmake_scripts_dir=%script_dir_path%\@__relative_path_to_cmake_scripts_dir@
|
|
set TOPQTDIR=%CD%
|
|
|
|
call :doargs %ARGS%
|
|
if errorlevel 1 exit /b
|
|
goto doneargs
|
|
|
|
:doargs
|
|
if "%~1" == "" exit /b
|
|
|
|
if /i "%~1" == "-redo" goto redo
|
|
if /i "%~1" == "--redo" goto redo
|
|
|
|
:nextarg
|
|
shift
|
|
goto doargs
|
|
|
|
:redo
|
|
if not exist "%TOPQTDIR%\config.opt" goto redoerr
|
|
echo %ARGS% > %TOPQTDIR%\config.redo.in
|
|
set redoing=""
|
|
goto nextarg
|
|
:redoerr
|
|
echo No config.opt present - cannot redo configuration. >&2
|
|
exit /b 1
|
|
|
|
:doneargs
|
|
|
|
rem Write config.opt if we're not currently -redo'ing
|
|
set OPT_FILE_PATH=%TOPQTDIR%\config.opt
|
|
set OPT_TMP_FILE_PATH=%TOPQTDIR%\config.opt.in
|
|
set REDO_FILE_PATH=%TOPQTDIR%\config.redo.last
|
|
set REDO_TMP_FILE_PATH=%TOPQTDIR%\config.redo.in
|
|
set FRESH_REQUESTED_ARG=
|
|
if not defined redoing (
|
|
rem "The '.' in 'echo.%*' ensures we don't print "echo is off" when no arguments are passed"
|
|
rem "https://devblogs.microsoft.com/oldnewthing/20170802-00/?p=96735"
|
|
rem "The space before the '>' makes sure that when we have a digit at the end of the args, we"
|
|
rem "don't accidentally concatenate it with the '>' resulting in '0>' or '2>' which redirects"
|
|
rem "into the file from a stream different than stdout, leading to broken or empty content."
|
|
echo.%* >"%OPT_TMP_FILE_PATH%"
|
|
|
|
rem "The SKIP_ARGS option makes sure not to write the repo path into the config.opt file"
|
|
call "%script_dir_path%\qt-cmake-private.bat" -DSKIP_ARGS=1 -DIN_FILE="%OPT_TMP_FILE_PATH%" ^
|
|
-DOUT_FILE="%OPT_FILE_PATH%" -P "%cmake_scripts_dir%\QtWriteArgsFile.cmake"
|
|
) else (
|
|
echo. 2> "%OPT_TMP_FILE_PATH%"
|
|
for /F "usebackq tokens=*" %%A in ("%OPT_FILE_PATH%") do echo "%%A" >> "%OPT_TMP_FILE_PATH%"
|
|
|
|
rem "The SKIP_REDO_FILE_ARGS option makes sure to remove the repo path read from the"
|
|
rem "config.redo.in file"
|
|
call "%script_dir_path%\qt-cmake-private.bat" -DSKIP_REDO_FILE_ARGS=1 ^
|
|
-DIN_FILE="%OPT_TMP_FILE_PATH%" -DREDO_FILE="%REDO_TMP_FILE_PATH%" ^
|
|
-DOUT_FILE="%REDO_FILE_PATH%" -DIGNORE_ARGS="-redo;--redo" ^
|
|
-P "%cmake_scripts_dir%\QtWriteArgsFile.cmake"
|
|
|
|
set OPT_FILE_PATH=%REDO_FILE_PATH%
|
|
set FRESH_REQUESTED_ARG=-DFRESH_REQUESTED=TRUE
|
|
)
|
|
|
|
rem Launch CMake-based configure
|
|
|
|
call "%script_dir_path%\qt-cmake-private.bat" -DOPTFILE="%OPT_FILE_PATH%" %FRESH_REQUESTED_ARG% ^
|
|
-DMODULE_ROOT="%module_root%" ^
|
|
-DCMAKE_COMMAND="%script_dir_path%\qt-cmake-private.bat" ^
|
|
-P "%cmake_scripts_dir%\QtProcessConfigureArgs.cmake"
|
|
goto :eof
|
|
|
|
:print_usage
|
|
echo Usage: qt-configure-module ^<module-source-dir^> [options]
|
|
echo.
|
|
echo To display the available options for a Qt module, run
|
|
echo qt-configure-module ^<module-source-dir^> -help
|
|
goto :eof
|