forked from COVESA/dlt-viewer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_sdk_windows_qt5_MSVC_cmake.bat
131 lines (102 loc) · 3.63 KB
/
build_sdk_windows_qt5_MSVC_cmake.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
REM @echo off
REM Date Version Author Changes
REM 4.7.19 1.0 Alexander Wenzel Update to Qt 5.12.4 and Visual Studio 2015
REM 25.11.20 1.1 Alexander Wenzel Update to Qt 5.12.10
REM 11.1.21 1.2 Alexander Wenzel Update to Qt 5.12.12, Visual Studio 2017 Build Tools, simplify and cmake
REM 27.1.21 1.2 Alexander Wenzel Update using cmake install
echo ************************************
echo *** DLT Viewer SDK (cmake) ***
echo ************************************
call build_config.bat
REM https://stackoverflow.com/questions/4983508/can-i-have-an-if-block-in-dos-batch-file
if "%WORKSPACE%"=="" (goto NO_WORKSPACE) else (goto WITH_WORKSPACE)
:NO_WORKSPACE
echo WORKSPACE variable is not defined
set SOURCE_DIR=%CD%
set BUILD_DIR=%SOURCE_DIR%\build\release
set DIST_DIR=%SOURCE_DIR%\build\dist
if "%DLT_VIEWER_SDK_DIR%"=="" (
set DLT_VIEWER_SDK_DIR=c:\DltViewerSDKQt%QTNO%
)
goto Continue1
:WITH_WORKSPACE
set SOURCE_DIR=%WORKSPACE%
set BUILD_DIR=%SOURCE_DIR%\build\release
set DIST_DIR=%SOURCE_DIR%\build\dist
if "%DLT_VIEWER_SDK_DIR%"=="" (
set DLT_VIEWER_SDK_DIR=%DIST_DIR%\DltViewerSDKQt%QTNO%
)
:Continue1
echo ************************************
echo * QTDIR = %QTDIR%
echo * MSVC_DIR = %MSVC_DIR%
echo * PATH = %PATH%
echo * DLT_VIEWER_SDK_DIR = %DLT_VIEWER_SDK_DIR%
echo * SOURCE_DIR = %SOURCE_DIR%
echo * BUILD_DIR = %BUILD_DIR%
echo * DIST_DIR = %DIST_DIR%
echo ************************************
if exist build (
echo ************************************
echo *** Delete old build Directory ***
echo ************************************
rmdir /s /q build || rem
if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER
)
echo ************************************
echo *** Configure MSVC environment ***
echo ************************************
call vcvarsall.bat x86_amd64
if %ERRORLEVEL% NEQ 0 goto ERROR_HANDLER
echo configuring was successful
if exist %DLT_VIEWER_SDK_DIR% (
echo ************************************
echo *** Delete old SDK Directory ***
echo ************************************
rmdir /s /q %DLT_VIEWER_SDK_DIR% || rem
if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER
)
echo ************************************
echo *** Build DLT Viewer ***
echo ************************************
mkdir build
if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER
cd build
if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER
mkdir Release
if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER
cd Release
if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DDLT_PARSER=ON -DCMAKE_INSTALL_PREFIX=%DLT_VIEWER_SDK_DIR% ..\..
if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER
cmake --build .
if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER
echo ************************************
echo *** Create SDK ***
echo ************************************
cmake --install .
if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER
if "%CPACK_7Z%" NEQ "" (
echo CPack 7Z
"C:\Program Files\CMake\bin\cpack" -G 7Z
cp DLTViewer*.7z %DIST_DIR%\
)
if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER
if "%CPACK_NSIS%" NEQ "" (
echo CPack NSIS
"C:\Program Files\CMake\bin\cpack" -G NSIS
cp DLTViewer*.exe %DIST_DIR%\
)
if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER
GOTO QUIT
:ERROR_HANDLER
echo ####################################
echo ### ERROR occured ###
echo ####################################
exit /b 1
:QUIT
echo ************************************
echo *** SUCCESS finish ***
echo ************************************
echo SDK installed in: %DLT_VIEWER_SDK_DIR%
exit /b 0