From e6878942f909e691cda5b56e0ba9282d7b009a32 Mon Sep 17 00:00:00 2001 From: Ari Vuollet Date: Sat, 12 Aug 2023 02:33:54 +0300 Subject: [PATCH] Fix missing C++ standard version in VC++ projects intellisense options --- .../VisualStudio/VCProjectGenerator.cs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Source/Tools/Flax.Build/Projects/VisualStudio/VCProjectGenerator.cs b/Source/Tools/Flax.Build/Projects/VisualStudio/VCProjectGenerator.cs index 4538ea8c1..76a0cf04b 100644 --- a/Source/Tools/Flax.Build/Projects/VisualStudio/VCProjectGenerator.cs +++ b/Source/Tools/Flax.Build/Projects/VisualStudio/VCProjectGenerator.cs @@ -1,5 +1,6 @@ // Copyright (c) 2012-2023 Wojciech Figat. All rights reserved. +using Flax.Build.NativeCpp; using System; using System.Collections.Generic; using System.IO; @@ -317,12 +318,31 @@ namespace Flax.Build.Projects.VisualStudio vcFiltersFileContent.AppendLine(" "); // IntelliSense information + + List additionalOptions = new List(); + switch (project.Configurations[0].TargetBuildOptions.CompileEnv.CppVersion) + { + case CppVersion.Cpp14: + additionalOptions.Add("/std:c++14"); + break; + case CppVersion.Cpp17: + additionalOptions.Add("/std:c++17"); + break; + case CppVersion.Cpp20: + additionalOptions.Add("/std:c++20"); + break; + case CppVersion.Latest: + additionalOptions.Add("/std:c++latest"); + break; + } + vcProjectFileContent.AppendLine(" "); vcProjectFileContent.AppendLine(string.Format(" $(NMakePreprocessorDefinitions){0}", (project.Defines.Count > 0 ? (";" + string.Join(";", project.Defines)) : ""))); vcProjectFileContent.AppendLine(string.Format(" $(NMakeIncludeSearchPath){0}", (project.SearchPaths.Length > 0 ? (";" + string.Join(";", project.SearchPaths)) : ""))); vcProjectFileContent.AppendLine(" $(NMakeForcedIncludes)"); vcProjectFileContent.AppendLine(" $(NMakeAssemblySearchPath)"); vcProjectFileContent.AppendLine(" $(NMakeForcedUsingAssemblies)"); + vcProjectFileContent.AppendLine(string.Format(" {0}", string.Join(" ", additionalOptions))); vcProjectFileContent.AppendLine(" "); foreach (var platform in platforms)