Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MinGWビルドをappveyorに組み込む #494

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion appveyor.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@
----|----
|[build-all.bat](build-all.bat)| appveyor.yml から呼ばれるバッチファイル |
|[build-sln.bat](build-sln.bat)| solution をビルドするバッチファイル |
|[build-gnu.bat](build-gnu.bat)| Makefile をビルドするバッチファイル |
|[sakura\preBuild.bat](sakura/preBuild.bat) | solution のビルド前に Visual Studio から呼ばれるバッチファイル |
|[sakura\postBuild.bat](sakura/postBuild.bat)| 特に何もしない |
|[sakura\mingw32-del.bat](sakura/mingw32-del.bat)| MinGW の clean でファイルを削除するバッチファイル |
|[parse-buildlog.bat](parse-buildlog.bat) | ビルドログを解析するバッチファイル |
|[build-chm.bat](build-chm.bat) | compiled HTML ファイルをビルドするバッチファイル |
|[build-installer.bat](build-installer.bat) | インストーラをビルドするバッチファイル |
Expand All @@ -85,6 +87,7 @@
- [appveyor_env.py](appveyor_env.py) : 環境変数を再現できる `set_appveyor_env.bat` を生成する。(成果物に含まれる)
- [parse-buildlog.py](parse-buildlog.py)
- [appveyor_env.py](appveyor_env.py)
- [build-gnu.bat](build-gnu.bat) : (Platform="MinGW"のみ) Makefileをビルドしてbuild-all.batの処理を終了する
- [build-chm.bat](build-chm.bat) : HTML Help をビルドする
- hhc.exe (Visual Studio 2017 に同梱)
- [externals\cppcheck\install-cppcheck.bat](externals/cppcheck/install-cppcheck.bat) : cppcheck をインストールする
Expand All @@ -107,10 +110,12 @@

| バッチファイル | 第一引数 | 第二引数 |
----|----|----
|build-all.bat | platform ("Win32" または "x64") | configuration ("Debug" または "Release") |
|build-all.bat | platform ("Win32" または "x64" または "MinGW") | configuration ("Debug" または "Release") |
|build-sln.bat | platform ("Win32" または "x64") | configuration ("Debug" または "Release") |
|build-gnu.bat | platform ("MinGW") | configuration ("Debug" または "Release") |
|sakura\preBuild.bat | HeaderMake.exe または MakefileMake.exe の実行ファイルのフォルダパス | なし |
|sakura\postBuild.bat| platform ("Win32" または "x64") | configuration ("Debug" または "Release") |
|sakura\mingw32-del.bat| 削除するファイルパス1 | 削除するファイルパス2(2つ目以降は省略可能) |
|parse-buildlog.bat | msbuild のビルドログパス | なし |
|build-chm.bat | なし | なし |
|build-installer.bat | platform ("Win32" または "x64") | configuration ("Debug" または "Release") |
Expand Down Expand Up @@ -172,6 +177,12 @@

* リポジトリに登録している bregonig の zipファイルを解凍して bregonig.dll を sakura.exe のビルドの出力先にコピーする

### mingw32-del.bat の構造

#### 処理の流れ

