Replace manual csc.exe invokation with dotnet project (for NuGet build)

This commit is contained in:
Joseph Henry
2021-03-20 03:06:24 -07:00
parent 42f188cdd6
commit 4b190ee384
4 changed files with 80 additions and 5 deletions

View File

@@ -131,10 +131,18 @@ function BuildNuGetPackage([string]$BuildType, [string]$Arch, [string]$Version)
#md pkg\nuget\ZeroTier.Sockets\runtimes\win10-arm\native -Force #md pkg\nuget\ZeroTier.Sockets\runtimes\win10-arm\native -Force
# Build wrapper library for C# ZeroTier.Sockets abstraction # Build wrapper library for C# ZeroTier.Sockets abstraction
csc -target:library -debug:pdbonly ` #csc -target:library -debug:pdbonly `
-pdb:pkg\nuget\ZeroTier.Sockets\bin\ZeroTier.Sockets.pdb ` # -pdb:pkg\nuget\ZeroTier.Sockets\bin\ZeroTier.Sockets.pdb `
-out:pkg\nuget\ZeroTier.Sockets\bin\ZeroTier.Sockets.dll ` # -out:pkg\nuget\ZeroTier.Sockets\bin\ZeroTier.Sockets.dll `
.\src\bindings\csharp\*.cs # .\src\bindings\csharp\*.cs
# Copy sources into bindings library project
cp .\src\bindings\csharp\*.cs .\pkg\nuget\bindings\ZeroTier.Sockets\
# Build bindings library
pushd ./pkg/nuget/bindings/
dotnet build --configuration Release
popd
# Build unmanaged native libzt.dll with exported P/INVOKE symbols # Build unmanaged native libzt.dll with exported P/INVOKE symbols
Build-Library -BuildType $BuildType -Arch $Arch -LangBinding "csharp" Build-Library -BuildType $BuildType -Arch $Arch -LangBinding "csharp"
@@ -145,7 +153,6 @@ function BuildNuGetPackage([string]$BuildType, [string]$Arch, [string]$Version)
# .NET Framework # .NET Framework
md pkg\nuget\ZeroTier.Sockets\lib\net40 -Force md pkg\nuget\ZeroTier.Sockets\lib\net40 -Force
md pkg\nuget\ZeroTier.Sockets\lib\net403 -Force
md pkg\nuget\ZeroTier.Sockets\lib\net45 -Force md pkg\nuget\ZeroTier.Sockets\lib\net45 -Force
md pkg\nuget\ZeroTier.Sockets\lib\net451 -Force md pkg\nuget\ZeroTier.Sockets\lib\net451 -Force
md pkg\nuget\ZeroTier.Sockets\lib\net452 -Force md pkg\nuget\ZeroTier.Sockets\lib\net452 -Force
@@ -156,6 +163,19 @@ function BuildNuGetPackage([string]$BuildType, [string]$Arch, [string]$Version)
md pkg\nuget\ZeroTier.Sockets\lib\net471 -Force md pkg\nuget\ZeroTier.Sockets\lib\net471 -Force
md pkg\nuget\ZeroTier.Sockets\lib\net472 -Force md pkg\nuget\ZeroTier.Sockets\lib\net472 -Force
md pkg\nuget\ZeroTier.Sockets\lib\net48 -Force md pkg\nuget\ZeroTier.Sockets\lib\net48 -Force
md pkg\nuget\ZeroTier.Sockets\lib\netstandard1.3 -Force
md pkg\nuget\ZeroTier.Sockets\lib\netstandard1.4 -Force
md pkg\nuget\ZeroTier.Sockets\lib\netstandard1.5 -Force
md pkg\nuget\ZeroTier.Sockets\lib\netstandard1.6 -Force
md pkg\nuget\ZeroTier.Sockets\lib\netstandard2.0 -Force
md pkg\nuget\ZeroTier.Sockets\lib\netstandard2.1 -Force
md pkg\nuget\ZeroTier.Sockets\lib\netcoreapp1.0 -Force
md pkg\nuget\ZeroTier.Sockets\lib\netcoreapp1.1 -Force
md pkg\nuget\ZeroTier.Sockets\lib\netcoreapp2.0 -Force
md pkg\nuget\ZeroTier.Sockets\lib\netcoreapp2.1 -Force
md pkg\nuget\ZeroTier.Sockets\lib\netcoreapp2.2 -Force
md pkg\nuget\ZeroTier.Sockets\lib\netcoreapp3.0 -Force
md pkg\nuget\ZeroTier.Sockets\lib\netcoreapp3.1 -Force
# .NET "Core" 5.0 (moniker missing from microsoft documentation?) # .NET "Core" 5.0 (moniker missing from microsoft documentation?)
md pkg\nuget\ZeroTier.Sockets\lib\net5.0 -Force md pkg\nuget\ZeroTier.Sockets\lib\net5.0 -Force
@@ -167,6 +187,13 @@ function BuildNuGetPackage([string]$BuildType, [string]$Arch, [string]$Version)
-Destination "pkg\nuget\ZeroTier.Sockets\lib\$folder" -Recurse -Destination "pkg\nuget\ZeroTier.Sockets\lib\$folder" -Recurse
} }
# Copy bindings library "ZeroTier.Sockets.dll"
$folders = Get-ChildItem .\pkg\nuget\bindings\ZeroTier.Sockets\bin\Release
foreach ($folder in $folders.name){
cp -Path ".\pkg\nuget\bindings\ZeroTier.Sockets\bin\Release\$folder\*.dll" `
-Destination "pkg\nuget\ZeroTier.Sockets\lib\$folder" -Recurse
}
# Native DLL placement # Native DLL placement
cp .\dist\win-$archAlias-pinvoke-$($BuildType.ToLower())\lib\*.dll ` cp .\dist\win-$archAlias-pinvoke-$($BuildType.ToLower())\lib\*.dll `

7
include/version.h Normal file
View File

@@ -0,0 +1,7 @@
#ifndef ZTS_VERSION_H
#define ZTS_VER_CORE_STR="1.4.6"
#define ZTS_VER_LIB_STR="1.3.4"
#define ZTS_VER_LIB_MAJOR=1.3.4
#define ZTS_VER_LIB_MINOR=1.3.4
#define ZTS_VER_LIB_PATCH=1.3.4
#endif

View File

@@ -0,0 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net5.0;net40;net45;net451;net452;net46;net461;net462;net47;net471;net472;net48;netcoreapp1.0;netcoreapp1.1;netcoreapp2.0;netcoreapp2.1;netcoreapp2.2;netcoreapp3.0;netcoreapp3.1;netstandard1.3;netstandard1.4;netstandard1.5;netstandard1.6;netstandard2.0;netstandard2.1</TargetFrameworks>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,34 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26124.0
MinimumVisualStudioVersion = 15.0.26124.0
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZeroTier.Sockets", "ZeroTier.Sockets\ZeroTier.Sockets.csproj", "{D4F39F65-88E6-457D-807A-AB602AE80D7A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D4F39F65-88E6-457D-807A-AB602AE80D7A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D4F39F65-88E6-457D-807A-AB602AE80D7A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D4F39F65-88E6-457D-807A-AB602AE80D7A}.Debug|x64.ActiveCfg = Debug|Any CPU
{D4F39F65-88E6-457D-807A-AB602AE80D7A}.Debug|x64.Build.0 = Debug|Any CPU
{D4F39F65-88E6-457D-807A-AB602AE80D7A}.Debug|x86.ActiveCfg = Debug|Any CPU
{D4F39F65-88E6-457D-807A-AB602AE80D7A}.Debug|x86.Build.0 = Debug|Any CPU
{D4F39F65-88E6-457D-807A-AB602AE80D7A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D4F39F65-88E6-457D-807A-AB602AE80D7A}.Release|Any CPU.Build.0 = Release|Any CPU
{D4F39F65-88E6-457D-807A-AB602AE80D7A}.Release|x64.ActiveCfg = Release|Any CPU
{D4F39F65-88E6-457D-807A-AB602AE80D7A}.Release|x64.Build.0 = Release|Any CPU
{D4F39F65-88E6-457D-807A-AB602AE80D7A}.Release|x86.ActiveCfg = Release|Any CPU
{D4F39F65-88E6-457D-807A-AB602AE80D7A}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal