Build: Skipping WindowsHost build on non-windows devices

This commit is contained in:
Zoe Roux 2021-08-22 20:26:52 +02:00
parent daedd60f3d
commit 3b85962dfd
7 changed files with 56 additions and 26 deletions

@ -1 +1 @@
Subproject commit 48782f895a40f28eda5e861fcaa624c0eab54076
Subproject commit 7bae8def39ace7bab481efea4825c4802e9e1f31

View File

@ -1,21 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project>
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net5.0-windows</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<RootNamespace>Kyoo.Host.Windows</RootNamespace>
<IsWindows Condition="$([MSBuild]::IsOSPlatform('Windows'))">true</IsWindows>
</PropertyGroup>
<Import Project="Kyoo.WindowsHost.target" Condition="$(IsWindows) == true" />
<Import Project="Kyoo.WindowsHost.linux.target" Condition="$(IsWindows) != true" />
<ItemGroup>
<ProjectReference Include="../Kyoo/Kyoo.csproj" />
<None Remove="*.target" />
</ItemGroup>
<ItemGroup>
<None Remove="kyoo.ico" />
<Content Include="kyoo.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>

View File

@ -0,0 +1,12 @@
<Project>
<!-- Project file used instead of the default csproj when the host system is not windows. This only skip the build. -->
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<NoWarn>NU1503</NoWarn>
</PropertyGroup>
<Target Name="Build">
<Message Importance="high" Text="Detected current operating system is not windows, skipping WindowsHost build." />
</Target>
</Project>

View File

@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">
<!-- Project file used instead of the default csproj when the host system is windows.
This is the real csproj used to compile the project.
-->
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net5.0-windows</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<RootNamespace>Kyoo.WindowsHost</RootNamespace>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="../Kyoo/Kyoo.csproj"/>
</ItemGroup>
<ItemGroup>
<None Remove="kyoo.ico"/>
<Content Include="kyoo.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>

View File

@ -4,7 +4,7 @@ using Autofac;
using Microsoft.Extensions.Hosting;
using Microsoft.Win32;
namespace Kyoo.Host.Windows
namespace Kyoo.WindowsHost
{
public static class Program
{

View File

@ -8,7 +8,7 @@ using Autofac;
using Kyoo.Models.Options;
using Microsoft.Extensions.Options;
namespace Kyoo.Host.Windows
namespace Kyoo.WindowsHost
{
/// <summary>
/// A singleton that add an notification icon on the window's toolbar.

View File

@ -18,9 +18,13 @@
</PropertyGroup>
<PropertyGroup>
<TranscoderBinary Condition="'$(IsWindows)' == 'true'">transcoder.dll</TranscoderBinary>
<TranscoderBinary Condition="'$(IsOSX)' == 'true'">libtranscoder.dylib</TranscoderBinary>
<TranscoderBinary Condition="'$(IsLinux)' == 'true'">libtranscoder.so</TranscoderBinary>
<TranscoderBinary Condition="$(IsWindows) == true">transcoder.dll</TranscoderBinary>
<TranscoderBinary Condition="$(IsOSX) == true">libtranscoder.dylib</TranscoderBinary>
<TranscoderBinary Condition="$(IsLinux) == true">libtranscoder.so</TranscoderBinary>
<TranscoderBuild Condition="$(IsWindows) == true">$(TranscoderRoot)buildWin</TranscoderBuild>
<TranscoderBuild Condition="$(IsOSX) == true">$(TranscoderRoot)buildOSX</TranscoderBuild>
<TranscoderBuild Condition="$(IsLinux) == true">$(TranscoderRoot)build</TranscoderBuild>
</PropertyGroup>
<ItemGroup>
@ -48,13 +52,13 @@
<ProjectReference Include="../Kyoo.WebApp/Kyoo.WebApp.csproj" />
</ItemGroup>
<Target Name="BuildTranscoder" BeforeTargets="BeforeBuild" Condition="'$(SkipTranscoder)' != 'true' And !Exists('$(TranscoderRoot)/build/$(TranscoderBinary)')">
<Exec WorkingDirectory="$(TranscoderRoot)" Condition="'$(IsWindows)' != 'true'" Command="mkdir -p build %26%26 cd build %26%26 cmake .. %26%26 make -j" />
<Exec WorkingDirectory="$(TranscoderRoot)" Condition="'$(IsWindows)' == 'true'" Command="(if not exist build mkdir build) %26%26 cd build %26%26 cmake .. -G &quot;NMake Makefiles&quot; %26%26 nmake" />
<Target Name="BuildTranscoder" BeforeTargets="BeforeBuild" Condition="'$(SkipTranscoder)' != 'true' And !Exists('$(TranscoderBuild)/$(TranscoderBinary)')">
<Exec Command="mkdir -p $(TranscoderBuild) %26%26 cd $(TranscoderBuild) %26%26 cmake $(TranscoderRoot) %26%26 make -j" Condition="'$(IsWindows)' != 'true'" />
<Exec Command="(if not exist build mkdir $(TranscoderBuild)) %26%26 cd $(TranscoderBuild) %26%26 cmake $(TranscoderRoot) -G &quot;NMake Makefiles&quot; %26%26 nmake" Condition="'$(IsWindows)' == 'true'" />
</Target>
<ItemGroup Condition="'$(SkipTranscoder)' != 'true'">
<None Include="$(TranscoderRoot)/build/$(TranscoderBinary)">
<None Include="$(TranscoderBuild)/$(TranscoderBinary)">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>false</Visible>
</None>