Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
lithiumtoast committed Aug 5, 2023
1 parent 45c77bd commit a2e9c6c
Show file tree
Hide file tree
Showing 16 changed files with 1,037 additions and 1,285 deletions.
1 change: 1 addition & 0 deletions .github/workflows/bindgen.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: "Bindgen"

on:
workflow_dispatch:
workflow_call:

jobs:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: "Build"

on:
workflow_dispatch:
workflow_call:
push:
tags:
Expand Down Expand Up @@ -106,5 +107,5 @@ jobs:
path: "./src/cs/production/Sokol"

- name: ".NET Build"
run: dotnet build "./src/cs"
run: dotnet build "./src/cs" --nologo --verbosity minimal --configuration Release -p:PackageVersion="$(date +'%Y.%m.%d')"

2 changes: 1 addition & 1 deletion .github/workflows/commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ jobs:
uses: EndBug/add-and-commit@v7
with:
author_name: 'lithiumtoast'
author_email: 'lithiumtoast@users.noreply.github.com'
author_email: '519592+lithiumtoast@users.noreply.github.com'
message: "Update C# bindings"
44 changes: 44 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: "Release"
on:
workflow_dispatch:
schedule:
- cron: "0 0 1 * *" # First day of every month

jobs:

build-job:
name: "Build"
uses: "./.github/workflows/build.yml"

release-job:
name: "Release .NET solution"
needs: [build-job]
runs-on: ubuntu-latest
steps:

- name: "Clone Git repository"
uses: actions/checkout@master

- name: "Download native libraries (win-x64)"
uses: actions/download-artifact@v1
with:
name: "native-libraries-win-x64"
path: "./lib"

- name: "Download native libraries (osx)"
uses: actions/download-artifact@v1
with:
name: "native-libraries-osx"
path: "./lib"

- name: "Download native libraries (linux-x64)"
uses: actions/download-artifact@v1
with:
name: "native-libraries-linux-x64"
path: "./lib"

- name: ".NET pack"
run: dotnet pack "./src/cs" --nologo --verbosity minimal --configuration Release --no-build -p:PackageVersion="$(date +'%Y.%m.%d')"

- name: "Upload packages"
run: dotnet nuget push "./nupkg/**/*.nupkg" --source https://api.nuget.org/v3/index.json --skip-duplicate --api-key $NUGET_ACCESS_TOKEN
10 changes: 7 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
# JetBrains
.idea/

# C# build artifacts
/bin/
/obj/
# Build artifacts
bin/
obj/
/artifacts/

# C# packages
/nupkg/

# C build artifacts
cmake-build-release/

# Native libraries
/lib/

Expand Down
4 changes: 2 additions & 2 deletions bindgen/config-generate-cs.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"inputFilePath": "./x-ast/ast-cross-platform.json",
"outputFilePath": "./../src/cs/production/Sokol/PInvoke.gen.cs",
"namespaceName": "bottlenoselabs",
"outputFileDirectory": "./../src/cs/production/Sokol",
"namespaceName": "bottlenoselabs.Sokol",
"className": "PInvoke",
"libraryName": "sokol",
"mappedNames": [
Expand Down
55 changes: 14 additions & 41 deletions src/cs/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,47 +1,20 @@
<Project>

<!-- Variables -->
<PropertyGroup>
<GitRepositoryPath>$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), .gitignore))/</GitRepositoryPath>
<IsWindows Condition=" '$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true' ">true</IsWindows>
<IsMacOS Condition=" '$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' == 'true' ">true</IsMacOS>
<IsLinux Condition=" '$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' ">true</IsLinux>
<UseArtifactsOutput>true</UseArtifactsOutput>
<ArtifactsPath>$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), .gitignore))/artifacts</ArtifactsPath>
</PropertyGroup>

<!-- Change obj/ and bin/ folders -->
<PropertyGroup>
<!-- `BaseIntermediateOutputPath`, `MSBuildProjectExtensionsPath`, and `RestoreOutputPath` must all be the same -->
<BaseIntermediateOutputPath>$(GitRepositoryPath)obj/$(MSBuildProjectName)/$(Configuration)</BaseIntermediateOutputPath>
<MSBuildProjectExtensionsPath>$(BaseIntermediateOutputPath)</MSBuildProjectExtensionsPath>
<RestoreOutputPath>$(BaseIntermediateOutputPath)</RestoreOutputPath>
<OutputPath>$(GitRepositoryPath)bin/$(MSBuildProjectName)/$(Configuration)</OutputPath>
</PropertyGroup>

