-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_windows_qt5_MSVC.bat
193 lines (146 loc) · 5.25 KB
/
build_windows_qt5_MSVC.bat
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
@echo off
REM Date Version Author Changes
echo ************************************
echo *** DLTMultimeter ***
echo ************************************
echo ************************************
echo *** Configuration ***
echo ************************************
set NAME=DLTMultimeter
set TARGET_NAME=%NAME%
rem parameter of this batch script can be either x86 or x86_amd64
if "%ARCHITECTURE%"=="" (
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" (
set ARCHITECTURE=x86_amd64
) else (
set ARCHITECTURE=x86
)
set USE_ARCH_PARAM=false
if "%1" NEQ "" (
if "%1"=="x86" set USE_ARCH_PARAM=true
if "%1"=="x86_amd64" set USE_ARCH_PARAM=true
)
if "!USE_ARCH_PARAM!"=="true" set ARCHITECTURE=%1
)
echo Target architecture is %ARCHITECTURE%
echo *** Setting up environment ***
if "%QTDIR%"=="" (
if "%ARCHITECTURE%"=="x86_amd64" (
set QTDIR=C:\Qt\Qt5.12.10\5.12.10\msvc2015_64
) else (set QTDIR=C:\Qt\Qt5.12.10\5.12.10\msvc2015)
)
if exist "C:\Program Files (x86)\Microsoft Visual Studio\%MSVC_VER%\Enterprise\VC\Auxiliary\Build" (
REM Visual Studio Community Edition 2019
if "%MSVC_DIR%"=="" set "MSVC_DIR=C:\Program Files (x86)\Microsoft Visual Studio\%MSVC_VER%\Enterprise\VC\Auxiliary\Build"
) else (
REM Vidual Studio Professional 2019
if "%MSVC_DIR%"=="" set "MSVC_DIR=C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build"
)
set PATH=%QTDIR%\bin;%MSVC_DIR%;%MSVC_DIR%\bin;%PATH%
set QTSDK=%QTDIR%
if '%WORKSPACE%'=='' (
if '%INSTALLATION_DIR%'=='' (
set INSTALLATION_DIR=c:\%TARGET_NAME%
)
set SOURCE_DIR=%CD%
set BUILD_DIR=%CD%\build\release
) else (
if '%INSTALLATION_DIR%'=='' (
set INSTALLATION_DIR=%WORKSPACE%\build\dist\%TARGET_NAME%
)
set SOURCE_DIR=%WORKSPACE%
set BUILD_DIR=%WORKSPACE%\build\release
)
echo ************************************
echo * QTDIR = %QTDIR%
echo * QTSDK = %QTSDK%
echo * QWT_DIR = %QWT_DIR%
echo * MSVC_DIR = %MSVC_DIR%
echo * PATH = %PATH%
echo * INSTALLATION_DIR = %INSTALLATION_DIR%
echo * SOURCE_DIR = %SOURCE_DIR%
echo * BUILD_DIR = %BUILD_DIR%
echo ************************************
if exist build (
echo ************************************
echo *** Delete old build Directory ***
echo ************************************
rmdir /s /q build
if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER
)
echo ************************************
echo *** Configure MSVC environment ***
echo ************************************
call vcvarsall.bat %ARCHITECTURE%
if %ERRORLEVEL% NEQ 0 goto error
echo configuring was successful
if exist %INSTALLATION_DIR% (
echo ************************************
echo *** Delete old Directory ***
echo ************************************
rmdir /s /q %INSTALLATION_DIR%
if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER
)
echo ************************************
echo *** Build ***
echo ************************************
mkdir build
if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER
cd build
if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER
qmake ../%NAME%.pro
if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER
nmake
if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER
echo ************************************
echo *** Create SDK ***
echo ************************************
if not exist %INSTALLATION_DIR% mkdir %INSTALLATION_DIR%
echo *** Create directories %INSTALLATION_DIR% ***
rem mkdir %INSTALLATION_DIR%
if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER
mkdir %INSTALLATION_DIR%\platforms
if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER
mkdir %INSTALLATION_DIR%\doc
if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER
echo *** Copy files ***
copy %QTDIR%\bin\Qt5Core.dll %INSTALLATION_DIR%
if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER
copy %QTDIR%\bin\Qt5Gui.dll %INSTALLATION_DIR%
if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER
copy %QTDIR%\bin\Qt5Network.dll %INSTALLATION_DIR%
if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER
copy %QTDIR%\bin\Qt5Svg.dll %INSTALLATION_DIR%
if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER
copy %QTDIR%\bin\Qt5Widgets.dll %INSTALLATION_DIR%
if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER
copy %QTDIR%\bin\Qt5PrintSupport.dll %INSTALLATION_DIR%
if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER
copy %QTDIR%\bin\Qt5Xml.dll %INSTALLATION_DIR%
if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER
copy %QTDIR%\bin\Qt5OpenGL.dll %INSTALLATION_DIR%
if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER
copy %QTDIR%\bin\Qt5SerialPort.dll %INSTALLATION_DIR%
if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER
copy %QTDIR%\plugins\platforms\qwindows.dll %INSTALLATION_DIR%\platforms
if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER
copy %BUILD_DIR%\%NAME%.exe %INSTALLATION_DIR%
if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER
copy %SOURCE_DIR%\README.md %INSTALLATION_DIR%
if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER
copy %SOURCE_DIR%\LICENSE %INSTALLATION_DIR%
if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER
GOTO QUIT
:ERROR_HANDLER
echo ####################################
echo ### ERROR occured ###
echo ####################################
set /p name= Continue
exit 1
:QUIT
echo ************************************
echo *** SUCCESS finish ***
echo ************************************
echo Installed in: %INSTALLATION_DIR%
set /p name= Continue
exit 0