-
Notifications
You must be signed in to change notification settings - Fork 138
/
RunExamplesWin64.bat
66 lines (54 loc) · 1.39 KB
/
RunExamplesWin64.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
@echo off
setlocal EnableDelayedExpansion
REM Get build directory
set BUILD_DIR=build_win64\build
if not "%1" == "" (
set BUILD_DIR=%1
if "!BUILD_DIR:~-1!"=="\" set BUILD_DIR=!BUILD_DIR:~0,-1!
if "!BUILD_DIR:~-1!"=="/" set BUILD_DIR=!BUILD_DIR:~0,-1!
if not exist "!BUILD_DIR!\Debug\LLGLD.dll" (
if not exist "!BUILD_DIR!\Release\LLGL.dll" (
set BUILD_DIR=!BUILD_DIR!\build
)
)
)
REM Find all example projects
set EXAMPLES=""
for /F "TOKENS=* USEBACKQ" %%F in (`dir /B /AD examples\Cpp`) do (
if !EXAMPLES! EQU "" (
set EXAMPLES=%%F
) else (
set EXAMPLES=!EXAMPLES! %%F
)
)
:Start
echo Select example:
echo q.^)^ QUIT
echo --------
set /A NUM_EXAMPLES = 0
for %%F in (!EXAMPLES!) do (
set /A NUM_EXAMPLES += 1
set EXAMPLE_NAME[!NUM_EXAMPLES!]=%%F
if !NUM_EXAMPLES! LSS 10 (
echo !NUM_EXAMPLES!.^)^ %%F
) else (
echo !NUM_EXAMPLES!.^)^ %%F
)
)
:Prompt
set /P "INPUT="
if not defined INPUT goto Prompt
if "%INPUT%"=="q" goto End
if "%INPUT%"=="Q" goto End
if %INPUT% LEQ %NUM_EXAMPLES% (
set SELECTION=!EXAMPLE_NAME[%INPUT%]!
pushd %~dp0\examples\Cpp\!SELECTION!
if exist "%~dp0\%BUILD_DIR%\Debug\Example_!SELECTION!D.exe" (
%~dp0\%BUILD_DIR%\Debug\Example_!SELECTION!D.exe
) else (
%~dp0\%BUILD_DIR%\Release\Example_!SELECTION!.exe
)
popd
)
goto Start
:End