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

build: fix build under mono msbuild #1867

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
10 changes: 6 additions & 4 deletions LaserGRBL/LaserGRBL.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
<WarningLevel>4</WarningLevel>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<UseVSHostingProcess>false</UseVSHostingProcess>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisIgnoreGeneratedCode>false</CodeAnalysisIgnoreGeneratedCode>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
Expand Down Expand Up @@ -81,6 +80,9 @@
<BaseIntermediateOutputPath>obj\</BaseIntermediateOutputPath>
<StartAction>Project</StartAction>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('Windows'))">
<DefineConstants>OS_WINDOWS</DefineConstants>
</PropertyGroup>
<PropertyGroup>
<ForceDesignerDPIUnaware>true</ForceDesignerDPIUnaware>
</PropertyGroup>
Expand All @@ -102,7 +104,7 @@
<Reference Include="System.Security" />
<Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.XML" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="WindowsBase" />
</ItemGroup>
Expand Down Expand Up @@ -981,7 +983,7 @@
<Compile Include="UserControls\MyPictureBox.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="UserControls\MyPictureBox.designer.cs">
<Compile Include="UserControls\MyPictureBox.Designer.cs">
<DependentUpon>MyPictureBox.cs</DependentUpon>
</Compile>
<Compile Include="UserControls\NumericInput\ColoredBorderControl.cs">
Expand Down Expand Up @@ -2442,4 +2444,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
2 changes: 2 additions & 0 deletions LaserGRBL/PreviewForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
#if OS_WINDOWS
using System.Diagnostics.Eventing.Reader;
#endif
using System.Drawing;
using System.Windows.Forms;

Expand Down
26 changes: 25 additions & 1 deletion LaserGRBL/Tools/HiResTimer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ namespace Tools
// sbagliata di molto. Abbiamo infatti notato su UNA macchina (portatile DELL VOSTRO 3750 - i5-2450M w7-64bit) che la funzione QPC può dare
// delle tempistiche incoerenti con la relativa QPF, cambiando la sua velocità anche in corso di esecuzione del programma, senza variazioni di QPF
//
#if OS_WINDOWS
public static class HiResTimer
{

Expand Down Expand Up @@ -311,6 +312,29 @@ public static double TestMultiplier //codice per simulare un HiResTimer a freque
}

}
#else
// Non-Windows platforms, use generic
public static class HiResTimer
{
private const long NANO_IN_MILLI = 1000 * 1000;
private static Stopwatch watch = new Stopwatch();

static HiResTimer() //costruttore static, viene chiamato prima del primo utilizzo della classe
{watch.Start();}

public static long TotalMilliseconds
{ get { return TotalNano / NANO_IN_MILLI; } }

public static long TotalNano
{
get
{
return (long)((double)watch.ElapsedTicks / (double)Stopwatch.Frequency * 1000000000.0);
}
}

}
#endif


public class Utils
Expand Down Expand Up @@ -503,4 +527,4 @@ public enum TimePrecision


}
}
}