-
Notifications
You must be signed in to change notification settings - Fork 1
/
generate.bat
80 lines (68 loc) · 1.92 KB
/
generate.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
@echo off
where /q cmake
IF ERRORLEVEL 1 (
echo CMake not found. Please install CMake and make sure to add its location to the system path.
pause
exit /b 1
)
rem use command line argument for selecting build target
set target_arg=
:target_loop
IF [%1]==[] (
goto target_end
)
set target_arg=%target_arg%-target %1
shift /1
goto target_loop
:target_end
IF DEFINED target_arg (
echo using filter: %target_arg%
)
rem verify all submodules are up to date
echo Updating Git submodules..
git submodule update
echo ..Done!
set chibi_bin="chibi-build/chibi/Debug/chibi.exe"
rem build chibi binary
mkdir "chibi-build\chibi"
cd chibi-build/chibi && cmake -DCMAKE_BUILD_TYPE=Debug ../../chibi && cmake --build . || cd %~dp0 && exit /b 1
cd %~dp0 || exit /b 1
rem generate cmake files using chibi
mkdir "chibi-build\cmake-files"
%chibi_bin% -g . chibi-build/cmake-files %target_arg% || cd %~dp0 && exit /b 1
cd %~dp0 || exit /b 1
rem generate Visual Studio project file
set success="false"
IF %success% == "false" (
mkdir "chibi-build\vs2019"
cd chibi-build/vs2019 && cmake -G "Visual Studio 16 2019" -A Win32 ../cmake-files
IF ERRORLEVEL 1 (
echo Failed to generate Visual Studio 2019 solution.
) ELSE (
set success="true"
%SystemRoot%\explorer.exe /select,.\Project.sln
)
cd %~dp0 || exit /b 1
)
IF %success% == "false" (
mkdir "chibi-build\vs2017"
cd chibi-build/vs2017 && cmake -G "Visual Studio 15 2017" -A Win32 ../cmake-files
IF ERRORLEVEL 1 (
echo Failed to generate Visual Studio 2017 solution.
) ELSE (
set success="true"
%SystemRoot%\explorer.exe /select,.\Project.sln
)
cd %~dp0 || exit /b 1
)
IF %success% == "false" (
mkdir "chibi-build\vs2015"
cd chibi-build/vs2015 && cmake -G "Visual Studio 14 2015" -A Win32 ../cmake-files
IF ERRORLEVEL 1 (
echo Failed to generate Visual Studio 2015 solution.
) ELSE (
set success="true"
%SystemRoot%\explorer.exe /select,.\Project.sln
)
cd %~dp0 || exit /b 1
)