-
Notifications
You must be signed in to change notification settings - Fork 48
/
build_win64_vs.bat
65 lines (50 loc) · 1.39 KB
/
build_win64_vs.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
REM Build
echo "Build win64 Visual Studio"
REM Ensure sh is not in the path for MinGW Makefiles generator to work.
setlocal enabledelayedexpansion
where sh.exe > path.txt
set /p SH_EXE_PATH=<path.txt
del /s /q path.txt
if "%SH_EXE_PATH%" == "" ( goto BUILD )
for %%i in ("%SH_EXE_PATH%") do set SH_EXE_DIR=%%~di%%~pi
if %SH_EXE_DIR:~-1%==\ set SH_EXE_DIR=%SH_EXE_DIR:~0,-1%
set PATH=!PATH:%SH_EXE_DIR%;=!
where sh.exe > path.txt
set /p SH_EXE_PATH=<path.txt
del /s /q path.txt
if "%SH_EXE_PATH%" == "" ( goto BUILD )
for %%i in ("%SH_EXE_PATH%") do set SH_EXE_DIR=%%~di%%~pi
if %SH_EXE_DIR:~-1%==\ set SH_EXE_DIR=%SH_EXE_DIR:~0,-1%
set PATH=!PATH:%SH_EXE_DIR%;=!
:BUILD
REM set BUILD_GENERATOR="Visual Studio 15 2017"
set BUILD_GENERATOR="Visual Studio 15 2017 Win64"
set BUILD_CONFIGURATION=Debug
REM set BUILD_CONFIGURATION=Release
set BUILD_TARGET=ALL_BUILD
md build
cd build
md win64
cd win64
md vs
cd vs
md %BUILD_CONFIGURATION%
cd %BUILD_CONFIGURATION%
cmake -G %BUILD_GENERATOR% -DCMAKE_BUILD_TYPE=%BUILD_CONFIGURATION% -DCMAKE_INSTALL_PREFIX=%cd%/install ..\..\..\..
if %errorlevel% neq 0 goto ERROR
cmake --build . --config %BUILD_CONFIGURATION% --target %BUILD_TARGET%
if %errorlevel% neq 0 goto ERROR
cmake --build . --target install
if %errorlevel% neq 0 goto ERROR
cpack ../../..
if %errorlevel% neq 0 goto ERROR
cd ..
cd ..
cd ..
cd ..
goto END
:ERROR
echo Build failed
exit /b 1
:END
exit /b 0