diff --git a/Source/Tools/Flax.Build/Deps/Dependencies/NvCloth.cs b/Source/Tools/Flax.Build/Deps/Dependencies/NvCloth.cs index 87bdcb659..71791a954 100644 --- a/Source/Tools/Flax.Build/Deps/Dependencies/NvCloth.cs +++ b/Source/Tools/Flax.Build/Deps/Dependencies/NvCloth.cs @@ -1,5 +1,6 @@ // Copyright (c) Wojciech Figat. All rights reserved. +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -89,6 +90,15 @@ namespace Flax.Deps.Dependencies // Get the source CloneGitRepoSingleBranch(root, "https://github.com/FlaxEngine/NvCloth.git", "master"); + // Patch the CMakeLists.txt to support custom compilation flags + foreach (var os in new[] { "android", "ios", "linux", "mac", "windows", }) + { + var filePath = Path.Combine(nvCloth, "compiler", "cmake", os, "CMakeLists.txt"); + var appendLine = "SET(CMAKE_CXX_FLAGS \"${CMAKE_CXX_FLAGS} ${NVCLOTH_CXX_FLAGS}\")"; + if (!File.ReadAllText(filePath).Contains(appendLine)) + File.AppendAllText(filePath, Environment.NewLine + appendLine + Environment.NewLine); + } + foreach (var platform in options.Platforms) { foreach (var architecture in options.Architectures) @@ -184,7 +194,7 @@ namespace Flax.Deps.Dependencies } break; case TargetPlatform.Mac: - cmakeArgs += " -DTARGET_BUILD_PLATFORM=mac"; + cmakeArgs += " -DTARGET_BUILD_PLATFORM=mac -DNVCLOTH_CXX_FLAGS=\"-Wno-error=poison-system-directories -Wno-error=missing-include-dirs\""; cmakeName = "mac"; binariesPrefix = "lib"; break; @@ -194,7 +204,7 @@ namespace Flax.Deps.Dependencies binariesPrefix = "lib"; break; case TargetPlatform.Linux: - cmakeArgs += " -DTARGET_BUILD_PLATFORM=linux"; + cmakeArgs += " -DTARGET_BUILD_PLATFORM=linux -DNVCLOTH_CXX_FLAGS=\"-Wno-error=poison-system-directories -Wno-error=missing-include-dirs\""; cmakeName = "linux"; binariesPrefix = "lib"; break;