diff --git a/CMakeLists.txt b/CMakeLists.txt index 94379917..d67f55b9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -486,4 +486,15 @@ if(KDDockWidgets_IS_ROOT_PROJECT) include(ECMUninstallTarget) endif() +# Deployment +if(WIN32) + add_custom_target( + createZipDemo + COMMAND cmd /c ${CMAKE_CURRENT_SOURCE_DIR}\\deploy\\create-demo-win-zip.bat + ${CMAKE_PROJECT_NAME}-${${PROJECT_NAME}_VERSION} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMENT "Target to generate the Zip demo installer for Windows" + ) +endif() + feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/deploy/create-demo-win-zip.bat b/deploy/create-demo-win-zip.bat new file mode 100644 index 00000000..1bdc5dcd --- /dev/null +++ b/deploy/create-demo-win-zip.bat @@ -0,0 +1,47 @@ +@echo off +rem +rem This file is part of KDDockWidgets. +rem +rem SPDX-FileCopyrightText: 2022 Klarälvdalens Datakonsult AB, a KDAB Group company +rem +rem SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only +rem +rem Contact KDAB at for commercial licensing options. +rem + +rem assumes the builddir is the workdir +rem assumes Qt is in PATH +rem %1 is the name of the deployment + +if [%1] == [] ( + echo "Usage: %~nx0 " + goto theEnd +) + +rem Prepare the deployDir +set "deploy=%1" +if exist %deploy% ( + rmdir /Q /S %deploy% +) +mkdir %deploy% + +rem Deploy programs +for %%s in (bin\*.dll bin\*_example.exe) do ( + copy %%s %deploy% >nul +) + +rem Deploy Qt +windeployqt --compiler-runtime %deploy% + +rem Zip it +set zipFile=%cd%\%deploy%.7z +if exist %zipFile% ( + del /F /Q %zipFile% +) +7z a %zipFile% %deploy% + +rem Must echo this line exactly for the CI +echo Created zip file "%zipFile%" successfully + +:theEnd +exit /b %ERRORLEVEL%