-
Notifications
You must be signed in to change notification settings - Fork 169
/
build-gnu.bat
123 lines (111 loc) · 3.46 KB
/
build-gnu.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
@echo off
set platform=%1
set configuration=%2
if "%platform%" == "MinGW" (
@rem OK
) else (
call :showhelp %0
exit /b 1
)
if "%configuration%" == "Release" (
@rem OK
set MYDEFINES=-DNDEBUG
set MYCFLAGS=-O2
set MYLIBS=-s
) else if "%configuration%" == "Debug" (
@rem OK
set MYDEFINES=-D_DEBUG
set MYCFLAGS=-g -O0
set MYLIBS=
) else (
call :showhelp %0
exit /b 1
)
@rem https://www.appveyor.com/docs/environment-variables/
@rem path=C:\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev1\mingw64\bin;%path%
path=C:\msys64\usr\bin;%path:C:\msys64\usr\bin;=%
path=C:\msys64\mingw64\bin;%path:C:\msys64\mingw64\bin;=%
:: find generic tools
if not defined CMD_NINJA call %~dp0tools\find-tools.bat
@rem create output directory, all executables will be placed here.
set OUTDIR=%~dp0%platform%\%configuration%
mkdir %OUTDIR% > NUL 2>&1
@rem build "sakura_core".
set SAKURA_CORE_MAKEFILE=%~dp0sakura_core\Makefile
set SAKURA_CORE_BUILD_DIR=%~dp0build\%platform%\%configuration%\sakura_core
mkdir "%SAKURA_CORE_BUILD_DIR%" > NUL 2>&1
pushd "%SAKURA_CORE_BUILD_DIR%"
mingw32-make -f "%SAKURA_CORE_MAKEFILE%" MYDEFINES="%MYDEFINES%" MYCFLAGS="%MYCFLAGS%" MYLIBS="%MYLIBS%" OUTDIR=%OUTDIR% StdAfx.h.gch sakura_rc.o
if errorlevel 1 (
echo error 2 errorlevel %errorlevel%
popd
exit /b 1
)
mingw32-make -f "%SAKURA_CORE_MAKEFILE%" MYDEFINES="%MYDEFINES%" MYCFLAGS="%MYCFLAGS%" MYLIBS="%MYLIBS%" OUTDIR=%OUTDIR% -j4
if errorlevel 1 (
echo error 2 errorlevel %errorlevel%
popd
exit /b 1
)
popd
@rem build "sakura_lang_en_US".
set SAKURA_LANG_EN_US_MAKEFILE=%~dp0sakura_lang_en_US\Makefile
set SAKURA_LANG_EN_US_BUILD_DIR=%~dp0build\%platform%\%configuration%\sakura_lang_en_US
mkdir "%SAKURA_LANG_EN_US_BUILD_DIR%" > NUL 2>&1
pushd "%SAKURA_LANG_EN_US_BUILD_DIR%"
mingw32-make -f "%SAKURA_LANG_EN_US_MAKEFILE%" MYDEFINES="%MYDEFINES%" SAKURA_CORE=../sakura_core OUTDIR=%OUTDIR%
if errorlevel 1 (
echo error 2 errorlevel %errorlevel%
popd
exit /b 1
)
popd
@rem build "googletest".
call %~dp0tests\googletest.build.cmd %~dp0build\%platform%\%configuration%\gtest_build\ %~dp0build\%platform%\%configuration%\googletest\
if errorlevel 1 (
echo error 2 errorlevel %errorlevel%
popd
exit /b 1
)
@rem build "tests1".
set TESTS1_MAKEFILE=%~dp0tests\unittests\Makefile
set TESTS1_BUILD_DIR=%~dp0build\%platform%\%configuration%\tests1
mkdir "%TESTS1_BUILD_DIR%" > NUL 2>&1
pushd "%TESTS1_BUILD_DIR%"
mingw32-make -f "%~dp0tests\unittests\resources\ja-JP\Makefile" -C "%~dp0tests\unittests\resources\ja-JP" OUTDIR="%TESTS1_BUILD_DIR%"
if errorlevel 1 (
echo error 2 errorlevel %errorlevel%
popd
exit /b 1
)
mingw32-make -f "%~dp0tests\unittests\resources\en-US\Makefile" -C "%~dp0tests\unittests\resources\en-US" OUTDIR="%TESTS1_BUILD_DIR%"
if errorlevel 1 (
echo error 2 errorlevel %errorlevel%
popd
exit /b 1
)
mingw32-make -f "%TESTS1_MAKEFILE%" MYDEFINES="%MYDEFINES%" SAKURA_CORE=../sakura_core OUTDIR=%OUTDIR% -j4
if errorlevel 1 (
echo error 2 errorlevel %errorlevel%
popd
exit /b 1
)
popd
exit /b 0
@rem ------------------------------------------------------------------------------
@rem show help
@rem see http://orangeclover.hatenablog.com/entry/20101004/1286120668
@rem ------------------------------------------------------------------------------
:showhelp
@echo off
@echo usage
@echo %~nx1 platform configuration
@echo.
@echo parameter
@echo platform : MinGW
@echo configuration : Release or Debug
@echo.
@echo example
@echo %~nx1 MinGW Release
@echo %~nx1 MinGW Debug
exit /b 0