-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathclean_build.bat
More file actions
164 lines (127 loc) · 4.6 KB
/
clean_build.bat
File metadata and controls
164 lines (127 loc) · 4.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
@echo off
if "%~1"=="" (
echo please set the app version same as in deiban/changelog
exit /B 1
)
set APP_VERSION=%~1
echo set APP_VERSION: %APP_VERSION%
REM Set architecture (default to x64 for backward compatibility)
set BUILD_ARCH=%~2
if "%BUILD_ARCH%"=="" set BUILD_ARCH=x64
echo Build architecture: %BUILD_ARCH%
REM Force use of the same compiler as used to build ChimeraX
@REM call "%VS170COMNTOOLS%"\vcvars64.bat
set VCINSTALLDIR=C:\Program Files\Microsoft Visual Studio\2022\Community\VC
echo VCINSTALLDIR: %VCINSTALLDIR%
REM Choose VS environment based on architecture
call "%VCINSTALLDIR%\Auxiliary\Build\vcvarsall.bat" %BUILD_ARCH%
@REM projects
set COO_PROJECT=dde-cooperation
set DT_PROJECT=data-transfer
REM defaults - override them by creating a build_env.bat file
set B_BUILD_TYPE=Release
set B_QT_ROOT=D:\Qt
set B_QT_VER=5.15.2
REM Set Qt MSVC version and OpenSSL based on architecture
if "%BUILD_ARCH%"=="x86" (
set VS_ARCH=Win32
set B_QT_MSVC=msvc2019
set "OPENSSL_ROOT_DIR=C:\Program Files (x86)\OpenSSL-Win32"
) else (
set VS_ARCH=x64
set B_QT_MSVC=msvc2019_64
set "OPENSSL_ROOT_DIR=C:\Program Files\OpenSSL-Win64"
)
set B_BONJOUR=%~dp0\3rdparty\ext\BonjourSDK
set savedir=%cd%
cd /d %~dp0
REM cmake generator name for the target build system
if "%VisualStudioVersion%"=="15.0" (
set cmake_gen=Visual Studio 15 2017
) else if "%VisualStudioVersion%"=="16.0" (
set cmake_gen=Visual Studio 16 2019
) else (
echo Visual Studio version was not detected: %VisualStudioVersion%
echo Did you forget to run inside a VS developer prompt?
echo Using the default cmake generator.
set cmake_gen=Visual Studio 17 2022
)
REM full path to Qt stuff we need
set B_QT_FULLPATH=%B_QT_ROOT%\%B_QT_VER%\%B_QT_MSVC%
echo Qt: %B_QT_FULLPATH%
rmdir /q /s build
mkdir build
if ERRORLEVEL 1 goto failed
cd build
mkdir installer-inno
echo ------------starting cmake------------
REM Set vcpkg triplet based on build architecture
if "%BUILD_ARCH%"=="x86" (
set VCPKG_TRIPLET=x86-windows
) else (
set VCPKG_TRIPLET=x64-windows
)
echo Using vcpkg triplet: %VCPKG_TRIPLET%
REM Pre-install vcpkg dependencies (optional but speeds up build)
echo Pre-installing vcpkg dependencies...
set VCPKG_ROOT=D:\vcpkg\vcpkg
set VCPKG_CMAKE=%VCPKG_ROOT%\scripts\buildsystems\vcpkg.cmake
echo Configuring with CMake...
cmake -G "%cmake_gen%" -A %VS_ARCH% -D CMAKE_BUILD_TYPE=%B_BUILD_TYPE% ^
-D CMAKE_PREFIX_PATH="%B_QT_FULLPATH%" -D QT_VERSION=%B_QT_VER% ^
-D CMAKE_TOOLCHAIN_FILE="%VCPKG_CMAKE%" ^
-D VCPKG_TARGET_TRIPLET=%VCPKG_TRIPLET% ^
-D APP_VERSION=%APP_VERSION% ..
if ERRORLEVEL 1 goto failed
cmake --build . --config %B_BUILD_TYPE%
if ERRORLEVEL 1 goto failed
REM Set architecture-specific variables
if "%BUILD_ARCH%"=="x86" (
set OPENSSL_CRYPTO=libcrypto-3.dll
set OPENSSL_SSL=libssl-3.dll
set BONJOUR_FILE=Bonjour.msi
) else (
set OPENSSL_CRYPTO=libcrypto-3-x64.dll
set OPENSSL_SSL=libssl-3-x64.dll
set BONJOUR_FILE=Bonjour64.msi
)
echo OpenSSL DLLs: %OPENSSL_CRYPTO%, %OPENSSL_SSL%
if exist output\%B_BUILD_TYPE% (
copy output\%B_BUILD_TYPE%\* output\%COO_PROJECT%\%B_BUILD_TYPE%\ > NUL
del output\%COO_PROJECT%\%B_BUILD_TYPE%\quazip* > NUL
copy "%OPENSSL_ROOT_DIR%\%OPENSSL_CRYPTO%" output\%COO_PROJECT%\%B_BUILD_TYPE%\ > NUL
copy "%OPENSSL_ROOT_DIR%\%OPENSSL_SSL%" output\%COO_PROJECT%\%B_BUILD_TYPE%\ > NUL
copy "%B_BONJOUR%\%BONJOUR_FILE%" output\%COO_PROJECT%\%B_BUILD_TYPE%\ > NUL
copy output\%B_BUILD_TYPE%\quazip* output\%DT_PROJECT%\%B_BUILD_TYPE%\ > NUL
copy "%OPENSSL_ROOT_DIR%\%OPENSSL_CRYPTO%" output\%DT_PROJECT%\%B_BUILD_TYPE%\ > NUL
copy "%OPENSSL_ROOT_DIR%\%OPENSSL_SSL%" output\%DT_PROJECT%\%B_BUILD_TYPE%\ > NUL
) else (
echo Remember to copy supporting binaries and configuration files!
)
echo Build completed successfully
set INNO_ROOT=C:\Program Files (x86)\Inno Setup 6
echo Building %BUILD_ARCH%-bit Windows installer...
"%INNO_ROOT%\ISCC.exe" /Qp %COO_PROJECT%-setup.iss
if ERRORLEVEL 1 goto issfailed
"%INNO_ROOT%\ISCC.exe" /Qp deepin-%DT_PROJECT%-setup.iss
if ERRORLEVEL 1 goto issfailed
echo Build all Windows installer successfully!!!
set BUILD_FAILED=0
goto done
:issfailed
echo Make Windows installer failed
:failed
set BUILD_FAILED=%ERRORLEVEL%
echo Build failed
:done
cd /d %savedir%
set B_BUILD_TYPE=
set B_QT_ROOT=
set B_QT_VER=
set B_QT_MSVC=
set B_BONJOUR=
set B_QT_FULLPATH=
set savedir=
set cmake_gen=
set INNO_ROOT=
EXIT /B %BUILD_FAILED%