-
Notifications
You must be signed in to change notification settings - Fork 45
/
build_win.bat
125 lines (91 loc) · 2.76 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
:: Build script for rc_sgm_producer 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
)
echo ----- Create directories for building and installing -----
if not exist "build\" mkdir build
cd build
if not exist "install\" mkdir install
cd install
set INSTALL_PATH=%CD%
cd ..\..\..
echo ----- Download zlib and libpng -----
if not exist "zlib\" (
git clone https://github.com/winlibs/zlib.git
cd zlib
git checkout zlib-1.2.11
cd ..
)
if not exist "libpng\" (
git clone https://github.com/winlibs/libpng.git
cd libpng
git checkout libpng-1.6.34
cd ..
)
echo ----- Building zlib -----
cd zlib
if not exist "build\" mkdir build
cd build
if exist "build_rc_genicam_api\" (
cd build_rc_genicam_api\
) else (
mkdir build_rc_genicam_api\
cd build_rc_genicam_api\
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_rc_genicam_api\" (
cd build_rc_genicam_api\
) else (
mkdir build_rc_genicam_api\
cd build_rc_genicam_api\
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="%INSTALL_PATH%" ..\..
)
nmake install
if %ERRORLEVEL% NEQ 0 exit /b 1
cd ..\..\..
echo ----- Build rc_genicam_api -----
cd %INSTALL_PATH%\..
if exist "build_rc_genicam_api\" (
cd build_rc_genicam_api\
) else (
mkdir build_rc_genicam_api\
cd build_rc_genicam_api\
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="%INSTALL_PATH%" ..\..
)
nmake install
if %ERRORLEVEL% NEQ 0 exit /b 1
cd ..
echo ----- Extracting files for publication -----
for /F "tokens=* USEBACKQ" %%F in (`git describe`) do (set VERSION=%%F)
set TARGET=rc_genicam_api-%VERSION%-win64
if not exist "%TARGET%\" mkdir %TARGET%
xcopy /s /y %INSTALL_PATH%\bin %TARGET%\bin\
if not exist "%TARGET%\include\" mkdir %TARGET%\include
xcopy /s /y %INSTALL_PATH%\include\rc_genicam_api %TARGET%\include\rc_genicam_api\
if not exist "%TARGET%\lib\" mkdir %TARGET%\lib
copy %INSTALL_PATH%\lib\GCBase*lib %TARGET%\lib\
copy %INSTALL_PATH%\lib\GenApi*lib %TARGET%\lib\
copy %INSTALL_PATH%\lib\rc_genicam_api.lib %TARGET%\lib\
if not exist "%TARGET%\lib\rc_genicam_api" mkdir %TARGET%\lib\rc_genicam_api
copy %INSTALL_PATH%\lib\rc_genicam_api\* %TARGET%\lib\rc_genicam_api\