Skip to content
Permalink
Browse files

[Build] Adjust platform detection (broken for multiplatform) and prep…

…arations for OSX
  • Loading branch information
xen2 committed Jan 12, 2019
1 parent dffa6ee commit 9c3fa42f753a619d12d78c8c9d08b3e67e3fe150
@@ -46,6 +46,12 @@
"#import": [
"linux"
]
},
"osx": {
"#import": [
"osx-vulkan",
"unix"
]
}
}
}
@@ -46,17 +46,23 @@

<XenkoRuntimeIdentifiers Condition="'$(XenkoRuntimeNetStandardNoRuntimeIdentifiers)' != 'true' And '$(TargetFramework)' == 'netstandard2.0' And $(_XenkoPlatforms.Contains(';Windows;'))">$(XenkoRuntimeIdentifiers);win</XenkoRuntimeIdentifiers>
<XenkoRuntimeIdentifiers Condition="'$(XenkoRuntimeNetStandardNoRuntimeIdentifiers)' != 'true' And '$(TargetFramework)' == 'netstandard2.0' And $(_XenkoPlatforms.Contains(';Linux;'))">$(XenkoRuntimeIdentifiers);linux</XenkoRuntimeIdentifiers>
<XenkoRuntimeIdentifiers Condition="'$(XenkoRuntimeNetStandardNoRuntimeIdentifiers)' != 'true' And '$(TargetFramework)' == 'netstandard2.0' And $(_XenkoPlatforms.Contains(';macOS;'))">$(XenkoRuntimeIdentifiers);osx</XenkoRuntimeIdentifiers>
<!-- Default: at least win (used when compiling only a single platform such as UWP for netstandard assemblies) -->
<XenkoRuntimeIdentifiers Condition="'$(XenkoRuntimeNetStandardNoRuntimeIdentifiers)' != 'true' And '$(TargetFramework)' == 'netstandard2.0' And '$(XenkoRuntimeIdentifiers)' == ''">win</XenkoRuntimeIdentifiers>

<!-- Need to use "win" runtime identifier for all other platforms as a workaround https://github.com/NuGet/Home/issues/7661#issuecomment-450040204 -->
<XenkoRuntimeIdentifiers Condition="'$(XenkoRuntimeNetStandardNoRuntimeIdentifiers)' != 'true' And '$(TargetFramework)' != 'netstandard2.0'">any</XenkoRuntimeIdentifiers>

<XenkoRuntimeIdentifiers Condition="'$(XenkoRuntimeIdentifiers)' != ''">;$(XenkoRuntimeIdentifiers);</XenkoRuntimeIdentifiers>

<!-- Make sure RuntimeIdentifier is part of the list -->
<XenkoRuntimeIdentifier Condition="'$(XenkoRuntimeIdentifiers)' != '' And $(XenkoRuntimeIdentifiers.Contains(';$(RuntimeIdentifier);'))">$(RuntimeIdentifier)</XenkoRuntimeIdentifier>
<!-- Otherwise compute fallback -->
<XenkoRuntimeIdentifier Condition="'$(XenkoRuntimeIdentifiers)' != '' And '$(XenkoRuntimeIdentifier)' == ''">$(XenkoRuntimeIdentifiers.Split(';', StringSplitOptions.RemoveEmptyEntries)[0])</XenkoRuntimeIdentifier>

<XenkoRuntimeTargetFrameworks>$([MSBuild]::Unescape($(XenkoRuntimeTargetFrameworks.Trim(';'))))</XenkoRuntimeTargetFrameworks>
<XenkoRuntimeIdentifiers>$([MSBuild]::Unescape($(XenkoRuntimeIdentifiers.Trim(';'))))</XenkoRuntimeIdentifiers>

<XenkoRuntimeIdentifier Condition="'$(XenkoRuntimeIdentifiers)' != ''">$(XenkoRuntimeIdentifiers.Split(';')[0])</XenkoRuntimeIdentifier>

<TargetFrameworks>$(XenkoRuntimeTargetFrameworks)</TargetFrameworks>
<RuntimeIdentifiers Condition="'$(XenkoRuntimeIdentifiers)' != ''">$(XenkoRuntimeIdentifiers)</RuntimeIdentifiers>

@@ -73,7 +79,7 @@

<PropertyGroup Condition="'$(XenkoGraphicsApiDependent)' != 'true'">
<!-- Force default runtime identifier -->
<RuntimeIdentifier>$(XenkoRuntimeIdentifier)</RuntimeIdentifier>
<RuntimeIdentifier Condition="'$(RuntimeIdentifier)' != 'win' And '$(RuntimeIdentifier)' != 'linux' And '$(RuntimeIdentifier)' != 'osx'">$(XenkoRuntimeIdentifier)</RuntimeIdentifier>
</PropertyGroup>

