Skip to content

Commit

Permalink
Update .props and .csproj
Browse files Browse the repository at this point in the history
  • Loading branch information
lithiumtoast committed Jul 12, 2023
1 parent dbb04e8 commit 23595a9
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 26 deletions.
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@ Automatically updated C# bindings for https://github.com/libsdl-org/SDL with nat
1. Download and install [.NET 7](https://dotnet.microsoft.com/download).
2. Fork the repository using GitHub or clone the repository manually with submodules: `git clone --recurse-submodules https://github.com/bottlenoselabs/SDL-cs`.
3. Build the native library by running `library.sh`. To execute `.sh` scripts on Windows, use Git Bash which can be installed with Git itself: https://git-scm.com/download/win. The `library.sh` script requires that CMake and Ninja is installed and in your path.
4. Import the MSBuild `SDL.props` file which is located in the root of this directory to your `.csproj` file to setup everything you need. See the [hello world sample](src/cs/samples/HelloWorld/HelloWorld.csproj) for an example of how to do this.
```xml
<!-- SDL: bindings + native library -->
<Import Project="$([System.IO.Path]::GetFullPath('path/to/SDL.props'))" />
```
4. Add the `src/cs/production/SDL/SDL.csproj` C# project to your solution as an existing project and then reference it within your own solution.

## Developers: Documentation

Expand Down
5 changes: 5 additions & 0 deletions src/cs/.globalconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
is_global = true

# StyleCop Rules
## Description: StyleCop code analysis rules for C# projects.
dotnet_diagnostic.SA1600.severity = none
34 changes: 32 additions & 2 deletions src/cs/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,19 +1,49 @@
<Project>

<!-- Implicit global usings-->
<ItemGroup Condition=" '$(ImplicitUsings)' == 'true' ">
<Using Include="System.Runtime.InteropServices" />
<Using Include="bottlenoselabs.C2CS" />
</ItemGroup>

<!-- .NET8: Use artifacts path for bin/obj output folders -->
<PropertyGroup>
<UseArtifactsOutput>true</UseArtifactsOutput>
<ArtifactsPath>$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), .gitignore))/artifacts</ArtifactsPath>
</PropertyGroup>

<!-- NuGet package references -->
<ItemGroup>
<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>
<!-- Dynamic link libraries -->
<PropertyGroup>
<LibraryName>SDL</LibraryName>
<LibraryDirectoryPath>$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory),.gitignore))/lib</LibraryDirectoryPath>
</PropertyGroup>
<ItemGroup>
<Content Include="$(LibraryDirectoryPath)/*.dll">
<Link>%(Filename)%(Extension)</Link>
<Pack>false</Pack>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="$(LibraryDirectoryPath)/*.dylib">
<Link>%(Filename)%(Extension)</Link>
<Pack>false</Pack>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="$(LibraryDirectoryPath)/*.so">
<Link>%(Filename)%(Extension)</Link>
<Pack>false</Pack>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

</Project>
19 changes: 0 additions & 19 deletions src/cs/production/SDL/SDL.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,4 @@
<PackageReference Include="bottlenoselabs.C2CS.Runtime" Version="6.0.3" />
</ItemGroup>

<!-- 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>

0 comments on commit 23595a9

Please sign in to comment.