@@ -73,6 +73,11 @@ namespace Flax.Build
|
||||
/// </summary>
|
||||
public abstract TargetCompiler Compiler { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the main native files compiler path.
|
||||
/// </summary>
|
||||
public virtual string NativeCompilerPath { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Toolchain"/> class.
|
||||
/// </summary>
|
||||
|
||||
@@ -267,6 +267,9 @@ namespace Flax.Build.Platforms
|
||||
/// <inheritdoc />
|
||||
public override TargetCompiler Compiler => TargetCompiler.Clang;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string NativeCompilerPath => ClangPath;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void LogInfo()
|
||||
{
|
||||
|
||||
@@ -358,6 +358,9 @@ namespace Flax.Build.Platforms
|
||||
/// <inheritdoc />
|
||||
public override TargetCompiler Compiler => TargetCompiler.MSVC;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string NativeCompilerPath => _compilerPath;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void LogInfo()
|
||||
{
|
||||
|
||||
@@ -542,6 +542,8 @@ namespace Flax.Build.Projects.VisualStudioCode
|
||||
var configuration = TargetConfiguration.Development;
|
||||
var architecture = TargetArchitecture.x64;
|
||||
|
||||
var compilerPath = string.Empty;
|
||||
var cppVersion = NativeCpp.CppVersion.Cpp14;
|
||||
var includePaths = new HashSet<string>();
|
||||
var preprocessorDefinitions = new HashSet<string>();
|
||||
foreach (var e in mainProject.Defines)
|
||||
@@ -563,6 +565,8 @@ namespace Flax.Build.Projects.VisualStudioCode
|
||||
module.Key.SetupEnvironment(targetBuildOptions);
|
||||
}
|
||||
|
||||
cppVersion = targetBuildOptions.CompileEnv.CppVersion;
|
||||
compilerPath = toolchain.NativeCompilerPath;
|
||||
foreach (var e in targetBuildOptions.CompileEnv.PreprocessorDefinitions)
|
||||
preprocessorDefinitions.Add(e);
|
||||
foreach (var e in targetBuildOptions.CompileEnv.IncludePaths)
|
||||
@@ -570,6 +574,28 @@ namespace Flax.Build.Projects.VisualStudioCode
|
||||
}
|
||||
}
|
||||
|
||||
if (compilerPath.Length != 0)
|
||||
json.AddField("compilerPath", compilerPath);
|
||||
|
||||
switch (cppVersion)
|
||||
{
|
||||
case NativeCpp.CppVersion.Cpp14:
|
||||
json.AddField("cStandard", "c11");
|
||||
json.AddField("cppStandard", "c++14");
|
||||
break;
|
||||
case NativeCpp.CppVersion.Cpp17:
|
||||
case NativeCpp.CppVersion.Latest:
|
||||
json.AddField("cStandard", "c17");
|
||||
json.AddField("cppStandard", "c++17");
|
||||
break;
|
||||
case NativeCpp.CppVersion.Cpp20:
|
||||
json.AddField("cStandard", "c17");
|
||||
json.AddField("cppStandard", "c++20");
|
||||
break;
|
||||
default:
|
||||
throw new Exception($"Visual Code project generator does not support C++ standard {cppVersion}.");
|
||||
}
|
||||
|
||||
json.BeginArray("includePath");
|
||||
{
|
||||
foreach (var path in includePaths)
|
||||
|
||||
Reference in New Issue
Block a user