forked from xsoameix/wz
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmake.bat
111 lines (97 loc) · 2.04 KB
/
make.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
@echo off
set argc=0
for %%x in (%*) do set /A argc+=1
if %argc% geq 3 (
goto :usage
)
if %argc% leq 0 (
goto :usage
)
if %argc% == 1 (
set "action="
set msvc=%1
)
if %argc% == 2 (
set action=%1
set msvc=%2
)
rem Get action
if not [%action%] == [] (
if not "%action%" == "all" (
goto :usage
)
)
rem Get visual studio version
if %msvc% == "Visual Studio 2013" (
set msvc_ver=12
)
if %msvc% == "Visual Studio 2015" (
set msvc_ver=14
)
if not defined msvc_ver (
goto :usage
)
rem Prepare the environment
if "%PROCESSOR_ARCHITECTURE%" == "x86" (
call "C:\Program Files\Microsoft Visual Studio %msvc_ver%.0\VC\vcvarsall.bat"
) else (
call "C:\Program Files (x86)\Microsoft Visual Studio %msvc_ver%.0\VC\vcvarsall.bat"
)
rem Set visual studio name
set msvc_name="Visual Studio %msvc_ver%"
rem Get wz folder
set wz=%cd%
cd ..
rem Get root folder
set root=%cd%
set zlib=%root%\zlib
set check=%root%\check
if "%action%" == "all" (
rem Compile zlib
cd "%zlib%"
if not exist local mkdir local
if not exist build mkdir build
cd build
cmake ^
-DCMAKE_INSTALL_PREFIX="%zlib%\local" ^
-G %msvc_name% ..
msbuild INSTALL.vcxproj
rem Compile check
cd "%check%"
if not exist local mkdir local
cmake ^
-DCMAKE_INSTALL_PREFIX="%check%\local" ^
-G %msvc_name% .
msbuild INSTALL.vcxproj
)
rem Compile wz
cd "%wz%"
if not exist local mkdir local
if not exist build mkdir build
cd build
cmake ^
-DCMAKE_INSTALL_PREFIX="%wz%\local" ^
-DZLIB_ROOT="%zlib%\local" ^
-DCHECK_ROOT_DIR="%check%\local" ^
-G %msvc_name% ..
msbuild INSTALL.vcxproj
rem Run Unit Tests
msbuild RUN_TESTS.vcxproj
rem Quit
cd ..
exit /B 0
rem Show usage
:usage
echo Usage: make [ACTION] VERSION
echo.
echo ACTION can be all or just empty
echo all means building the dependencies and this project
echo empty means building this project only
echo.
echo eg: make all "Visual Studio 2013"
echo make "Visual Studio 2015"
echo.
echo VERSION can be any one in following list:
echo 1. "Visual Studio 2013"
echo 2. "Visual Studio 2015"
exit /B 0