<!-- Those two targets are used to properly set the RuntimeIdentifier of ProjectReference (since we have sometimes weird transitions like win => win-d3d11 or win => noRID)
@@ -9,7 +9,7 @@
<XenkoDefaultGraphicsApi Condition="'$(XenkoPlatform)' == 'Android'">OpenGLES</XenkoDefaultGraphicsApi>
<XenkoDefaultGraphicsApi Condition="'$(XenkoPlatform)' == 'iOS'">OpenGLES</XenkoDefaultGraphicsApi>
<XenkoDefaultGraphicsApi Condition="'$(XenkoPlatform)' == 'Linux'">OpenGL</XenkoDefaultGraphicsApi>
<XenkoDefaultGraphicsApi Condition="'$(XenkoPlatform)' == 'macOS'">OpenGL</XenkoDefaultGraphicsApi>
<XenkoDefaultGraphicsApi Condition="'$(XenkoPlatform)' == 'macOS'">Vulkan</XenkoDefaultGraphicsApi>
<XenkoGraphicsApi Condition="'$(XenkoGraphicsApi)' == '' and '$(XenkoDefaultGraphicsApi)' != ''">$(XenkoDefaultGraphicsApi)</XenkoGraphicsApi>
<XenkoAssemblyProcessorOptions Condition="'$(XenkoAssemblyProcessorOptions)' == ''">$(XenkoAssemblyProcessorDefaultOptions)</XenkoAssemblyProcessorOptions>
</PropertyGroup>
@@ -32,15 +32,18 @@
<RuntimeIdentifiers Condition="$(_XenkoPlatforms.Contains(';Windows;')) And ($(TargetFramework.StartsWith('net4')) Or '$(TargetFramework)' == 'netstandard2.0') And '$(XenkoGraphicsApi)' == 'Vulkan'">$(RuntimeIdentifiers);win-vulkan</RuntimeIdentifiers>
<RuntimeIdentifiers Condition="$(_XenkoPlatforms.Contains(';Linux;')) And '$(TargetFramework)' == 'netstandard2.0' And ('$(XenkoGraphicsApi)' == 'OpenGL' Or '$(XenkoGraphicsApi)' == '')">$(RuntimeIdentifiers);linux-opengl</RuntimeIdentifiers>
<RuntimeIdentifiers Condition="$(_XenkoPlatforms.Contains(';Linux;')) And '$(TargetFramework)' == 'netstandard2.0' And '$(XenkoGraphicsApi)' == 'Vulkan'">$(RuntimeIdentifiers);linux-vulkan</RuntimeIdentifiers>
<RuntimeIdentifiers Condition="$(_XenkoPlatforms.Contains(';macOS;')) And '$(TargetFramework)' == 'netstandard2.0' And '$(XenkoGraphicsApi)' == 'Vulkan'">$(RuntimeIdentifiers);osx-vulkan</RuntimeIdentifiers>
</PropertyGroup>
<PropertyGroup Condition="'$(XenkoGraphicsApiDependent)' == 'true' And '$(XenkoGraphicsApiDependentBuildAll)' == 'true'">
<!-- Cross-compilation (multiple platforms at once) -->
<RuntimeIdentifiers></RuntimeIdentifiers>
<RuntimeIdentifiers Condition="($(TargetFramework.StartsWith('net4')) Or '$(TargetFramework)' == 'netstandard2.0') And $(_XenkoPlatforms.Contains(';Windows;'))">win-d3d11;win-d3d12;win-opengl;win-opengles;win-vulkan</RuntimeIdentifiers>
<RuntimeIdentifiers Condition="($(TargetFramework.StartsWith('net4')) Or '$(TargetFramework)' == 'netstandard2.0') And $(_XenkoPlatforms.Contains(';Linux;'))">$(RuntimeIdentifiers);linux-opengl;linux-vulkan</RuntimeIdentifiers>
<RuntimeIdentifiers Condition="($(TargetFramework.StartsWith('net4')) Or '$(TargetFramework)' == 'netstandard2.0') And $(_XenkoPlatforms.Contains(';macOS;'))">$(RuntimeIdentifiers);osx-vulkan</RuntimeIdentifiers>
<!-- Override if building a specific platform -->
<RuntimeIdentifiers Condition="'$(XenkoPlatformOriginal)' == 'Windows'">win-d3d11;win-d3d12;win-opengl;win-opengles;win-vulkan</RuntimeIdentifiers>
<RuntimeIdentifiers Condition="'$(XenkoPlatformOriginal)' == 'Linux'">linux-opengl;linux-vulkan</RuntimeIdentifiers>
<RuntimeIdentifiers Condition="'$(XenkoPlatformOriginal)' == 'macOS'">osx-vulkan</RuntimeIdentifiers>
</PropertyGroup>
<PropertyGroup Condition="'$(XenkoGraphicsApiDependent)' == 'true'">
<RuntimeIdentifiers>$([MSBuild]::Unescape($(RuntimeIdentifiers.Trim(';'))))</RuntimeIdentifiers>
@@ -66,6 +69,8 @@

<XenkoGraphicsApi Condition="'$(RuntimeIdentifier)' == 'linux-opengl'">OpenGL</XenkoGraphicsApi>
<XenkoGraphicsApi Condition="'$(RuntimeIdentifier)' == 'linux-vulkan'">Vulkan</XenkoGraphicsApi>

<XenkoGraphicsApi Condition="'$(RuntimeIdentifier)' == 'osx-vulkan'">Vulkan</XenkoGraphicsApi>
</PropertyGroup>

<!-- Workaround: Remove RuntimeIdentifier from Solution references (https://github.com/onovotny/MSBuildSdkExtras/issues/139)

0 comments on commit 9c3fa42

Please sign in to comment.
You can’t perform that action at this time.