From 19d9cd282d094e22a1c5d51fdfb0ea7d2114f694 Mon Sep 17 00:00:00 2001 From: Crawcik Date: Wed, 7 Sep 2022 16:53:30 +0200 Subject: [PATCH] Linux include paths fix --- .../Flax.Build/Platforms/Linux/LinuxPlatform.cs | 2 +- .../Flax.Build/Platforms/Linux/LinuxToolchain.cs | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Source/Tools/Flax.Build/Platforms/Linux/LinuxPlatform.cs b/Source/Tools/Flax.Build/Platforms/Linux/LinuxPlatform.cs index 1d0433f50..ced516a54 100644 --- a/Source/Tools/Flax.Build/Platforms/Linux/LinuxPlatform.cs +++ b/Source/Tools/Flax.Build/Platforms/Linux/LinuxPlatform.cs @@ -58,7 +58,7 @@ namespace Flax.Build.Platforms if (Compiler != null) { // System compiler - ToolchainRoot = string.Empty; + ToolchainRoot = "/"; Log.Verbose($"Using native Linux toolchain (compiler {Compiler})"); HasRequiredSDKsInstalled = true; } diff --git a/Source/Tools/Flax.Build/Platforms/Linux/LinuxToolchain.cs b/Source/Tools/Flax.Build/Platforms/Linux/LinuxToolchain.cs index ede17b639..2904b89a7 100644 --- a/Source/Tools/Flax.Build/Platforms/Linux/LinuxToolchain.cs +++ b/Source/Tools/Flax.Build/Platforms/Linux/LinuxToolchain.cs @@ -23,9 +23,16 @@ namespace Flax.Build.Platforms : base(platform, architecture, platform.ToolchainRoot, platform.Compiler) { // Setup system paths - SystemIncludePaths.Add(Path.Combine(ToolsetRoot, "usr", "include")); - SystemIncludePaths.Add(Path.Combine(ToolsetRoot, "include", "c++", "5.2.0")); - SystemIncludePaths.Add(Path.Combine(ToolsetRoot, "lib", "clang", ClangVersion.Major.ToString(), "include")); + var includePath = Path.Combine(ToolsetRoot, "usr", "include"); + SystemIncludePaths.Add(includePath); + var cppIncludePath = Path.Combine(includePath, "c++", ClangVersion.ToString()); + if (Directory.Exists(cppIncludePath)) + SystemIncludePaths.Add(cppIncludePath); + var clangLibPath = Path.Combine(ToolsetRoot, "usr", "lib", "clang"); + var clangIncludePath = Path.Combine(clangLibPath, ClangVersion.Major.ToString(), "include"); + if (!Directory.Exists(clangIncludePath)) + clangIncludePath = Path.Combine(clangLibPath, ClangVersion.ToString(), "include"); + SystemIncludePaths.Add(clangIncludePath); } ///