Warning, /graphics/krita/build-tools/windows/build-msvc.cmd is written in an unsupported language. File is not indexed.
0001 @echo off 0002 0003 setlocal enabledelayedexpansion 0004 goto begin 0005 0006 0007 :: Subroutines 0008 0009 :find_on_path out_variable file_name 0010 set %1=%~f$PATH:2 0011 goto :EOF 0012 0013 0014 :get_dir_path out_variable file_path 0015 set %1=%~dp2 0016 goto :EOF 0017 0018 0019 :get_full_path out_variable file_path 0020 setlocal 0021 set FULL_PATH=%~f2 0022 if not exist "%FULL_PATH%" ( 0023 set FULL_PATH= 0024 ) else ( 0025 if exist "%FULL_PATH%\" ( 0026 set FULL_PATH= 0027 ) 0028 ) 0029 endlocal & set "%1=%FULL_PATH%" 0030 goto :EOF 0031 0032 0033 :get_full_path_dir out_variable file_path 0034 setlocal 0035 set FULL_PATH=%~dp2 0036 if not exist "%FULL_PATH%" ( 0037 set FULL_PATH= 0038 ) 0039 endlocal & set "%1=%FULL_PATH%" 0040 goto :EOF 0041 0042 0043 :prompt_for_string out_variable prompt 0044 set /p %1=%~2^> 0045 goto :EOF 0046 0047 0048 :prompt_for_positive_integer out_variable prompt 0049 setlocal 0050 call :prompt_for_string USER_INPUT "%~2" 0051 if "%USER_INPUT%" == "" set USER_INPUT=0 0052 set /a RESULT=%USER_INPUT% 0053 if not %RESULT% GTR 0 ( 0054 set RESULT= 0055 ) 0056 endlocal & set "%1=%RESULT%" 0057 goto :EOF 0058 0059 0060 :prompt_for_file out_variable prompt 0061 setlocal 0062 :prompt_for_file__retry 0063 call :prompt_for_string USER_INPUT "%~2" 0064 if "%USER_INPUT%" == "" ( 0065 endlocal 0066 set %1= 0067 goto :EOF 0068 ) 0069 call :get_full_path RESULT "%USER_INPUT%" 0070 if "%RESULT%" == "" ( 0071 echo Input does not point to valid file! 0072 set USER_INPUT= 0073 goto prompt_for_file__retry 0074 ) 0075 endlocal & set "%1=%RESULT%" 0076 goto :EOF 0077 0078 0079 :prompt_for_dir out_variable prompt 0080 setlocal 0081 :prompt_for_dir__retry 0082 call :prompt_for_string USER_INPUT "%~2" 0083 if "%USER_INPUT%" == "" ( 0084 endlocal 0085 set %1= 0086 goto :EOF 0087 ) 0088 call :get_full_path_dir RESULT "%USER_INPUT%\" 0089 if "%RESULT%" == "" ( 0090 echo Input does not point to valid dir! 0091 set USER_INPUT= 0092 goto prompt_for_dir__retry 0093 ) 0094 endlocal & set "%1=%RESULT%" 0095 goto :EOF 0096 0097 0098 :has_target out_variable folder 0099 setlocal 0100 set RESULT= 0101 if exist "%~2" ( 0102 set RESULT=1 0103 ) 0104 endlocal & set "%1=%RESULT%" 0105 goto :EOF 0106 0107 :usage 0108 echo Usage: 0109 echo %~n0 [--no-interactive] [ OPTIONS ... ] 0110 echo. 0111 echo Basic options: 0112 echo --no-interactive Run without interactive prompts 0113 echo When not specified, the script will prompt 0114 echo for some of the parameters. 0115 echo --jobs ^<count^> Set parallel jobs count when building 0116 echo Defaults to no. of logical cores 0117 echo --skip-deps Skips (re)building of deps 0118 echo --skip-krita Skips (re)building of Krita 0119 echo --cmd Launch a cmd prompt instead of building. 0120 echo The environment is set up like the build 0121 echo environment with some helper command macros. 0122 echo --dev Activate developer options, like 'CodeBlocks' 0123 echo generator and BUILD_TESTING 0124 echo. 0125 echo Path options: 0126 echo --src-dir ^<dir_path^> Specify Krita source dir 0127 echo If unspecified, this will be determined from 0128 echo the script location. 0129 echo --download-dir ^<dir_path^> Specify deps download dir 0130 echo Can be omitted if --skip-deps is used 0131 echo --deps-build-dir ^<dir_path^> Specify deps build dir 0132 echo Can be omitted if --skip-deps is used 0133 echo --deps-install-dir ^<dir_path^> Specify deps install dir 0134 echo --krita-build-dir ^<dir_path^> Specify Krita build dir 0135 echo Can be omitted if --skip-krita is used 0136 echo --krita-install-dir ^<dir_path^> Specify Krita install dir 0137 echo Can be omitted if --skip-krita is used 0138 echo. 0139 goto :EOF 0140 :usage_and_exit 0141 call :usage 0142 exit /b 0143 :usage_and_fail 0144 call :usage 0145 exit /b 100 0146 0147 0148 :: ---------------------------- 0149 :begin 0150 0151 echo Krita build script for Windows 0152 echo. 0153 0154 0155 :: command-line args parsing 0156 set ARG_NO_INTERACTIVE= 0157 set ARG_JOBS= 0158 set ARG_SKIP_DEPS= 0159 set ARG_SKIP_KRITA= 0160 set ARG_SRC_DIR= 0161 set ARG_DOWNLOAD_DIR= 0162 set ARG_DEPS_BUILD_DIR= 0163 set ARG_DEPS_INSTALL_DIR= 0164 set ARG_KRITA_BUILD_DIR= 0165 set ARG_KRITA_INSTALL_DIR= 0166 set ARG_PLUGINS_BUILD_DIR= 0167 set ARG_CMD= 0168 set ARG_DEV= 0169 :args_parsing_loop 0170 set CURRENT_MATCHED= 0171 if not "%1" == "" ( 0172 if "%1" == "--no-interactive" ( 0173 set ARG_NO_INTERACTIVE=1 0174 set CURRENT_MATCHED=1 0175 ) 0176 if "%1" == "--jobs" ( 0177 if not "%ARG_JOBS%" == "" ( 0178 echo ERROR: Arg --jobs specified more than once 1>&2 0179 echo. 0180 goto usage_and_fail 0181 ) 0182 set /a "ARG_JOBS=%2" 0183 if not !ARG_JOBS! GTR 0 ( 0184 echo ERROR: Arg --jobs is not a positive integer 1>&2 0185 echo. 0186 goto usage_and_fail 0187 ) 0188 shift /2 0189 set CURRENT_MATCHED=1 0190 ) 0191 if "%1" == "--skip-deps" ( 0192 set ARG_SKIP_DEPS=1 0193 set CURRENT_MATCHED=1 0194 ) 0195 if "%1" == "--skip-krita" ( 0196 set ARG_SKIP_KRITA=1 0197 set CURRENT_MATCHED=1 0198 ) 0199 if "%1" == "--dev" ( 0200 set ARG_DEV=1 0201 set CURRENT_MATCHED=1 0202 ) 0203 if "%1" == "--src-dir" ( 0204 if not "%ARG_SRC_DIR%" == "" ( 0205 echo ERROR: Arg --src-dir specified more than once 1>&2 0206 echo. 0207 goto usage_and_fail 0208 ) 0209 if not exist "%~f2\" ( 0210 echo ERROR: Arg --src-dir does not point to a directory 1>&2 0211 echo. 0212 goto usage_and_fail 0213 ) 0214 call :get_dir_path ARG_SRC_DIR "%~f2\" 0215 shift /2 0216 set CURRENT_MATCHED=1 0217 ) 0218 if "%1" == "--download-dir" ( 0219 if not "%ARG_DOWNLOAD_DIR%" == "" ( 0220 echo ERROR: Arg --download-dir specified more than once 1>&2 0221 echo. 0222 goto usage_and_fail 0223 ) 0224 if "%~f2" == "" ( 0225 echo ERROR: Arg --download-dir does not point to a valid path 1>&2 0226 echo. 0227 goto usage_and_fail 0228 ) 0229 call :get_dir_path ARG_DOWNLOAD_DIR "%~f2\" 0230 shift /2 0231 set CURRENT_MATCHED=1 0232 ) 0233 if "%1" == "--deps-build-dir" ( 0234 if not "%ARG_DEPS_BUILD_DIR%" == "" ( 0235 echo ERROR: Arg --deps-build-dir specified more than once 1>&2 0236 echo. 0237 goto usage_and_fail 0238 ) 0239 if "%~f2" == "" ( 0240 echo ERROR: Arg --deps-build-dir does not point to a valid path 1>&2 0241 echo. 0242 goto usage_and_fail 0243 ) 0244 call :get_dir_path ARG_DEPS_BUILD_DIR "%~f2\" 0245 shift /2 0246 set CURRENT_MATCHED=1 0247 ) 0248 if "%1" == "--deps-install-dir" ( 0249 if not "%ARG_DEPS_INSTALL_DIR%" == "" ( 0250 echo ERROR: Arg --deps-install-dir specified more than once 1>&2 0251 echo. 0252 goto usage_and_fail 0253 ) 0254 if "%~f2" == "" ( 0255 echo ERROR: Arg --deps-install-dir does not point to a valid path 1>&2 0256 echo. 0257 goto usage_and_fail 0258 ) 0259 call :get_dir_path ARG_DEPS_INSTALL_DIR "%~f2\" 0260 shift /2 0261 set CURRENT_MATCHED=1 0262 ) 0263 if "%1" == "--krita-build-dir" ( 0264 if not "%ARG_KRITA_BUILD_DIR%" == "" ( 0265 echo ERROR: Arg --krita-build-dir specified more than once 1>&2 0266 echo. 0267 goto usage_and_fail 0268 ) 0269 if "%~f2" == "" ( 0270 echo ERROR: Arg --krita-build-dir does not point to a valid path 1>&2 0271 echo. 0272 goto usage_and_fail 0273 ) 0274 call :get_dir_path ARG_KRITA_BUILD_DIR "%~f2\" 0275 shift /2 0276 set CURRENT_MATCHED=1 0277 ) 0278 if "%1" == "--krita-install-dir" ( 0279 if not "%ARG_KRITA_INSTALL_DIR%" == "" ( 0280 echo ERROR: Arg --krita-install-dir specified more than once 1>&2 0281 echo. 0282 goto usage_and_fail 0283 ) 0284 if "%~f2" == "" ( 0285 echo ERROR: Arg --krita-install-dir does not point to a valid path 1>&2 0286 echo. 0287 goto usage_and_fail 0288 ) 0289 call :get_dir_path ARG_KRITA_INSTALL_DIR "%~f2\" 0290 shift /2 0291 set CURRENT_MATCHED=1 0292 ) 0293 if "%1" == "--plugins-build-dir" ( 0294 if not "%ARG_PLUGINS_BUILD_DIR%" == "" ( 0295 echo ERROR: Arg --plugins-build-dir specified more than once 1>&2 0296 echo. 0297 goto usage_and_fail 0298 ) 0299 if "%~f2" == "" ( 0300 echo ERROR: Arg --plugins-build-dir does not point to a valid path 1>&2 0301 echo. 0302 goto usage_and_fail 0303 ) 0304 call :get_dir_path ARG_PLUGINS_BUILD_DIR "%~f2\" 0305 shift /2 0306 set CURRENT_MATCHED=1 0307 ) 0308 if "%1" == "--cmd" ( 0309 set ARG_CMD=1 0310 set CURRENT_MATCHED=1 0311 ) 0312 if "%1" == "--help" ( 0313 goto usage_and_exit 0314 ) 0315 if not "!CURRENT_MATCHED!" == "1" ( 0316 echo ERROR: Unknown option %1 1>&2 0317 echo. 0318 goto usage_and_fail 0319 ) 0320 shift /1 0321 goto args_parsing_loop 0322 ) 0323 0324 if "%ARG_NO_INTERACTIVE%" == "1" ( 0325 echo Non-interactive mode 0326 ) else ( 0327 echo Interactive mode 0328 :: Trick to pause on exit 0329 call :real_begin 0330 pause 0331 exit /b !ERRORLEVEL! 0332 ) 0333 :real_begin 0334 echo. 0335 0336 0337 if "%ARG_SKIP_DEPS%" == "1" ( 0338 if "%ARG_SKIP_KRITA%" == "1" ( 0339 echo Both deps and Krita will be skipped. 0340 ) else ( 0341 echo Building of deps will be skipped. 0342 ) 0343 ) else ( 0344 if "%ARG_SKIP_KRITA%" == "1" ( 0345 echo Building of Krita will be skipped. 0346 ) else ( 0347 echo Both deps and Krita will be built. 0348 ) 0349 ) 0350 0351 0352 :: Check environment config 0353 0354 if "%CMAKE_EXE%" == "" ( 0355 call :find_on_path CMAKE_EXE cmake.exe 0356 if "!CMAKE_EXE!" == "" ( 0357 if not "%ARG_NO_INTERACTIVE%" == "1" ( 0358 call :prompt_for_file CMAKE_EXE "Provide path to cmake.exe" 0359 ) 0360 if "!CMAKE_EXE!" == "" ( 0361 echo ERROR: CMake not found! 1>&2 0362 exit /b 102 0363 ) 0364 ) else ( 0365 echo Found CMake on PATH: !CMAKE_EXE! 0366 if not "%ARG_NO_INTERACTIVE%" == "1" ( 0367 choice /c ny /n /m "Is this correct? [y/n] " 0368 if errorlevel 3 exit 255 0369 if not errorlevel 2 ( 0370 call :prompt_for_file CMAKE_EXE "Provide path to cmake.exe" 0371 if "!CMAKE_EXE!" == "" ( 0372 echo ERROR: CMake not found! 1>&2 0373 exit /b 102 0374 ) 0375 ) 0376 ) 0377 ) 0378 ) 0379 echo CMake: %CMAKE_EXE% 0380 0381 if "%SEVENZIP_EXE%" == "" ( 0382 call :find_on_path SEVENZIP_EXE 7z.exe 0383 if "!SEVENZIP_EXE!" == "" ( 0384 set "SEVENZIP_EXE=%ProgramFiles%\7-Zip\7z.exe" 0385 if "!SEVENZIP_EXE!" == "" ( 0386 set "SEVENZIP_EXE=%ProgramFiles(x86)%\7-Zip\7z.exe" 0387 ) 0388 if "!SEVENZIP_EXE!" == "" ( 0389 echo 7-Zip not found 0390 ) 0391 ) 0392 ) 0393 if "%SEVENZIP_EXE%" == "" ( 0394 echo 7-Zip: %SEVENZIP_EXE% 0395 ) 0396 0397 if "%PYTHON_BIN_DIR%" == "" ( 0398 call :find_on_path PYTHON_BIN_DIR_PYTHON_EXE python.exe 0399 if "!PYTHON_BIN_DIR_PYTHON_EXE!" == "" ( 0400 if not "%ARG_NO_INTERACTIVE%" == "1" ( 0401 call :prompt_for_file PYTHON_BIN_DIR_PYTHON_EXE "Provide path to python.exe of Python 3.6.2" 0402 ) 0403 if "!PYTHON_BIN_DIR_PYTHON_EXE!" == "" ( 0404 echo ERROR: Python not found! 1>&2 0405 exit /b 102 0406 ) 0407 call :get_dir_path PYTHON_BIN_DIR "!PYTHON_BIN_DIR_PYTHON_EXE!" 0408 ) else ( 0409 call :get_dir_path PYTHON_BIN_DIR "!PYTHON_BIN_DIR_PYTHON_EXE!" 0410 echo Found Python on PATH: !PYTHON_BIN_DIR! 0411 if not "%ARG_NO_INTERACTIVE%" == "1" ( 0412 choice /c ny /n /m "Is this correct? [y/n] " 0413 if errorlevel 3 exit 255 0414 if not errorlevel 2 ( 0415 call :prompt_for_file PYTHON_BIN_DIR_PYTHON_EXE "Provide path to python.exe of Python 3.6.2" 0416 if "!PYTHON_BIN_DIR_PYTHON_EXE!" == "" ( 0417 echo ERROR: Python not found! 1>&2 0418 exit /b 102 0419 ) 0420 call :get_dir_path PYTHON_BIN_DIR "!PYTHON_BIN_DIR_PYTHON_EXE!" 0421 ) 0422 ) 0423 ) 0424 ) 0425 echo Python: %PYTHON_BIN_DIR% 0426 0427 @REM Translation tools 0428 0429 if "%KRITA_GIT_DIR%" == "" ( 0430 call :find_on_path KRITA_GIT_EXE_DIR git.exe 0431 if NOT "!KRITA_GIT_EXE_DIR!" == "" ( 0432 call :get_dir_path KRITA_GIT_DIR "!KRITA_GIT_EXE_DIR!" 0433 echo Found Git on PATH: !KRITA_GIT_DIR! 0434 ) 0435 ) else echo Git found on %KRITA_GIT_DIR% 0436 0437 if "%KRITA_NINJA_DIR%" == "" ( 0438 call :find_on_path KRITA_NINJA_EXE_DIR ninja.exe 0439 if NOT "!KRITA_NINJA_EXE_DIR!" == "" ( 0440 call :get_dir_path KRITA_NINJA_DIR "!KRITA_NINJA_EXE_DIR!" 0441 echo Found Ninja on PATH: !KRITA_NINJA_DIR! 0442 ) 0443 ) else echo Ninja found on %KRITA_NINJA_DIR% 0444 0445 if "%SVN_DIR%" == "" ( 0446 call :find_on_path SVN_EXE_DIR svn.exe 0447 if NOT "!SVN_EXE_DIR!" == "" ( 0448 call :get_dir_path SVN_DIR "!SVN_EXE_DIR!" 0449 echo Found SVN on PATH: !SVN_DIR! 0450 ) 0451 ) else echo SVN found on %SVN_DIR% 0452 0453 if "%PERL_DIR%" == "" ( 0454 call :find_on_path PERL_EXE_DIR perl.exe 0455 if NOT "!PERL_EXE_DIR!" == "" ( 0456 call :get_dir_path PERL_DIR "!PERL_EXE_DIR!" 0457 echo Found Perl on PATH: !PERL_DIR! 0458 ) 0459 ) else echo Perl found on %PERL_DIR% 0460 0461 if "%ARG_SKIP_DEPS%" == "1" goto skip_windows_sdk_dir_check 0462 0463 if "%WindowsSdkDir%" == "" if not "%ProgramFiles(x86)%" == "" set "WindowsSdkDir=%ProgramFiles(x86)%\Windows Kits\10" 0464 if "%WindowsSdkDir%" == "" set "WindowsSdkDir=%ProgramFiles(x86)%\Windows Kits\10" 0465 if exist "%WindowsSdkDir%\" ( 0466 pushd "%WindowsSdkDir%" 0467 if exist "bin\x64\fxc.exe" ( 0468 set HAVE_FXC_EXE=1 0469 if "%WindowsSdkVerBinPath%" == "" set "WindowsSdkVerBinPath=%WindowsSdkDir%" 0470 ) else ( 0471 for /f "delims=" %%a in ('dir /a:d /b "bin\10.*"') do ( 0472 if exist "bin\%%a\x64\fxc.exe" ( 0473 set HAVE_FXC_EXE=1 0474 if "%WindowsSdkVerBinPath%" == "" set "WindowsSdkVerBinPath=%WindowsSdkDir%\bin\%%a\" 0475 ) 0476 ) 0477 ) 0478 popd 0479 ) 0480 set QT_ENABLE_DYNAMIC_OPENGL=ON 0481 if not "%HAVE_FXC_EXE%" == "1" ( 0482 set WindowsSdkDir= 0483 echo Windows SDK 10 with fxc.exe not found 0484 echo Qt will *not* be built with ANGLE ^(dynamic OpenGL^) support. 0485 if not "%ARG_NO_INTERACTIVE%" == "1" ( 0486 choice /c ny /n /m "Is this ok? [y/n] " 0487 if errorlevel 3 exit 255 0488 if not errorlevel 2 ( 0489 exit /b 102 0490 ) 0491 ) 0492 set QT_ENABLE_DYNAMIC_OPENGL=OFF 0493 ) else echo Windows SDK 10 with fxc.exe found on %WindowsSdkDir% 0494 0495 :skip_windows_sdk_dir_check 0496 0497 if not "%ARG_JOBS%" == "" ( 0498 set "PARALLEL_JOBS=%ARG_JOBS%" 0499 set "UseMultiToolTask=true" 0500 set "EnforceProcessCountAcrossBuilds=true" 0501 ) 0502 if "%PARALLEL_JOBS%" == "" ( 0503 echo Number of logical CPU cores detected: %NUMBER_OF_PROCESSORS% 0504 echo Enabling %NUMBER_OF_PROCESSORS% parallel jobs 0505 set PARALLEL_JOBS=%NUMBER_OF_PROCESSORS% 0506 if not "%ARG_NO_INTERACTIVE%" == "1" ( 0507 choice /c ny /n /m "Is this correct? [y/n] " 0508 if errorlevel 3 exit 255 0509 if not errorlevel 2 ( 0510 call :prompt_for_positive_integer PARALLEL_JOBS "Provide no. of parallel jobs" 0511 if "!PARALLEL_JOBS!" == "" ( 0512 echo ERROR: Invalid job count! 1>&2 0513 exit /b 102 0514 ) 0515 ) 0516 ) 0517 set "UseMultiToolTask=true" 0518 set "EnforceProcessCountAcrossBuilds=true" 0519 ) 0520 set "MultiProcMaxCount=%PARALLEL_JOBS%" 0521 echo Parallel jobs count: %PARALLEL_JOBS% (MultiProcMaxCount=%MultiProcMaxCount%) 0522 0523 if not "%ARG_SRC_DIR%" == "" ( 0524 set "KRITA_SRC_DIR=%ARG_SRC_DIR%" 0525 ) 0526 if "%KRITA_SRC_DIR%" == "" ( 0527 :: Check whether this looks like to be in the source tree 0528 set "_temp=%~dp0" 0529 if "!_temp:~-21!" == "\build-tools\windows\" ( 0530 if exist "!_temp:~0,-21!\CMakeLists.txt" ( 0531 if exist "!_temp:~0,-21!\3rdparty\CMakeLists.txt" ( 0532 set "KRITA_SRC_DIR=!_temp:~0,-21!\" 0533 echo Script is running inside Krita src dir 0534 ) 0535 ) 0536 ) 0537 ) 0538 if "%KRITA_SRC_DIR%" == "" ( 0539 if not "%ARG_NO_INTERACTIVE%" == "1" ( 0540 call :prompt_for_dir KRITA_SRC_DIR "Provide path of Krita src dir" 0541 ) 0542 if "!KRITA_SRC_DIR!" == "" ( 0543 echo ERROR: Krita src dir not found! 1>&2 0544 exit /b 102 0545 ) 0546 ) 0547 echo Krita src: %KRITA_SRC_DIR% 0548 0549 if "%ARG_SKIP_DEPS%" == "1" goto skip_deps_args_check 0550 0551 if not "%ARG_DOWNLOAD_DIR%" == "" ( 0552 set "DEPS_DOWNLOAD_DIR=%ARG_DOWNLOAD_DIR%" 0553 ) 0554 if "%DEPS_DOWNLOAD_DIR%" == "" ( 0555 set DEPS_DOWNLOAD_DIR=%CD%\d\ 0556 echo Using default deps download dir: !DEPS_DOWNLOAD_DIR! 0557 if not "%ARG_NO_INTERACTIVE%" == "1" ( 0558 choice /c ny /n /m "Is this ok? [y/n] " 0559 if errorlevel 3 exit 255 0560 if not errorlevel 2 ( 0561 call :prompt_for_dir DEPS_DOWNLOAD_DIR "Provide path of depps download dir" 0562 ) 0563 ) 0564 if "!DEPS_DOWNLOAD_DIR!" == "" ( 0565 echo ERROR: Deps download dir not set! 1>&2 0566 exit /b 102 0567 ) 0568 ) 0569 echo Deps download dir: %DEPS_DOWNLOAD_DIR% 0570 0571 if not "%ARG_DEPS_BUILD_DIR%" == "" ( 0572 set "DEPS_BUILD_DIR=%ARG_DEPS_BUILD_DIR%" 0573 ) 0574 if "%DEPS_BUILD_DIR%" == "" ( 0575 set DEPS_BUILD_DIR=%CD%\b_deps\ 0576 echo Using default deps build dir: !DEPS_BUILD_DIR! 0577 if not "%ARG_NO_INTERACTIVE%" == "1" ( 0578 choice /c ny /n /m "Is this ok? [y/n] " 0579 if errorlevel 3 exit 255 0580 if not errorlevel 2 ( 0581 call :prompt_for_dir DEPS_BUILD_DIR "Provide path of deps build dir" 0582 ) 0583 ) 0584 if "!DEPS_BUILD_DIR!" == "" ( 0585 echo ERROR: Deps build dir not set! 1>&2 0586 exit /b 102 0587 ) 0588 ) 0589 echo Deps build dir: %DEPS_BUILD_DIR% 0590 0591 :skip_deps_args_check 0592 0593 if not "%ARG_DEPS_INSTALL_DIR%" == "" ( 0594 set "DEPS_INSTALL_DIR=%ARG_DEPS_INSTALL_DIR%" 0595 ) 0596 if "%DEPS_INSTALL_DIR%" == "" ( 0597 set DEPS_INSTALL_DIR=%CD%\i_deps\ 0598 echo Using default deps install dir: !DEPS_INSTALL_DIR! 0599 if not "%ARG_NO_INTERACTIVE%" == "1" ( 0600 choice /c ny /n /m "Is this ok? [y/n] " 0601 if errorlevel 3 exit 255 0602 if not errorlevel 2 ( 0603 call :prompt_for_dir DEPS_INSTALL_DIR "Provide path of deps install dir" 0604 ) 0605 ) 0606 if "!DEPS_INSTALL_DIR!" == "" ( 0607 echo ERROR: Deps install dir not set! 1>&2 0608 exit /b 102 0609 ) 0610 ) 0611 echo Deps install dir: %DEPS_INSTALL_DIR% 0612 0613 if "%ARG_SKIP_KRITA%" == "1" goto skip_krita_args_check 0614 0615 if not "%ARG_KRITA_BUILD_DIR%" == "" ( 0616 set "KRITA_BUILD_DIR=%ARG_KRITA_BUILD_DIR%" 0617 ) 0618 if "%KRITA_BUILD_DIR%" == "" ( 0619 set KRITA_BUILD_DIR=%CD%\b\ 0620 echo Using default Krita build dir: !KRITA_BUILD_DIR! 0621 if not "%ARG_NO_INTERACTIVE%" == "1" ( 0622 choice /c ny /n /m "Is this ok? [y/n] " 0623 if errorlevel 3 exit 255 0624 if not errorlevel 2 ( 0625 call :prompt_for_dir KRITA_BUILD_DIR "Provide path of Krita build dir" 0626 ) 0627 ) 0628 if "!KRITA_BUILD_DIR!" == "" ( 0629 echo ERROR: Krita build dir not set! 1>&2 0630 exit /b 102 0631 ) 0632 ) 0633 echo Krita build dir: %KRITA_BUILD_DIR% 0634 0635 @REM Plugins also need the download dir 0636 if not "%ARG_DOWNLOAD_DIR%" == "" ( 0637 set "PLUGINS_DOWNLOAD_DIR=%ARG_DOWNLOAD_DIR%" 0638 ) 0639 if "%PLUGINS_DOWNLOAD_DIR%" == "" ( 0640 set PLUGINS_DOWNLOAD_DIR=%CD%\d\ 0641 echo Using default deps download dir: !PLUGINS_DOWNLOAD_DIR! 0642 if not "%ARG_NO_INTERACTIVE%" == "1" ( 0643 choice /c ny /n /m "Is this ok? [y/n] " 0644 if errorlevel 3 exit 255 0645 if not errorlevel 2 ( 0646 call :prompt_for_dir PLUGINS_DOWNLOAD_DIR "Provide path of plugins download dir" 0647 ) 0648 ) 0649 if "!PLUGINS_DOWNLOAD_DIR!" == "" ( 0650 echo ERROR: Plugins download dir not set! 1>&2 0651 exit /b 102 0652 ) 0653 ) 0654 echo Plugins download dir: %PLUGINS_DOWNLOAD_DIR% 0655 0656 if not "%ARG_PLUGINS_BUILD_DIR%" == "" ( 0657 set "PLUGINS_BUILD_DIR=%ARG_PLUGINS_BUILD_DIR%" 0658 ) 0659 if "%PLUGINS_BUILD_DIR%" == "" ( 0660 set PLUGINS_BUILD_DIR=%CD%\b_plugins\ 0661 echo Using default plugins build dir: !PLUGINS_BUILD_DIR! 0662 if not "%ARG_NO_INTERACTIVE%" == "1" ( 0663 choice /c ny /n /m "Is this ok? [y/n] " 0664 if errorlevel 3 exit 255 0665 if not errorlevel 2 ( 0666 call :prompt_for_dir PLUGINS_BUILD_DIR "Provide path of plugins build dir" 0667 ) 0668 ) 0669 if "!PLUGINS_BUILD_DIR!" == "" ( 0670 echo ERROR: Plugins build dir not set! 1>&2 0671 exit /b 102 0672 ) 0673 ) 0674 echo Plugins build dir: %PLUGINS_BUILD_DIR% 0675 0676 if not "%ARG_KRITA_INSTALL_DIR%" == "" ( 0677 set "KRITA_INSTALL_DIR=%ARG_KRITA_INSTALL_DIR%" 0678 ) 0679 if "%KRITA_INSTALL_DIR%" == "" ( 0680 set KRITA_INSTALL_DIR=%CD%\i\ 0681 echo Using default Krita install dir: !KRITA_INSTALL_DIR! 0682 if not "%ARG_NO_INTERACTIVE%" == "1" ( 0683 choice /c ny /n /m "Is this ok? [y/n] " 0684 if errorlevel 3 exit 255 0685 if not errorlevel 2 ( 0686 call :prompt_for_dir KRITA_INSTALL_DIR "Provide path of Krita install dir" 0687 ) 0688 ) 0689 if "!KRITA_INSTALL_DIR!" == "" ( 0690 echo ERROR: Krita install dir not set! 1>&2 0691 exit /b 102 0692 ) 0693 ) 0694 echo Krita install dir: %KRITA_INSTALL_DIR% 0695 0696 :skip_krita_args_check 0697 0698 echo. 0699 0700 0701 if not "%ARG_NO_INTERACTIVE%" == "1" ( 0702 choice /c ny /n /m "Is the above ok? [y/n] " 0703 if errorlevel 3 exit 255 0704 if not errorlevel 2 ( 0705 exit /b 1 0706 ) 0707 echo. 0708 ) 0709 0710 :: Initialize clean PATH 0711 set PATH=%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\ 0712 :: Set PATH for calling Python scripts 0713 set PATH=%PYTHON_BIN_DIR%;%PATH% 0714 :: Set PATH for external tools (Meson/Ninja) 0715 if NOT "%KRITA_GIT_DIR%" == "" ( 0716 set PATH=%PATH%;%KRITA_GIT_DIR% 0717 ) 0718 if NOT "%KRITA_NINJA_DIR%" == "" ( 0719 if NOT "%KRITA_NINJA_DIR%" == "%MINGW_BIN_DIR%" ( 0720 set PATH=%PATH%;%KRITA_NINJA_DIR% 0721 ) 0722 ) 0723 if NOT "%SVN_DIR%" == "" ( 0724 set PATH=%PATH%;%SVN_DIR% 0725 ) 0726 0727 echo Creating dirs... 0728 if NOT "%ARG_SKIP_DEPS%" == "1" ( 0729 mkdir %DEPS_DOWNLOAD_DIR% 0730 if errorlevel 1 ( 0731 if not exist "%DEPS_DOWNLOAD_DIR%\" ( 0732 echo ERROR: Cannot create deps download dir! 1>&2 0733 exit /b 103 0734 ) 0735 ) 0736 mkdir %DEPS_BUILD_DIR% 0737 if errorlevel 1 ( 0738 if not exist "%DEPS_BUILD_DIR%\" ( 0739 echo ERROR: Cannot create deps build dir! 1>&2 0740 exit /b 103 0741 ) 0742 ) 0743 mkdir %DEPS_INSTALL_DIR% 0744 if errorlevel 1 ( 0745 if not exist "%DEPS_INSTALL_DIR%\" ( 0746 echo ERROR: Cannot create deps install dir! 1>&2 0747 exit /b 103 0748 ) 0749 ) 0750 ) 0751 if NOT "%ARG_SKIP_KRITA%" == "1" ( 0752 mkdir %KRITA_BUILD_DIR% 0753 if errorlevel 1 ( 0754 if not exist "%KRITA_BUILD_DIR%\" ( 0755 echo ERROR: Cannot create Krita build dir! 1>&2 0756 exit /b 103 0757 ) 0758 ) 0759 mkdir %PLUGINS_DOWNLOAD_DIR% 0760 if errorlevel 1 ( 0761 if not exist "%PLUGINS_DOWNLOAD_DIR%\" ( 0762 echo ERROR: Cannot create plugins download dir! 1>&2 0763 exit /b 103 0764 ) 0765 ) 0766 mkdir %PLUGINS_BUILD_DIR% 0767 if errorlevel 1 ( 0768 if not exist "%PLUGINS_BUILD_DIR%\" ( 0769 echo ERROR: Cannot create plugins build dir! 1>&2 0770 exit /b 103 0771 ) 0772 ) 0773 mkdir %KRITA_INSTALL_DIR% 0774 if errorlevel 1 ( 0775 if not exist "%KRITA_INSTALL_DIR%\" ( 0776 echo ERROR: Cannot create Krita install dir! 1>&2 0777 exit /b 103 0778 ) 0779 ) 0780 ) 0781 0782 echo. 0783 0784 0785 set CMAKE_BUILD_TYPE=RelWithDebInfo 0786 set QT_ENABLE_DEBUG_INFO=OFF 0787 0788 set KRITA_GENERATOR=Visual Studio 17 2022 0789 set KRITA_BUILD_TESTING=OFF 0790 set KRITA_INSTALL_BENCHMARKS=OFF 0791 0792 if "%ARG_DEV%" == "1" ( 0793 set KRITA_BUILD_TESTING=ON 0794 set KRITA_INSTALL_BENCHMARKS=ON 0795 ) 0796 0797 if "%KRITA_BRANDING%" == "" ( 0798 rem Check Jenkins job name 0799 if "%JOB_NAME%" == "Krita_Nightly_Windows_Build" ( 0800 set KRITA_BRANDING=Next 0801 ) else ( 0802 if "%JOB_NAME%" == "Krita_Stable_Windows_Build" ( 0803 set KRITA_BRANDING=Plus 0804 ) 0805 ) 0806 ) 0807 0808 :: Paths for CMake 0809 set "BUILDDIR_DOWNLOAD_CMAKE=%DEPS_DOWNLOAD_DIR:\=/%" 0810 set "BUILDDIR_DOWNLOAD_CMAKE=%BUILDDIR_DOWNLOAD_CMAKE: =\ %" 0811 set "BUILDDIR_PLUGINS_DOWNLOAD_CMAKE=%PLUGINS_DOWNLOAD_DIR:\=/%" 0812 set "BUILDDIR_PLUGINS_DOWNLOAD_CMAKE=%BUILDDIR_PLUGINS_DOWNLOAD_CMAKE: =\ %" 0813 set "BUILDDIR_DEPS_INSTALL_CMAKE=%DEPS_INSTALL_DIR:\=/%" 0814 set "BUILDDIR_DEPS_INSTALL_CMAKE=%BUILDDIR_DEPS_INSTALL_CMAKE: =\ %" 0815 set "BUILDDIR_KRITA_INSTALL_CMAKE=%KRITA_INSTALL_DIR:\=/%" 0816 set "BUILDDIR_KRITA_INSTALL_CMAKE=%BUILDDIR_KRITA_INSTALL_CMAKE: =\ %" 0817 set "BUILDDIR_PLUGINS_INSTALL_CMAKE=%KRITA_INSTALL_DIR:\=/%" 0818 set "BUILDDIR_PLUGINS_INSTALL_CMAKE=%BUILDDIR_KRITA_INSTALL_CMAKE: =\ %" 0819 0820 if not "%PERL_DIR%" == "" ( 0821 set "PERL_EXECUTABLE=%PERL_DIR%\perl.exe" 0822 set "PERL_EXECUTABLE=%PERL_EXECUTABLE:\=/%" 0823 set "PERL_EXECUTABLE=%PERL_EXECUTABLE: =\ %" 0824 ) 0825 0826 set PATH=%DEPS_INSTALL_DIR%\bin;%PATH% 0827 0828 if not "%GETTEXT_SEARCH_PATH%" == "" ( 0829 set PATH=!PATH!;!GETTEXT_SEARCH_PATH! 0830 ) 0831 0832 :: Prepare the CMake command lines 0833 set CMDLINE_CMAKE_DEPS="%CMAKE_EXE%" "%KRITA_SRC_DIR%\3rdparty" ^ 0834 -DSUBMAKE_JOBS=%PARALLEL_JOBS% ^ 0835 -DQT_ENABLE_DEBUG_INFO=%QT_ENABLE_DEBUG_INFO% ^ 0836 -DQT_ENABLE_DYNAMIC_OPENGL=%QT_ENABLE_DYNAMIC_OPENGL% ^ 0837 -DPERL_EXECUTABLE=%PERL_EXECUTABLE% ^ 0838 -DEXTERNALS_DOWNLOAD_DIR=%BUILDDIR_DOWNLOAD_CMAKE% ^ 0839 -DINSTALL_ROOT=%BUILDDIR_DEPS_INSTALL_CMAKE% ^ 0840 -G "%KRITA_GENERATOR%" ^ 0841 -A "x64" ^ 0842 -T "host=x64" ^ 0843 -DCMAKE_BUILD_TYPE=%CMAKE_BUILD_TYPE% 0844 0845 set CMDLINE_CMAKE_KRITA="%CMAKE_EXE%" "%KRITA_SRC_DIR%\." ^ 0846 -DBoost_DEBUG=OFF ^ 0847 -DBOOST_INCLUDEDIR=%BUILDDIR_DEPS_INSTALL_CMAKE%/include ^ 0848 -DBOOST_ROOT=%BUILDDIR_DEPS_INSTALL_CMAKE% ^ 0849 -DBOOST_LIBRARYDIR=%BUILDDIR_DEPS_INSTALL_CMAKE%/lib ^ 0850 -DCMAKE_PREFIX_PATH=%BUILDDIR_DEPS_INSTALL_CMAKE% ^ 0851 -DCMAKE_INSTALL_PREFIX=%BUILDDIR_KRITA_INSTALL_CMAKE% ^ 0852 -DBUILD_TESTING=%KRITA_BUILD_TESTING% ^ 0853 -DINSTALL_BENCHMARKS=%KRITA_INSTALL_BENCHMARKS% ^ 0854 -DHAVE_MEMORY_LEAK_TRACKER=OFF ^ 0855 -DFOUNDATION_BUILD=ON ^ 0856 -DUSE_QT_TABLET_WINDOWS=ON ^ 0857 -DHIDE_SAFE_ASSERTS=ON ^ 0858 -DBRANDING=%KRITA_BRANDING% ^ 0859 -Wno-dev ^ 0860 -G "%KRITA_GENERATOR%" ^ 0861 -A "x64" ^ 0862 -T "host=x64" ^ 0863 -DCMAKE_BUILD_TYPE=%CMAKE_BUILD_TYPE% 0864 0865 set CMDLINE_CMAKE_PLUGINS="%CMAKE_EXE%" "%KRITA_SRC_DIR%\3rdparty_plugins" ^ 0866 -DSUBMAKE_JOBS=%PARALLEL_JOBS% ^ 0867 -DQT_ENABLE_DEBUG_INFO=%QT_ENABLE_DEBUG_INFO% ^ 0868 -DQT_ENABLE_DYNAMIC_OPENGL=%QT_ENABLE_DYNAMIC_OPENGL% ^ 0869 -DEXTERNALS_DOWNLOAD_DIR=%BUILDDIR_PLUGINS_DOWNLOAD_CMAKE% ^ 0870 -DINSTALL_ROOT=%BUILDDIR_PLUGINS_INSTALL_CMAKE% ^ 0871 -G "%KRITA_GENERATOR%" ^ 0872 -A "x64" ^ 0873 -T "host=x64" ^ 0874 -DCMAKE_BUILD_TYPE=%CMAKE_BUILD_TYPE% 0875 0876 :: Launch CMD prompt if requested 0877 if "%ARG_CMD%" == "1" ( 0878 doskey cmake-deps=cmd /c "pushd %DEPS_BUILD_DIR% && %CMDLINE_CMAKE_DEPS%" 0879 doskey cmake-krita=cmd /c "pushd %KRITA_BUILD_DIR% && %CMDLINE_CMAKE_KRITA%" 0880 doskey make-deps=cmd /c "pushd %DEPS_BUILD_DIR% && "%CMAKE_EXE%" --build . --config %CMAKE_BUILD_TYPE% --target $* --parallel %PARALLEL_JOBS%" 0881 doskey make-krita=cmd /c "pushd %KRITA_BUILD_DIR% && "%CMAKE_EXE%" --build . --config %CMAKE_BUILD_TYPE% --target install --parallel %PARALLEL_JOBS%" 0882 doskey make-plugins=cmd /c "pushd %PLUGINS_BUILD_DIR% && "%CMAKE_EXE%" --build . --config %CMAKE_BUILD_TYPE% --target $* --parallel %PARALLEL_JOBS%" 0883 echo. 0884 title Krita build - %KRITA_SRC_DIR% ^(deps: %DEPS_BUILD_DIR%, krita: %KRITA_BUILD_DIR%, plugins: %PLUGINS_BUILD_DIR%^) 0885 echo You're now in the build environment. 0886 echo The following macros are available: 0887 echo cmake-deps 0888 echo -- Run CMake for the deps. 0889 echo make-deps ^<deps target^> 0890 echo -- Run build for the specified deps target. The target name should 0891 echo include the `ext_` prefix, e.g. `ext_qt`. 0892 echo make-plugins ^<deps target^> 0893 echo -- Build the specified plugin target. The target name should 0894 echo include the `ext_` prefix, e.g. `ext_gmic`. 0895 echo cmake-krita 0896 echo -- Run CMake for Krita. 0897 echo make-krita 0898 echo -- Run build for Krita's `install` target. 0899 echo. 0900 echo For more info, type `doskey /macros` to view the macro commands. 0901 cmd /k 0902 exit 0903 ) 0904 0905 0906 if "%ARG_SKIP_DEPS%" == "1" goto skip_build_deps 0907 0908 pushd %DEPS_BUILD_DIR% 0909 if errorlevel 1 ( 0910 echo ERROR: Cannot enter deps build dir! 1>&2 0911 exit /b 104 0912 ) 0913 0914 echo Running CMake for deps... 0915 0916 @echo on 0917 %CMDLINE_CMAKE_DEPS% 0918 @if errorlevel 1 ( 0919 @echo ERROR: CMake configure failed! 1>&2 0920 @exit /b 104 0921 ) 0922 @echo off 0923 echo. 0924 0925 set EXT_TARGETS=patch zlib gettext openssl boost exiv2 fftw3 eigen3 jpeg lcms2 0926 set EXT_TARGETS=%EXT_TARGETS% ocio openexr png icoutils tiff gsl libraw 0927 set EXT_TARGETS=%EXT_TARGETS% giflib qt kwindowsystem drmingw freetype poppler 0928 set EXT_TARGETS=%EXT_TARGETS% python sip pyqt 0929 set EXT_TARGETS=%EXT_TARGETS% lzma quazip openjpeg libde265 libx265 libheif 0930 set EXT_TARGETS=%EXT_TARGETS% seexpr mypaint webp jpegxl xsimd 0931 0932 for %%a in (%EXT_TARGETS%) do ( 0933 set TEST_HAS_TARGET= 0934 call :has_target TEST_HAS_TARGET_SELF "ext_%%a\" 0935 call :has_target TEST_HAS_KF5_TARGET "ext_frameworks\ext_%%a-prefix\" 0936 call :has_target TEST_HAS_HEIF_TARGET "ext_heif\ext_%%a-prefix\" 0937 if "!TEST_HAS_TARGET_SELF!" == "1" set TEST_HAS_TARGET=1 0938 if "!TEST_HAS_KF5_TARGET!" == "1" set TEST_HAS_TARGET=1 0939 if "!TEST_HAS_HEIF_TARGET!" == "1" set TEST_HAS_TARGET=1 0940 0941 if defined TEST_HAS_TARGET ( 0942 echo Building ext_%%a... 0943 "%CMAKE_EXE%" --build . --config %CMAKE_BUILD_TYPE% --target ext_%%a --parallel %PARALLEL_JOBS% -- /p:CL_MPCount=2 0944 if errorlevel 1 ( 0945 echo ERROR: Building of ext_%%a failed! 1>&2 0946 exit /b 105 0947 ) 0948 ) else ( 0949 echo Skipping ext_%%a, using OS package... 0950 ) 0951 ) 0952 echo. 0953 0954 echo Deploying debug symbols for all dependencies... 0955 0956 python "%KRITA_SRC_DIR%\packaging\windows\deploy-deps-debug-symbols.py" ^ 0957 --no-interactive ^ 0958 --deps-install-dir="%DEPS_INSTALL_DIR%\" ^ 0959 --deps-build-dir="%DEPS_BUILD_DIR%\" 0960 0961 echo. 0962 0963 echo ******** Built deps ******** 0964 popd 0965 0966 :skip_build_deps 0967 0968 if "%ARG_SKIP_KRITA%" == "1" goto skip_build_krita 0969 0970 pushd %KRITA_BUILD_DIR% 0971 if errorlevel 1 ( 0972 echo ERROR: Cannot enter Krita build dir! 1>&2 0973 exit /b 104 0974 ) 0975 0976 echo Running CMake for Krita... 0977 0978 @echo on 0979 %CMDLINE_CMAKE_KRITA% 0980 @if errorlevel 1 ( 0981 @echo ERROR: CMake configure failed! 1>&2 0982 @exit /b 104 0983 ) 0984 @echo off 0985 echo. 0986 0987 echo Building Krita... 0988 "%CMAKE_EXE%" --build . --config %CMAKE_BUILD_TYPE% --target install --parallel %PARALLEL_JOBS% 0989 if errorlevel 1 ( 0990 echo ERROR: Building of Krita failed! 1>&2 0991 exit /b 105 0992 ) 0993 echo. 0994 0995 echo Deploying debug symbols for Krita... 0996 0997 python "%KRITA_SRC_DIR%\packaging\windows\deploy-krita-debug-symbols.py" ^ 0998 --no-interactive ^ 0999 --krita-install-dir="%KRITA_INSTALL_DIR%\" ^ 1000 --krita-build-dir="%KRITA_BUILD_DIR%\" 1001 1002 echo. 1003 1004 echo ******** Built Krita ******** 1005 popd 1006 1007 pushd %PLUGINS_BUILD_DIR% 1008 if errorlevel 1 ( 1009 echo ERROR: Cannot enter plugins build dir! 1>&2 1010 exit /b 104 1011 ) 1012 1013 echo Running CMake for plugins... 1014 1015 @echo on 1016 %CMDLINE_CMAKE_PLUGINS% 1017 @if errorlevel 1 ( 1018 @echo ERROR: CMake configure failed! 1>&2 1019 @exit /b 104 1020 ) 1021 @echo off 1022 echo. 1023 1024 set EXT_TARGETS=gmic 1025 1026 for %%a in (%EXT_TARGETS%) do ( 1027 echo Building ext_%%a... 1028 "%CMAKE_EXE%" --build . --config %CMAKE_BUILD_TYPE% --target ext_%%a 1029 if errorlevel 1 ( 1030 echo ERROR: Building of ext_%%a failed! 1>&2 1031 exit /b 105 1032 ) 1033 ) 1034 echo. 1035 1036 echo Deploying debug symbols for plugins... 1037 python "%KRITA_SRC_DIR%\packaging\windows\deploy-deps-debug-symbols.py" ^ 1038 --no-interactive ^ 1039 --deps-install-dir="%KRITA_INSTALL_DIR%\" ^ 1040 --deps-build-dir="%PLUGINS_BUILD_DIR%\" 1041 echo. 1042 1043 echo ******** Built plugins ******** 1044 popd 1045 1046 :skip_build_krita 1047 1048 echo Krita build completed!