Skip to content

Commit 322e28e

Browse files
committed
chore: [pkg]Make installer for windows
Make installer for windows and add release CI build. Log: Make win installer.
1 parent a30574d commit 322e28e

11 files changed

Lines changed: 172 additions & 235 deletions

File tree

.github/workflows/windows-mingw.yml

Lines changed: 0 additions & 116 deletions
This file was deleted.

.github/workflows/windows-msvc.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Windows MSVC Release
2+
on:
3+
push:
4+
tags:
5+
- "*"
6+
7+
jobs:
8+
build_and_release:
9+
strategy:
10+
matrix:
11+
include:
12+
- name: win64_msvc
13+
os: windows-2019
14+
build_type: Release
15+
compiler_type: msvc2019_64
16+
msvc_arch: x64
17+
qt_arch: win64_msvc2019_64
18+
qt_version: 5.15.2
19+
qt_target: desktop
20+
runs-on: ${{ matrix.os }}
21+
env:
22+
BUILD_TYPE: ${{ matrix.build_type }}
23+
COMPILER_TYPE: ${{ matrix.compiler_type }}
24+
QT_VERSION: ${{ matrix.qt_version }}
25+
OPENSSL_ROOT_DIR: C:\Program Files\OpenSSL
26+
steps:
27+
- name: '⚙️ Cache Qt'
28+
id: cache-qt
29+
uses: actions/cache@v3
30+
with:
31+
path: ..\Qt
32+
key: Windows-QtCache-${{ env.QT_VERSION }}
33+
34+
- name: Install Qt ${{ env.QT_VERSION }}
35+
uses: jurplel/install-qt-action@v3
36+
with:
37+
aqtversion: '==3.1.*'
38+
version: ${{ env.QT_VERSION }}
39+
target: ${{ matrix.qt_target }}
40+
arch: ${{ matrix.qt_arch }}
41+
# cached: 'false'
42+
cached: ${{ steps.cache-qt.outputs.cache-hit }}
43+
44+
# 3.20.0 高版本无法找到OPENSSL和ZLIB
45+
- name: Setup cmake
46+
uses: lukka/get-cmake@latest
47+
with:
48+
cmakeVersion: 3.20.0
49+
ninjaVersion: 1.11.1
50+
51+
- name: Checkout
52+
uses: actions/checkout@v4
53+
with:
54+
path: source
55+
fetch-depth: 0
56+
57+
- name: msvc-build
58+
id: build
59+
shell: cmd
60+
env:
61+
vc_arch: ${{ matrix.msvc_arch }}
62+
cmake_gen: Visual Studio 16 2019
63+
run: |
64+
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" %vc_arch%
65+
mkdir build && cd build
66+
cmake -G "%cmake_gen%" -A %vc_arch% -D CMAKE_BUILD_TYPE=%BUILD_TYPE% -D APP_VERSION="${{ github.ref_name }}" ../source/
67+
cmake --build . --config %BUILD_TYPE%
68+
cmake -G "%cmake_gen%" -A %vc_arch% -D CMAKE_BUILD_TYPE=%BUILD_TYPE% -D APP_VERSION="${{ github.ref_name }}" ../source/
69+
70+
- name: Inno Setup data-transfer
71+
uses: nadeemjazmawe/inno-setup-action-cli@v6.0.5
72+
with:
73+
filepath: build/deepin-data-transfer-setup.iss
74+
75+
- name: Inno Setup cooperation
76+
uses: nadeemjazmawe/inno-setup-action-cli@v6.0.5
77+
with:
78+
filepath: build/dde-cooperation-setup.iss
79+
80+
- name: Create Release
81+
uses: softprops/action-gh-release@v1
82+
if: startsWith(github.ref, 'refs/tags/')
83+
env:
84+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
85+
with:
86+
files: build/installer-inno/*.exe
87+
generate_release_notes: true
88+
draft: true

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ endif()
8383
message(" >>> CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE}")
8484
if(NOT CMAKE_BUILD_TYPE)
8585
message("Cmake build type is not defined!")
86-
set(CMAKE_BUILD_TYPE "Release")
86+
set(CMAKE_BUILD_TYPE "Debug")
8787
# 设置环境变量
8888
set(ENV{QT_SELECT} "5")
8989
endif()

clean_build.bat

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ set VCINSTALLDIR=C:\Program Files\Microsoft Visual Studio\2022\Community\VC
88
echo VCINSTALLDIR: %VCINSTALLDIR%
99
call "%VCINSTALLDIR%\Auxiliary\Build\vcvars64.bat"
1010

11+
@REM projects
12+
set COO_PROJECT=dde-cooperation
13+
set DT_PROJECT=data-transfer
14+
1115
REM defaults - override them by creating a build_env.bat file
1216
set B_BUILD_TYPE=Release
1317
set B_QT_ROOT=C:\Qt
@@ -41,8 +45,6 @@ set B_QT_FULLPATH=%B_QT_ROOT%\%B_QT_VER%\%B_QT_MSVC%
4145

4246
echo Qt: %B_QT_FULLPATH%
4347

44-
git submodule update --init --recursive
45-
4648
rmdir /q /s build
4749
mkdir build
4850
if ERRORLEVEL 1 goto failed
@@ -55,28 +57,53 @@ cmake -G "%cmake_gen%" -A x64 -D CMAKE_BUILD_TYPE=%B_BUILD_TYPE% -D CMAKE_PREFIX
5557
if ERRORLEVEL 1 goto failed
5658
cmake --build . --config %B_BUILD_TYPE%
5759
if ERRORLEVEL 1 goto failed
58-
if exist output\Debug (
59-
copy output\Debug\QtZeroConf.dll output\dde-cooperation\Debug\ > NUL
60-
copy "%OPENSSL_ROOT_DIR%\libcrypto-1_1-x64.dll" output\dde-cooperation\Debug\ > NUL
61-
copy "%OPENSSL_ROOT_DIR%\libssl-1_1-x64.dll" output\dde-cooperation\Debug\ > NUL
62-
) else if exist output\Release (
63-
copy output\Release\QtZeroConf.dll output\dde-cooperation\Release\ > NUL
64-
copy "%OPENSSL_ROOT_DIR%\libcrypto-1_1-x64.dll" output\dde-cooperation\Release\ > NUL
65-
copy "%OPENSSL_ROOT_DIR%\libssl-1_1-x64.dll" output\dde-cooperation\Release\ > NUL
66-
copy "%B_BONJOUR%\Bonjour64.msi" installer-inno\ > NUL
67-
move output\dde-cooperation\Release\vc_redist.x64.exe installer-inno\ > NUL
60+
if exist output\%B_BUILD_TYPE% (
61+
copy output\%B_BUILD_TYPE%\QtZeroConf.* output\%COO_PROJECT%\%B_BUILD_TYPE%\ > NUL
62+
copy "%OPENSSL_ROOT_DIR%\libcrypto-1_1-x64.dll" output\%COO_PROJECT%\%B_BUILD_TYPE%\ > NUL
63+
copy "%OPENSSL_ROOT_DIR%\libssl-1_1-x64.dll" output\%COO_PROJECT%\%B_BUILD_TYPE%\ > NUL
64+
65+
mkdir installer-inno\%COO_PROJECT%
66+
copy "%B_BONJOUR%\Bonjour64.msi" installer-inno\%COO_PROJECT%\ > NUL
67+
if exist output\%COO_PROJECT%\%B_BUILD_TYPE%\vc_redist.x64.exe (
68+
move output\%COO_PROJECT%\%B_BUILD_TYPE%\vc_redist.x64.exe installer-inno\%COO_PROJECT%\ > NUL
69+
)
70+
71+
72+
copy output\%B_BUILD_TYPE%\quazip* output\%DT_PROJECT%\%B_BUILD_TYPE%\ > NUL
73+
copy "%OPENSSL_ROOT_DIR%\libcrypto-1_1-x64.dll" output\%DT_PROJECT%\%B_BUILD_TYPE%\ > NUL
74+
copy "%OPENSSL_ROOT_DIR%\libssl-1_1-x64.dll" output\%DT_PROJECT%\%B_BUILD_TYPE%\ > NUL
75+
mkdir installer-inno\%DT_PROJECT%
76+
if exist output\%DT_PROJECT%\%B_BUILD_TYPE%\vc_redist.x64.exe (
77+
move output\%DT_PROJECT%\%B_BUILD_TYPE%\vc_redist.x64.exe installer-inno\%DT_PROJECT%\ > NUL
78+
)
6879
) else (
6980
echo Remember to copy supporting binaries and configuration files!
7081
)
7182

7283
echo Build completed successfully
7384

85+
set INNO_ROOT=C:\Program Files (x86)\Inno Setup 6
86+
87+
echo Building 64-bit Windows installer...
88+
89+
"%INNO_ROOT%\ISCC.exe" /Qp %COO_PROJECT%-setup.iss
90+
move %cd%\installer-inno\deepin-cooperation-* %cd%\installer-inno\%COO_PROJECT%\ > NUL
91+
if ERRORLEVEL 1 goto issfailed
92+
"%INNO_ROOT%\ISCC.exe" /Qp deepin-%DT_PROJECT%-setup.iss
93+
move %cd%\installer-inno\deepin-datatransfer-* %cd%\installer-inno\%DT_PROJECT%\ > NUL
94+
if ERRORLEVEL 1 goto issfailed
95+
96+
echo Build all Windows installer successfully!!!
97+
7498
@REM echo ------------cmake again forgenerate sources------------
7599
@REM cmake -G "%cmake_gen%" -A x64 -D CMAKE_BUILD_TYPE=%B_BUILD_TYPE% -D CMAKE_PREFIX_PATH="%B_QT_FULLPATH%" -D QT_VERSION=%B_QT_VER% ..
76100

77101
set BUILD_FAILED=0
78102
goto done
79103

104+
:issfailed
105+
echo Make Windows installer failed
106+
80107
:failed
81108
set BUILD_FAILED=%ERRORLEVEL%
82109
echo Build failed
@@ -93,4 +120,6 @@ set B_QT_FULLPATH=
93120
set savedir=
94121
set cmake_gen=
95122

123+
set INNO_ROOT=
124+
96125
EXIT /B %BUILD_FAILED%

dist/inno/setup.iss.in

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ DefaultDirName={pf}\{#MyAppName}
2323
DefaultGroupName={cm:CmAppName}
2424
DisableProgramGroupPage=yes
2525
LicenseFile=@CMAKE_SOURCE_DIR@/dist/License.rtf
26-
OutputDir=@CMAKE_RUNTIME_OUTPUT_DIRECTORY@/../installer-inno
26+
OutputDir=@CMAKE_BINARY_DIR@/installer-inno
2727
OutputBaseFilename={#MyAppName}-{#MyAppTextVersion}-setup
2828
SetupIconFile=@CMAKE_CURRENT_SOURCE_DIR@/res/win/@PROJ_NAME@.ico
2929
VersionInfoProductTextVersion={#MyAppTextVersion}
@@ -35,7 +35,7 @@ VersionInfoCopyright={#MyAppCopyright}
3535
Compression=lzma
3636
SolidCompression=yes
3737
WizardStyle=modern
38-
ArchitecturesInstallIn64BitMode=x64 ia64
38+
ArchitecturesInstallIn64BitMode=x64
3939
UninstallDisplayIcon={app}\{#MyAppExeName}
4040
UninstallDisplayName={cm:CmAppName}
4141
Uninstallable=yes
@@ -52,7 +52,7 @@ Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{
5252
; Name: "startupicon"; Description: "{cm:CmAutoStart}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: checkablealone
5353

5454
[Files]
55-
Source: "@CMAKE_RUNTIME_OUTPUT_DIRECTORY@/@PROJ_NAME@/@CMAKE_BUILD_TYPE@/*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
55+
Source: "@CMAKE_RUNTIME_OUTPUT_DIRECTORY@/@CMAKE_BUILD_TYPE@/*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
5656
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
5757

5858
[Icons]

modules/quazip.cmake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ if(NOT TARGET quazip)
1414
add_subdirectory("${QUAZIP_DIR}" quazip)
1515
include_directories(${QUAZIP_DIR}/quazip)
1616

17-
# ¿½±´Êä³öÎļþµ½Ó¦ÓÃ
18-
file(GLOB OUTPUTS ${CMAKE_INSTALL_LIBDIR}/quazip5d.*)
17+
# 拷贝输出文件到应用
18+
file(GLOB OUTPUTS ${CMAKE_INSTALL_LIBDIR}/quazip*)
1919
file(COPY ${OUTPUTS}
2020
DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/data-transfer/${CMAKE_BUILD_TYPE})
21-
message(" >>> copy QtZeroConf output libraries: ${OUTPUTS}")
21+
message(" >>> copy quazip output libraries: ${OUTPUTS}")
2222
endif()
2323

2424
endif()

src/apps/app.manifest

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2+
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
3+
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
4+
<security>
5+
<requestedPrivileges>
6+
<requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
7+
</requestedPrivileges>
8+
</security>
9+
</trustInfo>
10+
<application xmlns="urn:schemas-microsoft-com:asm.v3">
11+
<windowsSettings>
12+
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
13+
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitor</dpiAwareness>
14+
</windowsSettings>
15+
</application>
16+
</assembly>

0 commit comments

Comments
 (0)