Skip to content

Commit

Permalink
build: Add support for github action
Browse files Browse the repository at this point in the history
1. Remove the original external Boost dependency and use Nuget for
   package management.
2. Support github action to upload compiled binaries to Release page.
3. Changed the char set of some files to get the correct output.
  • Loading branch information
windowsair committed Dec 6, 2021
1 parent 7cdbe1a commit a51e1fa
Show file tree
Hide file tree
Showing 8 changed files with 258 additions and 21 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build

on:
push:
paths-ignore:
- '.github/*'
- '*.md'
pull_request:
paths-ignore:
- '.github/*'
- '*.md'

jobs:
build:
runs-on: windows-latest
env:
POWERSHELL_TELEMETRY_OPTOUT: 1
steps:
- uses: actions/checkout@v2
- uses: microsoft/setup-msbuild@v1
- name: Restore nuget package
run: nuget restore
- name: Build all targets
run: msbuild -m BuildAllTargets.proj
- name: Generate release tag
id: tag
run: echo "::set-output name=release_tag::NetDebugger_$(Get-Date -Format "yyyy.MM.dd_HH_mm")"
- name: Release bin files
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.tag.outputs.release_tag }}
files: |
Bin/NetDebugger_Debug_x86.exe
Bin/NetDebugger_Debug_x64.exe
Bin/NetDebugger_Release_x86.exe
Bin/NetDebugger_Release_x64.exe
11 changes: 10 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
.vs
NetDebugger/Debug
NetDebugger/Release
NetDebugger/x64
NetDebugger/x64

