forked from dxFeed/dxfeed-c-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcombine_package.bat
92 lines (82 loc) · 2.75 KB
/
combine_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
@echo off
rem Script CPack archives with specified platform and configuration. After
rem packing all files extracted to single release directory.
rem Usage:
rem combine_package <project-name> <configuration> <platform> <version> [no-tls]
rem where:
rem project-name - The name of target project package
rem configuration - Debug or Release
rem platform - x86 or x64
rem version - version of application i.e. 1.2.6
rem
rem WARNING: you must set the next environment variables
rem PACKAGE_WORK_DIR - the working directory where cpack result arhive will be stored and unpacked
setlocal
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
)
rem Check PACKAGE_WORK_DIR environment variable
if [%PACKAGE_WORK_DIR%] EQU [] (
echo ERROR: Environment variable PACKAGE_WORK_DIR is not specified!
echo Please set 'set PACKAGE_WORK_DIR=...' in your caller script or command line.
goto exit_error
)
set PROJECT_NAME=%1
set CONFIG=%2
set PLATFORM=%3
set VERSION=%4
set NO_TLS=%5
set PACKAGE_SUFFIX=
if [%PROJECT_NAME%] EQU [] (
echo ERROR: Project package name is not specified!
goto exit_error
)
if [%CONFIG%] NEQ [Debug] (
if [%CONFIG%] NEQ [Release] (
echo ERROR: Invalid configuration value '%CONFIG%'
goto exit_error
)
)
if [%PLATFORM%] NEQ [x86] (
if [%PLATFORM%] NEQ [x64] (
echo ERROR: Invalid platform value '%PLATFORM%'
goto exit_error
)
)
rem if [%VERSION%] EQU [] (
rem echo ERROR: Version is not specified!
rem goto exit_error
rem )
if [%NO_TLS%] EQU [no-tls] (
set PACKAGE_SUFFIX=-no-tls
)
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo "PLATFORM: %PLATFORM%"
echo "CONFIG : %CONFIG%"
echo "PROJECT : %PROJECT_NAME%"
echo "NO_TLS : %NO_TLS%"
echo "VERSION : %VERSION%"
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
type "%PLATFORM%\DXFeedAllCPackConfig.cmake"
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
cpack -G ZIP -C %CONFIG% --config %PLATFORM%\DXFeedAllCPackConfig.cmake
if %ERRORLEVEL% GEQ 1 goto exit_error
set PACKAGE_NAME=%PROJECT_NAME%-%VERSION%-%PLATFORM%%PACKAGE_SUFFIX%
set ARCHIVE_NAME=%PROJECT_NAME%-%VERSION%-%PLATFORM%%CONFIG%%PACKAGE_SUFFIX%
move /Y %PACKAGE_NAME%.zip %PACKAGE_WORK_DIR%\%ARCHIVE_NAME%.zip
7z x -y -o%PACKAGE_WORK_DIR% %PACKAGE_WORK_DIR%\%ARCHIVE_NAME%.zip
if %ERRORLEVEL% GEQ 1 goto exit_error
:exit_success
exit /b 0
:exit_error
exit /b 1
:end