Add msbuild low CPU priority option for polite compiling. (#7828)

This commit is contained in:
Jebtrix 2022-01-28 09:13:11 -05:00 committed by GitHub
parent 0ffc27dbe1
commit cfdf7d2a00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,6 +10,7 @@
@ECHO [-PRODUCT ^<product^>] [-DESTDIR ^<directory^>] @ECHO [-PRODUCT ^<product^>] [-DESTDIR ^<directory^>]
@ECHO [-STEPS ^<all^|all-dirty^|app^|app-dirty^|deps^|deps-dirty^>] @ECHO [-STEPS ^<all^|all-dirty^|app^|app-dirty^|deps^|deps-dirty^>]
@ECHO [-RUN ^<console^|custom^|none^|viewer^|window^>] @ECHO [-RUN ^<console^|custom^|none^|viewer^|window^>]
@ECHO [-PRIORITY ^<normal^|low^>]
@ECHO. @ECHO.
@ECHO -a -ARCH Target processor architecture @ECHO -a -ARCH Target processor architecture
@ECHO Default: %PS_ARCH_HOST% @ECHO Default: %PS_ARCH_HOST%
@ -38,6 +39,8 @@
@ECHO -d -DESTDIR Deps destination directory @ECHO -d -DESTDIR Deps destination directory
@ECHO Warning: Changing destdir path will not delete the old destdir. @ECHO Warning: Changing destdir path will not delete the old destdir.
@ECHO Default: %PS_DESTDIR_DEFAULT_MSG% @ECHO Default: %PS_DESTDIR_DEFAULT_MSG%
@ECHO -p -PRIORITY Build CPU priority
@ECHO Default: normal
@ECHO. @ECHO.
@ECHO Examples: @ECHO Examples:
@ECHO. @ECHO.
@ -86,6 +89,7 @@ SET PS_RUN=none
SET PS_DESTDIR= SET PS_DESTDIR=
SET PS_VERSION= SET PS_VERSION=
SET PS_PRODUCT=%PS_PRODUCT_DEFAULT% SET PS_PRODUCT=%PS_PRODUCT_DEFAULT%
SET PS_PRIORITY=normal
CALL :RESOLVE_DESTDIR_CACHE CALL :RESOLVE_DESTDIR_CACHE
REM Set up parameters used by help menu REM Set up parameters used by help menu
@ -99,7 +103,7 @@ SET EXIT_STATUS=1
SET PS_CURRENT_STEP=arguments SET PS_CURRENT_STEP=arguments
SET PARSER_STATE= SET PARSER_STATE=
SET PARSER_FAIL= SET PARSER_FAIL=
FOR %%I in (%*) DO CALL :PARSE_OPTION "ARCH CONFIG DESTDIR STEPS RUN VERSION PRODUCT" PARSER_STATE "%%~I" FOR %%I in (%*) DO CALL :PARSE_OPTION "ARCH CONFIG DESTDIR STEPS RUN VERSION PRODUCT PRIORITY" PARSER_STATE "%%~I"
IF "%PARSER_FAIL%" NEQ "" ( IF "%PARSER_FAIL%" NEQ "" (
@ECHO ERROR: Invalid switch: %PARSER_FAIL% 1>&2 @ECHO ERROR: Invalid switch: %PARSER_FAIL% 1>&2
GOTO :HELP GOTO :HELP
@ -114,6 +118,9 @@ CALL :TOLOWER PS_ARCH
SET PS_ARCH=%PS_ARCH:amd64=x64% SET PS_ARCH=%PS_ARCH:amd64=x64%
CALL :PARSE_OPTION_VALUE %PS_CONFIG_LIST:;= % PS_CONFIG CALL :PARSE_OPTION_VALUE %PS_CONFIG_LIST:;= % PS_CONFIG
IF "%PS_CONFIG%" EQU "" GOTO :HELP IF "%PS_CONFIG%" EQU "" GOTO :HELP
CALL :PARSE_OPTION_VALUE "normal low" PS_PRIORITY
SET PS_PRIORITY=%PS_PRIORITY:normal= %
SET PS_PRIORITY=%PS_PRIORITY:low=-low%
REM RESOLVE_DESTDIR_CACHE must go after PS_ARCH and PS_CONFIG, but before PS STEPS REM RESOLVE_DESTDIR_CACHE must go after PS_ARCH and PS_CONFIG, but before PS STEPS
CALL :RESOLVE_DESTDIR_CACHE CALL :RESOLVE_DESTDIR_CACHE
IF "%PS_STEPS%" EQU "" SET PS_STEPS=%PS_STEPS_DEFAULT% IF "%PS_STEPS%" EQU "" SET PS_STEPS=%PS_STEPS_DEFAULT%
@ -200,7 +207,7 @@ IF %ERRORLEVEL% NEQ 0 IF "%PS_STEPS_DIRTY%" NEQ "" (
(del CMakeCache.txt && cmake.exe .. -DDESTDIR="%PS_DESTDIR%") || GOTO :END (del CMakeCache.txt && cmake.exe .. -DDESTDIR="%PS_DESTDIR%") || GOTO :END
) ELSE GOTO :END ) ELSE GOTO :END
(echo %PS_DESTDIR%)> "%PS_DEPS_PATH_FILE%" (echo %PS_DESTDIR%)> "%PS_DEPS_PATH_FILE%"
msbuild /m ALL_BUILD.vcxproj /p:Configuration=%PS_CONFIG% /v:quiet || GOTO :END msbuild /m ALL_BUILD.vcxproj /p:Configuration=%PS_CONFIG% /v:quiet %PS_PRIORITY% || GOTO :END
cd ..\.. cd ..\..
IF /I "%PS_STEPS:~0,4%" EQU "deps" GOTO :RUN_APP IF /I "%PS_STEPS:~0,4%" EQU "deps" GOTO :RUN_APP
@ -223,7 +230,7 @@ IF %ERRORLEVEL% NEQ 0 IF "%PS_STEPS_DIRTY%" NEQ "" (
(del CMakeCache.txt && cmake.exe .. -DCMAKE_PREFIX_PATH="%PS_DESTDIR%\usr\local" -DCMAKE_CONFIGURATION_TYPES=%PS_CONFIG_LIST%) || GOTO :END (del CMakeCache.txt && cmake.exe .. -DCMAKE_PREFIX_PATH="%PS_DESTDIR%\usr\local" -DCMAKE_CONFIGURATION_TYPES=%PS_CONFIG_LIST%) || GOTO :END
) ELSE GOTO :END ) ELSE GOTO :END
REM Skip the build step if we're using the undocumented app-cmake to regenerate the full config from inside devenv REM Skip the build step if we're using the undocumented app-cmake to regenerate the full config from inside devenv
IF "%PS_STEPS%" NEQ "app-cmake" msbuild /m ALL_BUILD.vcxproj /p:Configuration=%PS_CONFIG% /v:quiet || GOTO :END IF "%PS_STEPS%" NEQ "app-cmake" msbuild /m ALL_BUILD.vcxproj /p:Configuration=%PS_CONFIG% /v:quiet %PS_PRIORITY% || GOTO :END
(echo %PS_DESTDIR%)> "%PS_DEPS_PATH_FILE_FOR_CONFIG%" (echo %PS_DESTDIR%)> "%PS_DEPS_PATH_FILE_FOR_CONFIG%"
REM Run app REM Run app