Compare commits
2 Commits
d0cc2b67a7
...
sdl_platfo
| Author | SHA1 | Date | |
|---|---|---|---|
| c6bc90a82a | |||
| 43b576d961 |
@@ -54,6 +54,9 @@ namespace FlaxEditor.Modules.SourceCodeEditing
|
||||
case CodeEditorTypes.VS2022:
|
||||
Name = "Visual Studio 2022";
|
||||
break;
|
||||
case CodeEditorTypes.VS2026:
|
||||
Name = "Visual Studio 2026";
|
||||
break;
|
||||
case CodeEditorTypes.VSCode:
|
||||
Name = "Visual Studio Code";
|
||||
break;
|
||||
@@ -110,6 +113,7 @@ namespace FlaxEditor.Modules.SourceCodeEditing
|
||||
case CodeEditorTypes.VS2017:
|
||||
case CodeEditorTypes.VS2019:
|
||||
case CodeEditorTypes.VS2022:
|
||||
case CodeEditorTypes.VS2026:
|
||||
// TODO: finish dynamic files adding to the project
|
||||
//Editor.Instance.ProgressReporting.GenerateScriptsProjectFiles.RunAsync();
|
||||
break;
|
||||
|
||||
@@ -62,6 +62,11 @@ API_ENUM(Namespace="FlaxEditor", Attributes="HideInEditor") enum class CodeEdito
|
||||
/// </summary>
|
||||
VS2022,
|
||||
|
||||
/// <summary>
|
||||
/// Visual Studio 2026
|
||||
/// </summary>
|
||||
VS2026,
|
||||
|
||||
/// <summary>
|
||||
/// Visual Studio Code
|
||||
/// </summary>
|
||||
|
||||
@@ -43,6 +43,9 @@ VisualStudioEditor::VisualStudioEditor(VisualStudioVersion version, const String
|
||||
case VisualStudioVersion::VS2022:
|
||||
_type = CodeEditorTypes::VS2022;
|
||||
break;
|
||||
case VisualStudioVersion::VS2026:
|
||||
_type = CodeEditorTypes::VS2026;
|
||||
break;
|
||||
default: CRASH;
|
||||
break;
|
||||
}
|
||||
@@ -70,6 +73,9 @@ void VisualStudioEditor::FindEditors(Array<CodeEditor*>* output)
|
||||
VisualStudioVersion version;
|
||||
switch (info.VersionMajor)
|
||||
{
|
||||
case 18:
|
||||
version = VisualStudioVersion::VS2026;
|
||||
break;
|
||||
case 17:
|
||||
version = VisualStudioVersion::VS2022;
|
||||
break;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
/// <summary>
|
||||
/// Microsoft Visual Studio version types
|
||||
/// </summary>
|
||||
DECLARE_ENUM_8(VisualStudioVersion, VS2008, VS2010, VS2012, VS2013, VS2015, VS2017, VS2019, VS2022);
|
||||
DECLARE_ENUM_9(VisualStudioVersion, VS2008, VS2010, VS2012, VS2013, VS2015, VS2017, VS2019, VS2022, VS2026);
|
||||
|
||||
/// <summary>
|
||||
/// Implementation of code editor utility that is using Microsoft Visual Studio.
|
||||
|
||||
@@ -236,12 +236,18 @@ int32 Engine::Main(const Char* cmdLine)
|
||||
}
|
||||
|
||||
// Start physics simulation
|
||||
if (Time::OnBeginPhysics(time))
|
||||
int phys = 0;
|
||||
while (Time::OnBeginPhysics(time))
|
||||
{
|
||||
phys++;
|
||||
OnFixedUpdate();
|
||||
OnLateFixedUpdate();
|
||||
Time::OnEndPhysics();
|
||||
}
|
||||
/*if (phys == 0)
|
||||
LOG(Info, "no ticks");
|
||||
else */if (phys > 1)
|
||||
LOG(Info, "{} ticks", phys);
|
||||
|
||||
// Draw frame
|
||||
if (Time::OnBeginDraw(time))
|
||||
|
||||
@@ -95,7 +95,8 @@ bool Time::TickData::OnTickBegin(double time, float targetFps, float maxDeltaTim
|
||||
if (targetFps > ZeroTolerance)
|
||||
{
|
||||
int skip = (int)(1 + (time - NextBegin) * targetFps);
|
||||
NextBegin += (1.0 / targetFps) * skip;
|
||||
//NextBegin += (1.0 / targetFps) * skip;
|
||||
NextBegin = time + (1.0 / targetFps);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,25 +147,34 @@ bool Time::FixedStepTickData::OnTickBegin(double time, float targetFps, float ma
|
||||
deltaTime = (double)maxDeltaTime;
|
||||
NextBegin = time;
|
||||
}
|
||||
|
||||
#if false
|
||||
if (targetFps > ZeroTolerance)
|
||||
{
|
||||
int skip = (int)(1 + (time - NextBegin) * targetFps);
|
||||
NextBegin += (1.0 / targetFps) * skip;
|
||||
}
|
||||
#else
|
||||
else if (targetFps > ZeroTolerance)
|
||||
{
|
||||
deltaTime = (1.0 / targetFps);
|
||||
//int skip = (int)(1 + (time - NextBegin) * targetFps);
|
||||
//NextBegin += (1.0 / targetFps) * skip;
|
||||
NextBegin += deltaTime;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
Samples.Add(deltaTime);
|
||||
//Samples.Add(deltaTime);
|
||||
|
||||
// Check if last few ticks were not taking too long so it's running slowly
|
||||
const bool isRunningSlowly = Samples.Average() > 1.5 * minDeltaTime;
|
||||
/*const bool isRunningSlowly = Samples.Average() > 1.5 * minDeltaTime;
|
||||
if (!isRunningSlowly)
|
||||
{
|
||||
// Make steps fixed size
|
||||
const double diff = deltaTime - minDeltaTime;
|
||||
time -= diff;
|
||||
deltaTime = minDeltaTime;
|
||||
}
|
||||
|
||||
}*/
|
||||
|
||||
// Update data
|
||||
Advance(time, deltaTime);
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#define ENET_IMPLEMENTATION
|
||||
#define _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#include <enet/enet.h>
|
||||
#include <Engine/Engine/Time.h>
|
||||
#undef _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#undef SendMessage
|
||||
|
||||
@@ -33,7 +34,7 @@ ENetPacketFlag ChannelTypeToPacketFlag(const NetworkChannelType channel)
|
||||
return static_cast<ENetPacketFlag>(flag);
|
||||
}
|
||||
|
||||
void SendPacketToPeer(ENetPeer* peer, const NetworkChannelType channelType, const NetworkMessage& message)
|
||||
void SendPacketToPeer(ENetHost* host, ENetPeer* peer, const NetworkChannelType channelType, const NetworkMessage& message)
|
||||
{
|
||||
// Covert our channel type to the internal ENet packet flags
|
||||
const ENetPacketFlag flag = ChannelTypeToPacketFlag(channelType);
|
||||
@@ -48,6 +49,7 @@ void SendPacketToPeer(ENetPeer* peer, const NetworkChannelType channelType, cons
|
||||
enet_peer_send(peer, 0, packet);
|
||||
|
||||
// TODO: To reduce latency, we can use `enet_host_flush` to flush all packets. Maybe some API, like NetworkManager::FlushQueues()?
|
||||
enet_host_flush(host);
|
||||
}
|
||||
|
||||
ENetDriver::ENetDriver(const SpawnParams& params)
|
||||
@@ -166,7 +168,9 @@ bool ENetDriver::PopEvent(NetworkEvent& eventPtr)
|
||||
{
|
||||
ASSERT(_host);
|
||||
ENetEvent event;
|
||||
enet_host_flush(_host); // Flush outbound packets to us so we can handle them immediately
|
||||
const int result = enet_host_service(_host, &event, 0);
|
||||
const auto tick = Time::Update.TicksCount;
|
||||
if (result < 0)
|
||||
LOG(Error, "Failed to check ENet events!");
|
||||
if (result > 0)
|
||||
@@ -213,7 +217,7 @@ bool ENetDriver::PopEvent(NetworkEvent& eventPtr)
|
||||
void ENetDriver::SendMessage(const NetworkChannelType channelType, const NetworkMessage& message)
|
||||
{
|
||||
ASSERT(!IsServer());
|
||||
SendPacketToPeer(_peer, channelType, message);
|
||||
SendPacketToPeer(_host, _peer, channelType, message);
|
||||
}
|
||||
|
||||
void ENetDriver::SendMessage(NetworkChannelType channelType, const NetworkMessage& message, NetworkConnection target)
|
||||
@@ -222,7 +226,7 @@ void ENetDriver::SendMessage(NetworkChannelType channelType, const NetworkMessag
|
||||
ENetPeer* peer;
|
||||
if (_peerMap.TryGet(target.ConnectionId, peer) && peer && peer->state == ENET_PEER_STATE_CONNECTED)
|
||||
{
|
||||
SendPacketToPeer(peer, channelType, message);
|
||||
SendPacketToPeer(_host, peer, channelType, message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,7 +238,7 @@ void ENetDriver::SendMessage(const NetworkChannelType channelType, const Network
|
||||
{
|
||||
if (_peerMap.TryGet(target.ConnectionId, peer) && peer && peer->state == ENET_PEER_STATE_CONNECTED)
|
||||
{
|
||||
SendPacketToPeer(peer, channelType, message);
|
||||
SendPacketToPeer(_host, peer, channelType, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,11 +97,15 @@ bool NetworkLagDriver::PopEvent(NetworkEvent& eventPtr)
|
||||
if (!_driver)
|
||||
return false;
|
||||
|
||||
const auto delta2 = Time::Current != nullptr ? Time::Current->UnscaledDeltaTime : Time::Update.UnscaledDeltaTime;
|
||||
// Try to pop lagged event from the queue
|
||||
for (int32 i = 0; i < _events.Count(); i++)
|
||||
{
|
||||
auto& e = _events[i];
|
||||
if (e.Lag > 0.0)
|
||||
e.LagTime -= delta2;
|
||||
//if (e.Lag > 0.0)
|
||||
// continue;
|
||||
if (e.LagTime > 0)
|
||||
continue;
|
||||
|
||||
eventPtr = e.Event;
|
||||
@@ -117,6 +121,7 @@ bool NetworkLagDriver::PopEvent(NetworkEvent& eventPtr)
|
||||
|
||||
auto& e = _events.AddOne();
|
||||
e.Lag = (double)Lag;
|
||||
e.LagTime = /*Time::Current->UnscaledTime + */TimeSpan::FromMilliseconds(Lag);
|
||||
e.Event = eventPtr;
|
||||
}
|
||||
return false;
|
||||
@@ -130,8 +135,10 @@ void NetworkLagDriver::SendMessage(const NetworkChannelType channelType, const N
|
||||
return;
|
||||
}
|
||||
|
||||
//const auto tick = Time::Current->TicksCount;
|
||||
auto& msg = _messages.AddOne();
|
||||
msg.Lag = (double)Lag;
|
||||
msg.LagTime = /*Time::Current->UnscaledTime +*/ TimeSpan::FromMilliseconds(Lag);
|
||||
msg.ChannelType = channelType;
|
||||
msg.Type = 0;
|
||||
msg.MessageData.Set(message.Buffer, message.Length);
|
||||
@@ -148,6 +155,7 @@ void NetworkLagDriver::SendMessage(NetworkChannelType channelType, const Network
|
||||
|
||||
auto& msg = _messages.AddOne();
|
||||
msg.Lag = (double)Lag;
|
||||
msg.LagTime = /*Time::Current->UnscaledTime +*/ TimeSpan::FromMilliseconds(Lag);
|
||||
msg.ChannelType = channelType;
|
||||
msg.Type = 1;
|
||||
msg.Target = target;
|
||||
@@ -165,6 +173,7 @@ void NetworkLagDriver::SendMessage(const NetworkChannelType channelType, const N
|
||||
|
||||
auto& msg = _messages.AddOne();
|
||||
msg.Lag = (double)Lag;
|
||||
msg.LagTime = /*Time::Current->UnscaledTime +*/ TimeSpan::FromMilliseconds(Lag);
|
||||
msg.ChannelType = channelType;
|
||||
msg.Type = 2;
|
||||
msg.Targets = targets;
|
||||
@@ -192,14 +201,20 @@ void NetworkLagDriver::OnUpdate()
|
||||
return;
|
||||
|
||||
// Update all pending messages and events
|
||||
const double deltaTime = Time::Update.UnscaledDeltaTime.GetTotalMilliseconds();
|
||||
const auto delta2 = Time::Current != nullptr ? Time::Current->UnscaledDeltaTime : Time::Update.UnscaledDeltaTime;
|
||||
for (int32 i = 0; i < _messages.Count(); i++)
|
||||
{
|
||||
auto& msg = _messages[i];
|
||||
msg.Lag -= deltaTime;
|
||||
if (msg.Lag > 0.0)
|
||||
//msg.Lag -= deltaTime;
|
||||
//if (msg.Lag > 0.0)
|
||||
// continue;
|
||||
|
||||
msg.LagTime -= delta2;
|
||||
if (msg.LagTime > 0)
|
||||
continue;
|
||||
|
||||
auto missed = (-msg.LagTime).GetTotalMilliseconds();
|
||||
|
||||
// Use this helper message as a container to send the stored data and length to the ENet driver
|
||||
NetworkMessage message;
|
||||
message.Buffer = msg.MessageData.Get();
|
||||
@@ -222,6 +237,7 @@ void NetworkLagDriver::OnUpdate()
|
||||
for (int32 i = 0; i < _events.Count(); i++)
|
||||
{
|
||||
auto& e = _events[i];
|
||||
e.Lag -= deltaTime;
|
||||
//e.Lag -= deltaTime;
|
||||
e.LagTime -= delta2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "Engine/Networking/NetworkEvent.h"
|
||||
#include "Engine/Scripting/ScriptingObject.h"
|
||||
#include "Engine/Core/Collections/Array.h"
|
||||
#include "Engine/Core/Types/TimeSpan.h"
|
||||
|
||||
/// <summary>
|
||||
/// Low-level network transport interface implementation that is proxy of another nested INetworkDriver implementation but with lag simulation feature.
|
||||
@@ -20,6 +21,7 @@ private:
|
||||
struct LagMessage
|
||||
{
|
||||
double Lag;
|
||||
TimeSpan LagTime;
|
||||
int32 Type;
|
||||
NetworkChannelType ChannelType;
|
||||
NetworkConnection Target;
|
||||
@@ -31,6 +33,7 @@ private:
|
||||
struct LagEvent
|
||||
{
|
||||
double Lag;
|
||||
TimeSpan LagTime;
|
||||
NetworkEvent Event;
|
||||
};
|
||||
|
||||
|
||||
@@ -192,6 +192,8 @@ namespace Flax.Build
|
||||
{
|
||||
// Pick the project format
|
||||
var projectFormats = new HashSet<ProjectFormat>();
|
||||
if (Configuration.ProjectFormatVS2026)
|
||||
projectFormats.Add(ProjectFormat.VisualStudio2026);
|
||||
if (Configuration.ProjectFormatVS2022)
|
||||
projectFormats.Add(ProjectFormat.VisualStudio2022);
|
||||
if (Configuration.ProjectFormatVS2019)
|
||||
@@ -209,8 +211,13 @@ namespace Flax.Build
|
||||
if (projectFormats.Count == 0)
|
||||
projectFormats.Add(Platform.BuildPlatform.DefaultProjectFormat);
|
||||
|
||||
// Always generate VS solution files for project (needed for C# Intellisense support)
|
||||
projectFormats.Add(ProjectFormat.VisualStudio2022);
|
||||
// Always generate VS solution files for project (needed for C# Intellisense support in other IDEs)
|
||||
if (!projectFormats.Contains(ProjectFormat.VisualStudio2026) &&
|
||||
!projectFormats.Contains(ProjectFormat.VisualStudio2022) &&
|
||||
!projectFormats.Contains(ProjectFormat.VisualStudio))
|
||||
{
|
||||
projectFormats.Add(ProjectFormat.VisualStudio2022);
|
||||
}
|
||||
|
||||
foreach (ProjectFormat projectFormat in projectFormats)
|
||||
GenerateProject(projectFormat);
|
||||
|
||||
@@ -201,6 +201,12 @@ namespace Flax.Build
|
||||
[CommandLine("vs2022", "Generates Visual Studio 2022 project format files. Valid only with -genproject option.")]
|
||||
public static bool ProjectFormatVS2022 = false;
|
||||
|
||||
/// <summary>
|
||||
/// Generates Visual Studio 2026 project format files. Valid only with -genproject option.
|
||||
/// </summary>
|
||||
[CommandLine("vs2026", "Generates Visual Studio 2026 project format files. Valid only with -genproject option.")]
|
||||
public static bool ProjectFormatVS2026 = false;
|
||||
|
||||
/// <summary>
|
||||
/// Generates Visual Studio Code project format files. Valid only with -genproject option.
|
||||
/// </summary>
|
||||
|
||||
@@ -32,8 +32,11 @@ namespace Flax.Build.Platforms
|
||||
if (!toolsets.ContainsKey(WindowsPlatformToolset.v141) &&
|
||||
!toolsets.ContainsKey(WindowsPlatformToolset.v142) &&
|
||||
!toolsets.ContainsKey(WindowsPlatformToolset.v143) &&
|
||||
!toolsets.ContainsKey(WindowsPlatformToolset.v144))
|
||||
!toolsets.ContainsKey(WindowsPlatformToolset.v144) &&
|
||||
!toolsets.ContainsKey(WindowsPlatformToolset.v145))
|
||||
{
|
||||
_hasRequiredSDKsInstalled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,12 @@ namespace Flax.Build.Platforms
|
||||
}
|
||||
|
||||
// Visual Studio 2017+ supported only
|
||||
var visualStudio = VisualStudioInstance.GetInstances().FirstOrDefault(x => x.Version == VisualStudioVersion.VisualStudio2017 || x.Version == VisualStudioVersion.VisualStudio2019 || x.Version == VisualStudioVersion.VisualStudio2022);
|
||||
var visualStudio = VisualStudioInstance.GetInstances().FirstOrDefault(x =>
|
||||
x.Version == VisualStudioVersion.VisualStudio2017 ||
|
||||
x.Version == VisualStudioVersion.VisualStudio2019 ||
|
||||
x.Version == VisualStudioVersion.VisualStudio2022 ||
|
||||
x.Version == VisualStudioVersion.VisualStudio2026
|
||||
);
|
||||
if (visualStudio == null)
|
||||
_hasRequiredSDKsInstalled = false;
|
||||
|
||||
@@ -46,7 +51,8 @@ namespace Flax.Build.Platforms
|
||||
if (!toolsets.ContainsKey(WindowsPlatformToolset.v141) &&
|
||||
!toolsets.ContainsKey(WindowsPlatformToolset.v142) &&
|
||||
!toolsets.ContainsKey(WindowsPlatformToolset.v143) &&
|
||||
!toolsets.ContainsKey(WindowsPlatformToolset.v144))
|
||||
!toolsets.ContainsKey(WindowsPlatformToolset.v144) &&
|
||||
!toolsets.ContainsKey(WindowsPlatformToolset.v145))
|
||||
{
|
||||
_hasRequiredSDKsInstalled = false;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,12 @@ namespace Flax.Build.Platforms
|
||||
public UWPToolchain(UWPPlatform platform, TargetArchitecture architecture, WindowsPlatformToolset toolsetVer = WindowsPlatformToolset.Latest, WindowsPlatformSDK sdkVer = WindowsPlatformSDK.Latest)
|
||||
: base(platform, architecture, toolsetVer, sdkVer)
|
||||
{
|
||||
var visualStudio = VisualStudioInstance.GetInstances().FirstOrDefault(x => x.Version == VisualStudioVersion.VisualStudio2017 || x.Version == VisualStudioVersion.VisualStudio2019 || x.Version == VisualStudioVersion.VisualStudio2022);
|
||||
var visualStudio = VisualStudioInstance.GetInstances().FirstOrDefault(x =>
|
||||
x.Version == VisualStudioVersion.VisualStudio2017 ||
|
||||
x.Version == VisualStudioVersion.VisualStudio2019 ||
|
||||
x.Version == VisualStudioVersion.VisualStudio2022 ||
|
||||
x.Version == VisualStudioVersion.VisualStudio2026
|
||||
);
|
||||
if (visualStudio == null)
|
||||
throw new Exception("Missing Visual Studio 2017 or newer. It's required to build for UWP.");
|
||||
_usingDirs.Add(Path.Combine(visualStudio.Path, "VC", "vcpackages"));
|
||||
|
||||
@@ -40,7 +40,8 @@ namespace Flax.Build.Platforms
|
||||
!toolsets.ContainsKey(WindowsPlatformToolset.v141) &&
|
||||
!toolsets.ContainsKey(WindowsPlatformToolset.v142) &&
|
||||
!toolsets.ContainsKey(WindowsPlatformToolset.v143) &&
|
||||
!toolsets.ContainsKey(WindowsPlatformToolset.v144))
|
||||
!toolsets.ContainsKey(WindowsPlatformToolset.v144) &&
|
||||
!toolsets.ContainsKey(WindowsPlatformToolset.v145))
|
||||
{
|
||||
Log.Warning("Missing MSVC toolset v140 or later (VS 2015 or later C++ build tools). Cannot build for Windows platform.");
|
||||
_hasRequiredSDKsInstalled = false;
|
||||
|
||||
@@ -54,6 +54,11 @@ namespace Flax.Build.Platforms
|
||||
/// Visual Studio 2022 (v17.10 and later)
|
||||
/// </summary>
|
||||
v144 = 144,
|
||||
|
||||
/// <summary>
|
||||
/// Visual Studio 2026
|
||||
/// </summary>
|
||||
v145 = 145,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -252,6 +257,8 @@ namespace Flax.Build.Platforms
|
||||
_toolsets[WindowsPlatformToolset.v143] = toolset;
|
||||
else if (version.Major == 14 && version.Minor / 10 == 4)
|
||||
_toolsets[WindowsPlatformToolset.v144] = toolset;
|
||||
else if (version.Major == 14 && version.Minor / 10 == 5)
|
||||
_toolsets[WindowsPlatformToolset.v145] = toolset;
|
||||
else
|
||||
Log.Warning("Found Unsupported MSVC toolset version: " + version);
|
||||
}
|
||||
@@ -287,11 +294,12 @@ namespace Flax.Build.Platforms
|
||||
}
|
||||
}
|
||||
|
||||
// Visual Studio 2017-2022 - multiple instances
|
||||
// Visual Studio 2017 or later - multiple instances
|
||||
foreach (var vs in vsInstances.Where(x =>
|
||||
x.Version == VisualStudioVersion.VisualStudio2017 ||
|
||||
x.Version == VisualStudioVersion.VisualStudio2019 ||
|
||||
x.Version == VisualStudioVersion.VisualStudio2022
|
||||
x.Version == VisualStudioVersion.VisualStudio2022 ||
|
||||
x.Version == VisualStudioVersion.VisualStudio2026
|
||||
))
|
||||
{
|
||||
FindMsvcToolsets(Path.Combine(vs.Path, "VC", "Tools", "MSVC"));
|
||||
@@ -469,6 +477,7 @@ namespace Flax.Build.Platforms
|
||||
case WindowsPlatformToolset.v142:
|
||||
case WindowsPlatformToolset.v143:
|
||||
case WindowsPlatformToolset.v144:
|
||||
case WindowsPlatformToolset.v145:
|
||||
{
|
||||
string hostFolder = hostArchitecture == TargetArchitecture.x86 ? "HostX86" : $"Host{hostArchitecture.ToString().ToLower()}";
|
||||
string nativeCompilerPath = Path.Combine(vcToolChainDir, "bin", hostFolder, architecture.ToString().ToLower(), "cl.exe");
|
||||
|
||||
@@ -89,7 +89,11 @@ namespace Flax.Build.Platforms
|
||||
// Pick the newest installed Visual Studio version if using the default toolset
|
||||
if (toolsetVer == WindowsPlatformToolset.Default)
|
||||
{
|
||||
if (VisualStudioInstance.HasIDE(VisualStudioVersion.VisualStudio2022))
|
||||
if (VisualStudioInstance.HasIDE(VisualStudioVersion.VisualStudio2026))
|
||||
{
|
||||
toolsetVer = WindowsPlatformToolset.v145;
|
||||
}
|
||||
else if (VisualStudioInstance.HasIDE(VisualStudioVersion.VisualStudio2022))
|
||||
{
|
||||
if (toolsets.Keys.Contains(WindowsPlatformToolset.v144))
|
||||
{
|
||||
@@ -206,6 +210,7 @@ namespace Flax.Build.Platforms
|
||||
case WindowsPlatformToolset.v142:
|
||||
case WindowsPlatformToolset.v143:
|
||||
case WindowsPlatformToolset.v144:
|
||||
case WindowsPlatformToolset.v145:
|
||||
{
|
||||
switch (Architecture)
|
||||
{
|
||||
@@ -392,6 +397,7 @@ namespace Flax.Build.Platforms
|
||||
var vcToolChainDir = toolsets[Toolset];
|
||||
switch (Toolset)
|
||||
{
|
||||
case WindowsPlatformToolset.v145:
|
||||
case WindowsPlatformToolset.v144:
|
||||
case WindowsPlatformToolset.v143:
|
||||
case WindowsPlatformToolset.v142:
|
||||
|
||||
@@ -37,6 +37,11 @@ namespace Flax.Build.Projects
|
||||
/// </summary>
|
||||
VisualStudio2022,
|
||||
|
||||
/// <summary>
|
||||
/// Visual Studio 2026.
|
||||
/// </summary>
|
||||
VisualStudio2026,
|
||||
|
||||
/// <summary>
|
||||
/// Visual Studio Code.
|
||||
/// </summary>
|
||||
|
||||
@@ -84,7 +84,11 @@ namespace Flax.Build.Projects
|
||||
// Pick the newest installed Visual Studio version
|
||||
if (format == ProjectFormat.VisualStudio)
|
||||
{
|
||||
if (VisualStudioInstance.HasIDE(VisualStudioVersion.VisualStudio2022))
|
||||
if (VisualStudioInstance.HasIDE(VisualStudioVersion.VisualStudio2026))
|
||||
{
|
||||
format = ProjectFormat.VisualStudio2026;
|
||||
}
|
||||
else if (VisualStudioInstance.HasIDE(VisualStudioVersion.VisualStudio2022))
|
||||
{
|
||||
format = ProjectFormat.VisualStudio2022;
|
||||
}
|
||||
@@ -113,6 +117,7 @@ namespace Flax.Build.Projects
|
||||
case ProjectFormat.VisualStudio2017:
|
||||
case ProjectFormat.VisualStudio2019:
|
||||
case ProjectFormat.VisualStudio2022:
|
||||
case ProjectFormat.VisualStudio2026:
|
||||
{
|
||||
VisualStudioVersion vsVersion;
|
||||
switch (format)
|
||||
@@ -129,6 +134,9 @@ namespace Flax.Build.Projects
|
||||
case ProjectFormat.VisualStudio2022:
|
||||
vsVersion = VisualStudioVersion.VisualStudio2022;
|
||||
break;
|
||||
case ProjectFormat.VisualStudio2026:
|
||||
vsVersion = VisualStudioVersion.VisualStudio2026;
|
||||
break;
|
||||
default: throw new ArgumentOutOfRangeException(nameof(format), format, null);
|
||||
}
|
||||
switch (type)
|
||||
|
||||
@@ -50,7 +50,9 @@ namespace Flax.Build.Projects.VisualStudio
|
||||
projectTypes = ProjectTypeGuids.ToOption(ProjectTypeGuids.FlaxVS) + ';' + projectTypes;
|
||||
|
||||
// Try to reuse the existing project guid from solution file
|
||||
vsProject.ProjectGuid = GetProjectGuid(solutionPath, vsProject.Name);
|
||||
vsProject.ProjectGuid = GetProjectGuid(vsProject.Path, vsProject.Name);
|
||||
if (vsProject.ProjectGuid == Guid.Empty)
|
||||
vsProject.ProjectGuid = GetProjectGuid(solutionPath, vsProject.Name);
|
||||
if (vsProject.ProjectGuid == Guid.Empty)
|
||||
vsProject.ProjectGuid = Guid.NewGuid();
|
||||
|
||||
|
||||
@@ -55,7 +55,9 @@ namespace Flax.Build.Projects.VisualStudio
|
||||
}
|
||||
|
||||
// Try to reuse the existing project guid from solution file
|
||||
vsProject.ProjectGuid = GetProjectGuid(solutionPath, vsProject.Name);
|
||||
vsProject.ProjectGuid = GetProjectGuid(vsProject.Path, vsProject.Name);
|
||||
if (vsProject.ProjectGuid == Guid.Empty)
|
||||
vsProject.ProjectGuid = GetProjectGuid(solutionPath, vsProject.Name);
|
||||
if (vsProject.ProjectGuid == Guid.Empty)
|
||||
vsProject.ProjectGuid = Guid.NewGuid();
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ namespace Flax.Build.Projects.VisualStudio
|
||||
case VisualStudioVersion.VisualStudio2017: return "v141";
|
||||
case VisualStudioVersion.VisualStudio2019: return "v142";
|
||||
case VisualStudioVersion.VisualStudio2022: return "v143";
|
||||
case VisualStudioVersion.VisualStudio2026: return "v145";
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
@@ -128,6 +128,8 @@ namespace Flax.Build.Projects.VisualStudio
|
||||
version = VisualStudioVersion.VisualStudio2019;
|
||||
else if (displayName.Contains("2022"))
|
||||
version = VisualStudioVersion.VisualStudio2022;
|
||||
else if (displayName.Contains("2026"))
|
||||
version = VisualStudioVersion.VisualStudio2026;
|
||||
else
|
||||
{
|
||||
Log.Warning(string.Format("Unknown Visual Studio installation. Display name: {0}", displayName));
|
||||
|
||||
@@ -128,6 +128,7 @@ namespace Flax.Build.Projects.VisualStudio
|
||||
case VisualStudioVersion.VisualStudio2017: return "15.0";
|
||||
case VisualStudioVersion.VisualStudio2019: return "16.0";
|
||||
case VisualStudioVersion.VisualStudio2022: return "17.0";
|
||||
case VisualStudioVersion.VisualStudio2026: return "18.0";
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
@@ -193,7 +194,7 @@ namespace Flax.Build.Projects.VisualStudio
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string SolutionFileExtension => "sln";
|
||||
public override string SolutionFileExtension => /*Version >= VisualStudioVersion.VisualStudio2026 ? "slnx" :*/ "sln";
|
||||
|
||||
/// <inheritdoc />
|
||||
public override Project CreateProject()
|
||||
@@ -277,6 +278,20 @@ namespace Flax.Build.Projects.VisualStudio
|
||||
}
|
||||
}
|
||||
|
||||
if (Version >= VisualStudioVersion.VisualStudio2026)
|
||||
GenerateXmlSolution(solution);
|
||||
else
|
||||
GenerateAsciiSolution(solution);
|
||||
}
|
||||
|
||||
private void GenerateXmlSolution(Solution solution)
|
||||
{
|
||||
// TODO: Generate the solution file in new format
|
||||
GenerateAsciiSolution(solution);
|
||||
}
|
||||
|
||||
private void GenerateAsciiSolution(Solution solution)
|
||||
{
|
||||
// Try to extract solution folder info from the existing solution file to make random IDs stable
|
||||
var solutionId = Guid.NewGuid();
|
||||
var folderIds = new Dictionary<string, Guid>();
|
||||
@@ -313,7 +328,7 @@ namespace Flax.Build.Projects.VisualStudio
|
||||
var projects = solution.Projects.Cast<VisualStudioProject>().ToArray();
|
||||
|
||||
// Header
|
||||
if (Version == VisualStudioVersion.VisualStudio2022)
|
||||
if (Version >= VisualStudioVersion.VisualStudio2022)
|
||||
{
|
||||
vcSolutionFileContent.AppendLine("Microsoft Visual Studio Solution File, Format Version 12.00");
|
||||
vcSolutionFileContent.AppendLine("# Visual Studio Version 17");
|
||||
|
||||
@@ -26,5 +26,10 @@ namespace Flax.Build.Projects.VisualStudio
|
||||
/// The Visual Studio 2022.
|
||||
/// </summary>
|
||||
VisualStudio2022,
|
||||
|
||||
/// <summary>
|
||||
/// The Visual Studio 2026.
|
||||
/// </summary>
|
||||
VisualStudio2026,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user