-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsh.bat
executable file
·90 lines (69 loc) · 2.81 KB
/
sh.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
echo >/dev/null # >nul & GOTO WINDOWS & rem ^
set -e
set -o pipefail
cores=$(nproc)
if [ "$cores" -gt 5 ]; then
((cores -= 2))
fi
if [ "$1" == "setup" ]; then
(cd dep/glfw/; mkdir -p build; cd build; cmake .. -DBUILD_SHARED_LIBS=OFF -DGLFW_BUILD_EXAMPLES=OFF -DGLFW_BUILD_TESTS=OFF -DGLFW_BUILD_DOCS=OFF; make -j$cores)
(cd dep/glew/; mkdir -p build; cd build; cmake .. -DBUILD_SHARED_LIBS=OFF; make -j$cores)
(cd dep/fmt/; mkdir -p build; cd build; cmake .. -DBUILD_SHARED_LIBS=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE -DFMT_TEST=OFF; make -j$cores)
(mkdir -p build/debug; cd build/debug; cmake ../../ -DCMAKE_BUILD_TYPE=Debug)
(mkdir -p build/release; cd build/release; cmake ../../ -DCMAKE_BUILD_TYPE=Release)
elif [ "$1" == "build" ]; then
(cd build/release/; make -j$cores)
elif [ "$1" == "run" ]; then
(cd Release/; ./Release.app)
else
echo "Error '$1': solo se reconocen tres posibles inputs..."
echo " > ./sh.bat setup"
echo " > ./sh.bat build"
echo " > ./sh.bat run"
fi
exit 0
:WINDOWS
@echo off
cls
set "rootdir=%CD%"
set cores=%NUMBER_OF_PROCESSORS%
if %cores% GTR 5 set /a "cores=%cores%-2"
if "%1" == "" (
set flag=1==1
set /p input="Ingrese la accion a realizar... ej. (setup, build o run): "
) else (
set flag=1==0
set input=%1
)
if "%input%" == "setup" (
(cd %rootdir%\dep\glfw) || exit /b 1
(cd build 2> NUL || (mkdir build & cd build)) || exit /b 1
(call cmake .. -G "MinGW Makefiles" -DBUILD_SHARED_LIBS=OFF -DGLFW_BUILD_EXAMPLES=OFF -DGLFW_BUILD_TESTS=OFF -DGLFW_BUILD_DOCS=OFF) || exit /b 1
(call mingw32-make -j%cores%) || exit /b 1
(cd %rootdir%\dep\glew) || exit /b 1
(cd build 2> NUL || (mkdir build & cd build)) || exit /b 1
(call cmake .. -G "MinGW Makefiles" -DBUILD_SHARED_LIBS=OFF) || exit /b 1
(call mingw32-make -j%cores%) || exit /b 1
(cd %rootdir%\dep\fmt) || exit /b 1
(cd build 2> NUL || (mkdir build & cd build)) || exit /b 1
(call cmake .. -G "MinGW Makefiles" -DBUILD_SHARED_LIBS=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE -DFMT_TEST=OFF) || exit /b 1
(call mingw32-make -j%cores%) || exit /b 1
cd %rootdir%
(cd build 2> NUL || (mkdir build & cd build)) || exit /b 1
(cd debug 2> NUL || (mkdir debug & cd debug)) || exit /b 1
(call cmake ../../ -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Debug) || exit /b 1
cd %rootdir%\build
(cd release 2> NUL || (mkdir release & cd release)) || exit /b 1
(call cmake ../../ -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release) || exit /b 1
) else if "%input%" == "build" (
(cd build/release/ && call mingw32-make -j%cores%) || exit /b 1
) else if "%input%" == "run" (
cd Release
call Release.exe
exit
) else (
echo "Error '%input%': solo se reconocen tres posibles inputs (setup, build, run)..."
)
if %flag% (
pause
)