-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.bat
60 lines (49 loc) · 1.38 KB
/
build.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
@echo off
set buildFolder=build
set generator="Visual Studio 17 2022"
set platform=x64
REM Speichere den aktuellen Pfad ab
set projectRootPath=%CD%
REM Enable colored output
SETLOCAL EnableExtensions DisableDelayedExpansion
for /F %%a in ('echo prompt $E ^| cmd') do (
set "ESC=%%a"
)
SETLOCAL EnableDelayedExpansion
set RED=!ESC![31m
set GREEN=!ESC![32m
set YELLOW=!ESC![33m
set WHITE=!ESC![37m
set END_COLOR=!ESC![0m
mkdir %buildFolder%
cd %buildFolder%
REM Funktionsaufruf build(Debug, projectRootPath)
CALL :build Debug, "%projectRootPath%/installation"
CALL :build Release, "%projectRootPath%/installation"
EXIT /b 0
REM Funktionsdefinition
:build
REM Lese Parameter 1
set buildType=%~1
REM Lese Parameter 2
set installPrefix=%~2
REM Erstelle Buildpfad
mkdir %buildType%
REM Bewege in den Buildpfad
cd %buildType%
REM cmake Befehl f�rs konfigurieren
cmake -G %generator% -A %platform% -DQT_DEPLOY=ON -DRELATIVE_BUILD_FOLDER="%buildFolder%" -DCMAKE_BUILD_TYPE=%buildType% -DCMAKE_INSTALL_PREFIX="%installPrefix%" -DCMAKE_CXX_FLAGS="/EHsc /MP" -DCMAKE_C_FLAGS="/EHsc /MP" "%projectRootPath%"
REM cmake Befehl f�rs kompilieren
cmake --build . --config %buildType% --target install
if %errorlevel% neq 0 (
CALL::ECHO_COLOR "Build failed!", %RED%
REM pause
EXIT /B 1
) else (
CALL::ECHO_COLOR "Build successful!", %GREEN%
)
cd ..
EXIT /B 0
:ECHO_COLOR
echo %2 %1 %END_COLOR%
EXIT /B 0