Merge branch 'release/8.0' into feature/fix-no-wchar

This commit is contained in:
Wu, Ganhao 2021-12-24 02:34:22 +08:00
commit e92882dbf0
7 changed files with 179 additions and 32 deletions

41
.github/workflows/nuget.yml vendored Normal file
View File

@ -0,0 +1,41 @@
name: nuget
on: pull_request
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: nuget/setup-nuget@v1
with:
nuget-api-key: ${{ secrets.nuget_apikey }}
nuget-version: '5.x'
- name: Create Build Environment
run: cmake -E make_directory build
- name: Configure
working-directory: build
run: |
cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=ON -A x64 -DCMAKE_CXX_STANDARD=17 ..
- name: Build
working-directory: build
run: |
cmake --build . --config Debug
cmake --build . --config Release
- name: Test
working-directory: build
run: ctest -C Debug -V
env:
CTEST_OUTPUT_ON_FAILURE: True
- name: NuGet Pack
run: |
cp readme.rst readme.md
cp license.rst license.md
nuget pack bundle\nuget\fmt.nuspec -properties Id=wuganhao.fmt -version 1.0-dev -basepath . -OutputFileNamesWithoutVersion

55
.github/workflows/tag.yml vendored Normal file
View File

@ -0,0 +1,55 @@
name: tagging
on:
push:
tags:
- '*'
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: nuget/setup-nuget@v1
with:
nuget-api-key: ${{ secrets.nuget_apikey }}
nuget-version: '5.x'
- name: Create Build Environment
run: cmake -E make_directory build
- name: Configure
working-directory: build
run: |
cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=ON -A x64 -DCMAKE_CXX_STANDARD=17 ..
- name: Build
working-directory: build
run: |
cmake --build . --config Debug
cmake --build . --config Release
- name: Test
working-directory: build
run: ctest -C Debug -V
env:
CTEST_OUTPUT_ON_FAILURE: True
- name: NuGet Pack
run: |
cp readme.rst readme.md
cp license.rst license.md
$Tag = "${{ github.ref }}" -replace '(refs/tags/)(.+)', '$2'
$Version = $Tag -replace '((\d+)(\.\d+){1,3})(-.+|)', '$1'
$InformationalVersion = "$Tag SHA-${{ github.SHA }}"
$PackageVersion = $Tag
echo "Version: $Tag"
echo "Informational Version: $InformationalVersion"
echo "Package Version: $Tag"
nuget pack bundle\nuget\fmt.nuspec -properties Id=wuganhao.fmt -version $PackageVersion -basepath . -OutputFileNamesWithoutVersion -OutputDirectory dist
- name: Nuget Push
run: |
nuget push dist\*.nupkg -source https://api.nuget.org/v3/index.json -apikey ${{ secrets.nuget_apikey }}

View File

@ -9,52 +9,29 @@ jobs:
matrix:
# windows-2016 and windows-2019 have MSVC 2017 and 2019 installed
# respectively: https://github.com/actions/virtual-environments.
os: [windows-2016, windows-2019]
os: [windows-2019, windows-latest]
platform: [Win32, x64]
build_type: [Debug, Release]
standard: [11, 17, 20]
include:
- os: windows-2016
platform: Win32
build_type: Debug
shared: -DBUILD_SHARED_LIBS=ON
exclude:
- os: windows-2016
platform: Win32
- os: windows-2016
standard: 17
- os: windows-2016
standard: 20
- os: windows-2019
standard: 11
- os: windows-2019
standard: 20
platform: Win32
standard: [11, 17]
shared: [ -DBUILD_SHARED_LIBS=ON ]
steps:
- uses: actions/checkout@v2
- name: Create Build Environment
run: cmake -E make_directory ${{runner.workspace}}/build
run: cmake -E make_directory build
- name: Configure
# Use a bash shell for $GITHUB_WORKSPACE.
shell: bash
working-directory: ${{runner.workspace}}/build
working-directory: build
run: |
cmake -DCMAKE_BUILD_TYPE=${{matrix.build_type}} ${{matrix.shared}} \
-A ${{matrix.platform}} \
-DCMAKE_CXX_STANDARD=${{matrix.standard}} \
$GITHUB_WORKSPACE
cmake -DCMAKE_BUILD_TYPE=${{matrix.build_type}} ${{matrix.shared}} -A ${{matrix.platform}} -DCMAKE_CXX_STANDARD=${{matrix.standard}} ..
- name: Build
working-directory: ${{runner.workspace}}/build
run: |
$threads = (Get-CimInstance Win32_ComputerSystem).NumberOfLogicalProcessors
cmake --build . --config ${{matrix.build_type}} --parallel $threads
working-directory: build
run: cmake --build . --config ${{matrix.build_type}}
- name: Test
working-directory: ${{runner.workspace}}/build
working-directory: build
run: ctest -C ${{matrix.build_type}} -V
env:
CTEST_OUTPUT_ON_FAILURE: True