<!-- NuGet -->
<PropertyGroup>
<IsPackable>false</IsPackable>
</PropertyGroup>

<!-- Code analysis settings -->
<PropertyGroup>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<AnalysisMode>all</AnalysisMode>
<AnalysisLevel>latest</AnalysisLevel>
<RunAnalyzersDuringBuild>true</RunAnalyzersDuringBuild>
<RunAnalyzersDuringLiveAnalysis>true</RunAnalyzersDuringLiveAnalysis>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<NoWarn>$(NoWarn);CS1591;CA1050;CA1051;CA1062;CA1711;CA1716;CA1720;CA1822;CA5392</NoWarn>
</PropertyGroup>

<!-- StyleCop -->

<ItemGroup>
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.435">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<GlobalAnalyzerConfigFiles Include="$(MSBuildThisFileDirectory)StyleCop.globalconfig" />
<AdditionalFiles Include="$(MSBuildThisFileDirectory)StyleCop.json" Link="StyleCop.json" Visible="false" />
<PackageReference Include="bottlenoselabs.Common.Tools" Version="*">
<PrivateAssets>all</PrivateAssets>
</PackageReference>

<PackageReference Include="StyleCop.Analyzers.Unstable" Version="*">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

</Project>

</Project>

2 changes: 1 addition & 1 deletion src/cs/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<Project>

