2
0
mirror of https://github.com/raylib-cs/raylib-cs synced 2025-04-03 11:09:40 -04:00
raylib-cs/Raylib-cs.Native/Raylib-cs.Native.csproj
2024-12-14 09:32:28 +00:00

83 lines
3.5 KiB
XML

<Project Sdk="Microsoft.NET.Sdk" InitialTargets="ConfigureNative">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</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 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)"
Condition="!Exists('$(BaseIntermediateOutputPath)native/CMakeCache.txt')" />
<Exec Command="cmake --build $(OutputPath)native --config $(Configuration)" />
</Target>
</Project>