3
.gitignore vendored
View File

@ -42,3 +42,6 @@ fmt.pc
*.vcxproj
*.sln
/Release/
*.nupkg
/license.md
/readme.md

30
bundle/nuget/fmt.nuspec Normal file
View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>$Id$</id>
<version>$version$</version>
<authors>Wu Ganhao&lt;wuganhao@hotmail.com&gt;</authors>
<owners>Wu Ganhao&lt;wuganhao@hotmail.com&gt;</owners>
<developmentDependency>true</developmentDependency>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>{fmt} is an open-source formatting library providing a fast and safe alternative to C stdio and C++ iostreams.</description>
<repository type="git" url="https://github.com/$repository$/" />
<license type="file">docs\license.md</license>
<readme>docs\readme.md</readme>
<dependencies>
<group targetFramework="native0.0" />
</dependencies>
</metadata>
<files>
<file src="include\fmt\**\*" target="include\fmt\" />
<file src="build\Debug\fmtd.lib" target="lib\native\x64\debug\" />
<file src="build\bin\Debug\fmtd.dll" target="lib\native\x64\debug\" />
<file src="build\bin\Debug\fmtd.pdb" target="lib\native\x64\debug\" />
<file src="build\Release\fmt.lib" target="lib\native\x64\debug\" />
<file src="build\bin\Release\fmt.dll" target="lib\native\x64\debug\" />
<file src="bundle\nuget\fmt.props" target="build\$Id$.props" />
<file src="bundle\nuget\fmt.targets" target="build\$Id$.targets" />
<file src="license.md" target="docs\" />
<file src="readme.md" target="docs\" />
</files>
</package>

12
bundle/nuget/fmt.props Normal file
View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<fmtIncludePaths>$(MSBuildThisFileDirectory)..\include\;$(MSBuildThisFileDirectory)..\lib\native\x64\$(Configuration)</fmtIncludePaths>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<fmtLibs>fmt.lib;</fmtLibs>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
<fmtLibs>fmtd.lib;</fmtLibs>
</PropertyGroup>
</Project>

29
bundle/nuget/fmt.targets Normal file
View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>$(fmtIncludePaths);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup>
<Link>
<AdditionalDependencies>%(fmtLibs);%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup>
<Link>
<AdditionalLibraryDirectories>$(MSBuildThisFileDirectory)..\lib\native\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<PropertyGroup Label="Globals">
<BuildDependsOn>$(BuildDependsOn);DeployfmtArtifacts</BuildDependsOn>
</PropertyGroup>
<ItemGroup>
<wxWidgetsArtifacts Include="$(MSBuildThisFileDirectory)..\lib\native\x64\$(Configuration)\*.dll" />
<wxWidgetsArtifacts Condition="'$(Configuration)'=='Debug'" Include="$(MSBuildThisFileDirectory)..\lib\native\x64\$(Configuration)\*.pdb" />
</ItemGroup>
<Target Name="DeployfmtArtifacts">
<Error Text="Package 'wxWidgets' currently only support 64bit build" Condition="'$(Platform)'!='x64'" />
<Copy SourceFiles="@(fmtArtifacts)" DestinationFolder="$(TargetDir)\" />
</Target>
</Project>