-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathPreBuild.bat
More file actions
61 lines (47 loc) · 1.42 KB
/
PreBuild.bat
File metadata and controls
61 lines (47 loc) · 1.42 KB
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
@echo off
setlocal
:main
rem push directory and change current directory
pushd "%~dp0\Source\ThirdParty\assimp\assimp"
rem assure that cmake command exists
call :assureHasCommand cmake
rem cmake
call :assureExecute cmake -DASSIMP_BUILD_ALL_EXPORTERS_BY_DEFAULT=OFF -DASSIMP_INSTALL=OFF -DCMAKE_BUILD_TYPE=Release CMakeLists.txt
call :assureExecute cmake --build . --config Release
rem pop from stack
popd
exit /b
:assureHasCommand
rem check command existence
where %1 >nul 2>nul
rem if the command was not found
if not %errorlevel% equ 0 (
rem show error message
echo ERROR: '%1' is not recognized as an internal or external command, operable program or batch file. 1>&2
rem show path for check details
setlocal enabledelayedexpansion
echo PATH = !PATH!
endlocal
rem exit with command not found error
exit 9009
)
exit /b
:assureExecute
setlocal
rem generate escaped command
set escapedcommand=%*
set escapedcommand=%escapedcommand:"=\"%
rem exectute command
%*
rem if has error
if not %errorlevel% equ 0 (
rem show error message
echo ERROR: command "%escapedcommand%" failed. 1>&2
rem show path for check details
setlocal enabledelayedexpansion
echo PATH = !PATH!
endlocal
rem exit with error
exit %errorlevel%
)
exit /b