forked from firebreath/FireBreath
-
Notifications
You must be signed in to change notification settings - Fork 1
/
common.cmd
executable file
·71 lines (57 loc) · 1.61 KB
/
common.cmd
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
@echo off
set FB_ROOT="%~dp0"
set RUN_FROM=%CD%
set _SHIFTTOK=0
set _NPARAM=%~1
IF /I "%_NPARAM%"=="" goto defaults
IF /I "%_NPARAM:~0,1%"=="-" goto defaults
set PROJDIR=%1
shift
set _SHIFTTOK=1
set _NPARAM=%~1
IF /I "%_NPARAM%"=="" goto default_build
IF /I "%_NPARAM:~0,1%"=="-" goto default_build
set BUILDDIR=%1
shift
set _SHIFTTOK=2
goto finish
:defaults
set PROJDIR="%RUN_FROM%\projects"
:default_build
IF /I %PROJDIR%==examples goto examples
set BUILDDIR="%RUN_FROM%\build"
goto finish
:examples
echo Building examples
set BUILDDIR="%RUN_FROM%\buildex"
:finish
IF EXIST %PROJDIR% GOTO direxists
echo ERROR: Project directory %PROJDIR% does not exist. usage: prep[ver].cmd [project dir] [build dir]
exit /B 2
goto end
:direxists
REM We need the full path of the directories
REM This is a hack, but it works
pushd ""%PROJDIR%"" > NUL
set PROJDIR="%CD%"
popd > NUL
mkdir ""%BUILDDIR%""
pushd ""%BUILDDIR%"" > NUL
if %errorlevel% == 1 goto error
set BUILDDIR="%CD%"
popd > NUL
for /f "tokens=%_SHIFTTOK%*" %%a in ('echo.%*') do set CMAKE_PARAMS=%%b
goto finished
:error
echo "Could not create build directory %BUILDDIR%"
exit /B 2
:finished
echo Using projects in: %PROJDIR%
echo Generating build files in: %BUILDDIR%
echo NOTE: The build files in %BUILDDIR% should *NEVER* be modified directly.
echo When needed, make project changes in cmake files and re-run this script.
echo Project-specific cmake files are found in [plugin dir]\CMakeLists.txt and
echo [plugin dir]\Win\projectDef.cmake.
echo Note that parameters for cmake should be enclosed in double quotes, e.g. "-DVERBOSE=1"
echo CMAKE parameters: %CMAKE_PARAMS%
:end