[graphics/krita] /: Add cmake option INSTALL_BENCHMARKS to make benchmark packagable

Dmitry Kazakov null at kde.org
Tue Jun 29 13:37:51 BST 2021


Git commit ce0ec220e48141036f38eb4029fd51faa62ee5eb by Dmitry Kazakov.
Committed on 29/06/2021 at 12:37.
Pushed by dkazakov into branch 'master'.

Add cmake option INSTALL_BENCHMARKS to make benchmark packagable

When the option is activated, FreehandStrokeBenchmark is installed
into the install root directory with all its dependencies. This file
can later be embedded into the prebuilt package and shared among
all the users.

CC:kimageshop at kde.org

M  +3    -0    CMakeLists.txt
M  +28   -0    libs/ui/tests/CMakeLists.txt
M  +6    -0    packaging/windows/package-complete-msvc.py
M  +7    -0    packaging/windows/package-complete.cmd
M  +19   -0    sdk/tests/qimage_test_util.h

https://invent.kde.org/graphics/krita/commit/ce0ec220e48141036f38eb4029fd51faa62ee5eb

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7f68287188..899b19afd7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -200,6 +200,9 @@ endif ()
 option(HIDE_SAFE_ASSERTS "Don't show message box for \"safe\" asserts, just ignore them automatically and dump a message to the terminal." ON)
 add_feature_info("Hide safe asserts" HIDE_SAFE_ASSERTS "Don't show message box for \"safe\" asserts, just ignore them automatically and dump a message to the terminal.")
 
+option(INSTALL_BENCHMARKS "Install benchmarks into the installation root to make them packagable" OFF)
+add_feature_info("Install benchmarks" INSTALL_BENCHMARKS "Install benchmarks into the installation root to make them packagable")
+
 option(CRASH_ON_SAFE_ASSERTS "Crash unconditionally whenever a \"safe\" assert happens. Useful for running unittests" OFF)
 add_feature_info("Crash on safe asserts" CRASH_ON_SAFE_ASSERTS "Crash unconditionally whenever a \"safe\" assert happens. Useful for running unittests")
 
diff --git a/libs/ui/tests/CMakeLists.txt b/libs/ui/tests/CMakeLists.txt
index 30b2bcc997..2f08704aa4 100644
--- a/libs/ui/tests/CMakeLists.txt
+++ b/libs/ui/tests/CMakeLists.txt
@@ -363,3 +363,31 @@ endif()
         KisZoomAndPanTest
         KisCategoriesMapperTest
         )
+
+
+if (${INSTALL_BENCHMARKS})
+    install(TARGETS FreehandStrokeBenchmark  ${INSTALL_TARGETS_DEFAULT_ARGS})
+
+    install(FILES data/testing_200px_colorsmudge_default_dulling_old_sa.kpp
+        data/testing_200px_colorsmudge_defaut_dulling_new_nsa.kpp
+        data/testing_200px_colorsmudge_defaut_dulling_new_sa.kpp
+        data/testing_200px_colorsmudge_defaut_dulling_old_nsa.kpp
+        data/testing_200px_colorsmudge_defaut_smearing_new_nsa.kpp
+        data/testing_200px_colorsmudge_defaut_smearing_new_sa.kpp
+        data/testing_200px_colorsmudge_defaut_smearing_old_nsa.kpp
+        data/testing_200px_colorsmudge_defaut_smearing_old_sa.kpp
+        data/testing_200px_colorsmudge_lightness_smearing_new_nsa_maskmode.kpp
+        data/testing_200px_colorsmudge_lightness_smearing_new_nsa_nopt.kpp
+        data/testing_200px_colorsmudge_lightness_smearing_new_nsa_ptoverlay.kpp
+        data/testing_200px_colorsmudge_lightness_smearing_new_nsa_ptoverwrite.kpp
+        data/testing_1000px_auto_deafult.kpp
+        data/testing_1000px_auto_gaussian.kpp
+        data/testing_1000px_auto_gaussian_rect.kpp
+        data/testing_1000px_auto_rectangular.kpp
+        data/testing_1000px_auto_soft.kpp
+        data/testing_1000px_auto_soft_rect.kpp
+        data/testing_1000px_stamp_450_rotated.kpp
+        data/3_texture.png
+        data/DA_RGBA\ bluegreen_small1.png
+        DESTINATION ${CMAKE_INSTALL_BINDIR}/data)
+endif()
diff --git a/packaging/windows/package-complete-msvc.py b/packaging/windows/package-complete-msvc.py
index 11f8eedd9d..048e474ff4 100644
--- a/packaging/windows/package-complete-msvc.py
+++ b/packaging/windows/package-complete-msvc.py
@@ -224,6 +224,12 @@ shutil.copy(f"{KRITA_INSTALL_DIR}\\bin\\krita.pdb", f"{pkg_root}\\bin\\")
 shutil.copy(f"{KRITA_INSTALL_DIR}\\bin\\kritarunner.exe", f"{pkg_root}\\bin\\")
 shutil.copy(f"{KRITA_INSTALL_DIR}\\bin\\kritarunner.com", f"{pkg_root}\\bin\\")
 shutil.copy(f"{KRITA_INSTALL_DIR}\\bin\\kritarunner.pdb", f"{pkg_root}\\bin\\")
