You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
__SKIA__ constant is not defined in a library when targeting net9.0-desktop #18996
difficulty/starter 🚀Categorizes an issue for which the difficulty level is reachable by newcomerskind/bugSomething isn't workingkind/papercutIssue that is especially relevant to users beginning to use Unoproject/core-tools 🛠️Categorizes an issue or PR as relevant to core and tools
In a Uno Platform library the __SKIA__ constant is not defined, even when compiling against net9.0-desktop. This is confusing as for net9.0-browserwasm the __WASM__ constant is defined correctly.
The reason seems to be that Uno.Skia.Runtime.XYZ packages are referenced only on executables:
<ItemGroupCondition="$(_IsExecutable) == 'true'">
<_UnoProjectSystemPackageReferenceInclude="Uno.WinUI.Runtime.Skia.Linux.FrameBuffer"ProjectSystem="true" />
<_UnoProjectSystemPackageReferenceInclude="Uno.WinUI.Runtime.Skia.MacOS"ProjectSystem="true" />
<_UnoProjectSystemPackageReferenceInclude="Uno.WinUI.Runtime.Skia.Wpf"ProjectSystem="true" />
<_UnoProjectSystemPackageReferenceInclude="Uno.WinUI.Runtime.Skia.X11"ProjectSystem="true" />
<!-- Enable WPF Hardware acceleration over RDP, only if not specified by the project -->
<RuntimeHostConfigurationOption
Include="Switch.System.Windows.Media.EnableHardwareAccelerationInRdp"
Value="true"
Exclude="@(RuntimeHostConfigurationOption)" />
</ItemGroup>
In case of WebAssembly the constant is defined in Uno.UI.Runtime.WebAssembly\buildTransitive\Uno.WinUI.Runtime.WebAssembly.targets, which is referenced as browserwasm references the runtime WebAssembly.
Expected behavior
Should be defined,
How to reproduce it (as minimally and precisely as possible)
@jeromelaban is there a reason the Runtime.Skia packages cannot be referenced for non-executable -desktop projects? If yes, could we separate Uno.UI.Runtime.Skia itself as its own package and reference it similarly to how -browserwasm references Uno.UI.Runtime.WebAssembly?
Also note the runtime packages will define HAS_UNO_SKIA_XYZ which is completely wrong. We can't determine the underlying platform in compile-time. So constants like HAS_UNO_SKIA_WPF does not make any sense. It used to make sense in past before single project.
difficulty/starter 🚀Categorizes an issue for which the difficulty level is reachable by newcomerskind/bugSomething isn't workingkind/papercutIssue that is especially relevant to users beginning to use Unoproject/core-tools 🛠️Categorizes an issue or PR as relevant to core and tools
Activity
MartinZikmund commentedon Dec 4, 2024
@jeromelaban is there a reason the
Runtime.Skiapackages cannot be referenced for non-executable-desktopprojects? If yes, could we separateUno.UI.Runtime.Skiaitself as its own package and reference it similarly to how-browserwasmreferencesUno.UI.Runtime.WebAssembly?jeromelaban commentedon Dec 4, 2024
Why do you need to reference those packages? As for
__SKIA__, it's not an end-user defineHAS_UNO_SKIAis.MartinZikmund commentedon Dec 4, 2024
@jeromelaban neither is defined in a Uno library currently:
While they both are for wasm:
The problem is that for
browserwasmthe runtime package is referenced even in Uno Library project:But it is not referenced for
desktop:Youssef1313 commentedon Dec 4, 2024
IMO,
DefineConstants should be provided by Uno.WinUI itself and not the runtime packages. Just a simple TargetFramework check there.Youssef1313 commentedon Dec 4, 2024
For whatever reason, the runtime packages are only included when building an executable.
uno/src/Uno.Sdk/targets/Uno.Implicit.Packages.ProjectSystem.Desktop.targets
Lines 18 to 21 in 2f3ac18
Youssef1313 commentedon Dec 4, 2024
Also note the runtime packages will define
HAS_UNO_SKIA_XYZwhich is completely wrong. We can't determine the underlying platform in compile-time. So constants likeHAS_UNO_SKIA_WPFdoes not make any sense. It used to make sense in past before single project.uno/src/Uno.UI.Runtime.Skia.Wpf/buildTransitive/Uno.WinUI.Runtime.Skia.Wpf.targets
Line 10 in 2f3ac18