-
Notifications
You must be signed in to change notification settings - Fork 66
/
Copy pathbuild_win.bat
205 lines (145 loc) · 4.43 KB
/
build_win.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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
:: Build script for cvkit under Windows
@echo off
setlocal enabledelayedexpansion
where nmake >nul 2>nul
if %ERRORLEVEL% NEQ 0 (
echo This must be run in Visual Studio command prompt for x64
exit /b 1
)
where git >nul 2>nul
if %ERRORLEVEL% NEQ 0 (
echo You must download and install git from: git-scm.com/download/win
exit /b 1
)
where cmake >nul 2>nul
if %ERRORLEVEL% NEQ 0 (
echo You must download and install cmake from: https://cmake.org/download/
exit /b 1
)
:: Create directories building and installing
if not exist "build\" mkdir build
cd build
if not exist "install\" mkdir install
cd install
set INSTALL_PATH=%CD%
if not exist "bin\" mkdir bin
if not exist "include\" mkdir include
if not exist "include\GL\" mkdir include\GL
if not exist "lib" mkdir lib
set LIB=%LIB%;%INSTALL_PATH%\lib
cd ..\..\..
echo ----- Clone all missing repositories -----
if not exist "FreeGLUT\" (
git clone https://github.com/dcnieho/FreeGLUT.git
git checkout 349a23dcc1264a76deb79962d1c90462ad0c6f50
)
if not exist "glew-2.2.0\" (
echo You must download and unpack https://sourceforge.net/projects/glew/files/glew/2.2.0/glew-2.2.0-win32.zip/download
exit /b 1
)
if not exist "%INSTALL_PATH%\include\GL\glew.h" (
copy glew-2.2.0\include\GL\* %INSTALL_PATH%\include\GL
)
if not exist "%INSTALL_PATH%\bin\glew32.dll" (
copy glew-2.2.0\bin\Release\x64\glew32.dll %INSTALL_PATH%\bin
)
if not exist "%INSTALL_PATH%\lib\glew32.lib" (
copy glew-2.2.0\lib\Release\x64\glew32.lib %INSTALL_PATH%\lib
)
set OPT_GLEW=-DGLEW_INCLUDE_DIR="%INSTALL_PATH%\include" -DGLEW_SHARED_LIBRARY_RELEASE="%INSTALL_PATH%\lib\glew32.lib"
if not exist "zlib\" (
git clone https://github.com/winlibs/zlib.git -b zlib-1.2.11
)
if not exist "libpng\" (
git clone https://github.com/winlibs/libpng.git -b libpng-1.6.34
)
if not exist "libjpeg\" (
git clone https://github.com/winlibs/libjpeg.git -b libjpeg-turbo-2.1.0
)
if not exist "libtiff\" (
git clone https://gitlab.com/libtiff/libtiff.git -b v4.5.0
)
echo ----- Building FreeGLUT -----
cd FreeGLUT/freeglut/freeglut
if not exist "build\" mkdir build
cd build
if exist "build_cvkit\" (
cd build_cvkit\
) else (
mkdir build_cvkit\
cd build_cvkit\
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="%INSTALL_PATH%" ..\..
)
nmake install
if %ERRORLEVEL% NEQ 0 exit /b 1
copy "%INSTALL_PATH%\include\GL\freeglut.h" "%INSTALL_PATH%\include\GL\glut.h"
set OPT_GLUT=-DGLUT_INCLUDE_DIR="%INSTALL_PATH%\include" -DGLUT_glut_LIBRARY_RELEASE="%INSTALL_PATH%\lib\freeglut.lib"
cd ..\..\..\..\..
echo ----- Building zlib -----
cd zlib
if not exist "build\" mkdir build
cd build
if exist "build_cvkit\" (
cd build_cvkit\
) else (
mkdir build_cvkit\
cd build_cvkit\
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="%INSTALL_PATH%" ..\..
)
nmake install
if %ERRORLEVEL% NEQ 0 exit /b 1
cd ..\..\..
echo ----- Building libpng -----
cd libpng
if not exist "build\" mkdir build
cd build
if exist "build_cvkit\" (
cd build_cvkit\
) else (
mkdir build_cvkit\
cd build_cvkit\
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DPNG_SHARED=OFF -DCMAKE_INSTALL_PREFIX="%INSTALL_PATH%" ..\..
)
nmake install
if %ERRORLEVEL% NEQ 0 exit /b 1
cd ..\..\..
echo ----- Building libjpeg -----
cd libjpeg
if not exist "build\" mkdir build
cd build
if exist "build_cvkit\" (
cd build_cvkit\
) else (
mkdir build_cvkit\
cd build_cvkit\
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DENABLE_SHARED=OFF -DCMAKE_INSTALL_PREFIX="%INSTALL_PATH%" ..\..
)
nmake install
if %ERRORLEVEL% NEQ 0 exit /b 1
cd ..\..\..
echo ----- Building libtiff -----
cd libtiff
if not exist "build\" mkdir build
cd build
if exist "build_cvkit\" (
cd build_cvkit\
) else (
mkdir build_cvkit\
cd build_cvkit\
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="%INSTALL_PATH%" -DBUILD_SHARED_LIBS=OFF -Dtiff-tools=OFF -Dtiff-tests=OFF -Dtiff-opengl=OFF -Dtiff-docs=OFF ..\..
)
nmake install
if %ERRORLEVEL% NEQ 0 exit /b 1
cd ..\..\..
echo ----- Building cvkit -----
cd cvkit\build
if exist "build_cvkit\" (
cd build_cvkit\
) else (
mkdir build_cvkit\
cd build_cvkit\
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="%INSTALL_PATH%" %OPT_GLUT% %OPT_GLEW% -DINCLUDE_DLL="%INSTALL_PATH%\bin\zlib.dll;%INSTALL_PATH%\bin\glew32.dll;%INSTALL_PATH%\bin\freeglut.dll" ..\..
)
nmake package
if %ERRORLEVEL% NEQ 0 exit /b 1
cd ..