Update build
This commit is contained in:
parent
ef98ca456a
commit
306583de50
6 changed files with 204 additions and 130 deletions
|
|
@ -20,6 +20,5 @@
|
|||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../Raylib-cs/Raylib-cs.csproj" />
|
||||
<ProjectReference Include="../Raylib-cs.Native/Raylib-cs.Native.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
namespace Raylib_cs.Native;
|
||||
|
||||
internal class Native
|
||||
{
|
||||
}
|
||||
|
|
@ -1,71 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk" InitialTargets="ConfigureNative">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
<DebugType>none</DebugType>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<GenerateDependencyFile>False</GenerateDependencyFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="../Raylib-cs/Build.props" />
|
||||
|
||||
<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('Linux'))">
|
||||
<NativeExt>so</NativeExt>
|
||||
<NativePre>lib</NativePre>
|
||||
<NativeArch>x64</NativeArch>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('OSX'))">
|
||||
<NativeExt>dylib</NativeExt>
|
||||
<NativePre>lib</NativePre>
|
||||
<NativeArch Condition="$(BuildArch) == ''">x86_x64</NativeArch>
|
||||
<NativeArch Condition="$(BuildArch) != ''">$(BuildArch)</NativeArch>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('Windows'))">
|
||||
<NativeExt>dll</NativeExt>
|
||||
<NativePre>$(Configuration)/</NativePre>
|
||||
<NativeArch Condition="$(BuildArch) == ''">x64</NativeArch>
|
||||
<NativeArch Condition="$(BuildArch) != ''">$(BuildArch)</NativeArch>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition="$([MSBuild]::IsOSPlatform('OSX')) AND $(NativeArch) == 'arm64'">
|
||||
<CMakeArgs Include="-D CMAKE_OSX_ARCHITECTURES=arm64" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="$([MSBuild]::IsOSPlatform('OSX')) AND $(NativeArch) == 'x86_64'">
|
||||
<CMakeArgs Include="-D CMAKE_OSX_ARCHITECTURES=x86_64" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="$([MSBuild]::IsOsPlatform('Windows')) AND $(NativeArch) == 'win32'">
|
||||
<CMakeArgs Include="-A win32" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="$([MSBuild]::IsOsPlatform('Windows')) AND $(NativeArch) == 'x64'">
|
||||
<CMakeArgs Include="-A x64" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="$(OutputPath)native/raylib/$(NativePre)raylib.$(NativeExt)" Link="%(Filename)%(Extension)" CopyToOutputDirectory="PreserveNewest" Condition="Exists('$(OutputPath)native/raylib/$(NativePre)raylib.$(NativeExt)')" />
|
||||
|
||||
<CMakeArgs Include="-B $(OutputPath)native" />
|
||||
<CMakeArgs Include="-S $(BaseIntermediateOutputPath)raylib-$(TargetRaylibTag)" />
|
||||
<CMakeArgs Include="-D CMAKE_BUILD_TYPE=$(Configuration)" />
|
||||
<CMakeArgs Include="-D BUILD_SHARED_LIBS=ON" />
|
||||
<CMakeArgs Include="-D BUILD_EXAMPLES=OFF" />
|
||||
<CMakeArgs Include="-D CMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded" />
|
||||
<CMakeArgs Include="-D CMAKE_MINIMUM_REQUIRED_VERSION=3.15" />
|
||||
<CMakeArgs Include="-D CMAKE_POLICY_DEFAULT_CMP0091=NEW" />
|
||||
<!-- <CMakeArgs Include="-D GLFW_BUILD_WAYLAND=ON" /> -->
|
||||
<!-- <CMakeArgs Include="-D GRAPHICS=GRAPHICS_API_OPENGL_43" /> -->
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="ConfigureNative" Condition="$(SkipLocalBuild) != true">
|
||||
<DownloadFile SourceUrl="https://github.com/raysan5/raylib/archive/refs/tags/$(TargetRaylibTag).zip" DestinationFolder="$(BaseIntermediateOutputPath)" DestinationFileName="raylib.zip" Condition="!Exists('$(BaseIntermediateOutputPath)raylib.zip')" />
|
||||
|
||||
<Unzip SourceFiles="$(BaseIntermediateOutputPath)raylib.zip" DestinationFolder="$(BaseIntermediateOutputPath)" OverwriteReadOnlyFiles="true" Condition="!Exists('$(BaseIntermediateOutputPath)raylib-$(TargetRaylibTag)')" />
|
||||
|
||||
<Exec Command="cmake @(CMakeArgs, ' ') $(CMakeExtraArgs)" />
|
||||
<Exec Command="cmake --build $(OutputPath)native --config $(Configuration)" />
|
||||
</Target>
|
||||
</Project>
|
||||
|
|
@ -9,16 +9,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Raylib-cs.Tests", "Raylib-c
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Examples", "Examples\Examples.csproj", "{1E2A5986-3F11-457F-AF97-D0C08D0060BA}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Raylib-cs.Native", "Raylib-cs.Native\Raylib-cs.Native.csproj", "{B89AA313-3675-42A3-80BC-6156913E3A27}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{236DB383-2FDC-4A77-8B33-22122D9B8950}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{236DB383-2FDC-4A77-8B33-22122D9B8950}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
|
|
@ -32,9 +27,8 @@ Global
|
|||
{1E2A5986-3F11-457F-AF97-D0C08D0060BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1E2A5986-3F11-457F-AF97-D0C08D0060BA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1E2A5986-3F11-457F-AF97-D0C08D0060BA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B89AA313-3675-42A3-80BC-6156913E3A27}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B89AA313-3675-42A3-80BC-6156913E3A27}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B89AA313-3675-42A3-80BC-6156913E3A27}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B89AA313-3675-42A3-80BC-6156913E3A27}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
|
|||
|
|
@ -3,5 +3,165 @@
|
|||
<TargetRaylibTag>6.0</TargetRaylibTag>
|
||||
<Version>8.0.0</Version>
|
||||
<PackageVersion>8.0.0</PackageVersion>
|
||||
<PackageRids>win-x64;win-x86;linux-x64;osx-x64;osx-arm64;browser-wasm</PackageRids>
|
||||
<NativesRoot>runtimes/</NativesRoot>
|
||||
<DownloadedRuntimesDir>$(TargetDir)/runtimes/</DownloadedRuntimesDir>
|
||||
</PropertyGroup>
|
||||
|
||||
<Choose>
|
||||
<When Condition="'$(RuntimeIdentifier)' == 'win-x64'">
|
||||
<PropertyGroup>
|
||||
<RaylibPackageName>raylib-$(TargetRaylibTag)_win64_msvc16</RaylibPackageName>
|
||||
<ArchiveExt>.zip</ArchiveExt>
|
||||
<LibPattern>raylib.dll</LibPattern>
|
||||
</PropertyGroup>
|
||||
</When>
|
||||
<When Condition="'$(RuntimeIdentifier)' == 'win-x86'">
|
||||
<PropertyGroup>
|
||||
<RaylibPackageName>raylib-$(TargetRaylibTag)_win32_msvc16</RaylibPackageName>
|
||||
<ArchiveExt>.zip</ArchiveExt>
|
||||
<LibPattern>raylib.dll</LibPattern>
|
||||
</PropertyGroup>
|
||||
</When>
|
||||
<When Condition="'$(RuntimeIdentifier)' == 'linux-x64'">
|
||||
<PropertyGroup>
|
||||
<RaylibPackageName>raylib-$(TargetRaylibTag)_linux_amd64</RaylibPackageName>
|
||||
<ArchiveExt>.tar.gz</ArchiveExt>
|
||||
<LibPattern>libraylib.so*</LibPattern>
|
||||
</PropertyGroup>
|
||||
</When>
|
||||
<When Condition="'$(RuntimeIdentifier)' == 'osx-x64'">
|
||||
<PropertyGroup>
|
||||
<RaylibPackageName>raylib-$(TargetRaylibTag)_macos</RaylibPackageName>
|
||||
<ArchiveExt>.tar.gz</ArchiveExt>
|
||||
<LibPattern>libraylib.dylib</LibPattern>
|
||||
</PropertyGroup>
|
||||
</When>
|
||||
<When Condition="'$(RuntimeIdentifier)' == 'osx-arm64'">
|
||||
<PropertyGroup>
|
||||
<RaylibPackageName>raylib-$(TargetRaylibTag)_macos</RaylibPackageName>
|
||||
<ArchiveExt>.tar.gz</ArchiveExt>
|
||||
<LibPattern>libraylib.dylib</LibPattern>
|
||||
</PropertyGroup>
|
||||
</When>
|
||||
<When Condition="'$(RuntimeIdentifier)' == 'browser-wasm'">
|
||||
<PropertyGroup>
|
||||
<RaylibPackageName>raylib-$(TargetRaylibTag)_webassembly</RaylibPackageName>
|
||||
<ArchiveExt>.zip</ArchiveExt>
|
||||
<LibPattern>libraylib.web.a</LibPattern>
|
||||
</PropertyGroup>
|
||||
</When>
|
||||
</Choose>
|
||||
|
||||
<!-- ================================================================== -->
|
||||
<!-- TARGET: PACKING -->
|
||||
<!-- ================================================================== -->
|
||||
<Target Name="PrepareNativesForPack" BeforeTargets="_GetPackageFiles">
|
||||
<ItemGroup>
|
||||
<_TargetRids Include="$(PackageRids)"/>
|
||||
</ItemGroup>
|
||||
|
||||
<MSBuild Projects="$(MSBuildThisFileFullPath)"
|
||||
Targets="_DownloadAndExtractInternal"
|
||||
Properties="RuntimeIdentifier=%(_TargetRids.Identity);TargetFramework=$(TargetFramework);TargetRaylibTag=$(TargetRaylibTag)"
|
||||
BuildInParallel="false"/>
|
||||
|
||||
<!-- Direct injection into _PackageFiles -->
|
||||
<ItemGroup>
|
||||
<_PackageFiles Include="$(NativesRoot)win-x64/raylib-$(TargetRaylibTag)_win64_msvc16/lib/raylib.dll">
|
||||
<PackagePath>runtimes/win-x64/native/</PackagePath>
|
||||
<BuildAction>None</BuildAction>
|
||||
</_PackageFiles>
|
||||
|
||||
<_PackageFiles Include="$(NativesRoot)win-x86/raylib-$(TargetRaylibTag)_win32_msvc16/lib/raylib.dll">
|
||||
<PackagePath>runtimes/win-x86/native/</PackagePath>
|
||||
<BuildAction>None</BuildAction>
|
||||
</_PackageFiles>
|
||||
|
||||
<_PackageFiles Include="$(NativesRoot)linux-x64/raylib-$(TargetRaylibTag)_linux_amd64/lib/libraylib.so">
|
||||
<PackagePath>runtimes/linux-x64/native/</PackagePath>
|
||||
<BuildAction>None</BuildAction>
|
||||
</_PackageFiles>
|
||||
|
||||
<_PackageFiles Include="$(NativesRoot)osx-x64/raylib-$(TargetRaylibTag)_macos/lib/libraylib.dylib">
|
||||
<PackagePath>runtimes/osx-x64/native/</PackagePath>
|
||||
<BuildAction>None</BuildAction>
|
||||
</_PackageFiles>
|
||||
|
||||
<_PackageFiles Include="$(NativesRoot)osx-arm64/raylib-$(TargetRaylibTag)_macos/lib/libraylib.dylib">
|
||||
<PackagePath>runtimes/osx-arm64/native/</PackagePath>
|
||||
<BuildAction>None</BuildAction>
|
||||
</_PackageFiles>
|
||||
|
||||
<_PackageFiles Include="$(NativesRoot)browser-wasm/raylib-$(TargetRaylibTag)_webassembly/lib/libraylib.a">
|
||||
<PackagePath>runtimes/browser-wasm/native/raylib.a</PackagePath>
|
||||
<BuildAction>None</BuildAction>
|
||||
</_PackageFiles>
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
|
||||
<!-- ================================================================== -->
|
||||
<!-- TARGET: LOCAL DEVELOPMENT -->
|
||||
<!-- ================================================================== -->
|
||||
|
||||
<Target Name="CopyNativeToOutput" AfterTargets="Build"
|
||||
Condition="'$(GeneratePackageOnBuild)' != 'true' AND '$(RuntimeIdentifier)' != ''">
|
||||
|
||||
<CallTarget Targets="_DownloadAndExtractInternal"/>
|
||||
<ItemGroup>
|
||||
<_NativeToCopy Include="$(NativesRoot)$(RuntimeIdentifier)/**/$(LibPattern)"/>
|
||||
</ItemGroup>
|
||||
<Copy SourceFiles="@(_NativeToCopy)" DestinationFolder="$(OutputPath)" SkipUnchangedFiles="true"/>
|
||||
</Target>
|
||||
|
||||
<!-- ================================================================== -->
|
||||
<!-- WORKER: DOWNLOADER -->
|
||||
<!-- ================================================================== -->
|
||||
|
||||
<Target Name="_DownloadAndExtractInternal" Condition="'$(RaylibPackageName)' != ''">
|
||||
<PropertyGroup>
|
||||
<_WorkDir>$(NativesRoot)$(RuntimeIdentifier)/</_WorkDir>
|
||||
<_ArchiveFile>$(_WorkDir)$(RaylibPackageName)$(ArchiveExt)</_ArchiveFile>
|
||||
<_ExtractMarker>$(_WorkDir).extracted</_ExtractMarker>
|
||||
</PropertyGroup>
|
||||
|
||||
<Message Text="=== _DownloadAndExtractInternal ===" Importance="high"/>
|
||||
<Message Text="RID = $(RuntimeIdentifier)" Importance="high"/>
|
||||
<Message Text="Archive = $(_ArchiveFile)" Importance="high"/>
|
||||
<Message Text="Marker = $(_ExtractMarker)" Importance="high"/>
|
||||
|
||||
<MakeDir Directories="$(_WorkDir)"/>
|
||||
|
||||
<DownloadFile
|
||||
SourceUrl="https://github.com/raysan5/raylib/releases/download/$(TargetRaylibTag)/$(RaylibPackageName)$(ArchiveExt)"
|
||||
DestinationFolder="$(_WorkDir)"
|
||||
DestinationFileName="$(RaylibPackageName)$(ArchiveExt)"
|
||||
Condition="!Exists('$(_ArchiveFile)')"
|
||||
Retries="3"
|
||||
/>
|
||||
|
||||
<Message
|
||||
Text="unZIPping"
|
||||
Importance="high"
|
||||
Condition="'$(ArchiveExt)' == '.zip' AND !Exists('$(_ExtractMarker)')"
|
||||
/>
|
||||
<Unzip
|
||||
SourceFiles="$(_ArchiveFile)"
|
||||
DestinationFolder="$(_WorkDir)"
|
||||
OverwriteReadOnlyFiles="true"
|
||||
Condition="'$(ArchiveExt)' == '.zip' AND !Exists('$(_ExtractMarker)')"
|
||||
/>
|
||||
|
||||
<Message
|
||||
Text="unTARing"
|
||||
Importance="high"
|
||||
Condition="'$(ArchiveExt)' == '.tar.gz' AND !Exists('$(_ExtractMarker)')"
|
||||
/>
|
||||
<Exec Command="tar -xzf "$(RaylibPackageName)$(ArchiveExt)""
|
||||
WorkingDirectory="$(_WorkDir)"
|
||||
Condition="'$(ArchiveExt)' == '.tar.gz' AND !Exists('$(_ExtractMarker)')"/>
|
||||
|
||||
<Touch Files="$(_ExtractMarker)" AlwaysCreate="true"/>
|
||||
<Message Text="Extraction complete" Importance="high"/>
|
||||
</Target>
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -28,6 +28,9 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="interop\*.cs" />
|
||||
<Compile Include="types\*.cs" />
|
||||
<Compile Include="types\native\*.cs" />
|
||||
<None Include="logo/raylib-cs_64x64.png" Pack="true" PackagePath="" />
|
||||
<None Include="../README.md" Pack="true" PackagePath="" />
|
||||
</ItemGroup>
|
||||
|
|
@ -45,10 +48,4 @@
|
|||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="interop\*.cs" />
|
||||
<Compile Include="types\*.cs" />
|
||||
<Compile Include="types\native\*.cs" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
|
|||
Loading…
Reference in a new issue