# Ignore NuGet Packages
*.nupkg
# Ignore the packages folder
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
51 changes: 51 additions & 0 deletions BuildAllTargets.proj
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<Project
DefaultTargets="Restore;Build"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<SolutionPath>$(MSBuildThisFileDirectory)*.sln</SolutionPath>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="$(SolutionPath)">
<AdditionalProperties>Configuration=Debug;Platform=x86</AdditionalProperties>
</ProjectReference>
<ProjectReference Include="$(SolutionPath)">
<AdditionalProperties>Configuration=Release;Platform=x86</AdditionalProperties>
</ProjectReference>
<ProjectReference Include="$(SolutionPath)">
<AdditionalProperties>Configuration=Debug;Platform=x64</AdditionalProperties>
</ProjectReference>
<ProjectReference Include="$(SolutionPath)">
<AdditionalProperties>Configuration=Release;Platform=x64</AdditionalProperties>
</ProjectReference>
<!-- <ProjectReference Include="$(SolutionPath)">
<AdditionalProperties>Configuration=Debug;Platform=ARM64</AdditionalProperties>
</ProjectReference>
<ProjectReference Include="$(SolutionPath)">
<AdditionalProperties>Configuration=Release;Platform=ARM64</AdditionalProperties>
</ProjectReference> -->
</ItemGroup>
<Target Name="Restore" >
<MSBuild
Projects="@(ProjectReference)"
Targets="Restore"
StopOnFirstFailure="True"
Properties="PreferredToolArchitecture=x64" />
</Target>
<Target Name="Build" >
<MSBuild
Projects="@(ProjectReference)"
Targets="Build"
BuildInParallel="True"
StopOnFirstFailure="True"
Properties="PreferredToolArchitecture=x64" />
</Target>
<Target Name="Rebuild" >
<MSBuild
Projects="@(ProjectReference)"
Targets="Rebuild"
BuildInParallel="True"
StopOnFirstFailure="True"
Properties="PreferredToolArchitecture=x64" />
</Target>
</Project>
16 changes: 8 additions & 8 deletions NetDebugger/CRealTimeStatusCtrl.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "pch.h"
#include "pch.h"
#include "NetDebugger.h"
#include "CRealTimeStatusCtrl.h"
#include "GdiplusAux.hpp"
Expand Down Expand Up @@ -105,7 +105,7 @@ int CRealTimeStatusCtrl::DrawStatisicsString(Gdiplus::Graphics& graphics,const G
{
graphics.SetSmoothingMode(Gdiplus::SmoothingMode::SmoothingModeAntiAlias);
graphics.SetTextRenderingHint(Gdiplus::TextRenderingHint::TextRenderingHintClearTypeGridFit);

auto fontFamily = CreateUIFontFamily();
Gdiplus::Font font(fontFamily.get(), 16.0f, Gdiplus::FontStyleRegular, Gdiplus::UnitPixel);
CString statisticsRXC;
Expand Down Expand Up @@ -157,28 +157,28 @@ int CRealTimeStatusCtrl::DrawStatisicsString(Gdiplus::Graphics& graphics,const G
textBrush.SetColor(Gdiplus::Color::White);
textRectRXC.Offset(-1.0f, -1.0f);
graphics.DrawString(statisticsRXC.GetString(), statisticsRXC.GetLength(), &font, textRectRXC, &sf, &textBrush);

textBrush.SetColor(Gdiplus::Color::Black);
textRectTXC.Offset(1.0f, 1.0f);
graphics.DrawString(statisticsTXC.GetString(), statisticsTXC.GetLength(), &font, textRectTXC, &sf, &textBrush);
textBrush.SetColor(Gdiplus::Color::White);
textRectTXC.Offset(-1.0f, -1.0f);
graphics.DrawString(statisticsTXC.GetString(), statisticsTXC.GetLength(), &font, textRectTXC, &sf, &textBrush);

textBrush.SetColor(Gdiplus::Color::Black);
textRectRXS.Offset(1.0f, 1.0f);
graphics.DrawString(statisticsRXS.GetString(), statisticsRXS.GetLength(), &font, textRectRXS, &sf, &textBrush);
textBrush.SetColor(Gdiplus::Color(204, 255, 153));
textRectRXS.Offset(-1.0f, -1.0f);
graphics.DrawString(statisticsRXS.GetString(), statisticsRXS.GetLength(), &font, textRectRXS, &sf, &textBrush);

textBrush.SetColor(Gdiplus::Color::Black);
textRectTXS.Offset(1.0f, 1.0f);
graphics.DrawString(statisticsTXS.GetString(), statisticsTXS.GetLength(), &font, textRectTXS, &sf, &textBrush);
textBrush.SetColor(Gdiplus::Color(255, 102, 102));
textRectTXS.Offset(-1.0f, -1.0f);
graphics.DrawString(statisticsTXS.GetString(), statisticsTXS.GetLength(), &font, textRectTXS, &sf, &textBrush);

return (int)bottom;
}

Expand Down Expand Up @@ -208,7 +208,7 @@ void CRealTimeStatusCtrl::DrawSpeedCurve(Gdiplus::Graphics& graphics, const Gdip
x += kXSTEP_LENGTH;
}
path.AddCurve(points.data(), (int)points.size());
points.clear();
points.clear();
points.push_back(Gdiplus::Point(x - kXSTEP_LENGTH, b));
points.push_back(Gdiplus::Point(0, b));
path.AddLines(points.data(), (int)points.size());
Expand Down Expand Up @@ -247,7 +247,7 @@ void CRealTimeStatusCtrl::DrawSpeedCurve(Gdiplus::Graphics& graphics, const Gdip

void CRealTimeStatusCtrl::DrawDisconnectedStatus(Gdiplus::Graphics& graphics, const Gdiplus::RectF& clientRect)
{
CString str = L"δÁ¬½Ó";
CString str = L"未连接";
auto fontFamily = CreateUIFontFamily();
Gdiplus::Font font(fontFamily.get(), 22.0f, Gdiplus::FontStyleRegular, Gdiplus::UnitPixel);
Gdiplus::SolidBrush brush(Gdiplus::Color(255, 255, 255));
Expand Down
4 changes: 2 additions & 2 deletions NetDebugger/GdiplusAux.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#pragma once
#pragma once

inline Gdiplus::REAL MeasureStringHeight(Gdiplus::Graphics& graphics, const CString& str, const Gdiplus::Font& font, int width)
{
Expand All @@ -17,7 +17,7 @@ inline std::shared_ptr<Gdiplus::FontFamily> CreateUIFontFamily()
if (fontFamily->GetLastStatus() != Gdiplus::Status::Ok)
fontFamily.reset(new Gdiplus::FontFamily(L"Arial"));
if (fontFamily->GetLastStatus() != Gdiplus::Status::Ok)
fontFamily.reset(new Gdiplus::FontFamily(L"ËÎÌå"));
fontFamily.reset(new Gdiplus::FontFamily(L"宋体"));
if (fontFamily->GetLastStatus() != Gdiplus::Status::Ok)
{
LOGFONT logfont;
Expand Down
Loading

0 comments on commit a51e1fa

Please sign in to comment.