+
+if os.path.isfile(f"{KRITA_INSTALL_DIR}\\bin\\FreehandStrokeBenchmark.exe"):
+    shutil.copy(f"{KRITA_INSTALL_DIR}\\bin\\FreehandStrokeBenchmark.exe", f"{pkg_root}\\bin\\")
+    subprocess.run(["xcopy", "/S", "/Y", "/I",
+                   f"{DEPS_INSTALL_DIR}\\bin\\data\\", f"{pkg_root}\\bin\\data\\"])
+
 # DLLs from bin/
 print("INFO: Copying all DLLs except Qt5 * from bin/")
 files = glob.glob(f"{KRITA_INSTALL_DIR}\\bin\\*.dll")
diff --git a/packaging/windows/package-complete.cmd b/packaging/windows/package-complete.cmd
index f17a12985c..3f0938bedf 100644
--- a/packaging/windows/package-complete.cmd
+++ b/packaging/windows/package-complete.cmd
@@ -558,6 +558,13 @@ copy %KRITA_INSTALL_DIR%\bin\krita.com %pkg_root%\bin
 :: kritarunner.exe
 copy %KRITA_INSTALL_DIR%\bin\kritarunner.exe %pkg_root%\bin
 copy %KRITA_INSTALL_DIR%\bin\kritarunner.com %pkg_root%\bin
+
+if exist %KRITA_INSTALL_DIR%\bin\FreehandStrokeBenchmark.exe (
+    :: FreehandStrokeBenchmark.exe
+    copy %KRITA_INSTALL_DIR%\bin\FreehandStrokeBenchmark.exe %pkg_root%\bin
+    xcopy /S /Y /I %DEPS_INSTALL_DIR%\bin\data %pkg_root%\bin\data
+)
+
 :: qt.conf -- to specify the location to Qt translations
 copy %KRITA_SRC_DIR%\packaging\windows\qt.conf %pkg_root%\bin
 :: DLLs from bin/
diff --git a/sdk/tests/qimage_test_util.h b/sdk/tests/qimage_test_util.h
index 092a24a50b..a613879563 100644
--- a/sdk/tests/qimage_test_util.h
+++ b/sdk/tests/qimage_test_util.h
@@ -11,6 +11,7 @@
 
 #include <QProcessEnvironment>
 #include <QDir>
+#include <QApplication>
 
 namespace TestUtil {
 
@@ -57,6 +58,24 @@ inline QString fetchDataFileLazy(const QString relativeFileName, bool externalTe
         if (QFileInfo(filename).exists()) {
             return filename;
         }
+
+        filename  =
+            QFileInfo(qApp->applicationFilePath()).absolutePath() +
+            "/" +
+            relativeFileName;
+
+        if (QFileInfo(filename).exists()) {
+            return filename;
+        }
+
+        filename  =
+            QFileInfo(qApp->applicationFilePath()).absolutePath() +
+            "/data/" +
+            relativeFileName;
+
+        if (QFileInfo(filename).exists()) {
+            return filename;
+        }
     }
 
     return QString();


More information about the kimageshop mailing list