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