[Build] Native: prefix folder with platform (for future unification of .NET 5 without RID)
This commit is contained in:
Родитель
a1b195ea75
Коммит
2b4bb6af5d
|
@ -1,11 +1,11 @@
|
|||
// Copyright (c) Stride contributors (https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp)
|
||||
// Distributed under the MIT license. See the LICENSE.md file in the project root for more information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Stride.Core.Annotations;
|
||||
#if STRIDE_PLATFORM_DESKTOP
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using Stride.Core.Annotations;
|
||||
|
||||
namespace Stride.Core.Diagnostics
|
||||
{
|
||||
|
@ -45,7 +45,7 @@ namespace Stride.Core.Diagnostics
|
|||
}
|
||||
}
|
||||
|
||||
public static readonly bool IsAvailable = NativeLibrary.LoadLibrary(VTune2015DllName) != IntPtr.Zero;
|
||||
public static readonly bool IsAvailable = NativeLibrary.Load(VTune2015DllName) != IntPtr.Zero;
|
||||
|
||||
public static Event CreateEvent([NotNull] string eventName)
|
||||
{
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace Stride.Core.Native
|
|||
|
||||
static NativeInvoke()
|
||||
{
|
||||
NativeLibrary.PreloadLibrary("libcore", typeof(NativeInvoke));
|
||||
NativeLibraryHelper.PreloadLibrary("libcore", typeof(NativeInvoke));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -1,177 +0,0 @@
|
|||
// Copyright (c) Stride contributors (https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp)
|
||||
// Distributed under the MIT license. See the LICENSE.md file in the project root for more information.
|
||||
#pragma warning disable SA1307 // Accessible fields must begin with upper-case letter
|
||||
#pragma warning disable SA1310 // Field names must not contain underscore
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Stride.Core
|
||||
{
|
||||
public static class NativeLibrary
|
||||
{
|
||||
private static readonly Dictionary<string, IntPtr> LoadedLibraries = new Dictionary<string, IntPtr>();
|
||||
|
||||
#if STRIDE_PLATFORM_DESKTOP
|
||||
[DllImport("kernel32", EntryPoint = "LoadLibrary", SetLastError = true, CharSet = CharSet.Unicode)]
|
||||
internal static extern IntPtr LoadLibrary(string lpFileName);
|
||||
|
||||
[DllImport("kernel32", EntryPoint = "FreeLibrary", SetLastError = true, CharSet = CharSet.Unicode)]
|
||||
internal static extern int FreeLibrary(IntPtr libraryHandle);
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Try to preload the library.
|
||||
/// This is useful when we want to have AnyCPU .NET and CPU-specific native code.
|
||||
/// Only available on Windows for now.
|
||||
/// </summary>
|
||||
/// <param name="libraryName">Name of the library.</param>
|
||||
/// <param name="owner">Type whose assembly location is related to the native library (we can't use GetCallingAssembly as it might be wrong due to optimizations).</param>
|
||||
/// <exception cref="System.InvalidOperationException">Library could not be loaded.</exception>
|
||||
public static void PreloadLibrary(string libraryName, Type owner)
|
||||
{
|
||||
if (Platform.Type != PlatformType.Windows)
|
||||
return;
|
||||
#if STRIDE_PLATFORM_DESKTOP
|
||||
NormalizeLibName(ref libraryName);
|
||||
lock (LoadedLibraries)
|
||||
{
|
||||
// If already loaded, just exit as we want to load it just once
|
||||
if (LoadedLibraries.ContainsKey(libraryName))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
string cpu;
|
||||
SYSTEM_INFO systemInfo;
|
||||
GetNativeSystemInfo(out systemInfo);
|
||||
|
||||
if (systemInfo.processorArchitecture == PROCESSOR_ARCHITECTURE.PROCESSOR_ARCHITECTURE_ARM)
|
||||
cpu = "ARM";
|
||||
else
|
||||
cpu = IntPtr.Size == 8 ? "x64" : "x86";
|
||||
|
||||
// We are trying to load the dll from a shadow path if it is already registered, otherwise we use it directly from the folder
|
||||
string basePath;
|
||||
{
|
||||
var dllFolder = Path.Combine(Path.GetDirectoryName(owner.GetTypeInfo().Assembly.Location), cpu);
|
||||
if (!Directory.Exists(dllFolder))
|
||||
dllFolder = Path.Combine(Environment.CurrentDirectory, cpu);
|
||||
var libraryFilename = Path.Combine(dllFolder, libraryName);
|
||||
basePath = libraryFilename;
|
||||
|
||||
if (File.Exists(libraryFilename))
|
||||
{
|
||||
var result = LoadLibrary(libraryFilename);
|
||||
if (result != IntPtr.Zero)
|
||||
{
|
||||
LoadedLibraries.Add(libraryName.ToLowerInvariant(), result);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Attempt to load it from PATH
|
||||
foreach (var p in Environment.GetEnvironmentVariable("PATH").Split(Path.PathSeparator))
|
||||
{
|
||||
var libraryFilename = Path.Combine(p, libraryName);
|
||||
|
||||
if (File.Exists(libraryFilename))
|
||||
{
|
||||
var result = LoadLibrary(libraryFilename);
|
||||
if (result != IntPtr.Zero)
|
||||
{
|
||||
LoadedLibraries.Add(libraryName.ToLowerInvariant(), result);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
throw new InvalidOperationException($"Could not load native library {libraryName} from path [{basePath}] using CPU architecture {cpu}.");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// UnLoad a specific native dynamic library loaded previously by <see cref="LoadLibrary" />.
|
||||
/// </summary>
|
||||
/// <param name="libraryName">Name of the library to unload.</param>
|
||||
public static void UnLoad(string libraryName)
|
||||
{
|
||||
#if STRIDE_PLATFORM_DESKTOP
|
||||
NormalizeLibName(ref libraryName);
|
||||
lock (LoadedLibraries)
|
||||
{
|
||||
IntPtr libHandle;
|
||||
if (LoadedLibraries.TryGetValue(libraryName, out libHandle))
|
||||
{
|
||||
FreeLibrary(libHandle);
|
||||
LoadedLibraries.Remove(libraryName);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// UnLoad all native dynamic library loaded previously by <see cref="LoadLibrary"/>.
|
||||
/// </summary>
|
||||
public static void UnLoadAll()
|
||||
{
|
||||
#if STRIDE_PLATFORM_DESKTOP
|
||||
lock (LoadedLibraries)
|
||||
{
|
||||
foreach (var libraryItem in LoadedLibraries)
|
||||
{
|
||||
FreeLibrary(libraryItem.Value);
|
||||
}
|
||||
LoadedLibraries.Clear();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if STRIDE_PLATFORM_DESKTOP
|
||||
private static void NormalizeLibName(ref string libName)
|
||||
{
|
||||
libName = libName.ToLowerInvariant();
|
||||
if (libName.EndsWith(".dll") == false)
|
||||
{
|
||||
libName += ".dll";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if STRIDE_PLATFORM_DESKTOP
|
||||
private const string SYSINFO_FILE = "kernel32.dll";
|
||||
|
||||
[DllImport(SYSINFO_FILE)]
|
||||
private static extern void GetNativeSystemInfo(out SYSTEM_INFO lpSystemInfo);
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
private struct SYSTEM_INFO
|
||||
{
|
||||
public PROCESSOR_ARCHITECTURE processorArchitecture;
|
||||
private ushort reserved;
|
||||
public uint pageSize;
|
||||
public IntPtr minimumApplicationAddress;
|
||||
public IntPtr maximumApplicationAddress;
|
||||
public IntPtr activeProcessorMask;
|
||||
public uint numberOfProcessors;
|
||||
public uint processorType;
|
||||
public uint allocationGranularity;
|
||||
public ushort processorLevel;
|
||||
public ushort processorRevision;
|
||||
}
|
||||
|
||||
private enum PROCESSOR_ARCHITECTURE : ushort
|
||||
{
|
||||
PROCESSOR_ARCHITECTURE_AMD64 = 9,
|
||||
PROCESSOR_ARCHITECTURE_ARM = 5,
|
||||
PROCESSOR_ARCHITECTURE_IA64 = 6,
|
||||
PROCESSOR_ARCHITECTURE_INTEL = 0,
|
||||
PROCESSOR_ARCHITECTURE_UNKNOWN = 0xffff,
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
|
@ -0,0 +1,139 @@
|
|||
// Copyright (c) Stride contributors (https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp)
|
||||
// Distributed under the MIT license. See the LICENSE.md file in the project root for more information.
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Stride.Core
|
||||
{
|
||||
public static class NativeLibraryHelper
|
||||
{
|
||||
private static readonly Dictionary<string, IntPtr> LoadedLibraries = new Dictionary<string, IntPtr>();
|
||||
|
||||
/// <summary>
|
||||
/// Try to preload the library.
|
||||
/// This is useful when we want to have AnyCPU .NET and CPU-specific native code.
|
||||
/// Only available on Windows for now.
|
||||
/// </summary>
|
||||
/// <param name="libraryName">Name of the library.</param>
|
||||
/// <param name="owner">Type whose assembly location is related to the native library (we can't use GetCallingAssembly as it might be wrong due to optimizations).</param>
|
||||
/// <exception cref="System.InvalidOperationException">Library could not be loaded.</exception>
|
||||
public static void PreloadLibrary(string libraryName, Type owner)
|
||||
{
|
||||
#if STRIDE_PLATFORM_DESKTOP
|
||||
lock (LoadedLibraries)
|
||||
{
|
||||
// If already loaded, just exit as we want to load it just once
|
||||
if (LoadedLibraries.ContainsKey(libraryName))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
string cpu;
|
||||
string platform;
|
||||
|
||||
switch (RuntimeInformation.ProcessArchitecture)
|
||||
{
|
||||
case Architecture.X86:
|
||||
cpu = "x86";
|
||||
break;
|
||||
case Architecture.X64:
|
||||
cpu = "x64";
|
||||
break;
|
||||
case Architecture.Arm:
|
||||
cpu = "ARM";
|
||||
break;
|
||||
default:
|
||||
throw new PlatformNotSupportedException();
|
||||
}
|
||||
|
||||
switch (Platform.Type)
|
||||
{
|
||||
case PlatformType.Windows:
|
||||
platform = "win";
|
||||
break;
|
||||
case PlatformType.Linux:
|
||||
platform = "linux";
|
||||
break;
|
||||
case PlatformType.macOS:
|
||||
platform = "osx";
|
||||
break;
|
||||
default:
|
||||
throw new PlatformNotSupportedException();
|
||||
}
|
||||
|
||||
// We are trying to load the dll from a shadow path if it is already registered, otherwise we use it directly from the folder
|
||||
{
|
||||
foreach (var libraryPath in new[]
|
||||
{
|
||||
Path.Combine(Path.GetDirectoryName(owner.GetTypeInfo().Assembly.Location), $"{platform}-{cpu}"),
|
||||
Path.Combine(Environment.CurrentDirectory, $"{platform}-{cpu}"),
|
||||
// Also try without platform for Windows-only packages (backward compat for editor packages)
|
||||
Path.Combine(Path.GetDirectoryName(owner.GetTypeInfo().Assembly.Location), $"{cpu}"),
|
||||
Path.Combine(Environment.CurrentDirectory, $"{cpu}"),
|
||||
})
|
||||
{
|
||||
var libraryFilename = Path.Combine(libraryPath, libraryName);
|
||||
if (NativeLibrary.TryLoad(libraryFilename, out var result))
|
||||
{
|
||||
LoadedLibraries.Add(libraryName.ToLowerInvariant(), result);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Attempt to load it from PATH
|
||||
foreach (var p in Environment.GetEnvironmentVariable("PATH").Split(Path.PathSeparator))
|
||||
{
|
||||
var libraryFilename = Path.Combine(p, libraryName);
|
||||
if (NativeLibrary.TryLoad(libraryFilename, out var result))
|
||||
{
|
||||
LoadedLibraries.Add(libraryName.ToLowerInvariant(), result);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
throw new InvalidOperationException($"Could not load native library {libraryName} using CPU architecture {cpu}.");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// UnLoad a specific native dynamic library loaded previously by <see cref="LoadLibrary" />.
|
||||
/// </summary>
|
||||
/// <param name="libraryName">Name of the library to unload.</param>
|
||||
public static void UnLoad(string libraryName)
|
||||
{
|
||||
#if STRIDE_PLATFORM_DESKTOP
|
||||
lock (LoadedLibraries)
|
||||
{
|
||||
IntPtr libHandle;
|
||||
if (LoadedLibraries.TryGetValue(libraryName, out libHandle))
|
||||
{
|
||||
NativeLibrary.Free(libHandle);
|
||||
LoadedLibraries.Remove(libraryName);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// UnLoad all native dynamic library loaded previously by <see cref="LoadLibrary"/>.
|
||||
/// </summary>
|
||||
public static void UnLoadAll()
|
||||
{
|
||||
#if STRIDE_PLATFORM_DESKTOP
|
||||
lock (LoadedLibraries)
|
||||
{
|
||||
foreach (var libraryItem in LoadedLibraries)
|
||||
{
|
||||
NativeLibrary.Free(libraryItem.Value);
|
||||
}
|
||||
LoadedLibraries.Clear();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
|
@ -8,7 +8,7 @@ namespace Stride.Core.Native
|
|||
{
|
||||
static NativeLz4Base()
|
||||
{
|
||||
NativeLibrary.PreloadLibrary(NativeInvoke.Library, typeof(NativeLz4Base));
|
||||
NativeLibraryHelper.PreloadLibrary(NativeInvoke.Library, typeof(NativeLz4Base));
|
||||
}
|
||||
|
||||
[DllImport(NativeInvoke.Library, CallingConvention = CallingConvention.Cdecl)]
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace Stride.Assets.Models
|
|||
{
|
||||
static AssimpAssetImporter()
|
||||
{
|
||||
NativeLibrary.PreloadLibrary("assimp-vc140-mt.dll", typeof(AssimpAssetImporter));
|
||||
NativeLibraryHelper.PreloadLibrary("assimp-vc140-mt.dll", typeof(AssimpAssetImporter));
|
||||
}
|
||||
|
||||
// Supported file extensions for this importer
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Stride.Assets.Models
|
|||
{
|
||||
static FbxAssetImporter()
|
||||
{
|
||||
NativeLibrary.PreloadLibrary("libfbxsdk.dll", typeof(FbxAssetImporter));
|
||||
NativeLibraryHelper.PreloadLibrary("libfbxsdk.dll", typeof(FbxAssetImporter));
|
||||
}
|
||||
|
||||
// Supported file extensions for this importer
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace Stride.Assets.Physics
|
|||
{
|
||||
static ColliderShapeAssetCompiler()
|
||||
{
|
||||
NativeLibrary.PreloadLibrary("VHACD.dll", typeof(ColliderShapeAssetCompiler));
|
||||
NativeLibraryHelper.PreloadLibrary("VHACD.dll", typeof(ColliderShapeAssetCompiler));
|
||||
}
|
||||
|
||||
public override IEnumerable<BuildDependencyInfo> GetInputTypes(AssetItem assetItem)
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Stride.Audio
|
|||
|
||||
internal static void PreLoad()
|
||||
{
|
||||
NativeLibrary.PreloadLibrary("libstrideaudio", typeof(NativeInvoke));
|
||||
NativeLibraryHelper.PreloadLibrary("libstrideaudio", typeof(NativeInvoke));
|
||||
}
|
||||
|
||||
static NativeInvoke()
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
using System;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using Stride.Core;
|
||||
using Stride.Graphics.OpenGL;
|
||||
|
||||
namespace Stride.Games
|
||||
|
@ -109,7 +110,7 @@ namespace Stride.Games
|
|||
#if STRIDE_GRAPHICS_API_OPENGL || STRIDE_GRAPHICS_API_OPENGLES
|
||||
// Preload proper SDL native library (depending on CPU type)
|
||||
// This is for OpenGL ES on desktop
|
||||
Core.NativeLibrary.PreloadLibrary("SDL2.dll", typeof(GameContextOpenTK));
|
||||
NativeLibraryHelper.PreloadLibrary("SDL2.dll", typeof(GameContextOpenTK));
|
||||
#endif
|
||||
|
||||
var gameWindow = new OpenTK.GameWindow(requestedWidth, requestedHeight, graphicMode, GameContext.ProductName, GameWindowFlags.Default, DisplayDevice.Default, versionMajor, versionMinor,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// Copyright (c) Stride contributors (https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp)
|
||||
// Distributed under the MIT license. See the LICENSE.md file in the project root for more information.
|
||||
#if STRIDE_UI_SDL
|
||||
using Stride.Core;
|
||||
using Stride.Graphics.SDL;
|
||||
|
||||
namespace Stride.Games
|
||||
|
@ -13,7 +14,7 @@ namespace Stride.Games
|
|||
static GameContextSDL()
|
||||
{
|
||||
// Preload proper SDL native library (depending on CPU type)
|
||||
Core.NativeLibrary.PreloadLibrary("SDL2.dll", typeof(Window));
|
||||
NativeLibraryHelper.PreloadLibrary("SDL2.dll", typeof(Window));
|
||||
}
|
||||
|
||||
/// <inheritDoc/>
|
||||
|
|
|
@ -4,7 +4,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using SharpFont;
|
||||
|
||||
using Stride.Core;
|
||||
using Stride.Core.Diagnostics;
|
||||
using Stride.Core.IO;
|
||||
using Stride.Core.Mathematics;
|
||||
|
@ -79,7 +79,7 @@ namespace Stride.Graphics.Font
|
|||
contentManager = new ContentManager(fileProviderService);
|
||||
|
||||
// Preload proper freetype native library (depending on CPU type)
|
||||
Core.NativeLibrary.PreloadLibrary("freetype.dll", typeof(FontManager));
|
||||
NativeLibraryHelper.PreloadLibrary("freetype.dll", typeof(FontManager));
|
||||
|
||||
// create a freetype library used to generate the bitmaps
|
||||
freetypeLibrary = new Library();
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<Choose>
|
||||
<When Condition="$(StrideUI.Contains('SDL'))">
|
||||
<ItemGroup>
|
||||
<StrideNativeLib Include="..\..\..\deps\SDL2\$(StridePlatform)\**\*SDL2*">
|
||||
<StrideNativeLib Include="..\..\..\deps\SDL2\$(StridePlatformDeps)\**\*SDL2*">
|
||||
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
|
||||
<RelativePath>%(RecursiveDir)%(Filename)%(Extension)</RelativePath>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
|
@ -26,15 +26,15 @@
|
|||
</ItemGroup>
|
||||
</When>
|
||||
</Choose>
|
||||
<ItemGroup Condition=" '$(StridePlatform)' == 'macOS' Or '$(StrideGraphicsApi)' == 'Vulkan' ">
|
||||
<StrideNativeLib Include="..\..\..\deps\MoltenVK\$(StridePlatform)\**\*.*">
|
||||
<ItemGroup Condition=" '$(StrideGraphicsApi)' == 'Vulkan' ">
|
||||
<StrideNativeLib Include="..\..\..\deps\MoltenVK\$(StridePlatformDeps)\**\*.*">
|
||||
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
|
||||
<RelativePath>%(RecursiveDir)%(Filename)%(Extension)</RelativePath>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</StrideNativeLib>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<StrideNativeLib Include="..\..\..\deps\freetype\$(StridePlatform)\**\*.*">
|
||||
<StrideNativeLib Include="..\..\..\deps\freetype\$(StridePlatformDeps)\**\*.*">
|
||||
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
|
||||
<RelativePath>%(RecursiveDir)%(Filename)%(Extension)</RelativePath>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace Stride.Native
|
|||
|
||||
internal static void PreLoad()
|
||||
{
|
||||
Core.NativeLibrary.PreloadLibrary("libstride", typeof(NativeInvoke));
|
||||
NativeLibraryHelper.PreloadLibrary("libstride", typeof(NativeInvoke));
|
||||
}
|
||||
|
||||
static NativeInvoke()
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Stride.Navigation
|
|||
|
||||
internal static void PreLoad()
|
||||
{
|
||||
NativeLibrary.PreloadLibrary("libstridenavigation", typeof(NativeInvoke));
|
||||
NativeLibraryHelper.PreloadLibrary("libstridenavigation", typeof(NativeInvoke));
|
||||
}
|
||||
|
||||
static NativeInvoke()
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace Stride.Physics
|
|||
static Bullet2PhysicsSystem()
|
||||
{
|
||||
// Preload proper libbulletc native library (depending on CPU type)
|
||||
NativeLibrary.PreloadLibrary("libbulletc.dll", typeof(Bullet2PhysicsSystem));
|
||||
NativeLibraryHelper.PreloadLibrary("libbulletc.dll", typeof(Bullet2PhysicsSystem));
|
||||
}
|
||||
|
||||
public Bullet2PhysicsSystem(IServiceRegistry registry)
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Stride.Engine
|
|||
AssemblyRegistry.Register(typeof(Module).GetTypeInfo().Assembly, AssemblyCommonCategories.Assets);
|
||||
|
||||
// Preload proper libbulletc native library (depending on CPU type)
|
||||
NativeLibrary.PreloadLibrary("libbulletc.dll", typeof(PhysicsComponent));
|
||||
NativeLibraryHelper.PreloadLibrary("libbulletc.dll", typeof(PhysicsComponent));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<StrideCodeAnalysis>true</StrideCodeAnalysis>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<StrideNativeLib Include="..\..\..\deps\BulletPhysics\$(StridePlatform)\**\libbulletc.*">
|
||||
<StrideNativeLib Include="..\..\..\deps\BulletPhysics\$(StridePlatformDeps)\**\libbulletc.*">
|
||||
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
|
||||
</StrideNativeLib>
|
||||
<StrideContent Condition="'$(StridePlatform)' == 'Linux'" Include="..\..\..\deps\BulletPhysics\BulletSharp.NetStandard.dll.config">
|
||||
|
|
|
@ -120,7 +120,7 @@ namespace Stride.Rendering.LightProbes
|
|||
static BowyerWatsonTetrahedralization()
|
||||
{
|
||||
// TODO: Add native to Stride.Engine?
|
||||
Core.NativeLibrary.PreloadLibrary(NativeInvoke.Library, typeof(NativeInvoke));
|
||||
NativeLibraryHelper.PreloadLibrary(NativeInvoke.Library, typeof(NativeInvoke));
|
||||
exactinit();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Copyright (c) Stride contributors (https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp)
|
||||
// Distributed under the MIT license. See the LICENSE.md file in the project root for more information.
|
||||
#if STRIDE_PLATFORM_DESKTOP || STRIDE_GRAPHICS_API_DIRECT3D // Need SharpDX
|
||||
#if STRIDE_PLATFORM_DESKTOP
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
|
|
@ -46,7 +46,7 @@ namespace Stride.Shaders.Compiler
|
|||
public EffectCompiler(IVirtualFileProvider fileProvider)
|
||||
{
|
||||
FileProvider = fileProvider;
|
||||
NativeLibrary.PreloadLibrary("d3dcompiler_47.dll", typeof(EffectCompiler));
|
||||
NativeLibraryHelper.PreloadLibrary("d3dcompiler_47.dll", typeof(EffectCompiler));
|
||||
SourceDirectories = new List<string>();
|
||||
UrlToFilePath = new Dictionary<string, string>();
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ namespace Stride.Shaders.Compiler
|
|||
// Note: No lock, it's probably fine if it gets called from multiple threads at the same time.
|
||||
if (Platform.IsWindowsDesktop && !d3dCompilerLoaded)
|
||||
{
|
||||
NativeLibrary.PreloadLibrary("d3dcompiler_47.dll", typeof(EffectCompiler));
|
||||
NativeLibraryHelper.PreloadLibrary("d3dcompiler_47.dll", typeof(EffectCompiler));
|
||||
d3dCompilerLoaded = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -115,7 +115,22 @@ namespace Stride.Shaders.Compiler.OpenGL
|
|||
File.WriteAllBytes(inputFileName, Encoding.ASCII.GetBytes(shader));
|
||||
|
||||
// Run shader compiler
|
||||
var filename = Platform.Type == PlatformType.Windows ? "glslangValidator.exe" : "glslangValidator";
|
||||
string filename;
|
||||
switch (Platform.Type)
|
||||
{
|
||||
case PlatformType.Windows:
|
||||
case PlatformType.UWP:
|
||||
filename = @"win-x64\glslangValidator.exe";
|
||||
break;
|
||||
case PlatformType.Linux:
|
||||
filename = @"linux-x64\glslangValidator";
|
||||
break;
|
||||
case PlatformType.macOS:
|
||||
filename = @"osx-x64\glslangValidator";
|
||||
break;
|
||||
default:
|
||||
throw new PlatformNotSupportedException();
|
||||
}
|
||||
ShellHelper.RunProcessAndRedirectToLogger(filename, $"-V -o {outputFileName} {inputFileName}", null, shaderBytecodeResult);
|
||||
|
||||
if (!File.Exists(outputFileName))
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<Project>
|
||||
<PropertyGroup>
|
||||
<StrideRuntime>true</StrideRuntime>
|
||||
<StrideGraphicsApiDependent>true</StrideGraphicsApiDependent>
|
||||
</PropertyGroup>
|
||||
<Import Project="..\..\targets\Stride.props" />
|
||||
<Import Project="Sdk.props" Sdk="MSBuild.Sdk.Extras" Version="3.0.22" />
|
||||
|
@ -23,20 +22,13 @@
|
|||
<ProjectReference Include="..\Stride.Shaders.Parser\Stride.Shaders.Parser.csproj" />
|
||||
<PackageReference Include="SharpDX.D3DCompiler" Version="4.2.0" Condition="'$(StridePlatform)' == 'Windows' Or '$(StridePlatform)' == 'UWP'" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(StridePlatform)' == 'Windows'">
|
||||
<ItemGroup Condition="$(TargetFramework.StartsWith('net'))">
|
||||
<StrideNativeLib Include="$(WindowsSdkDir_10)\Redist\D3D\**\d3dcompiler_47.dll">
|
||||
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
|
||||
<RelativePath>%(RecursiveDir)%(Filename)%(Extension)</RelativePath>
|
||||
<Link>win-%(RecursiveDir)%(Filename)%(Extension)</Link>
|
||||
<RelativePath>win-%(RecursiveDir)%(Filename)%(Extension)</RelativePath>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</StrideNativeLib>
|
||||
<StrideContent Include="..\..\..\deps\glslang\Windows\glslangValidator.exe">
|
||||
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
|
||||
<RelativePath>%(RecursiveDir)%(Filename)%(Extension)</RelativePath>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</StrideContent>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="('$(StridePlatform)' == 'Linux' Or '$(StridePlatform)' == 'macOS') And '$(StrideGraphicsApi)' == 'Vulkan'">
|
||||
<StrideContent Include="..\..\..\deps\glslang\$(StridePlatform)\glslangValidator">
|
||||
<StrideContent Include="..\..\..\deps\glslang\**\glslangValidator*.*">
|
||||
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
|
||||
<RelativePath>%(RecursiveDir)%(Filename)%(Extension)</RelativePath>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
|
|
|
@ -76,13 +76,13 @@ namespace Stride.Video.FFmpeg
|
|||
if (Platform.Type == PlatformType.Windows)
|
||||
{
|
||||
var type = typeof(FFmpegUtils);
|
||||
Core.NativeLibrary.PreloadLibrary("avutil-55", type);
|
||||
Core.NativeLibrary.PreloadLibrary("swresample-2", type);
|
||||
Core.NativeLibrary.PreloadLibrary("avcodec-57", type);
|
||||
Core.NativeLibrary.PreloadLibrary("avformat-57", type);
|
||||
Core.NativeLibrary.PreloadLibrary("swscale-4", type);
|
||||
Core.NativeLibrary.PreloadLibrary("avfilter-6", type);
|
||||
Core.NativeLibrary.PreloadLibrary("avdevice-57", type);
|
||||
NativeLibraryHelper.PreloadLibrary("avutil-55", type);
|
||||
NativeLibraryHelper.PreloadLibrary("swresample-2", type);
|
||||
NativeLibraryHelper.PreloadLibrary("avcodec-57", type);
|
||||
NativeLibraryHelper.PreloadLibrary("avformat-57", type);
|
||||
NativeLibraryHelper.PreloadLibrary("swscale-4", type);
|
||||
NativeLibraryHelper.PreloadLibrary("avfilter-6", type);
|
||||
NativeLibraryHelper.PreloadLibrary("avdevice-57", type);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -31,15 +31,8 @@
|
|||
</ItemGroup>
|
||||
<Choose>
|
||||
<When Condition="$(DefineConstants.Contains(STRIDE_VIDEO_FFMPEG))">
|
||||
<ItemGroup Condition="'$(StridePlatform)' == 'Android'">
|
||||
<StrideNativeLib Include="$(MSBuildThisFileDirectory)..\..\..\deps\FFmpeg\$(StridePlatform)\**\*.so">
|
||||
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
|
||||
<RelativePath>%(RecursiveDir)%(Filename)%(Extension)</RelativePath>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</StrideNativeLib>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(StridePlatform)' == 'Windows'">
|
||||
<StrideNativeLib Include="$(MSBuildThisFileDirectory)..\..\..\deps\FFmpeg\$(StridePlatform)\**\*.dll">
|
||||
<ItemGroup>
|
||||
<StrideNativeLib Include="$(MSBuildThisFileDirectory)..\..\..\deps\FFmpeg\$(StridePlatformDeps)\**\*.*" Exclude="$(MSBuildThisFileDirectory)..\..\..\deps\FFmpeg\$(StridePlatformDeps)\*.*">
|
||||
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
|
||||
<RelativePath>%(RecursiveDir)%(Filename)%(Extension)</RelativePath>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace Stride.VirtualReality
|
|||
{
|
||||
static Fove()
|
||||
{
|
||||
Core.NativeLibrary.PreloadLibrary(NativeInvoke.Library, typeof(Fove));
|
||||
NativeLibraryHelper.PreloadLibrary(NativeInvoke.Library, typeof(Fove));
|
||||
}
|
||||
|
||||
[SuppressUnmanagedCodeSecurity]
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Stride.VirtualReality
|
|||
|
||||
internal static void PreLoad()
|
||||
{
|
||||
NativeLibrary.PreloadLibrary("libstridevr", typeof(NativeInvoke));
|
||||
NativeLibraryHelper.PreloadLibrary("libstridevr", typeof(NativeInvoke));
|
||||
}
|
||||
|
||||
static NativeInvoke()
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Stride.VirtualReality
|
|||
{
|
||||
static OculusOvr()
|
||||
{
|
||||
Core.NativeLibrary.PreloadLibrary(NativeInvoke.Library, typeof(OculusOvr));
|
||||
NativeLibraryHelper.PreloadLibrary(NativeInvoke.Library, typeof(OculusOvr));
|
||||
}
|
||||
|
||||
[SuppressUnmanagedCodeSecurity]
|
||||
|
|
|
@ -196,7 +196,7 @@ namespace Stride.VirtualReality
|
|||
|
||||
static OpenVR()
|
||||
{
|
||||
NativeLibrary.PreloadLibrary("openvr_api.dll", typeof(OpenVR));
|
||||
NativeLibraryHelper.PreloadLibrary("openvr_api.dll", typeof(OpenVR));
|
||||
}
|
||||
|
||||
public static bool InitDone = false;
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
<Choose>
|
||||
<When Condition=" '$(StrideGraphicsApi)' == 'Direct3D11' Or '$(StrideGraphicsApi)' == 'Direct3D12' ">
|
||||
<ItemGroup>
|
||||
<StrideNativeLib Include="..\..\..\deps\OpenVR\$(StridePlatform)\**\openvr_api.*">
|
||||
<StrideNativeLib Include="..\..\..\deps\OpenVR\$(StridePlatformDeps)\**\openvr_api.*">
|
||||
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
|
||||
<RelativePath>%(RecursiveDir)%(Filename)%(Extension)</RelativePath>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
|
|
|
@ -46,8 +46,10 @@
|
|||
|
||||
<!-- Define default CPU architectures -->
|
||||
<ItemGroup>
|
||||
<StrideNativeCPU Condition=" '$(StridePlatform)' == 'Windows' Or '$(StridePlatform)' == 'UWP' " Include="x86;x64"/>
|
||||
<StrideNativeCPU Condition=" '$(StridePlatform)' == 'UWP' " Include="ARM"/>
|
||||
<StrideNativeCPU Condition=" '$(StridePlatform)' == 'Windows' " Include="win-x64;win-x86"/>
|
||||
<StrideNativeCPU Condition=" '$(StridePlatform)' == 'Linux' " Include="linux-x64"/>
|
||||
<StrideNativeCPU Condition=" '$(StridePlatform)' == 'macOS' " Include="osx-x64"/>
|
||||
<StrideNativeCPU Condition=" '$(StridePlatform)' == 'UWP' " Include="x86;x64;ARM"/>
|
||||
<StrideNativeCPU Condition=" '$(StridePlatform)' == 'Android' " Include="arm64-v8a;armeabi-v7a;x86;x86_64"/>
|
||||
</ItemGroup>
|
||||
|
||||
|
@ -121,15 +123,15 @@
|
|||
</Target>-->
|
||||
|
||||
<Target Name="CompileNativeClang_Windows" Inputs="@(StrideNativeCFile);@(StrideNativeHFile)" Outputs="@(StrideNativeOutput)" Condition="'$(StridePlatform)' == 'Windows' And $(DesignTimeBuild) != true And $(BuildingProject) != false" BeforeTargets="CoreCompile" DependsOnTargets="_StrideRegisterNativeOutputs">
|
||||
<MakeDir Directories="$(OutputObjectPath)\x86"/>
|
||||
<Exec Condition="'%(StrideNativeCFile.Extension)' != '.cpp'" Command=""$(MSBuildThisFileDirectory)..\..\deps\\LLVM\clang.exe" -gcodeview -fno-ms-extensions -nobuiltininc -nostdinc++ $(StrideNativeClang) -o "$(OutputObjectPath)\x86\%(StrideNativeCFile.Filename).obj" -c "%(StrideNativeCFile.FullPath)" -fms-extensions -DWINDOWS_DESKTOP -target i686-pc-windows-msvc" />
|
||||
<Exec Condition="'%(StrideNativeCFile.Extension)' == '.cpp'" Command=""$(MSBuildThisFileDirectory)..\..\deps\\LLVM\clang.exe" -gcodeview -fno-ms-extensions -nobuiltininc -nostdinc++ $(StrideNativeClangCPP) $(StrideNativeClang) -o "$(OutputObjectPath)\x86\%(StrideNativeCFile.Filename).obj" -c "%(StrideNativeCFile.FullPath)" -fms-extensions -DWINDOWS_DESKTOP -target i686-pc-windows-msvc" />
|
||||
<MSBuild Projects="$(MSBuildThisFileDirectory)WindowsProjects\WindowsDesktop\WindowsDesktop.vcxproj" Targets="Build" Properties="StrideNativeOutputName=$(StrideNativeOutputName);StrideNativeOutputDir=$(StrideNativeOutputPath)\x86;StrideDependenciesDir=$(MSBuildThisFileDirectory)..\..\deps\;StrideNativePathLibs=libNativePath.lib $(StrideNativePathLibs);StrideNativeProjectFolder=$(ProjectDir);StrideNativeProjectObjFolder=$(OutputObjectPath)\x86;Configuration=$(Configuration);Platform=x86" StopOnFirstFailure="true" />
|
||||
<MakeDir Directories="$(OutputObjectPath)\win-x86"/>
|
||||
<Exec Condition="'%(StrideNativeCFile.Extension)' != '.cpp'" Command=""$(MSBuildThisFileDirectory)..\..\deps\\LLVM\clang.exe" -gcodeview -fno-ms-extensions -nobuiltininc -nostdinc++ $(StrideNativeClang) -o "$(OutputObjectPath)\win-x86\%(StrideNativeCFile.Filename).obj" -c "%(StrideNativeCFile.FullPath)" -fms-extensions -DWINDOWS_DESKTOP -target i686-pc-windows-msvc" />
|
||||
<Exec Condition="'%(StrideNativeCFile.Extension)' == '.cpp'" Command=""$(MSBuildThisFileDirectory)..\..\deps\\LLVM\clang.exe" -gcodeview -fno-ms-extensions -nobuiltininc -nostdinc++ $(StrideNativeClangCPP) $(StrideNativeClang) -o "$(OutputObjectPath)\win-x86\%(StrideNativeCFile.Filename).obj" -c "%(StrideNativeCFile.FullPath)" -fms-extensions -DWINDOWS_DESKTOP -target i686-pc-windows-msvc" />
|
||||
<MSBuild Projects="$(MSBuildThisFileDirectory)WindowsProjects\WindowsDesktop\WindowsDesktop.vcxproj" Targets="Build" Properties="StrideNativeOutputName=$(StrideNativeOutputName);StrideNativeOutputDir=$(StrideNativeOutputPath)\win-x86;StrideDependenciesDir=$(MSBuildThisFileDirectory)..\..\deps\;StrideNativePathLibs=libNativePath.lib $(StrideNativePathLibs);StrideNativeProjectFolder=$(ProjectDir);StrideNativeProjectObjFolder=$(OutputObjectPath)\win-x86;Configuration=$(Configuration);Platform=x86" StopOnFirstFailure="true" />
|
||||
|
||||
<MakeDir Directories="$(OutputObjectPath)\x64"/>
|
||||
<Exec Condition="'%(StrideNativeCFile.Extension)' != '.cpp'" Command=""$(MSBuildThisFileDirectory)..\..\deps\\LLVM\clang.exe" -gcodeview -fno-ms-extensions -nobuiltininc -nostdinc++ $(StrideNativeClang) -o "$(OutputObjectPath)\x64\%(StrideNativeCFile.Filename).obj" -c "%(StrideNativeCFile.FullPath)" -fms-extensions -DWINDOWS_DESKTOP -target x86_64-pc-windows-msvc" />
|
||||
<Exec Condition="'%(StrideNativeCFile.Extension)' == '.cpp'" Command=""$(MSBuildThisFileDirectory)..\..\deps\\LLVM\clang.exe" -gcodeview -fno-ms-extensions -nobuiltininc -nostdinc++ $(StrideNativeClangCPP) $(StrideNativeClang) -o "$(OutputObjectPath)\x64\%(StrideNativeCFile.Filename).obj" -c "%(StrideNativeCFile.FullPath)" -fms-extensions -DWINDOWS_DESKTOP -target x86_64-pc-windows-msvc" />
|
||||
<MSBuild Projects="$(MSBuildThisFileDirectory)WindowsProjects\WindowsDesktop\WindowsDesktop.vcxproj" Targets="Build" Properties="StrideNativeOutputName=$(StrideNativeOutputName);StrideNativeOutputDir=$(StrideNativeOutputPath)x64;StrideDependenciesDir=$(MSBuildThisFileDirectory)..\..\deps\;StrideNativePathLibs=libNativePath.lib $(StrideNativePathLibs);StrideNativeProjectFolder=$(ProjectDir);StrideNativeProjectObjFolder=$(OutputObjectPath)\x64;Configuration=$(Configuration);Platform=x64" StopOnFirstFailure="true" />
|
||||
<MakeDir Directories="$(OutputObjectPath)\win-x64"/>
|
||||
<Exec Condition="'%(StrideNativeCFile.Extension)' != '.cpp'" Command=""$(MSBuildThisFileDirectory)..\..\deps\\LLVM\clang.exe" -gcodeview -fno-ms-extensions -nobuiltininc -nostdinc++ $(StrideNativeClang) -o "$(OutputObjectPath)\win-x64\%(StrideNativeCFile.Filename).obj" -c "%(StrideNativeCFile.FullPath)" -fms-extensions -DWINDOWS_DESKTOP -target x86_64-pc-windows-msvc" />
|
||||
<Exec Condition="'%(StrideNativeCFile.Extension)' == '.cpp'" Command=""$(MSBuildThisFileDirectory)..\..\deps\\LLVM\clang.exe" -gcodeview -fno-ms-extensions -nobuiltininc -nostdinc++ $(StrideNativeClangCPP) $(StrideNativeClang) -o "$(OutputObjectPath)\win-x64\%(StrideNativeCFile.Filename).obj" -c "%(StrideNativeCFile.FullPath)" -fms-extensions -DWINDOWS_DESKTOP -target x86_64-pc-windows-msvc" />
|
||||
<MSBuild Projects="$(MSBuildThisFileDirectory)WindowsProjects\WindowsDesktop\WindowsDesktop.vcxproj" Targets="Build" Properties="StrideNativeOutputName=$(StrideNativeOutputName);StrideNativeOutputDir=$(StrideNativeOutputPath)\win-x64;StrideDependenciesDir=$(MSBuildThisFileDirectory)..\..\deps\;StrideNativePathLibs=libNativePath.lib $(StrideNativePathLibs);StrideNativeProjectFolder=$(ProjectDir);StrideNativeProjectObjFolder=$(OutputObjectPath)\win-x64;Configuration=$(Configuration);Platform=x64" StopOnFirstFailure="true" />
|
||||
|
||||
<SignFile Condition="'$(StrideSign)' == 'true'" CertificateThumbprint="c3dd2388073e8c038a62dc57865bd0994a784c76" SigningTarget="%(StrideNativeOutput.Identity)" TimestampUrl="http://timestamp.digicert.com" />
|
||||
|
||||
|
@ -236,15 +238,20 @@
|
|||
</Target>
|
||||
|
||||
<Target Name="CompileNativeClang_Linux" Inputs="@(StrideNativeCFile);@(StrideNativeHFile)" Outputs="@(StrideNativeOutput)" Condition="'$(StridePlatform)' == 'Linux' And $(DesignTimeBuild) != true And $(BuildingProject) != false" BeforeTargets="CoreCompile" DependsOnTargets="_StrideRegisterNativeOutputs">
|
||||
<Exec Condition="'%(StrideNativeCFile.Extension)' != '.cpp'" Command=""$(MSBuildThisFileDirectory)..\..\deps\\LLVM\clang.exe" $(StrideNativeClang) -o "$(OutputObjectPath)\%(StrideNativeCFile.Filename)_x64.o" -c "%(StrideNativeCFile.FullPath)" -fPIC -target x86_64-linux-gnu" />
|
||||
<Exec Condition="'%(StrideNativeCFile.Extension)' == '.cpp'" Command=""$(MSBuildThisFileDirectory)..\..\deps\\LLVM\clang.exe" $(StrideNativeClangCPP) $(StrideNativeClang) -o "$(OutputObjectPath)\%(StrideNativeCFile.Filename)_x64.o" -c "%(StrideNativeCFile.FullPath)" -fPIC -target x86_64-linux-gnu" />
|
||||
<Exec Command=""$(MSBuildThisFileDirectory)..\..\deps\\LLVM\lld.exe" -flavor gnu --eh-frame-hdr -m elf_x86_64 -shared -o "$(StrideNativeOutputPath)\$(StrideNativeOutputName)$(StrideNativeLibraryTargetExt)" @(StrideNativeCFile->'"$(OutputObjectPath)\%(Filename)_x64.o"', ' ') @(StrideNativePathLibs2->'"$(MSBuildThisFileDirectory)..\..\deps\\NativePath\Linux\x86_64\%(Filename).a"', ' ') "$(MSBuildThisFileDirectory)..\..\deps\\NativePath\Linux\x86_64\libNativePath.a"" />
|
||||
<MakeDir Directories="$(OutputObjectPath)\linux-x64"/>
|
||||
<Exec Condition="'%(StrideNativeCFile.Extension)' != '.cpp'" Command=""$(MSBuildThisFileDirectory)..\..\deps\\LLVM\clang.exe" $(StrideNativeClang) -o "$(OutputObjectPath)\linux-x64\%(StrideNativeCFile.Filename)_x64.o" -c "%(StrideNativeCFile.FullPath)" -fPIC -target x86_64-linux-gnu" />
|
||||
<Exec Condition="'%(StrideNativeCFile.Extension)' == '.cpp'" Command=""$(MSBuildThisFileDirectory)..\..\deps\\LLVM\clang.exe" $(StrideNativeClangCPP) $(StrideNativeClang) -o "$(OutputObjectPath)\linux-x64\%(StrideNativeCFile.Filename)_x64.o" -c "%(StrideNativeCFile.FullPath)" -fPIC -target x86_64-linux-gnu" />
|
||||
<Exec Command=""$(MSBuildThisFileDirectory)..\..\deps\\LLVM\lld.exe" -flavor gnu --eh-frame-hdr -m elf_x86_64 -shared -o "$(StrideNativeOutputPath)\$(StrideNativeOutputName)$(StrideNativeLibraryTargetExt)" @(StrideNativeCFile->'"$(OutputObjectPath)\linux-x64\%(Filename)_x64.o"', ' ') @(StrideNativePathLibs2->'"$(MSBuildThisFileDirectory)..\..\deps\\NativePath\dotnet\linux-x64\%(Filename).a"', ' ') "$(MSBuildThisFileDirectory)..\..\deps\\NativePath\dotnet\linux-x64\libNativePath.a"" />
|
||||
|
||||
<!-- Workaround: forcing C# rebuild so that timestamp are up to date (ideally we should have separate input/output groups for C# and Native) -->
|
||||
<Delete Files="@(IntermediateAssembly)"/>
|
||||
</Target>
|
||||
|
||||
<Target Name="CompileNativeClang_macOS" Inputs="@(StrideNativeCFile);@(StrideNativeHFile)" Outputs="@(StrideNativeOutput)" Condition="'$(StridePlatform)' == 'macOS' And $(DesignTimeBuild) != true And $(BuildingProject) != false" BeforeTargets="CoreCompile" DependsOnTargets="_StrideRegisterNativeOutputs">
|
||||
<Exec Condition="'%(StrideNativeCFile.Extension)' != '.cpp'" Command=""$(MSBuildThisFileDirectory)..\..\deps\\LLVM\clang.exe" $(StrideNativeClang) -o "$(OutputObjectPath)\%(StrideNativeCFile.Filename)_x64.o" -c "%(StrideNativeCFile.FullPath)" -fPIC -target x86_64-apple-darwin" />
|
||||
<Exec Condition="'%(StrideNativeCFile.Extension)' == '.cpp'" Command=""$(MSBuildThisFileDirectory)..\..\deps\\LLVM\clang.exe" $(StrideNativeClangCPP) $(StrideNativeClang) -o "$(OutputObjectPath)\%(StrideNativeCFile.Filename)_x64.o" -c "%(StrideNativeCFile.FullPath)" -fPIC -target x86_64-apple-darwin" />
|
||||
<Exec Command=""$(MSBuildThisFileDirectory)..\..\deps\\LLVM\darwin_ld.exe" -arch x86_64 -w -flat_namespace -undefined dynamic_lookup -sdk_version 10.11 -macosx_version_min 10.11 -dylib -o "$(StrideNativeOutputPath)\$(StrideNativeOutputName)$(StrideNativeLibraryTargetExt)" @(StrideNativeCFile->'"$(OutputObjectPath)\%(Filename)_x64.o"', ' ') @(StrideNativePathLibs2->'"$(MSBuildThisFileDirectory)..\..\deps\\NativePath\$(StridePlatform)\%(Filename).a"', ' ') "$(MSBuildThisFileDirectory)..\..\deps\\NativePath\$(StridePlatform)\libNativePath.a"" />
|
||||
<MakeDir Directories="$(OutputObjectPath)\osx-x64"/>
|
||||
<Exec Condition="'%(StrideNativeCFile.Extension)' != '.cpp'" Command=""$(MSBuildThisFileDirectory)..\..\deps\\LLVM\clang.exe" $(StrideNativeClang) -o "$(OutputObjectPath)\osx-x64\%(StrideNativeCFile.Filename)_x64.o" -c "%(StrideNativeCFile.FullPath)" -fPIC -target x86_64-apple-darwin" />
|
||||
<Exec Condition="'%(StrideNativeCFile.Extension)' == '.cpp'" Command=""$(MSBuildThisFileDirectory)..\..\deps\\LLVM\clang.exe" $(StrideNativeClangCPP) $(StrideNativeClang) -o "$(OutputObjectPath)\osx-x64\%(StrideNativeCFile.Filename)_x64.o" -c "%(StrideNativeCFile.FullPath)" -fPIC -target x86_64-apple-darwin" />
|
||||
<Exec Command=""$(MSBuildThisFileDirectory)..\..\deps\\LLVM\darwin_ld.exe" -arch x86_64 -w -flat_namespace -undefined dynamic_lookup -sdk_version 10.11 -macosx_version_min 10.11 -dylib -o "$(StrideNativeOutputPath)\$(StrideNativeOutputName)$(StrideNativeLibraryTargetExt)" @(StrideNativeCFile->'"$(OutputObjectPath)\osx-x64\%(Filename)_x64.o"', ' ') @(StrideNativePathLibs2->'"$(MSBuildThisFileDirectory)..\..\deps\NativePath\dotnet\osx-x64\%(Filename).a"', ' ') "$(MSBuildThisFileDirectory)..\..\deps\NativePath\dotnet\osx-x64\libNativePath.a"" />
|
||||
|
||||
<!-- Workaround: forcing C# rebuild so that timestamp are up to date (ideally we should have separate input/output groups for C# and Native) -->
|
||||
<Delete Files="@(IntermediateAssembly)"/>
|
||||
|
|
|
@ -96,7 +96,7 @@
|
|||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(StrideDependenciesDir)\NativePath\Windows\x86\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(StrideDependenciesDir)\NativePath\dotnet\win-x86\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalOptions>$(StrideNativePathLibs) %(AdditionalOptions)</AdditionalOptions>
|
||||
</Link>
|
||||
|
@ -116,7 +116,7 @@
|
|||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(StrideDependenciesDir)\NativePath\Windows\x64\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(StrideDependenciesDir)\NativePath\dotnet\win-x64\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalOptions>$(StrideNativePathLibs) %(AdditionalOptions)</AdditionalOptions>
|
||||
</Link>
|
||||
|
@ -139,7 +139,7 @@
|
|||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalLibraryDirectories>$(StrideDependenciesDir)\NativePath\Windows\x86\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(StrideDependenciesDir)\NativePath\dotnet\win-x86\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalOptions>$(StrideNativePathLibs) %(AdditionalOptions)</AdditionalOptions>
|
||||
</Link>
|
||||
|
@ -162,7 +162,7 @@
|
|||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalLibraryDirectories>$(StrideDependenciesDir)\NativePath\Windows\x64\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(StrideDependenciesDir)\NativePath\dotnet\win-x64\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalOptions>$(StrideNativePathLibs) %(AdditionalOptions)</AdditionalOptions>
|
||||
</Link>
|
||||
|
|
|
@ -21,6 +21,11 @@
|
|||
<StridePlatform Condition=" '$(StridePlatform)' == '' ">Windows</StridePlatform>
|
||||
|
||||
<StridePlatformFullName Condition="'$(StridePlatformFullName)' == ''">$(StridePlatform)</StridePlatformFullName>
|
||||
|
||||
<StridePlatformDeps Condition=" $(TargetFramework.StartsWith('net')) ">dotnet</StridePlatformDeps>
|
||||
<StridePlatformDeps Condition=" $(TargetFramework.StartsWith('uap10.0')) ">UWP</StridePlatformDeps>
|
||||
<StridePlatformDeps Condition=" '$(TargetFramework)' == 'monoandroid81' ">Android</StridePlatformDeps>
|
||||
<StridePlatformDeps Condition=" '$(TargetFramework)' == 'xamarinios10' ">iOS</StridePlatformDeps>
|
||||
</PropertyGroup>
|
||||
|
||||
<!--Import Local Pre Settings for the solution being loaded -->
|
||||
|
|
|
@ -37,11 +37,11 @@ namespace Stride.TextureConverter
|
|||
static TextureTool()
|
||||
{
|
||||
var type = typeof(TextureTool);
|
||||
NativeLibrary.PreloadLibrary("DxtWrapper.dll", type);
|
||||
NativeLibrary.PreloadLibrary("PVRTexLib.dll", type);
|
||||
NativeLibrary.PreloadLibrary("PvrttWrapper.dll", type);
|
||||
NativeLibrary.PreloadLibrary("FreeImage.dll", type);
|
||||
NativeLibrary.PreloadLibrary("FreeImageNET.dll", type);
|
||||
NativeLibraryHelper.PreloadLibrary("DxtWrapper.dll", type);
|
||||
NativeLibraryHelper.PreloadLibrary("PVRTexLib.dll", type);
|
||||
NativeLibraryHelper.PreloadLibrary("PvrttWrapper.dll", type);
|
||||
NativeLibraryHelper.PreloadLibrary("FreeImage.dll", type);
|
||||
NativeLibraryHelper.PreloadLibrary("FreeImageNET.dll", type);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Загрузка…
Ссылка в новой задаче