forked from sakura-editor/sakura
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate-project.bat
69 lines (57 loc) · 1.47 KB
/
create-project.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
set platform=%1
set configuration=%2
set ERROR_RESULT=0
if not defined CMD_CMAKE call "%~dp0..\tools\find-tools.bat"
if not defined CMD_CMAKE (
echo cmake.exe was not found.
exit /b 1
)
@rem produces header files necessary in creating the project.
if "%platform%" == "MinGW" (
set BUILD_EDITOR_BAT=build-gnu.bat
) else (
set BUILD_EDITOR_BAT=build-sln.bat
)
pushd "%~dp0.."
@echo ---- start %BUILD_EDITOR_BAT% ----
call "%BUILD_EDITOR_BAT%" %platform% %configuration% || set ERROR_RESULT=1
@echo ---- end %BUILD_EDITOR_BAT% ----
popd
if "%ERROR_RESULT%" == "1" (
@echo ERROR
exit /b 1
)
pushd "%~dp0"
if not exist "googletest\CMakeLists.txt" (
git submodule init
git submodule update
)
set BUILDDIR=build\%platform%
if exist "%BUILDDIR%" (
rmdir /s /q "%BUILDDIR%"
)
mkdir "%BUILDDIR%"
call :setenv_%platform% %platform% %configuration%
"%CMD_CMAKE%" %CMAKE_GEN_OPT% -H. -B"%BUILDDIR%" || set ERROR_RESULT=1
popd
if "%ERROR_RESULT%" == "1" (
@echo ERROR
exit /b 1
)
exit /b
@rem ----------------------------------------------
@rem sub-routines
@rem ----------------------------------------------
:setenv_Win32
:setenv_x64
if defined CMAKE_G_PARAM (
set CMAKE_G_OPTION=-G "%CMAKE_G_PARAM%"
) else (
set CMAKE_G_OPTION=
)
set CMAKE_GEN_OPT=%CMAKE_G_OPTION% -A "%~1" -D BUILD_GTEST=ON
exit /b
:setenv_MinGW
set CMAKE_GEN_OPT=-G "MinGW Makefiles" -D CMAKE_BUILD_TYPE="%~2" -D BUILD_GTEST=OFF
set PATH=C:\msys64\mingw64\bin;%PATH:C:\Program Files\Git\usr\bin;=%
exit /b