diff --git a/Sharpmake.Generators/Generic/JsonCompilationDatabase.cs b/Sharpmake.Generators/Generic/JsonCompilationDatabase.cs index 180437256..5e09b239c 100644 --- a/Sharpmake.Generators/Generic/JsonCompilationDatabase.cs +++ b/Sharpmake.Generators/Generic/JsonCompilationDatabase.cs @@ -141,6 +141,7 @@ private enum CompilerFlags CreatePrecomp, PrecompPath, IncludePath, + IncludeSystemPath } private static readonly IDictionary s_clangFlags = new Dictionary @@ -149,6 +150,7 @@ private enum CompilerFlags { CompilerFlags.UsePrecomp, "-include-pch {0}" }, { CompilerFlags.CreatePrecomp, "-x c++-header {0}" }, { CompilerFlags.IncludePath, "-I" }, + { CompilerFlags.IncludeSystemPath, "-isystem" }, }; private static readonly IDictionary s_vcFlags = new Dictionary @@ -158,6 +160,7 @@ private enum CompilerFlags { CompilerFlags.CreatePrecomp, "/Yc\"{0}\" /FI\"{0}\"" }, { CompilerFlags.PrecompPath, "/Fp\"{0}\"" }, { CompilerFlags.IncludePath, "/I" }, + { CompilerFlags.IncludeSystemPath, "/external:I" }, }; private static readonly ProjectOptionsGenerator s_optionGenerator = new ProjectOptionsGenerator(); @@ -274,13 +277,18 @@ private void FillIncludeDirectoriesOptions(CompileCommandGenerationContext conte var platformDescriptor = PlatformRegistry.Get(context.Configuration.Platform); string defaultCmdLineIncludePrefix = _flags[CompilerFlags.IncludePath]; + string defaultCmdLineIncludeSystemPrefix = _flags[CompilerFlags.IncludeSystemPath]; // Fill include dirs var dirs = new List(); - var platformIncludePaths = platformVcxproj.GetPlatformIncludePathsWithPrefix(context); - var platformIncludePathsPrefixed = platformIncludePaths.Select(p => CmdLineConvertIncludePathsFunc(context, p.Path, p.CmdLinePrefix)).ToList(); + var platformIncludePaths = context.Configuration.IncludePaths; + var platformIncludeSystemPaths = context.Configuration.IncludeSystemPaths; + var platformIncludePathsPrefixed = platformIncludePaths.Select(p => CmdLineConvertIncludePathsFunc(context, p, defaultCmdLineIncludePrefix)).ToList(); + var platformIncludeSystemPathsPrefixed = platformIncludeSystemPaths.Select(p => CmdLineConvertIncludePathsFunc(context, p, defaultCmdLineIncludeSystemPrefix)).ToList(); + dirs.AddRange(platformIncludePathsPrefixed); + dirs.AddRange(platformIncludeSystemPathsPrefixed); // TODO: move back up, just below the creation of the dirs list dirs.AddRange(includePaths.Select(p => CmdLineConvertIncludePathsFunc(context, p, defaultCmdLineIncludePrefix))); @@ -300,7 +308,7 @@ private void FillIncludeDirectoriesOptions(CompileCommandGenerationContext conte { // with LLVM as toolchain, we are still using the default resource compiler, so we need the default include prefix // TODO: this is not great, ideally we would need the prefix to be per "compiler", and a platform can have many - var platformIncludePathsDefaultPrefix = platformIncludePaths.Select(p => CmdLineConvertIncludePathsFunc(context, p.Path, defaultCmdLineIncludePrefix)); + var platformIncludePathsDefaultPrefix = platformIncludePaths.Select(p => CmdLineConvertIncludePathsFunc(context, p, defaultCmdLineIncludePrefix)); resourceDirs.AddRange(platformIncludePathsDefaultPrefix); } else