-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathmake_package.bat
214 lines (194 loc) · 7.23 KB
/
make_package.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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
@echo off
rem Script builds, tests and makes package.
rem Script build all targets from CMakeLists.txt by successively calling
rem build.bat for next configurations: Debug x86, Release x86, Debug x64,
rem Release x64. If one of configurations fail the process stopped.
rem Usage:
rem make_package <major>.<minor>[.<patch>] [rebuild|clean] [no-test] [no-tls] [<CMake Generator>]
rem Where
rem <major>.<minor>[.<patch>] - Version of package, i.e. 1.2.6
rem clean - removes build directory
rem rebuild - performs clean and build
rem no-test - build testing will not be started
rem no-tls - performs build without TLS\SSL support
rem <CMake Generator>:
rem vs2015 - performs build using "Visual Studio 14 2015" CMake generator
rem vs2017 - performs build using "Visual Studio 15 2017" CMake generator
rem vs2019 - performs build using "Visual Studio 16 2019" CMake generator
rem vs2022 - performs build using "Visual Studio 17 2022" CMake generator
rem
rem The operation order:
rem 1. Build sources in next configurations Debug x86, Release x86,
rem Debug x64, Release x64. The result of build is located into the
rem BUILD_DIR directory. Building performes with build.bat script from
rem current directory where this script is located.
rem 2. Run tests of build with scripts\check_build.bat.
rem 3. Create individual packages for each configuration with
rem scripts\combine_package.bat. Then create the target package which
rem will be placed into BUILD_DIR directory.
rem Dependencies:
rem 1. CMake x64 + CPack
rem 2. MSBuild
rem 3. MSBuild Command Prompt x64
rem 4. 7z
setlocal
rem Check cmake application in PATH
where /q cmake
if %ERRORLEVEL% GEQ 1 (
echo The 'cmake' application is missing. Ensure it is installed and placed in your PATH.
goto exit_error
)
rem Check msbuild application in PATH
rem where /q msbuild
rem if %ERRORLEVEL% GEQ 1 (
rem echo The 'msbuild' application is missing. Ensure it is installed and placed in your PATH.
rem goto exit_error
rem )
rem Check cpack application in PATH
where /q cpack
if %ERRORLEVEL% GEQ 1 (
echo The 'cpack' application is missing. Ensure it is installed and placed in your PATH.
goto exit_error
)
rem Check 7z archiver in PATH
where /q 7z
if %ERRORLEVEL% GEQ 1 (
echo The '7z' application is missing. Ensure it is installed and placed in your PATH.
goto exit_error
)
set VERSION=%1
set DO_TEST=1
set BUILD_DIR=%~dp0\build
set PROJECT_NAME=DXFeedAll
set PACKAGE_WORK_DIR=_CPack_Packages
set TARGET_PACKAGE=dxfeed-c-api-%VERSION%
set NO_TLS=
set PACKAGE_SUFFIX=
set GENERATOR=vs2022
for %%A in (%*) do (
if [%%A] EQU [clean] (
call build.bat clean
goto end
) else if [%%A] EQU [rebuild] (
call build.bat clean
) else if [%%A] EQU [no-test] (
set DO_TEST=0
) else if [%%A] EQU [no-tls] (
set NO_TLS=no-tls
set PACKAGE_SUFFIX=-no-tls
) else if [%%A] EQU [vs2015] (
set GENERATOR=%%A
) else if [%%A] EQU [vs2017] (
set GENERATOR=%%A
) else if [%%A] EQU [vs2019] (
set GENERATOR=%%A
) else if [%%A] EQU [vs2022] (
set GENERATOR=%%A
)
)
rem Check version parameter
if [%VERSION%] EQU [] (
echo ERROR: The version of package is not specified or invalid^!
goto usage
)
if [%VERSION%] EQU [clean] (
echo ERROR: The version of package is not specified or invalid^!
goto usage
)
if [%VERSION%] EQU [rebuild] (
echo ERROR: The version of package is not specified or invalid^!
goto usage
)
if [%VERSION%] EQU [no-test] (
echo ERROR: The version of package is not specified or invalid^!
goto usage
)
if [%VERSION%] EQU [no-tls] (
echo ERROR: The version of package is not specified or invalid^!
goto usage
)
if [%VERSION%] EQU [vs2015] (
echo ERROR: The version of package is not specified or invalid^!
goto usage
)
if [%VERSION%] EQU [vs2017] (
echo ERROR: The version of package is not specified or invalid^!
goto usage
)
if [%VERSION%] EQU [vs2019] (
echo ERROR: The version of package is not specified or invalid^!
goto usage
)
if [%VERSION%] EQU [vs2022] (
echo ERROR: The version of package is not specified or invalid^!
goto usage
)
echo Start building package %VERSION%
rem === UPDATE VERSION ===
set APP_VERSION=%VERSION%
rem === BUILD ALL TARGETS ===
call build.bat Debug x86 %NO_TLS% %GENERATOR%
if %ERRORLEVEL% GEQ 1 goto exit_error
call build.bat Release x86 %NO_TLS% %GENERATOR%
if %ERRORLEVEL% GEQ 1 goto exit_error
call build.bat Debug x64 %NO_TLS% %GENERATOR%
if %ERRORLEVEL% GEQ 1 goto exit_error
call build.bat Release x64 %NO_TLS% %GENERATOR%
if %ERRORLEVEL% GEQ 1 goto exit_error
rem === TEST BUILDS ===
if %DO_TEST% EQU 0 (
echo Build checking will be skipped.
goto make_package
)
echo Start checking build %VERSION%
call %~dp0\scripts\check_build %BUILD_DIR%
if %ERRORLEVEL% GEQ 1 goto exit_error
rem === MAKE PACKAGE ===
:make_package
echo Start make release package %VERSION%
set HOME_DIR=%cd%
cd %BUILD_DIR%
call %~dp0\scripts\combine_package %PROJECT_NAME% Debug x86 %VERSION% %NO_TLS%
if %ERRORLEVEL% GEQ 1 goto cpack_error
call %~dp0\scripts\combine_package %PROJECT_NAME% Release x86 %VERSION% %NO_TLS%
if %ERRORLEVEL% GEQ 1 goto cpack_error
call %~dp0\scripts\combine_package %PROJECT_NAME% Debug x64 %VERSION% %NO_TLS%
if %ERRORLEVEL% GEQ 1 goto cpack_error
call %~dp0\scripts\combine_package %PROJECT_NAME% Release x64 %VERSION% %NO_TLS%
if %ERRORLEVEL% GEQ 1 goto cpack_error
if NOT EXIST %PACKAGE_WORK_DIR% mkdir %PACKAGE_WORK_DIR%
cd %PACKAGE_WORK_DIR%
if EXIST %TARGET_PACKAGE%%PACKAGE_SUFFIX% rmdir %TARGET_PACKAGE%%PACKAGE_SUFFIX% /S /Q
mkdir %TARGET_PACKAGE%%PACKAGE_SUFFIX%
xcopy /Y /S %PROJECT_NAME%-%VERSION%-x86%PACKAGE_SUFFIX% %TARGET_PACKAGE%%PACKAGE_SUFFIX%
xcopy /Y /S %PROJECT_NAME%-%VERSION%-x64%PACKAGE_SUFFIX% %TARGET_PACKAGE%%PACKAGE_SUFFIX%
7z a %TARGET_PACKAGE%%PACKAGE_SUFFIX%.zip %TARGET_PACKAGE%%PACKAGE_SUFFIX%
move /Y %TARGET_PACKAGE%%PACKAGE_SUFFIX%.zip %BUILD_DIR%\%TARGET_PACKAGE%%PACKAGE_SUFFIX%.zip
cd %HOME_DIR%
rem === FINISH ===
goto exit_success
:usage
echo Usage: %0 ^<major^>.^<minor^>[.^<patch^>] [rebuild^|clean] [no-test] [no-tls] [^<CMake Generator^>]
echo ^<major^>.^<minor^>[.^<patch^>] - Version of package, i.e. 1.2.6
echo clean - removes build directory
echo rebuild - performs clean and build
echo no-test - build tests will not be started
echo no-tls - performs build without TLS\SSL support
echo ^<CMake Generator^>:
echo vs2015 - performs build using "Visual Studio 14 2015" CMake generator
echo vs2017 - performs build using "Visual Studio 15 2017" CMake generator
echo vs2019 - performs build using "Visual Studio 16 2019" CMake generator
echo vs2022 - performs build using "Visual Studio 17 2022" CMake generator
goto exit_error
:exit_success
echo.
echo Making package complete successfully.
exit /b 0
:cpack_error
cd %HOME_DIR%
goto exit_error
:exit_error
echo.
echo Making package failed!
exit /b 1
:end