Skip to content

Commit

Permalink
Merge 885265c into 7206fa0
Browse files Browse the repository at this point in the history
  • Loading branch information
berryzplus authored May 8, 2021
2 parents 7206fa0 + 885265c commit 05b8718
Show file tree
Hide file tree
Showing 21 changed files with 1,560 additions and 54 deletions.
9 changes: 4 additions & 5 deletions HeaderMake/HeaderMake.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,17 @@
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Label="UserMacros">
<IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup>
<_ProjectFileVersion>15.0.27130.2020</_ProjectFileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
Expand Down
63 changes: 49 additions & 14 deletions build-gnu.bat
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
@echo off
set platform=%1
set configuration=%2
set PLATFORM=%1
set CONFIGURATION=%2

if "%platform%" == "MinGW" (
if "%PLATFORM%" == "MinGW" (
@rem OK
) else (
call :showhelp %0
exit /b 1
)

if "%configuration%" == "Release" (
@rem OK
if "%CONFIGURATION%" == "Release" (
set MYDEFINES=-DNDEBUG
set MYCFLAGS=-O2
set MYLIBS=-s
) else if "%configuration%" == "Debug" (
@rem OK
) else if "%CONFIGURATION%" == "Debug" (
set MYDEFINES=-D_DEBUG
set MYCFLAGS=-g -O0
set MYLIBS=
Expand All @@ -26,14 +23,51 @@ if "%configuration%" == "Release" (

@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%
path=C:\msys64\mingw64\bin;%path:C:\msys64\mingw64\bin;=%

@rem create output directory, all executables will be placed here.
set OUTDIR=../../../../%PLATFORM%/%CONFIGURATION%
mkdir "%~dp0%PLATFORM%\%CONFIGURATION%" > NUL 2>&1

@echo mingw32-make -C sakura_core MYDEFINES="%MYDEFINES%" MYCFLAGS="%MYCFLAGS%" MYLIBS="%MYLIBS%"
mingw32-make -C sakura_core MYDEFINES="%MYDEFINES%" MYCFLAGS="%MYCFLAGS%" MYLIBS="%MYLIBS%" -j4
@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 && 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 "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 "%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


Expand All @@ -44,11 +78,12 @@ exit /b 0
:showhelp
@echo off
@echo usage
@echo %~nx1 platform configuration
@echo %~nx1 PLATFORM CONFIGURATION
@echo.
@echo parameter
@echo platform : MinGW
@echo configuration : Release or Debug
@echo PLATFORM : MinGW
@echo CONFIGURATION : Release or Debug
@echo BUILD_BASE : (optional) Path to build directory.
@echo.
@echo example
@echo %~nx1 MinGW Release
Expand Down
2 changes: 1 addition & 1 deletion ci/azure-pipelines/template.job.build-on-msys2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
displayName: Build with MinGW-w64-gcc

# Unit tests
- script: tests\build-and-test.bat $(BuildPlatform) $(Configuration)
- script: tests\run-tests.bat $(BuildPlatform) $(Configuration)
displayName: Unit test

# see https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/copy-files?view=azure-devops&tabs=yaml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
# なし
#############################################################################################################
steps:
- script: C:\msys64\usr\bin\bash --login -c "pacman -S --noconfirm mingw-w64-x86_64-gtest"
- script: C:\msys64\usr\bin\bash --login -c "pacman -S --noconfirm p7zip mingw-w64-x86_64-gtest"
displayName: install MinGW-w64-gtest
14 changes: 5 additions & 9 deletions sakura/sakura.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -62,28 +62,23 @@
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Label="UserMacros">
<IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\sakura_core\</IntDir>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup>
<_ProjectFileVersion>15.0.27130.2020</_ProjectFileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
Expand Down Expand Up @@ -1017,6 +1012,7 @@
</ImportGroup>
<Import Project="..\sakura\githash.targets" />
<Import Project="..\sakura\funccode.targets" />
<Import Project="..\tests\compiletests.targets" />
<Target Name="AppendCleanTargets" BeforeTargets="CoreClean">
<!-- Add files to @Clean just before running CoreClean. -->
<ItemGroup>
Expand Down
16 changes: 14 additions & 2 deletions sakura_core/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ DIRSEP = $(strip \ )
DEVNULL = NUL
ICONV = C:\msys64\usr\bin\iconv.exe
SED = C:\msys64\usr\bin\sed.exe
P7Z = "C:\Program Files\7-Zip\7z.exe"
else
# If unix-like shell is used.
MKDIR = mkdir -p
Expand All @@ -39,6 +40,7 @@ DIRSEP = /
DEVNULL = /dev/null
ICONV = iconv
SED = sed
P7Z = 7z
endif

ifndef PREFIX
Expand Down Expand Up @@ -100,6 +102,8 @@ LIBS= \
$(MYLIBS)

exe= $(or $(OUTDIR),.)/sakura.exe
bregonig= $(or $(OUTDIR),.)/bregonig.dll
ctags= $(or $(OUTDIR),.)/ctags.exe

SRCS = $(wildcard $(SRCDIR)/*.cpp) \
$(wildcard $(SRCDIR)/*/*.cpp) \
Expand All @@ -120,11 +124,19 @@ GENERATED_FILES= \
HEADERMAKETOOLDIR= $(SRCDIR)/../HeaderMake
HEADERMAKE= $(or $(OUTDIR),$(HEADERMAKETOOLDIR))/HeaderMake.exe

all: $(exe)
all: $(exe) \
$(bregonig) \
$(ctags)

$(exe): $(OBJS) sakura_rc.o
$(CXX) -o $@ $(OBJS) sakura_rc.o $(LIBS)

$(bregonig): $(SRCDIR)/../installer/externals/bregonig/bron420.zip
$(P7Z) e $< -o$(@D) x64/$(@F)

$(ctags): $(SRCDIR)/../installer/externals/universal-ctags/ctags-2020-01-12_feffe43a-x64.zip
$(P7Z) e $< -o$(@D) $(@F)

Funccode_define.h: Funccode_x.hsrc $(HEADERMAKE)
$(HEADERMAKE) -in=$< -out=$@ -mode=define

Expand Down Expand Up @@ -152,7 +164,7 @@ sakura_rc.o: sakura_rc.rc.utf8 sakura_rc.rc2.utf8 githash.h Funccode_define.h
$(RC) -c utf-8 --language=0411 $(DEFINES) -I. -I$(SRCDIR) $< -o $@

sakura_rc.rc.utf8 sakura_rc.rc2.utf8: sakura_rc.rc sakura_rc.rc2
$(ICONV) -f utf-16 -t utf-8 $(subst .utf8,,$(@F)) | $(SED) -e 1i'#pragma code_page(65001)' -e '/#include/s/.rc2\b/.rc2.utf8/' > $@
$(ICONV) -f utf-16 -t utf-8 $(SRCDIR)/$(subst .utf8,,$(@F)) | $(SED) -e 1i'#pragma code_page(65001)' -e '/#include/s/.rc2\b/.rc2.utf8/' > $@

clean:
-$(RM) $(subst /,$(DIRSEP),$(exe) $(OBJS) $(HEADERMAKE)) StdAfx.h.gch $(GENERATED_FILES) sakura_rc.o sakura_rc.*.utf8
Expand Down
9 changes: 8 additions & 1 deletion sakura_lang_en_US/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,16 @@ MKDIR = md
RM = del
DIRSEP = $(strip \ )
DEVNULL = NUL
ICONV = C:\msys64\usr\bin\iconv.exe
SED = C:\msys64\usr\bin\sed.exe
else
# If unix-like shell is used.
MKDIR = mkdir -p
RM = rm -f
DIRSEP = /
DEVNULL = /dev/null
ICONV = iconv
SED = sed
endif

ifndef PREFIX
Expand Down Expand Up @@ -97,9 +101,12 @@ ifneq ($(SAKURA_CORE),.)
endif
$(MAKE) -f $< -C $(@D) $(@F)

sakura_lang_rc.o: sakura_lang_rc.rc $(sakura_rc)
sakura_lang_rc.o: sakura_lang_rc.rc.utf8 sakura_lang_rc.rc2.utf8 $(sakura_rc)
$(RC) -c utf-8 --language=0409 $(DEFINES) -I$(SAKURA_CORE) -I$(SRCDIR)/../sakura_core $< -o $@

sakura_lang_rc.rc.utf8 sakura_lang_rc.rc2.utf8: sakura_lang_rc.rc sakura_lang_rc.rc2
$(ICONV) -f utf-16 -t utf-8 $(SRCDIR)/$(subst .utf8,,$(@F)) | $(SED) -e 1i'#pragma code_page(65001)' -e '/#include/s/.rc2\b/.rc2.utf8/' > $@

clean:
-$(RM) $(subst /,$(DIRSEP),$(dll) $(OBJS))

Expand Down
13 changes: 4 additions & 9 deletions sakura_lang_en_US/sakura_lang_en_US.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,31 +50,26 @@
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Label="UserMacros">
<IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup>
<_ProjectFileVersion>15.0.27130.2020</_ProjectFileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
<IgnoreImportLibrary>true</IgnoreImportLibrary>
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
<IgnoreImportLibrary>true</IgnoreImportLibrary>
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
<IgnoreImportLibrary>true</IgnoreImportLibrary>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
<IgnoreImportLibrary>true</IgnoreImportLibrary>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
Expand Down
9 changes: 7 additions & 2 deletions tests/compiletests.targets
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="CompileTest">
<CompileTestSourceDir>$(MSBuildThisFileDirectory)compiletests\</CompileTestSourceDir>
<CompileTestBuildDir>$(MSBuildThisFileDirectory)build\$(Platform)\$(Configuration)\compiletests\</CompileTestBuildDir>
<CompileTestBuildDir>$(SolutionDir)build\$(Platform)\$(Configuration)\compiletests\</CompileTestBuildDir>
</PropertyGroup>
<ItemGroup>
<CompileTestTarget Include="..\sakura_core\basis\CLaxInteger.h" />
<CompileTestTarget Include="..\sakura_core\basis\CStrictInteger.h" />
<CompileTestTarget Include="..\sakura_core\basis\SakuraBasis.h" />
</ItemGroup>
<Target Name="MakeCompileTestBuildDir" Condition="!Exists('$(CompileTestBuildDir)')">
<MakeDir Directories="$(CompileTestBuildDir)" />
</Target>
<Target Name="RunCompileTests" DependsOnTargets="MakeCompileTestBuildDir" BeforeTargets="ClCompile" Condition="!Exists('$(CompileTestBuildDir)CMakeCache.txt')">
<Target Name="RunCompileTests" DependsOnTargets="MakeCompileTestBuildDir" BeforeTargets="ClCompile" Inputs="@(CompileTestTarget)" Outputs="$(CompileTestBuildDir)CMakeCache.txt">
<PropertyGroup>
<VsVersion>$([System.Text.RegularExpressions.Regex]::Replace('$(VisualStudioVersion)', '^(\d+).*', '$1'))</VsVersion>
</PropertyGroup>
Expand Down
4 changes: 2 additions & 2 deletions tests/googletest.targets
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="GoogleTest">
<GoogleTestSourceDir>$(MSBuildThisFileDirectory)googletest</GoogleTestSourceDir>
<GoogleTestBuildDir>$(MSBuildThisFileDirectory)build\$(Platform)\$(Configuration)\gtest_build\</GoogleTestBuildDir>
<GoogleTestInstallDir>$([MsBuild]::NormalizePath('$(GoogleTestBuildDir)..\googletest\'))</GoogleTestInstallDir>
<GoogleTestBuildDir>$(SolutionDir)build\$(Platform)\$(Configuration)\gtest_build\</GoogleTestBuildDir>
<GoogleTestInstallDir>$(SolutionDir)build\$(Platform)\$(Configuration)\googletest\</GoogleTestInstallDir>
<IncludePath>$(GoogleTestInstallDir)include;$(IncludePath)</IncludePath>
<GoogleTestLibInstallDir Condition="'$(Platform)' == 'Win32'">$(GoogleTestInstallDir)lib</GoogleTestLibInstallDir>
<GoogleTestLibInstallDir Condition="'$(Platform)' == 'x64'">$(GoogleTestInstallDir)lib64</GoogleTestLibInstallDir>
Expand Down
Loading

0 comments on commit 05b8718

Please sign in to comment.