</Project>
</Project>
21 changes: 21 additions & 0 deletions src/cs/Sokol.sln
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "External", "External", "{46
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImGui", "..\..\ext\imgui-cs\src\cs\production\ImGui\ImGui.csproj", "{EAD2C176-17C5-459A-B7D5-8354951CD7F0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sokol.runtime.osx", "production\Sokol.runtime.osx\Sokol.runtime.osx.csproj", "{51CE53D3-699B-456C-A195-D80187212A6E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sokol.runtime.linux-x64", "production\Sokol.runtime.linux-x64\Sokol.runtime.linux-x64.csproj", "{7F1C2DF9-F28D-4591-A507-70989D1FE4AB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sokol.runtime.win-x64", "production\Sokol.runtime.win-x64\Sokol.runtime.win-x64.csproj", "{D19CFB61-47C8-4255-A690-581C50B9D17A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -42,12 +48,27 @@ Global
{EAD2C176-17C5-459A-B7D5-8354951CD7F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EAD2C176-17C5-459A-B7D5-8354951CD7F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EAD2C176-17C5-459A-B7D5-8354951CD7F0}.Release|Any CPU.Build.0 = Release|Any CPU
{51CE53D3-699B-456C-A195-D80187212A6E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{51CE53D3-699B-456C-A195-D80187212A6E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{51CE53D3-699B-456C-A195-D80187212A6E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{51CE53D3-699B-456C-A195-D80187212A6E}.Release|Any CPU.Build.0 = Release|Any CPU
{7F1C2DF9-F28D-4591-A507-70989D1FE4AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7F1C2DF9-F28D-4591-A507-70989D1FE4AB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7F1C2DF9-F28D-4591-A507-70989D1FE4AB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7F1C2DF9-F28D-4591-A507-70989D1FE4AB}.Release|Any CPU.Build.0 = Release|Any CPU
{D19CFB61-47C8-4255-A690-581C50B9D17A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D19CFB61-47C8-4255-A690-581C50B9D17A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D19CFB61-47C8-4255-A690-581C50B9D17A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D19CFB61-47C8-4255-A690-581C50B9D17A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{B3FC66C4-0D2B-49A8-B39B-0478E853E67E} = {D96A33BC-F5E8-4080-AA0A-8588A1C41312}
{19B4C212-E580-4122-82FE-940AC439C4A1} = {D96A33BC-F5E8-4080-AA0A-8588A1C41312}
{C2D26EF1-5704-4B7E-920D-2537D26B0CC3} = {081F91DD-336C-4BB1-B619-ED0DD3ED32D0}
{AF9E4E1D-52EA-4D2C-99C9-FD1208FD2D72} = {D96A33BC-F5E8-4080-AA0A-8588A1C41312}
{EAD2C176-17C5-459A-B7D5-8354951CD7F0} = {462BF9C1-AE31-4443-B4E1-C5B42ABB4EA3}
{51CE53D3-699B-456C-A195-D80187212A6E} = {081F91DD-336C-4BB1-B619-ED0DD3ED32D0}
{7F1C2DF9-F28D-4591-A507-70989D1FE4AB} = {081F91DD-336C-4BB1-B619-ED0DD3ED32D0}
{D19CFB61-47C8-4255-A690-581C50B9D17A} = {081F91DD-336C-4BB1-B619-ED0DD3ED32D0}
EndGlobalSection
EndGlobal
19 changes: 0 additions & 19 deletions src/cs/production/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,4 @@

<Import Project="../Directory.Build.props" />

<!-- Dynamic link libraries -->
<ItemGroup>
<Content Include="$(GitRepositoryPath)lib/*.dll">
<Link>%(Filename)%(Extension)</Link>
<Pack>false</Pack>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="$(GitRepositoryPath)lib/*.dylib">
<Link>%(Filename)%(Extension)</Link>
<Pack>false</Pack>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="$(GitRepositoryPath)lib/*.so">
<Link>%(Filename)%(Extension)</Link>
<Pack>false</Pack>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard1.0</TargetFramework>
<ImplicitUsings>false</ImplicitUsings>
<Nullable>disable</Nullable>
<NoPackageAnalysis>true</NoPackageAnalysis>
</PropertyGroup>

<!-- NuGet -->
<PropertyGroup>
<IsPackable>true</IsPackable>
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
<DevelopmentDependency>true</DevelopmentDependency>
<IncludeBuildOutput>false</IncludeBuildOutput>
<IncludeSymbols>false</IncludeSymbols>
</PropertyGroup>

<!-- Dynamic link libraries -->
<ItemGroup>
<Content Include="$(GitRepositoryPath)/lib/libsokol.so">
<Link>%(Filename)%(Extension)</Link>
<PackagePath>runtimes/linux-x64/native/%(Filename)%(Extension)</PackagePath>
<Pack>true</Pack>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

</Project>
29 changes: 29 additions & 0 deletions src/cs/production/Sokol.runtime.osx/Sokol.runtime.osx.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard1.0</TargetFramework>
<ImplicitUsings>false</ImplicitUsings>
<Nullable>disable</Nullable>
<NoPackageAnalysis>true</NoPackageAnalysis>
</PropertyGroup>

<!-- NuGet -->
<PropertyGroup>
<IsPackable>true</IsPackable>
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
<DevelopmentDependency>true</DevelopmentDependency>
<IncludeBuildOutput>false</IncludeBuildOutput>
<IncludeSymbols>false</IncludeSymbols>
</PropertyGroup>

<!-- Dynamic link libraries -->
<ItemGroup>
<Content Include="$(GitRepositoryPath)/lib/libsokol.dylib">
<Link>%(Filename)%(Extension)</Link>
<PackagePath>runtimes/osx/native/%(Filename)%(Extension)</PackagePath>
<Pack>true</Pack>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard1.0</TargetFramework>
<ImplicitUsings>false</ImplicitUsings>
<Nullable>disable</Nullable>
<NoPackageAnalysis>true</NoPackageAnalysis>
</PropertyGroup>

<!-- NuGet -->
<PropertyGroup>
<IsPackable>true</IsPackable>
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
<DevelopmentDependency>true</DevelopmentDependency>
<IncludeBuildOutput>false</IncludeBuildOutput>
<IncludeSymbols>false</IncludeSymbols>
</PropertyGroup>

<!-- Dynamic link libraries -->
<ItemGroup>
<Content Include="$(GitRepositoryPath)/lib/sokol.dll">
<Link>%(Filename)%(Extension)</Link>
<PackagePath>runtimes/win-x64/native/%(Filename)%(Extension)</PackagePath>
<Pack>true</Pack>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

</Project>
26 changes: 26 additions & 0 deletions src/cs/production/Sokol/AssemblyAttributes.gen.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// To disable generating this file set `isEnabledGenerateAssemblyAttributes` to `false` in the config file for generating C# code.
// <auto-generated>
// This code was generated by the following tool on 2023-08-04 17:37:31 GMT-04:00:
// https://github.com/bottlenoselabs/c2cs (v6.0.7.0)
//
// Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
// </auto-generated>
// ReSharper disable All

#region Template
#nullable enable
#pragma warning disable CS1591
#pragma warning disable CS8981
global using bottlenoselabs.C2CS.Runtime;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
#endregion

#if NET7_0_OR_GREATER
[assembly: DisableRuntimeMarshalling]
#endif

[assembly: DefaultDllImportSearchPathsAttribute(DllImportSearchPath.SafeDirectories)]
Loading

0 comments on commit a2e9c6c

Please sign in to comment.