Compare commits
8 Commits
sdl_platfo
...
d0cc2b67a7
| Author | SHA1 | Date | |
|---|---|---|---|
| d0cc2b67a7 | |||
| 9b93bef983 | |||
| ee95a292a6 | |||
| a336b4966f | |||
| da1c112c92 | |||
| 9ffe206b81 | |||
| a87a6898ae | |||
| ebf57ef9b0 |
4
.github/workflows/build_ios.yml
vendored
4
.github/workflows/build_ios.yml
vendored
@@ -19,7 +19,7 @@ jobs:
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v3
|
||||
with:
|
||||
dotnet-version: 9.0.x
|
||||
dotnet-version: 8.0.x
|
||||
- name: Setup .NET Workload
|
||||
run: |
|
||||
dotnet workload install ios
|
||||
@@ -33,4 +33,4 @@ jobs:
|
||||
git lfs pull
|
||||
- name: Build
|
||||
run: |
|
||||
./Development/Scripts/Mac/CallBuildTool.sh -build -log -dotnet=9 -arch=ARM64 -platform=iOS -configuration=Release -buildtargets=FlaxGame
|
||||
./Development/Scripts/Mac/CallBuildTool.sh -build -log -dotnet=8 -arch=ARM64 -platform=iOS -configuration=Release -buildtargets=FlaxGame
|
||||
|
||||
@@ -412,7 +412,7 @@ namespace FlaxEditor.Surface.ContextMenu
|
||||
{
|
||||
group.UnlockChildrenRecursive();
|
||||
// TODO: Improve filtering to be based on boxes with the most common things instead of first box
|
||||
if (_contextSensitiveSearchEnabled && _selectedBoxes.Count > 0 && _selectedBoxes[0] != null)
|
||||
if (_contextSensitiveSearchEnabled && _selectedBoxes[0] != null)
|
||||
UpdateFilters();
|
||||
else
|
||||
SortGroups();
|
||||
@@ -424,7 +424,7 @@ namespace FlaxEditor.Surface.ContextMenu
|
||||
OnSearchFilterChanged();
|
||||
}
|
||||
}
|
||||
else if (_contextSensitiveSearchEnabled && _selectedBoxes.Count > 0)
|
||||
else if (_contextSensitiveSearchEnabled)
|
||||
{
|
||||
// TODO: Filtering could be improved here as well
|
||||
group.EvaluateVisibilityWithBox(_selectedBoxes[0]);
|
||||
@@ -462,7 +462,7 @@ namespace FlaxEditor.Surface.ContextMenu
|
||||
Parent = group
|
||||
};
|
||||
}
|
||||
if (_contextSensitiveSearchEnabled && _selectedBoxes.Count > 0)
|
||||
if (_contextSensitiveSearchEnabled)
|
||||
group.EvaluateVisibilityWithBox(_selectedBoxes[0]);
|
||||
group.SortChildren();
|
||||
if (ShowExpanded)
|
||||
@@ -476,7 +476,7 @@ namespace FlaxEditor.Surface.ContextMenu
|
||||
|
||||
if (!isLayoutLocked)
|
||||
{
|
||||
if (_contextSensitiveSearchEnabled && _selectedBoxes.Count != 0 && _selectedBoxes[0] != null)
|
||||
if (_contextSensitiveSearchEnabled && _selectedBoxes[0] != null)
|
||||
UpdateFilters();
|
||||
else
|
||||
SortGroups();
|
||||
|
||||
@@ -257,23 +257,16 @@ namespace FlaxEditor.Viewport
|
||||
/// </summary>
|
||||
public void SaveActiveUIScalingOption()
|
||||
{
|
||||
if (!Prefab)
|
||||
return;
|
||||
var id = Prefab.ID;
|
||||
var defaultKey = $"{id}:DefaultViewportScalingIndex";
|
||||
var defaultKey = $"{Prefab.ID}:DefaultViewportScalingIndex";
|
||||
Editor.Instance.ProjectCache.SetCustomData(defaultKey, _defaultScaleActiveIndex.ToString());
|
||||
var customKey = $"{id}:CustomViewportScalingIndex";
|
||||
var customKey = $"{Prefab.ID}:CustomViewportScalingIndex";
|
||||
Editor.Instance.ProjectCache.SetCustomData(customKey, _customScaleActiveIndex.ToString());
|
||||
}
|
||||
|
||||
private void LoadCustomUIScalingOption()
|
||||
{
|
||||
if (!Prefab)
|
||||
return;
|
||||
var id = Prefab.ID;
|
||||
Prefab.WaitForLoaded();
|
||||
|
||||
var defaultKey = $"{id}:DefaultViewportScalingIndex";
|
||||
var defaultKey = $"{Prefab.ID}:DefaultViewportScalingIndex";
|
||||
if (Editor.Instance.ProjectCache.TryGetCustomData(defaultKey, out string defaultData))
|
||||
{
|
||||
if (int.TryParse(defaultData, out var index))
|
||||
@@ -293,7 +286,7 @@ namespace FlaxEditor.Viewport
|
||||
}
|
||||
}
|
||||
|
||||
var customKey = $"{id}:CustomViewportScalingIndex";
|
||||
var customKey = $"{Prefab.ID}:CustomViewportScalingIndex";
|
||||
if (Editor.Instance.ProjectCache.TryGetCustomData(customKey, out string data))
|
||||
{
|
||||
if (int.TryParse(data, out var index))
|
||||
|
||||
@@ -889,12 +889,12 @@ namespace FlaxEditor.Windows
|
||||
if (!_cursorVisible)
|
||||
Screen.CursorVisible = true;
|
||||
Screen.CursorLock = CursorLockMode.None;
|
||||
}
|
||||
|
||||
if (Editor.IsPlayMode && IsDocked && IsSelected && RootWindow.FocusedControl == null)
|
||||
{
|
||||
// Game UI cleared focus so regain it to maintain UI navigation just like game window does
|
||||
FlaxEngine.Scripting.InvokeOnUpdate(Focus);
|
||||
}
|
||||
if (Editor.IsPlayMode && IsDocked && IsSelected && RootWindow.FocusedControl == null)
|
||||
{
|
||||
// Game UI cleared focus so regain it to maintain UI navigation just like game window does
|
||||
FlaxEngine.Scripting.InvokeOnUpdate(Focus);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -208,7 +208,7 @@ public:
|
||||
typedef typename FallbackAllocation::template Data<T> FallbackData;
|
||||
|
||||
bool _useFallback = false;
|
||||
alignas(sizeof(void*)) byte _data[Capacity * sizeof(T)];
|
||||
byte _data[Capacity * sizeof(T)];
|
||||
FallbackData _fallback;
|
||||
|
||||
public:
|
||||
|
||||
@@ -192,7 +192,6 @@ void GPUContextVulkan::AddImageBarrier(VkImage image, VkImageLayout srcLayout, V
|
||||
|
||||
void GPUContextVulkan::AddImageBarrier(GPUTextureViewVulkan* handle, VkImageLayout dstLayout)
|
||||
{
|
||||
ASSERT(handle->Owner);
|
||||
auto& state = handle->Owner->State;
|
||||
const auto subresourceIndex = handle->SubresourceIndex;
|
||||
if (subresourceIndex == -1)
|
||||
@@ -517,7 +516,7 @@ void GPUContextVulkan::UpdateDescriptorSets(const SpirvShaderDescriptorInfo& des
|
||||
case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE:
|
||||
{
|
||||
auto handle = (GPUTextureViewVulkan*)handles[slot];
|
||||
if (!handle || !handle->Owner)
|
||||
if (!handle)
|
||||
{
|
||||
const auto dummy = _device->HelperResources.GetDummyTexture(descriptor.ResourceType);
|
||||
switch (descriptor.ResourceType)
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "Engine/Physics/Physics.h"
|
||||
#include "Engine/Physics/PhysicsBackend.h"
|
||||
#include "Engine/Physics/PhysicsScene.h"
|
||||
#include "Engine/Profiler/ProfilerCPU.h"
|
||||
#include "Engine/Engine/Time.h"
|
||||
|
||||
#define CC_MIN_SIZE 0.001f
|
||||
@@ -179,7 +178,6 @@ CharacterController::CollisionFlags CharacterController::SimpleMove(const Vector
|
||||
|
||||
CharacterController::CollisionFlags CharacterController::Move(const Vector3& displacement)
|
||||
{
|
||||
PROFILE_CPU();
|
||||
CollisionFlags result = CollisionFlags::None;
|
||||
if (_controller && !_isUpdatingTransform)
|
||||
{
|
||||
@@ -379,10 +377,7 @@ void CharacterController::AddMovement(const Vector3& translation, const Quaterni
|
||||
displacement += GetPhysicsScene()->GetGravity() * deltaTime;
|
||||
}
|
||||
|
||||
if (!displacement.IsZero())
|
||||
{
|
||||
Move(displacement);
|
||||
}
|
||||
Move(displacement);
|
||||
|
||||
if (!rotation.IsIdentity())
|
||||
{
|
||||
|
||||
@@ -5,9 +5,6 @@
|
||||
#include "Types.h"
|
||||
#include "Engine/Core/Types/StringView.h"
|
||||
#include "Engine/Core/Types/Guid.h"
|
||||
#if PLATFORM_ARCH_ARM64
|
||||
#include "Engine/Core/Core.h"
|
||||
#endif
|
||||
|
||||
class MMethod;
|
||||
class BinaryModule;
|
||||
|
||||
@@ -32,7 +32,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
using JsonWriter::Key;
|
||||
|
||||
// [JsonWriter]
|
||||
void Key(const char* str, int32 length) override
|
||||
|
||||
@@ -390,7 +390,7 @@ public class Slider : ContainerControl
|
||||
}
|
||||
|
||||
// Draw thumb
|
||||
var thumbColorV = _isSliding ? ThumbColorSelected : (_mouseOverThumb || IsNavFocused ? ThumbColorHighlighted : ThumbColor);
|
||||
var thumbColorV = _isSliding ? ThumbColorSelected : (_mouseOverThumb ? ThumbColorHighlighted : ThumbColor);
|
||||
if (ThumbBrush != null)
|
||||
ThumbBrush.Draw(_thumbRect, thumbColorV);
|
||||
else
|
||||
|
||||
BIN
Source/Platforms/Mac/Binaries/ThirdParty/ARM64/libopenal.a
(Stored with Git LFS)
vendored
BIN
Source/Platforms/Mac/Binaries/ThirdParty/ARM64/libopenal.a
(Stored with Git LFS)
vendored
Binary file not shown.
BIN
Source/Platforms/Mac/Binaries/ThirdParty/x64/libopenal.a
(Stored with Git LFS)
vendored
BIN
Source/Platforms/Mac/Binaries/ThirdParty/x64/libopenal.a
(Stored with Git LFS)
vendored
Binary file not shown.
BIN
Source/Platforms/iOS/Binaries/ThirdParty/ARM64/libopenal.a
(Stored with Git LFS)
vendored
BIN
Source/Platforms/iOS/Binaries/ThirdParty/ARM64/libopenal.a
(Stored with Git LFS)
vendored
Binary file not shown.
@@ -1,95 +0,0 @@
|
||||
// Copyright (c) Wojciech Figat. All rights reserved.
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using Flax.Build;
|
||||
using Flax.Build.Platforms;
|
||||
|
||||
namespace Flax.Deps.Dependencies
|
||||
{
|
||||
/// <summary>
|
||||
/// Visual Studio EnvDTE COM library. https://learn.microsoft.com/en-us/dotnet/api/envdte?view=visualstudiosdk-2022
|
||||
/// </summary>
|
||||
/// <seealso cref="Flax.Deps.Dependency" />
|
||||
class EnvDTE : Dependency
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override TargetPlatform[] Platforms
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (BuildPlatform)
|
||||
{
|
||||
case TargetPlatform.Windows:
|
||||
return new[]
|
||||
{
|
||||
TargetPlatform.Windows,
|
||||
};
|
||||
default: return new TargetPlatform[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override TargetArchitecture[] Architectures
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (BuildPlatform)
|
||||
{
|
||||
case TargetPlatform.Windows:
|
||||
return new[]
|
||||
{
|
||||
TargetArchitecture.x64,
|
||||
TargetArchitecture.ARM64,
|
||||
};
|
||||
default: return new TargetArchitecture[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Build(BuildOptions options)
|
||||
{
|
||||
options.IntermediateFolder.Replace("/" + GetType().Name, "/Microsoft.VisualStudio.Setup.Configuration.Native");
|
||||
|
||||
// Get the source
|
||||
var root = options.IntermediateFolder;
|
||||
var packagePath = Path.Combine(root, $"package.zip");
|
||||
if (!File.Exists(packagePath))
|
||||
{
|
||||
Downloader.DownloadFileFromUrlToPath("https://www.nuget.org/api/v2/package/Microsoft.VisualStudio.Setup.Configuration.Native/3.14.2075", packagePath);
|
||||
}
|
||||
var extractedPath = Path.Combine(root, "extracted");
|
||||
if (!Directory.Exists(extractedPath))
|
||||
{
|
||||
using (ZipArchive archive = ZipFile.Open(packagePath, ZipArchiveMode.Read))
|
||||
archive.ExtractToDirectory(extractedPath);
|
||||
}
|
||||
root = extractedPath;
|
||||
|
||||
foreach (var platform in options.Platforms)
|
||||
{
|
||||
foreach (var architecture in options.Architectures)
|
||||
{
|
||||
BuildStarted(platform, architecture);
|
||||
switch (platform)
|
||||
{
|
||||
case TargetPlatform.Windows:
|
||||
{
|
||||
var bin = Path.Combine(root, "lib", "native", "v141", architecture.ToString().ToLower());
|
||||
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
|
||||
Utilities.FileCopy(Path.Combine(bin, "Microsoft.VisualStudio.Setup.Configuration.Native.lib"), Path.Combine(depsFolder, "Microsoft.VisualStudio.Setup.Configuration.Native.lib"));
|
||||
|
||||
var include = Path.Combine(root, "lib", "native", "include");
|
||||
Utilities.FileCopy(Path.Combine(include, "Setup.Configuration.h"), Path.Combine(options.ThirdPartyFolder, "Microsoft.VisualStudio.Setup.Configuration.Native", "Setup.Configuration.h"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
// Copyright (c) Wojciech Figat. All rights reserved.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -90,15 +89,6 @@ namespace Flax.Deps.Dependencies
|
||||
// Get the source
|
||||
CloneGitRepoSingleBranch(root, "https://github.com/FlaxEngine/NvCloth.git", "master");
|
||||
|
||||
// Patch the CMakeLists.txt to support custom compilation flags
|
||||
foreach (var os in new[] { "android", "ios", "linux", "mac", "windows", })
|
||||
{
|
||||
var filePath = Path.Combine(nvCloth, "compiler", "cmake", os, "CMakeLists.txt");
|
||||
var appendLine = "SET(CMAKE_CXX_FLAGS \"${CMAKE_CXX_FLAGS} ${NVCLOTH_CXX_FLAGS}\")";
|
||||
if (!File.ReadAllText(filePath).Contains(appendLine))
|
||||
File.AppendAllText(filePath, Environment.NewLine + appendLine + Environment.NewLine);
|
||||
}
|
||||
|
||||
foreach (var platform in options.Platforms)
|
||||
{
|
||||
foreach (var architecture in options.Architectures)
|
||||
@@ -194,7 +184,7 @@ namespace Flax.Deps.Dependencies
|
||||
}
|
||||
break;
|
||||
case TargetPlatform.Mac:
|
||||
cmakeArgs += " -DTARGET_BUILD_PLATFORM=mac -DNVCLOTH_CXX_FLAGS=\"-Wno-error=poison-system-directories -Wno-error=missing-include-dirs\"";
|
||||
cmakeArgs += " -DTARGET_BUILD_PLATFORM=mac";
|
||||
cmakeName = "mac";
|
||||
binariesPrefix = "lib";
|
||||
break;
|
||||
@@ -204,7 +194,7 @@ namespace Flax.Deps.Dependencies
|
||||
binariesPrefix = "lib";
|
||||
break;
|
||||
case TargetPlatform.Linux:
|
||||
cmakeArgs += " -DTARGET_BUILD_PLATFORM=linux -DNVCLOTH_CXX_FLAGS=\"-Wno-error=poison-system-directories -Wno-error=missing-include-dirs\"";
|
||||
cmakeArgs += " -DTARGET_BUILD_PLATFORM=linux";
|
||||
cmakeName = "linux";
|
||||
binariesPrefix = "lib";
|
||||
break;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (c) Wojciech Figat. All rights reserved.
|
||||
//#define USE_GIT_REPOSITORY
|
||||
#define USE_GIT_REPOSITORY
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
@@ -83,7 +83,6 @@ namespace Flax.Deps.Dependencies
|
||||
var configuration = "Release";
|
||||
var cmakeArgs = "-DCMAKE_POLICY_VERSION_MINIMUM=3.5";
|
||||
var dstIncludePath = Path.Combine(options.ThirdPartyFolder, "OpenAL");
|
||||
var noSSL = true; // OpenAL Soft website has broken certs
|
||||
|
||||
#if !USE_GIT_REPOSITORY
|
||||
if (options.Platforms.Contains(TargetPlatform.Windows))
|
||||
@@ -100,7 +99,10 @@ namespace Flax.Deps.Dependencies
|
||||
var packagePath = Path.Combine(root, $"package-{version}.zip");
|
||||
if (!File.Exists(packagePath))
|
||||
{
|
||||
Downloader.DownloadFileFromUrlToPath("https://openal-soft.org/openal-releases/openal-soft-" + version + ".tar.bz2", packagePath, noSSL);
|
||||
// The certificate was expired, use alternative source
|
||||
//Downloader.DownloadFileFromUrlToPath($"https://openal-soft.org/openal-releases/openal-soft-{version}.tar.bz2", packagePath);
|
||||
Downloader.DownloadFileFromUrlToPath($"https://github.com/kcat/openal-soft/releases/download/{version}/openal-soft-{version}.tar.bz2", packagePath);
|
||||
|
||||
if (Platform.BuildTargetPlatform == TargetPlatform.Windows)
|
||||
{
|
||||
// TODO: Maybe use PowerShell Expand-Archive instead?
|
||||
|
||||
@@ -135,7 +135,8 @@ namespace Flax.Deps.Dependencies
|
||||
}
|
||||
break;
|
||||
case TargetPlatform.Linux:
|
||||
ConfigureCmakeSwitch(cmakeParams, "PHYSX_CXX_FLAGS", "\"-Wno-error=format -Wno-error=unused-but-set-variable -Wno-error=switch-default -Wno-error=invalid-offsetof -Wno-error=unsafe-buffer-usage -Wno-error=unsafe-buffer-usage-in-libc-call -Wno-error=missing-include-dirs\"");
|
||||
ConfigureCmakeSwitch(cmakeParams, "CMAKE_C_FLAGS", ""-Wno-error=format -Wno-error=unused-but-set-variable -Wno-error=switch-default -Wno-error=invalid-offsetof -Wno-error=unsafe-buffer-usage -Wno-error=unsafe-buffer-usage-in-libc-call -Wno-error=missing-include-dirs"");
|
||||
ConfigureCmakeSwitch(cmakeParams, "CMAKE_CXX_FLAGS", ""-Wno-error=format -Wno-error=unused-but-set-variable -Wno-error=switch-default -Wno-error=invalid-offsetof -Wno-error=unsafe-buffer-usage -Wno-error=unsafe-buffer-usage-in-libc-call -Wno-error=missing-include-dirs"");
|
||||
break;
|
||||
case TargetPlatform.Android:
|
||||
ConfigureCmakeSwitch(cmakeParams, "CMAKE_INSTALL_PREFIX", $"install/android-{Configuration.AndroidPlatformApi}/PhysX");
|
||||
@@ -144,7 +145,8 @@ namespace Flax.Deps.Dependencies
|
||||
break;
|
||||
case TargetPlatform.Mac:
|
||||
ConfigureCmakeSwitch(cmakeParams, "CMAKE_OSX_DEPLOYMENT_TARGET", Configuration.MacOSXMinVer);
|
||||
ConfigureCmakeSwitch(cmakeParams, "PHYSX_CXX_FLAGS", "\"-Wno-error=format -Wno-error=unused-but-set-variable -Wno-error=switch-default -Wno-error=invalid-offsetof -Wno-error=unsafe-buffer-usage -Wno-error=unsafe-buffer-usage-in-libc-call -Wno-error=missing-include-dirs\"");
|
||||
ConfigureCmakeSwitch(cmakeParams, "CMAKE_C_FLAGS", ""-Wno-error=format -Wno-error=unused-but-set-variable -Wno-error=switch-default -Wno-error=invalid-offsetof -Wno-error=unsafe-buffer-usage -Wno-error=unsafe-buffer-usage-in-libc-call -Wno-error=missing-include-dirs"");
|
||||
ConfigureCmakeSwitch(cmakeParams, "CMAKE_CXX_FLAGS", ""-Wno-error=format -Wno-error=unused-but-set-variable -Wno-error=switch-default -Wno-error=invalid-offsetof -Wno-error=unsafe-buffer-usage -Wno-error=unsafe-buffer-usage-in-libc-call -Wno-error=missing-include-dirs"");
|
||||
break;
|
||||
case TargetPlatform.iOS:
|
||||
ConfigureCmakeSwitch(cmakeParams, "CMAKE_OSX_DEPLOYMENT_TARGET", Configuration.iOSMinVer);
|
||||
@@ -423,20 +425,15 @@ namespace Flax.Deps.Dependencies
|
||||
{
|
||||
if (architecture == TargetArchitecture.x64 || architecture == TargetArchitecture.ARM64)
|
||||
{
|
||||
if (WindowsPlatform.GetToolsets().Any(x => x.Key == WindowsPlatformToolset.v145))
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
Build(options, architecture == TargetArchitecture.x64 ? "vc18win64" : "vc18win-arm64", platform, architecture);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Warning($"Failed to generate VS2026 solution for PhysX, fallback to VS2022: {e.Message}");
|
||||
Build(options, architecture == TargetArchitecture.x64 ? "vc17win64" : "vc17win-arm64", platform, architecture);
|
||||
}
|
||||
Build(options, architecture == TargetArchitecture.x64 ? "vc18win64" : "vc18win-arm64", platform, architecture);
|
||||
}
|
||||
else
|
||||
catch
|
||||
{
|
||||
Log.Verbose("Failed to generate VS2026 solution for PhysX, fallback to VS2022");
|
||||
Build(options, architecture == TargetArchitecture.x64 ? "vc17win64" : "vc17win-arm64", platform, architecture);
|
||||
}
|
||||
}
|
||||
else
|
||||
throw new InvalidArchitectureException(architecture);
|
||||
@@ -499,7 +496,7 @@ namespace Flax.Deps.Dependencies
|
||||
var dstIncludePath = Path.Combine(options.ThirdPartyFolder, "PhysX");
|
||||
Directory.GetFiles(dstIncludePath, "*.h", SearchOption.AllDirectories).ToList().ForEach(File.Delete);
|
||||
Utilities.FileCopy(Path.Combine(root, "LICENSE.md"), Path.Combine(dstIncludePath, "License.txt"));
|
||||
Utilities.DirectoryCopy(Path.Combine(root, "physx", "include"), dstIncludePath, true, true);
|
||||
Utilities.DirectoryCopy(Path.Combine(root, "physx", "include"), dstIncludePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
// Copyright (c) Wojciech Figat. All rights reserved.
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using Flax.Build;
|
||||
using Flax.Build.Platforms;
|
||||
|
||||
namespace Flax.Deps.Dependencies
|
||||
{
|
||||
/// <summary>
|
||||
/// WinPixEventRuntime. https://github.com/microsoft/PixEvents
|
||||
/// </summary>
|
||||
/// <seealso cref="Flax.Deps.Dependency" />
|
||||
class WinPixEventRuntime : Dependency
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override TargetPlatform[] Platforms
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (BuildPlatform)
|
||||
{
|
||||
case TargetPlatform.Windows:
|
||||
return new[]
|
||||
{
|
||||
TargetPlatform.Windows,
|
||||
};
|
||||
default: return new TargetPlatform[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override TargetArchitecture[] Architectures
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (BuildPlatform)
|
||||
{
|
||||
case TargetPlatform.Windows:
|
||||
return new[]
|
||||
{
|
||||
TargetArchitecture.x64,
|
||||
TargetArchitecture.ARM64,
|
||||
};
|
||||
default: return new TargetArchitecture[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Build(BuildOptions options)
|
||||
{
|
||||
// Get the source
|
||||
var root = options.IntermediateFolder;
|
||||
var packagePath = Path.Combine(root, $"package.zip");
|
||||
if (!File.Exists(packagePath))
|
||||
{
|
||||
Downloader.DownloadFileFromUrlToPath("https://www.nuget.org/api/v2/package/WinPixEventRuntime/1.0.240308001", packagePath);
|
||||
}
|
||||
var extractedPath = Path.Combine(root, "extracted");
|
||||
if (!Directory.Exists(extractedPath))
|
||||
{
|
||||
using (ZipArchive archive = ZipFile.Open(packagePath, ZipArchiveMode.Read))
|
||||
archive.ExtractToDirectory(extractedPath);
|
||||
}
|
||||
root = extractedPath;
|
||||
|
||||
foreach (var platform in options.Platforms)
|
||||
{
|
||||
foreach (var architecture in options.Architectures)
|
||||
{
|
||||
BuildStarted(platform, architecture);
|
||||
switch (platform)
|
||||
{
|
||||
case TargetPlatform.Windows:
|
||||
{
|
||||
var bin = Path.Combine(root, "bin", architecture.ToString());
|
||||
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
|
||||
Utilities.FileCopy(Path.Combine(bin, "WinPixEventRuntime.dll"), Path.Combine(depsFolder, "WinPixEventRuntime.dll"));
|
||||
Utilities.FileCopy(Path.Combine(bin, "WinPixEventRuntime.lib"), Path.Combine(depsFolder, "WinPixEventRuntime.lib"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
// Copyright (c) Wojciech Figat. All rights reserved.
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using Flax.Build;
|
||||
|
||||
@@ -83,8 +82,7 @@ namespace Flax.Deps.Dependencies
|
||||
|
||||
// Setup the external sources
|
||||
// Requires distutils (pip install setuptools)
|
||||
if (Utilities.Run(BuildPlatform != TargetPlatform.Mac ? "python" : "python3", "update_glslang_sources.py", null, root, Utilities.RunOptions.ConsoleLogOutput) != 0)
|
||||
throw new Exception("Failed to update glslang sources, make sure setuptools python package is installed.");
|
||||
Utilities.Run("python", "update_glslang_sources.py", null, root, Utilities.RunOptions.ConsoleLogOutput);
|
||||
|
||||
foreach (var platform in options.Platforms)
|
||||
{
|
||||
|
||||
@@ -83,20 +83,18 @@ namespace Flax.Deps.Dependencies
|
||||
{
|
||||
public string Filename;
|
||||
public string SrcFolder;
|
||||
public string DstFilename;
|
||||
|
||||
public Binary(string filename, string srcFolder, string dstFilename = null)
|
||||
public Binary(string filename, string srcFolder)
|
||||
{
|
||||
Filename = filename;
|
||||
SrcFolder = srcFolder;
|
||||
DstFilename = dstFilename;
|
||||
}
|
||||
}
|
||||
|
||||
private bool hasSourcesReady;
|
||||
private string root;
|
||||
private string rootMsvcLib;
|
||||
private string _configuration = "Release";
|
||||
private string configurationMsvc;
|
||||
private List<string> vcxprojContentsWindows;
|
||||
private string[] vcxprojPathsWindows;
|
||||
|
||||
@@ -106,6 +104,22 @@ namespace Flax.Deps.Dependencies
|
||||
new Binary("libvorbisfile_static.lib", "libvorbisfile"),
|
||||
};
|
||||
|
||||
private (string, string)[] vorbisBinariesToCopyWindowsCmake =
|
||||
{
|
||||
("vorbis.lib", "libvorbis_static.lib"),
|
||||
("vorbisfile.lib", "libvorbisfile_static.lib"),
|
||||
};
|
||||
|
||||
private Binary[] oggBinariesToCopyWindows =
|
||||
{
|
||||
new Binary("libogg_static.lib", "ogg"),
|
||||
};
|
||||
|
||||
private (string, string)[] oggBinariesToCopyWindowsCmake =
|
||||
{
|
||||
("ogg.lib", "libogg_static.lib"),
|
||||
};
|
||||
|
||||
private void PatchWindowsTargetPlatformVersion(string windowsTargetPlatformVersion, string platformToolset)
|
||||
{
|
||||
// Fix the MSVC project settings for Windows
|
||||
@@ -123,6 +137,7 @@ namespace Flax.Deps.Dependencies
|
||||
return;
|
||||
|
||||
hasSourcesReady = true;
|
||||
configurationMsvc = "Release";
|
||||
|
||||
string oggRoot = Path.Combine(root, "libogg");
|
||||
string vorbisRoot = Path.Combine(root, "libvorbis");
|
||||
@@ -212,7 +227,7 @@ namespace Flax.Deps.Dependencies
|
||||
break;
|
||||
default: throw new InvalidArchitectureException(architecture);
|
||||
}
|
||||
binariesToCopy.AddRange(vorbisBinariesToCopyWindows.Select(x => new Binary(x.Filename, Path.Combine(buildDir, x.SrcFolder, buildPlatform, _configuration))));
|
||||
binariesToCopy.AddRange(vorbisBinariesToCopyWindows.Select(x => new Binary(x.Filename, Path.Combine(buildDir, x.SrcFolder, buildPlatform, configurationMsvc))));
|
||||
break;
|
||||
}
|
||||
case TargetPlatform.PS4:
|
||||
@@ -231,7 +246,7 @@ namespace Flax.Deps.Dependencies
|
||||
buildDir, true, true);
|
||||
Utilities.FileCopy(Path.Combine(GetBinariesFolder(options, platform), "Data", "ogg", "ogg", "config_types.h"),
|
||||
Path.Combine(root, "libogg", "include", "ogg", "config_types.h"));
|
||||
binariesToCopy.AddRange(binariesToCopyVorbis.Select(x => new Binary(x.Filename, Path.Combine(buildDir, x.SrcFolder, buildPlatform, _configuration))));
|
||||
binariesToCopy.AddRange(binariesToCopyVorbis.Select(x => new Binary(x.Filename, Path.Combine(buildDir, x.SrcFolder, buildPlatform, configurationMsvc))));
|
||||
break;
|
||||
}
|
||||
case TargetPlatform.PS5:
|
||||
@@ -252,7 +267,7 @@ namespace Flax.Deps.Dependencies
|
||||
Utilities.FileCopy(
|
||||
Path.Combine(GetBinariesFolder(options, platform), "Data", "ogg", "ogg", "config_types.h"),
|
||||
Path.Combine(root, "libogg", "include", "ogg", "config_types.h"));
|
||||
binariesToCopy.AddRange(binariesToCopyVorbis.Select(x => new Binary(x.Filename, Path.Combine(buildDir, x.SrcFolder, buildPlatform, _configuration))));
|
||||
binariesToCopy.AddRange(binariesToCopyVorbis.Select(x => new Binary(x.Filename, Path.Combine(buildDir, x.SrcFolder, buildPlatform, configurationMsvc))));
|
||||
break;
|
||||
}
|
||||
case TargetPlatform.XboxOne:
|
||||
@@ -260,21 +275,21 @@ namespace Flax.Deps.Dependencies
|
||||
vcxprojPaths = vcxprojPathsWindows;
|
||||
buildPlatform = "x64";
|
||||
PatchWindowsTargetPlatformVersion("10.0", "v143");
|
||||
binariesToCopy.AddRange(vorbisBinariesToCopyWindows.Select(x => new Binary(x.Filename, Path.Combine(buildDir, x.SrcFolder, buildPlatform, _configuration))));
|
||||
binariesToCopy.AddRange(vorbisBinariesToCopyWindows.Select(x => new Binary(x.Filename, Path.Combine(buildDir, x.SrcFolder, buildPlatform, configurationMsvc))));
|
||||
break;
|
||||
case TargetPlatform.XboxScarlett:
|
||||
buildDir = Path.Combine(rootMsvcLib, "win32", "VS2010");
|
||||
vcxprojPaths = vcxprojPathsWindows;
|
||||
buildPlatform = "x64";
|
||||
PatchWindowsTargetPlatformVersion("10.0", "v143");
|
||||
binariesToCopy.AddRange(vorbisBinariesToCopyWindows.Select(x => new Binary(x.Filename, Path.Combine(buildDir, x.SrcFolder, buildPlatform, _configuration))));
|
||||
binariesToCopy.AddRange(vorbisBinariesToCopyWindows.Select(x => new Binary(x.Filename, Path.Combine(buildDir, x.SrcFolder, buildPlatform, configurationMsvc))));
|
||||
break;
|
||||
default: throw new InvalidPlatformException(platform);
|
||||
}
|
||||
|
||||
// Build
|
||||
foreach (var vcxprojPath in vcxprojPaths)
|
||||
Deploy.VCEnvironment.BuildSolution(vcxprojPath, _configuration, buildPlatform);
|
||||
Deploy.VCEnvironment.BuildSolution(vcxprojPath, configurationMsvc, buildPlatform);
|
||||
|
||||
// Copy binaries
|
||||
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
|
||||
@@ -288,107 +303,48 @@ namespace Flax.Deps.Dependencies
|
||||
|
||||
string oggRoot = Path.Combine(root, "libogg");
|
||||
string vorbisRoot = Path.Combine(root, "libvorbis");
|
||||
|
||||
var oggBuildDir = Path.Combine(oggRoot, "build-" + architecture.ToString());
|
||||
var vorbisBuildDir = Path.Combine(vorbisRoot, "build-" + architecture.ToString());
|
||||
var installDir = Path.Combine(root, "install");
|
||||
|
||||
string ext;
|
||||
string oggConfig = $"-DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DCMAKE_BUILD_TYPE={_configuration} -DCMAKE_INSTALL_PREFIX=\"{installDir}\"";
|
||||
string vorbisConfig = $"-DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DCMAKE_BUILD_TYPE={_configuration} -DCMAKE_INSTALL_PREFIX=\"{installDir}\"";
|
||||
string liboggFilename = "libogg";
|
||||
Dictionary<string, string> envVars = new Dictionary<string, string>();
|
||||
(string, string)[] oggBinariesToCopy;
|
||||
Binary[] vorbisBinariesToCopy;
|
||||
switch (platform)
|
||||
{
|
||||
case TargetPlatform.Windows:
|
||||
case TargetPlatform.UWP:
|
||||
case TargetPlatform.XboxOne:
|
||||
oggConfig += " -DBUILD_SHARED_LIBS=OFF";
|
||||
vorbisConfig += " -DBUILD_SHARED_LIBS=OFF";
|
||||
ext = ".lib";
|
||||
liboggFilename = "ogg";
|
||||
break;
|
||||
case TargetPlatform.Linux:
|
||||
oggConfig += " -DCMAKE_POSITION_INDEPENDENT_CODE=ON";
|
||||
vorbisConfig += " -DCMAKE_POSITION_INDEPENDENT_CODE=ON";
|
||||
envVars = new Dictionary<string, string>
|
||||
{
|
||||
{ "CC", "clang-" + Configuration.LinuxClangMinVer },
|
||||
{ "CC_FOR_BUILD", "clang-" + Configuration.LinuxClangMinVer }
|
||||
};
|
||||
ext = ".a";
|
||||
break;
|
||||
case TargetPlatform.Mac:
|
||||
//oggConfig += $" -DOGG_INCLUDE_DIR=\"{oggRoot}/install/include\" -DOGG_LIBRARY=\"{oggRoot}/install/lib\"";
|
||||
ext = ".a";
|
||||
break;
|
||||
default: throw new InvalidPlatformException(platform);
|
||||
}
|
||||
|
||||
switch (platform)
|
||||
{
|
||||
case TargetPlatform.Windows:
|
||||
case TargetPlatform.UWP:
|
||||
case TargetPlatform.XboxOne:
|
||||
oggBinariesToCopy =
|
||||
[
|
||||
("ogg.lib", "libogg_static.lib")
|
||||
];
|
||||
vorbisBinariesToCopy =
|
||||
[
|
||||
new Binary("vorbis.lib", "libvorbis", "libvorbis_static.lib"),
|
||||
new Binary("vorbisfile.lib", "libvorbisfile", "libvorbisfile_static.lib")
|
||||
];
|
||||
break;
|
||||
case TargetPlatform.Linux:
|
||||
case TargetPlatform.Mac:
|
||||
oggBinariesToCopy =
|
||||
[
|
||||
("libogg.a", "libogg.a")
|
||||
];
|
||||
vorbisBinariesToCopy =
|
||||
[
|
||||
new Binary("libvorbis.a", "lib"),
|
||||
new Binary("libvorbisenc.a", "lib"),
|
||||
new Binary("libvorbisfile.a", "lib")
|
||||
];
|
||||
break;
|
||||
default: throw new InvalidPlatformException(platform);
|
||||
}
|
||||
|
||||
vorbisConfig += $" -DOGG_INCLUDE_DIR=\"{Path.Combine(installDir, "include")}\" -DOGG_LIBRARY=\"{Path.Combine(installDir, "lib", liboggFilename + ext)}\"";
|
||||
|
||||
var binariesToCopy = new List<(string, string)>();
|
||||
|
||||
SetupDirectory(installDir, true);
|
||||
// Build ogg
|
||||
{
|
||||
SetupDirectory(oggBuildDir, true);
|
||||
RunCmake(oggRoot, platform, architecture, $"-B\"{oggBuildDir}\" " + oggConfig, envVars);
|
||||
if (platform == TargetPlatform.Windows)
|
||||
Deploy.VCEnvironment.BuildSolution(Path.Combine(oggBuildDir, "ogg.sln"), _configuration, architecture.ToString());
|
||||
else
|
||||
BuildCmake(oggBuildDir);
|
||||
Utilities.Run("cmake", $"--build . --config {_configuration} --target install", null, oggBuildDir, Utilities.RunOptions.DefaultTool);
|
||||
var solutionPath = Path.Combine(oggBuildDir, "ogg.sln");
|
||||
|
||||
RunCmake(oggRoot, platform, architecture, $"-B\"{oggBuildDir}\" -DBUILD_SHARED_LIBS=OFF -DCMAKE_POLICY_VERSION_MINIMUM=3.5");
|
||||
Deploy.VCEnvironment.BuildSolution(solutionPath, configurationMsvc, architecture.ToString());
|
||||
foreach (var file in oggBinariesToCopyWindowsCmake)
|
||||
binariesToCopy.Add((Path.Combine(oggBuildDir, configurationMsvc, file.Item1), file.Item2));
|
||||
}
|
||||
|
||||
// Build vorbis
|
||||
{
|
||||
SetupDirectory(vorbisBuildDir, true);
|
||||
RunCmake(vorbisRoot, platform, architecture, $"-B\"{vorbisBuildDir}\" " + vorbisConfig);
|
||||
if (platform == TargetPlatform.Windows)
|
||||
Deploy.VCEnvironment.BuildSolution(Path.Combine(vorbisBuildDir, "vorbis.sln"), _configuration, architecture.ToString());
|
||||
else
|
||||
BuildCmake(vorbisBuildDir);
|
||||
Utilities.Run("cmake", $"--build . --config {_configuration} --target install", null, vorbisBuildDir, Utilities.RunOptions.DefaultTool);
|
||||
var oggLibraryPath = Path.Combine(oggBuildDir, configurationMsvc, "ogg" + ext);
|
||||
var solutionPath = Path.Combine(vorbisBuildDir, "vorbis.sln");
|
||||
|
||||
RunCmake(vorbisRoot, platform, architecture, $"-B\"{vorbisBuildDir}\" -DOGG_INCLUDE_DIR=\"{Path.Combine(oggRoot, "include")}\" -DOGG_LIBRARY=\"{oggLibraryPath}\" -DBUILD_SHARED_LIBS=OFF -DCMAKE_POLICY_VERSION_MINIMUM=3.5");
|
||||
Deploy.VCEnvironment.BuildSolution(solutionPath, configurationMsvc, architecture.ToString());
|
||||
foreach (var file in vorbisBinariesToCopyWindowsCmake)
|
||||
binariesToCopy.Add((Path.Combine(vorbisBuildDir, "lib", configurationMsvc, file.Item1), file.Item2));
|
||||
}
|
||||
|
||||
// Copy binaries
|
||||
foreach (var file in oggBinariesToCopy)
|
||||
binariesToCopy.Add((Path.Combine(installDir, "lib", file.Item1), file.Item2));
|
||||
foreach (var file in vorbisBinariesToCopy)
|
||||
binariesToCopy.Add((Path.Combine(installDir, "lib", file.Filename), file.DstFilename ?? file.Filename));
|
||||
|
||||
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
|
||||
foreach (var file in binariesToCopy)
|
||||
Utilities.FileCopy(file.Item1, Path.Combine(depsFolder, file.Item2));
|
||||
@@ -433,7 +389,29 @@ namespace Flax.Deps.Dependencies
|
||||
}
|
||||
case TargetPlatform.Linux:
|
||||
{
|
||||
BuildCmake(options, TargetPlatform.Linux, architecture);
|
||||
// Note: assumes the libogg-dev package is pre-installed on the system
|
||||
|
||||
// Get the source
|
||||
CloneGitRepoFast(root, "https://github.com/xiph/vorbis.git");
|
||||
|
||||
var envVars = new Dictionary<string, string>
|
||||
{
|
||||
{ "CC", "clang-" + Configuration.LinuxClangMinVer },
|
||||
{ "CC_FOR_BUILD", "clang-" + Configuration.LinuxClangMinVer }
|
||||
};
|
||||
var buildDir = Path.Combine(root, "build");
|
||||
|
||||
Utilities.Run(Path.Combine(root, "autogen.sh"), null, null, root, Utilities.RunOptions.Default, envVars);
|
||||
|
||||
// Build for Linux
|
||||
var toolchain = UnixToolchain.GetToolchainName(platform, architecture);
|
||||
Utilities.Run(Path.Combine(root, "configure"), string.Format("--host={0}", toolchain), null, root, Utilities.RunOptions.Default, envVars);
|
||||
SetupDirectory(buildDir, true);
|
||||
Utilities.Run("cmake", "-G \"Unix Makefiles\" -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release ..", null, buildDir, Utilities.RunOptions.ConsoleLogOutput, envVars);
|
||||
Utilities.Run("cmake", "--build .", null, buildDir, Utilities.RunOptions.ConsoleLogOutput, envVars);
|
||||
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
|
||||
foreach (var file in binariesToCopyUnix)
|
||||
Utilities.FileCopy(Path.Combine(buildDir, file.SrcFolder, file.Filename), Path.Combine(depsFolder, file.Filename));
|
||||
break;
|
||||
}
|
||||
case TargetPlatform.PS4:
|
||||
@@ -465,7 +443,7 @@ namespace Flax.Deps.Dependencies
|
||||
// Build for Android
|
||||
SetupDirectory(oggBuildDir, true);
|
||||
RunCmake(oggBuildDir, platform, TargetArchitecture.ARM64, ".. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=\"../install\"");
|
||||
Utilities.Run("cmake", "--build . --config Release --target install", null, oggBuildDir, Utilities.RunOptions.ConsoleLogOutput);
|
||||
Utilities.Run("cmake", "--build . --target install", null, oggBuildDir, Utilities.RunOptions.ConsoleLogOutput);
|
||||
SetupDirectory(buildDir, true);
|
||||
RunCmake(buildDir, platform, TargetArchitecture.ARM64, string.Format(".. -DCMAKE_BUILD_TYPE=Release -DOGG_INCLUDE_DIR=\"{0}/install/include\" -DOGG_LIBRARY=\"{0}/install/lib\"", oggRoot));
|
||||
BuildCmake(buildDir);
|
||||
@@ -480,33 +458,51 @@ namespace Flax.Deps.Dependencies
|
||||
var oggBuildDir = Path.Combine(oggRoot, "build");
|
||||
var buildDir = Path.Combine(root, "build");
|
||||
|
||||
// Get the source
|
||||
SetupDirectory(oggRoot, false);
|
||||
CloneGitRepo(root, "https://github.com/xiph/vorbis.git");
|
||||
GitCheckout(root, "master", "98eddc72d36e3421519d54b101c09b57e4d4d10d");
|
||||
CloneGitRepo(oggRoot, "https://github.com/xiph/ogg.git");
|
||||
GitCheckout(oggRoot, "master", "4380566a44b8d5e85ad511c9c17eb04197863ec5");
|
||||
Utilities.DirectoryCopy(Path.Combine(GetBinariesFolder(options, platform), "Data/ogg"), oggRoot, true, true);
|
||||
Utilities.DirectoryCopy(Path.Combine(GetBinariesFolder(options, platform), "Data/vorbis"), buildDir, true, true);
|
||||
|
||||
// Build for Switch
|
||||
SetupDirectory(oggBuildDir, true);
|
||||
RunCmake(oggBuildDir, platform, TargetArchitecture.ARM64, ".. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=\"../install\"");
|
||||
Utilities.Run("cmake", "--build . --target install", null, oggBuildDir, Utilities.RunOptions.ConsoleLogOutput);
|
||||
Utilities.FileCopy(Path.Combine(GetBinariesFolder(options, platform), "Data/ogg", "include", "ogg", "config_types.h"), Path.Combine(oggRoot, "install", "include", "ogg", "config_types.h"));
|
||||
SetupDirectory(buildDir, true);
|
||||
RunCmake(buildDir, platform, TargetArchitecture.ARM64, string.Format(".. -DCMAKE_BUILD_TYPE=Release -DOGG_INCLUDE_DIR=\"{0}/install/include\" -DOGG_LIBRARY=\"{0}/install/lib\"", oggRoot));
|
||||
BuildCmake(buildDir);
|
||||
var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.ARM64);
|
||||
foreach (var file in binariesToCopyUnix)
|
||||
Utilities.FileCopy(Path.Combine(buildDir, file.SrcFolder, file.Filename), Path.Combine(depsFolder, file.Filename));
|
||||
break;
|
||||
}
|
||||
case TargetPlatform.Mac:
|
||||
{
|
||||
var oggRoot = Path.Combine(root, "ogg");
|
||||
var oggBuildDir = Path.Combine(oggRoot, "build");
|
||||
var buildDir = Path.Combine(root, "build");
|
||||
|
||||
// Get the source
|
||||
SetupDirectory(oggRoot, false);
|
||||
CloneGitRepo(root, "https://github.com/xiph/vorbis.git");
|
||||
GitCheckout(root, "master", "98eddc72d36e3421519d54b101c09b57e4d4d10d");
|
||||
CloneGitRepoFast(root, "https://github.com/xiph/vorbis.git");
|
||||
CloneGitRepo(oggRoot, "https://github.com/xiph/ogg.git");
|
||||
GitCheckout(oggRoot, "master", "4380566a44b8d5e85ad511c9c17eb04197863ec5");
|
||||
Utilities.DirectoryCopy(Path.Combine(GetBinariesFolder(options, platform), "Data/ogg"), oggRoot, true, true);
|
||||
Utilities.DirectoryCopy(Path.Combine(GetBinariesFolder(options, platform), "Data/vorbis"), buildDir, true, true);
|
||||
|
||||
// Build for Switch
|
||||
// Build for Mac
|
||||
SetupDirectory(oggBuildDir, true);
|
||||
RunCmake(oggBuildDir, platform, TargetArchitecture.ARM64, ".. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=\"../install\"");
|
||||
Utilities.Run("cmake", "--build . --config Release --target install", null, oggBuildDir, Utilities.RunOptions.ConsoleLogOutput);
|
||||
Utilities.FileCopy(Path.Combine(GetBinariesFolder(options, platform), "Data/ogg", "include", "ogg", "config_types.h"), Path.Combine(oggRoot, "install", "include", "ogg", "config_types.h"));
|
||||
RunCmake(oggBuildDir, platform, architecture, ".. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=\"../install\"");
|
||||
Utilities.Run("cmake", "--build . --target install", null, oggBuildDir, Utilities.RunOptions.ConsoleLogOutput);
|
||||
SetupDirectory(buildDir, true);
|
||||
RunCmake(buildDir, platform, TargetArchitecture.ARM64, string.Format(".. -DCMAKE_BUILD_TYPE=Release -DOGG_INCLUDE_DIR=\"{0}/install/include\" -DOGG_LIBRARY=\"{0}/install/lib\"", oggRoot));
|
||||
RunCmake(buildDir, platform, architecture, string.Format(".. -DCMAKE_BUILD_TYPE=Release -DOGG_INCLUDE_DIR=\"{0}/install/include\" -DOGG_LIBRARY=\"{0}/install/lib\"", oggRoot));
|
||||
BuildCmake(buildDir);
|
||||
var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.ARM64);
|
||||
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
|
||||
foreach (var file in binariesToCopyUnix)
|
||||
Utilities.FileCopy(Path.Combine(buildDir, file.SrcFolder, file.Filename), Path.Combine(depsFolder, file.Filename));
|
||||
break;
|
||||
}
|
||||
case TargetPlatform.Mac:
|
||||
{
|
||||
BuildCmake(options, TargetPlatform.Mac, architecture);
|
||||
break;
|
||||
}
|
||||
case TargetPlatform.iOS:
|
||||
{
|
||||
var oggRoot = Path.Combine(root, "ogg");
|
||||
@@ -521,7 +517,7 @@ namespace Flax.Deps.Dependencies
|
||||
// Build for Mac
|
||||
SetupDirectory(oggBuildDir, true);
|
||||
RunCmake(oggBuildDir, platform, TargetArchitecture.ARM64, ".. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=\"../install\"");
|
||||
Utilities.Run("cmake", "--build . --config Release --target install", null, oggBuildDir, Utilities.RunOptions.ConsoleLogOutput);
|
||||
Utilities.Run("cmake", "--build . --target install", null, oggBuildDir, Utilities.RunOptions.ConsoleLogOutput);
|
||||
SetupDirectory(buildDir, true);
|
||||
RunCmake(buildDir, platform, TargetArchitecture.ARM64, string.Format(".. -DCMAKE_BUILD_TYPE=Release -DOGG_INCLUDE_DIR=\"{0}/install/include\" -DOGG_LIBRARY=\"{0}/install/lib\"", oggRoot));
|
||||
BuildCmake(buildDir);
|
||||
@@ -534,17 +530,37 @@ namespace Flax.Deps.Dependencies
|
||||
}
|
||||
}
|
||||
|
||||
// Setup headers directory
|
||||
var installDir = Path.Combine(root, "install");
|
||||
var oggOut = Path.Combine(options.ThirdPartyFolder, "ogg");
|
||||
var vorbisOut = Path.Combine(options.ThirdPartyFolder, "vorbis");
|
||||
// Backup files
|
||||
if (hasSourcesReady)
|
||||
root = rootMsvcLib;
|
||||
var srcIncludePath = Path.Combine(root, "include", "vorbis");
|
||||
var dstIncludePath = Path.Combine(options.ThirdPartyFolder, "vorbis");
|
||||
foreach (var filename in filesToKeep)
|
||||
{
|
||||
var src = Path.Combine(dstIncludePath, filename);
|
||||
var dst = Path.Combine(options.IntermediateFolder, filename + ".tmp");
|
||||
Utilities.FileCopy(src, dst);
|
||||
}
|
||||
|
||||
// Deploy header files
|
||||
Utilities.DirectoryCopy(Path.Combine(installDir, "include", "ogg"), oggOut, true, true);
|
||||
Utilities.DirectoryCopy(Path.Combine(installDir, "include", "vorbis"), vorbisOut, true, true);
|
||||
try
|
||||
{
|
||||
// Setup headers directory
|
||||
SetupDirectory(dstIncludePath, true);
|
||||
|
||||
Utilities.FileCopy(Path.Combine(root, "libogg", "COPYING"), Path.Combine(oggOut, "COPYING"));
|
||||
Utilities.FileCopy(Path.Combine(root, "libvorbis", "COPYING"), Path.Combine(vorbisOut, "COPYING"));
|
||||
// Deploy header files and restore files
|
||||
Directory.GetFiles(srcIncludePath, "Makefile*").ToList().ForEach(File.Delete);
|
||||
Utilities.DirectoryCopy(srcIncludePath, dstIncludePath, true, true);
|
||||
Utilities.FileCopy(Path.Combine(root, "COPYING"), Path.Combine(dstIncludePath, "COPYING"));
|
||||
}
|
||||
finally
|
||||
{
|
||||
foreach (var filename in filesToKeep)
|
||||
{
|
||||
var src = Path.Combine(options.IntermediateFolder, filename + ".tmp");
|
||||
var dst = Path.Combine(dstIncludePath, filename);
|
||||
Utilities.FileCopy(src, dst);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,20 +14,20 @@ namespace Flax.Deps
|
||||
/// </summary>
|
||||
static class Downloader
|
||||
{
|
||||
private static bool NoSSL = false;
|
||||
private static bool IgnoreSSL = false;
|
||||
private const string GoogleDriveDomain = "drive.google.com";
|
||||
private const string GoogleDriveDomain2 = "https://drive.google.com";
|
||||
|
||||
// Normal example: FileDownloader.DownloadFileFromURLToPath( "http://example.com/file/download/link", @"C:\file.txt" );
|
||||
// Drive example: FileDownloader.DownloadFileFromURLToPath( "http://drive.google.com/file/d/FILEID/view?usp=sharing", @"C:\file.txt" );
|
||||
public static FileInfo DownloadFileFromUrlToPath(string url, string path, bool noSSL = false)
|
||||
public static FileInfo DownloadFileFromUrlToPath(string url, string path)
|
||||
{
|
||||
Log.Info(string.Format("Downloading {0} to {1}", url, path));
|
||||
if (File.Exists(path))
|
||||
File.Delete(path);
|
||||
if (url.StartsWith(GoogleDriveDomain) || url.StartsWith(GoogleDriveDomain2))
|
||||
return DownloadGoogleDriveFileFromUrlToPath(url, path, noSSL);
|
||||
return DownloadFileFromUrlToPath(url, path, null, noSSL);
|
||||
return DownloadGoogleDriveFileFromUrlToPath(url, path);
|
||||
return DownloadFileFromUrlToPath(url, path, null);
|
||||
}
|
||||
|
||||
private static FileInfo DownloadFileFromUrlToPathRaw(string url, string path, HttpClient httpClient)
|
||||
@@ -49,14 +49,16 @@ namespace Flax.Deps
|
||||
return new FileInfo(path);
|
||||
}
|
||||
|
||||
private static FileInfo DownloadFileFromUrlToPath(string url, string path, HttpClient httpClient, bool noSSL)
|
||||
private static FileInfo DownloadFileFromUrlToPath(string url, string path, HttpClient httpClient)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (httpClient == null)
|
||||
{
|
||||
using (httpClient = GetHttpClient(noSSL))
|
||||
using (httpClient = GetHttpClient())
|
||||
{
|
||||
return DownloadFileFromUrlToPathRaw(url, path, httpClient);
|
||||
}
|
||||
}
|
||||
return DownloadFileFromUrlToPathRaw(url, path, httpClient);
|
||||
}
|
||||
@@ -124,12 +126,12 @@ namespace Flax.Deps
|
||||
// Downloading large files from Google Drive prompts a warning screen and
|
||||
// requires manual confirmation. Consider that case and try to confirm the download automatically
|
||||
// if warning prompt occurs
|
||||
private static FileInfo DownloadGoogleDriveFileFromUrlToPath(string url, string path, bool noSSL)
|
||||
private static FileInfo DownloadGoogleDriveFileFromUrlToPath(string url, string path)
|
||||
{
|
||||
// You can comment the statement below if the provided url is guaranteed to be in the following format:
|
||||
// https://drive.google.com/uc?id=FILEID&export=download
|
||||
url = GetGoogleDriveDownloadLinkFromUrl(url);
|
||||
using (var httpClient = GetHttpClient(noSSL))
|
||||
using (var httpClient = GetHttpClient())
|
||||
{
|
||||
FileInfo downloadedFile;
|
||||
|
||||
@@ -137,7 +139,7 @@ namespace Flax.Deps
|
||||
// but works in the second attempt
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
downloadedFile = DownloadFileFromUrlToPath(url, path, httpClient, noSSL);
|
||||
downloadedFile = DownloadFileFromUrlToPath(url, path, httpClient);
|
||||
if (downloadedFile == null)
|
||||
return null;
|
||||
|
||||
@@ -170,7 +172,7 @@ namespace Flax.Deps
|
||||
url = "https://drive.google.com" + content.Substring(linkIndex, linkEnd - linkIndex).Replace("&", "&");
|
||||
}
|
||||
|
||||
downloadedFile = DownloadFileFromUrlToPath(url, path, httpClient, noSSL);
|
||||
downloadedFile = DownloadFileFromUrlToPath(url, path, httpClient);
|
||||
return downloadedFile;
|
||||
}
|
||||
}
|
||||
@@ -209,10 +211,11 @@ namespace Flax.Deps
|
||||
return string.Format("https://drive.google.com/uc?id={0}&export=download", url.Substring(index, closingIndex - index));
|
||||
}
|
||||
|
||||
private static HttpClient GetHttpClient(bool noSSL)
|
||||
private static HttpClient GetHttpClient()
|
||||
{
|
||||
if (noSSL || NoSSL)
|
||||
if (IgnoreSSL)
|
||||
{
|
||||
Log.Warning("Accessing HTTP with SSL certificate validation disabled!");
|
||||
var handler = new HttpClientHandler();
|
||||
handler.ClientCertificateOptions = ClientCertificateOption.Manual;
|
||||
handler.ServerCertificateCustomValidationCallback = (httpRequestMessage, cert, cetChain, policyErrors) => true;
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Flax.Build
|
||||
/// <summary>
|
||||
/// Specifies the minimum CPU architecture type to support (on x86/x64).
|
||||
/// </summary>
|
||||
[CommandLine("winCpuArch", "<arch>", "Specifies the minimum CPU architecture type to support (on x86/x64).")]
|
||||
[CommandLine("winCpuArch", "<arch>", "Specifies the minimum CPU architecture type to support (om x86/x64).")]
|
||||
public static CpuArchitecture WindowsCpuArch = CpuArchitecture.AVX2; // 94.48% support on PC according to Steam Hardware & Software Survey: May 2025 (https://store.steampowered.com/hwsurvey/)
|
||||
}
|
||||
}
|
||||
@@ -76,27 +76,22 @@ namespace Flax.Build.Platforms
|
||||
options.LinkEnv.InputLibraries.Add("oleaut32.lib");
|
||||
options.LinkEnv.InputLibraries.Add("delayimp.lib");
|
||||
|
||||
options.CompileEnv.CpuArchitecture = Configuration.WindowsCpuArch;
|
||||
|
||||
if (options.Architecture == TargetArchitecture.x64)
|
||||
{
|
||||
if (_minVersion.Major <= 7 && options.CompileEnv.CpuArchitecture == CpuArchitecture.AVX2)
|
||||
{
|
||||
// Old Windows had lower support ratio for latest CPU features
|
||||
options.CompileEnv.CpuArchitecture = CpuArchitecture.AVX;
|
||||
}
|
||||
if (_minVersion.Major >= 11 && options.CompileEnv.CpuArchitecture == CpuArchitecture.AVX)
|
||||
{
|
||||
// Windows 11 has hard requirement on SSE4.2
|
||||
options.CompileEnv.CpuArchitecture = CpuArchitecture.SSE4_2;
|
||||
}
|
||||
}
|
||||
else if (options.Architecture == TargetArchitecture.ARM64)
|
||||
if (options.Architecture == TargetArchitecture.ARM64)
|
||||
{
|
||||
options.CompileEnv.PreprocessorDefinitions.Add("USE_SOFT_INTRINSICS");
|
||||
options.LinkEnv.InputLibraries.Add("softintrin.lib");
|
||||
if (options.CompileEnv.CpuArchitecture != CpuArchitecture.None)
|
||||
options.CompileEnv.CpuArchitecture = CpuArchitecture.NEON;
|
||||
}
|
||||
|
||||
options.CompileEnv.CpuArchitecture = Configuration.WindowsCpuArch;
|
||||
if (_minVersion.Major <= 7 && options.CompileEnv.CpuArchitecture == CpuArchitecture.AVX2)
|
||||
{
|
||||
// Old Windows had lower support ratio for latest CPU features
|
||||
options.CompileEnv.CpuArchitecture = CpuArchitecture.AVX;
|
||||
}
|
||||
if (_minVersion.Major >= 11 && options.CompileEnv.CpuArchitecture == CpuArchitecture.AVX)
|
||||
{
|
||||
// Windows 11 has hard requirement on SSE4.2
|
||||
options.CompileEnv.CpuArchitecture = CpuArchitecture.SSE4_2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -342,8 +342,6 @@ namespace Flax.Build.Projects.VisualStudioCode
|
||||
|
||||
json.BeginArray("args");
|
||||
{
|
||||
if (configuration.Platform == TargetPlatform.Linux || configuration.Platform == TargetPlatform.Mac)
|
||||
json.AddUnnamedField("-std");
|
||||
json.AddUnnamedField("-project");
|
||||
json.AddUnnamedField(buildToolWorkspace);
|
||||
json.AddUnnamedField("-skipCompile");
|
||||
@@ -397,8 +395,6 @@ namespace Flax.Build.Projects.VisualStudioCode
|
||||
json.AddField("program", Path.Combine(Globals.EngineRoot, "Binaries", "Editor", editorFolder, configuration.ConfigurationName, "FlaxEditor"));
|
||||
json.BeginArray("args");
|
||||
{
|
||||
if (configuration.Platform == TargetPlatform.Linux || configuration.Platform == TargetPlatform.Mac)
|
||||
json.AddUnnamedField("-std");
|
||||
json.AddUnnamedField("-project");
|
||||
json.AddUnnamedField(buildToolWorkspace);
|
||||
json.AddUnnamedField("-skipCompile");
|
||||
|
||||
Reference in New Issue
Block a user