* 引数で渡されたパスに含まれるスラッシュ(`/`)をバックスラッシュ(`\`)に置換してdelコマンドに渡し、ファイルを削除する

### zipArtifacts.bat の構造

#### 生成する環境変数
Expand Down
1 change: 1 addition & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ configuration:
platform:
- Win32
- x64
- MinGW

build_script:
- cmd: >-
Expand Down
14 changes: 12 additions & 2 deletions build-all.bat
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ if "%platform%" == "Win32" (
@rem OK
) else if "%platform%" == "x64" (
@rem OK
) else if "%platform%" == "MinGW" (
@rem OK
) else (
call :showhelp %0
exit /b 1
Expand All @@ -24,6 +26,12 @@ if "%configuration%" == "Release" (
@echo CONFIGURATION %CONFIGURATION%
@echo.

if "%platform%" == "MinGW" (
@echo call build-gnu.bat %PLATFORM% %CONFIGURATION%
call build-gnu.bat %PLATFORM% %CONFIGURATION% || (echo error build-gnu.bat && exit /b 1)
exit /b 0
)

@echo ---- start build-sln.bat ----
call build-sln.bat %PLATFORM% %CONFIGURATION% || (echo error build-sln.bat && exit /b 1)
@echo ---- end build-sln.bat ----
Expand Down Expand Up @@ -66,12 +74,14 @@ exit /b 0
@echo %~nx1 platform configuration
@echo.
@echo parameter
@echo platform : Win32 or x64
@echo platform : Win32 or x64 or MinGW
@echo configuration : Release or Debug
@echo.
@echo example
@echo %~nx1 Win32 Release
@echo %~nx1 Win32 Debug
@echo %~nx1 x64 Release
@echo %~nx1 x64 Release
@echo %~nx1 x64 Debug
@echo %~nx1 MinGW Release
@echo %~nx1 MinGW Debug
exit /b 0
57 changes: 57 additions & 0 deletions build-gnu.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
@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\mingw64\bin;%path%

@echo mingw32-make -C sakura_core MYDEFINES="%MYDEFINES%" MYCFLAGS="%MYCFLAGS%" MYLIBS="%MYLIBS%"
mingw32-make -C sakura_core MYDEFINES="%MYDEFINES%" MYCFLAGS="%MYCFLAGS%" MYLIBS="%MYLIBS%" githash stdafx Funccode_enum.h Funccode_define.h
if %errorlevel% neq 0 (popd && exit /b 1)

mingw32-make -C sakura_core MYDEFINES="%MYDEFINES%" MYCFLAGS="%MYCFLAGS%" MYLIBS="%MYLIBS%" -j4
m-tmatma marked this conversation as resolved.
Show resolved Hide resolved
if %errorlevel% neq 0 (popd && exit /b 1)

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
7 changes: 1 addition & 6 deletions sakura/mingw32-del.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,20 @@

SETLOCAL

:�����œn���ꂽ�t�@�C���Q���擾
set OUTFILES=%*
:�p�X��؂��u��
set OUTFILES=%OUTFILES:/=\%


:del_file
:1�t�@�C������del�R�}���h�ɓn���č폜
for /F "tokens=1,*" %%f in ("%OUTFILES%") DO (
if exist %%f del /F /Q %%f
set OUTFILES=%%g
)

:����ԍ폜�ł�����I��
if "%OUTFILES%" == "" goto :EOF
if "%OUTFILES%" == "" goto :END
goto :del_file


:END

ENDLOCAL
exit /b
5 changes: 5 additions & 0 deletions tests/build-and-test.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ set platform=%1
set configuration=%2
set ERROR_RESULT=0

if "%platform%" == "MinGW" (
@echo test for MinGW will be skipped. (platform: %platform%, configuration: %configuration%)
ds14050 marked this conversation as resolved.
Show resolved Hide resolved
exit /b 0
)

@echo ---- start create-project.bat ----
call %~dp0create-project.bat %platform% %configuration%
if %ERRORLEVEL% neq 0 (
Expand Down
2 changes: 1 addition & 1 deletion unittest.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ GUI でステップ実行することができます。
|[tests\create-project.bat](tests/create-project.bat)| platform ("Win32" または "x64") | configuration ("Debug" または "Release") |
|[tests\build-project.bat](tests/build-project.bat) | platform ("Win32" または "x64") | configuration ("Debug" または "Release") |
|[tests\run-tests.bat](tests/run-tests.bat) | platform ("Win32" または "x64") | configuration ("Debug" または "Release") |
|[tests\build-and-test.bat](tests/build-and-test.bat)| platform ("Win32" または "x64") | configuration ("Debug" または "Release") |
|[tests\build-and-test.bat](tests/build-and-test.bat)| platform ("Win32" または "x64" または "MinGW") | configuration ("Debug" または "Release") |

## インクルードディレクトリ

Expand Down