[graphics/krita] build-tools/windows: build.cmd: add support for Ninja

L. E. Segovia null at kde.org
Sat Sep 11 08:16:11 BST 2021


Git commit 6cbf4a47d7295063c6d1919bd1ce7058fa14e645 by L. E. Segovia, on behalf of Dmitry Kazakov.
Committed on 10/09/2021 at 12:58.
Pushed by dkazakov into branch 'master'.

build.cmd: add support for Ninja

The patch does three changes:

1) Makes build.cmd switch between "Ninja" and "MinGW Makefiles"
   generators depending on the presence of Ninja in the system.

2) Makes build.cmd detect ninja.exe installed outside the MinGW
   environment (which is the case of standalone MinGW installation)

3) Adds a '--dev' option to build.cmd. This option enables
   "CodeBlocks" generator (so that QtCreator could use this build)
   and -DBUILD_TESTING=ON for unittests.

CC:kimageshop at kde.org

M  +35   -3    build-tools/windows/build.cmd

https://invent.kde.org/graphics/krita/commit/6cbf4a47d7295063c6d1919bd1ce7058fa14e645

diff --git a/build-tools/windows/build.cmd b/build-tools/windows/build.cmd
index 7daec2da0b..a4b5f335a6 100644
--- a/build-tools/windows/build.cmd
+++ b/build-tools/windows/build.cmd
@@ -123,6 +123,8 @@ echo --skip-krita                    Skips (re)building of Krita
 echo --cmd                           Launch a cmd prompt instead of building.
 echo                                 The environment is set up like the build
 echo                                 environment with some helper command macros.
+echo --dev                           Activate developer options, like 'CodeBlocks'
+echo                                 generator and BUILD_TESTING
 echo.
 echo Path options:
 echo --src-dir ^<dir_path^>            Specify Krita source dir
@@ -167,6 +169,7 @@ set ARG_KRITA_BUILD_DIR=
 set ARG_KRITA_INSTALL_DIR=
 set ARG_PLUGINS_BUILD_DIR=
 set ARG_CMD=
+set ARG_DEV=
 :args_parsing_loop
 set CURRENT_MATCHED=
 if not "%1" == "" (
@@ -197,6 +200,10 @@ if not "%1" == "" (
         set ARG_SKIP_KRITA=1
         set CURRENT_MATCHED=1
     )
+    if "%1" == "--dev" (
+        set ARG_DEV=1
+        set CURRENT_MATCHED=1
+    )
     if "%1" == "--src-dir" (
         if not "%ARG_SRC_DIR%" == "" (
             echo ERROR: Arg --src-dir specified more than once 1>&2
@@ -461,6 +468,14 @@ if "%KRITA_GIT_DIR%" == "" (
     )
 ) else echo Git found on %KRITA_GIT_DIR%
 
+if "%KRITA_NINJA_DIR%" == "" (
+    call :find_on_path KRITA_NINJA_EXE_DIR ninja.exe
+    if NOT "!KRITA_NINJA_EXE_DIR!" == "" (
+        call :get_dir_path KRITA_NINJA_DIR "!KRITA_NINJA_EXE_DIR!"
+        echo Found Ninja on PATH: !KRITA_NINJA_DIR!
+    )
+) else echo Git found on %KRITA_NINJA_DIR%
+
 if "%SVN_DIR%" == "" (
     call :find_on_path SVN_EXE_DIR svn.exe
     if NOT "!SVN_EXE_DIR!" == "" (
@@ -719,6 +734,11 @@ set PATH=%PYTHON_BIN_DIR%;%MINGW_BIN_DIR%;%PATH%
 if NOT "%KRITA_GIT_DIR%" == "" (
     set PATH=%PATH%;%KRITA_GIT_DIR%
 )
+if NOT "%KRITA_NINJA_DIR%" == "" (
+    if NOT "%KRITA_NINJA_DIR%" == "%MINGW_BIN_DIR%" (
+        set PATH=%PATH%;%KRITA_NINJA_DIR%
+    )
+)
 if NOT "%SVN_DIR%" == "" (
     set PATH=%PATH%;%SVN_DIR%
 )
@@ -784,6 +804,18 @@ echo.
 set CMAKE_BUILD_TYPE=RelWithDebInfo
 set QT_ENABLE_DEBUG_INFO=OFF
 
+set KRITA_GENERATOR=MinGW Makefiles
+set KRITA_BUILD_TESTING=OFF
+
+if NOT "%KRITA_NINJA_DIR%" == "" (
+    set KRITA_GENERATOR=Ninja
+)
+
+if "%ARG_DEV%" == "1" (
+    set KRITA_GENERATOR=CodeBlocks - %KRITA_GENERATOR%
+    set KRITA_BUILD_TESTING=ON
+)
+
 if "%KRITA_BRANDING%" == "" (
     rem Check Jenkins job name
     if "%JOB_NAME%" == "Krita_Nightly_Windows_Build" (
@@ -830,7 +862,7 @@ set CMDLINE_CMAKE_KRITA="%CMAKE_EXE%" "%KRITA_SRC_DIR%\." ^
     -DBOOST_LIBRARYDIR=%BUILDDIR_DEPS_INSTALL_CMAKE%/lib ^
     -DCMAKE_PREFIX_PATH=%BUILDDIR_DEPS_INSTALL_CMAKE% ^
     -DCMAKE_INSTALL_PREFIX=%BUILDDIR_KRITA_INSTALL_CMAKE% ^
-    -DBUILD_TESTING=OFF ^
+    -DBUILD_TESTING=%KRITA_BUILD_TESTING% ^
     -DHAVE_MEMORY_LEAK_TRACKER=OFF ^
     -DFOUNDATION_BUILD=ON ^
     -DUSE_QT_TABLET_WINDOWS=ON ^
@@ -838,7 +870,7 @@ set CMDLINE_CMAKE_KRITA="%CMAKE_EXE%" "%KRITA_SRC_DIR%\." ^
     -DFETCH_TRANSLATIONS=ON ^
     -DBRANDING=%KRITA_BRANDING% ^
     -Wno-dev ^
-    -G "MinGW Makefiles" ^
+    -G "%KRITA_GENERATOR%" ^
     -DCMAKE_BUILD_TYPE=%CMAKE_BUILD_TYPE%
 
 set CMDLINE_CMAKE_PLUGINS="%CMAKE_EXE%" "%KRITA_SRC_DIR%\3rdparty_plugins" ^
@@ -847,7 +879,7 @@ set CMDLINE_CMAKE_PLUGINS="%CMAKE_EXE%" "%KRITA_SRC_DIR%\3rdparty_plugins" ^
     -DQT_ENABLE_DYNAMIC_OPENGL=%QT_ENABLE_DYNAMIC_OPENGL% ^
     -DEXTERNALS_DOWNLOAD_DIR=%BUILDDIR_PLUGINS_DOWNLOAD_CMAKE% ^
     -DINSTALL_ROOT=%BUILDDIR_PLUGINS_INSTALL_CMAKE% ^
-    -G "MinGW Makefiles" ^
+    -G "%KRITA_GENERATOR%" ^
     -DCMAKE_BUILD_TYPE=%CMAKE_BUILD_TYPE%
 
 :: Launch CMD prompt if requested



More information about the kimageshop mailing list