diff --git a/docs/build_xml/Defines.md b/docs/build_xml/Defines.md index 319c47cca..6d89b214a 100755 --- a/docs/build_xml/Defines.md +++ b/docs/build_xml/Defines.md @@ -91,3 +91,5 @@ Defines affecting target architecture. | *HXCPP_MINGW* | Compile for windows using mingw | | *NO_AUTO_MSVC* | Do not detect msvc location, use the one already in the executable path | | *HXCPP_WINXP_COMPAT* | Remain compatible with Windows XP. Disables condition variables. No effect on ARM. | +| *HXCPP_MSVC_LLVM* | Compile for windows using the LLVM-based MSVC toolchain | +| *HXCPP_MSVC_ROOT* | Set the root for MSVC libraries and headers | diff --git a/src/hx/libs/regexp/pcre2_sources.xml b/src/hx/libs/regexp/pcre2_sources.xml index a70d8fa0e..e91bb83c8 100644 --- a/src/hx/libs/regexp/pcre2_sources.xml +++ b/src/hx/libs/regexp/pcre2_sources.xml @@ -3,7 +3,7 @@ - + @@ -32,4 +32,4 @@ - \ No newline at end of file + diff --git a/toolchain/msvc-toolchain.xml b/toolchain/msvc-toolchain.xml index fc2383848..efc8ca49e 100644 --- a/toolchain/msvc-toolchain.xml +++ b/toolchain/msvc-toolchain.xml @@ -3,7 +3,27 @@ + +
+ + + + + + + +
+ +
+ + + + + + + +
@@ -52,8 +72,15 @@ + +
+ + +
+ + @@ -107,19 +134,28 @@ - - + +
+ +
+
+ + +
+ - + - +
+ + @@ -142,8 +178,10 @@ + + @@ -166,7 +204,9 @@ + + @@ -175,8 +215,10 @@ + + @@ -197,10 +239,12 @@ + + diff --git a/tools/hxcpp/BuildTool.hx b/tools/hxcpp/BuildTool.hx index 4f553eade..bb5434e05 100644 --- a/tools/hxcpp/BuildTool.hx +++ b/tools/hxcpp/BuildTool.hx @@ -1525,6 +1525,11 @@ class BuildTool return instance.mDefines.get("toolchain")=="msvc"; } + public static function isMsvcLlvm() + { + return isMsvc() && instance.mDefines.exists("HXCPP_MSVC_LLVM"); + } + public static function isMingw() { return instance.mDefines.get("toolchain")=="mingw"; @@ -2129,9 +2134,14 @@ class BuildTool // Cross-compile? if(defines.exists("windows")) { - defines.set("toolchain","mingw"); - defines.set("mingw", "mingw"); - defines.set("xcompile","1"); + if (defines.exists("HXCPP_MSVC_LLVM")) + defines.set("toolchain", "msvc"); + else + { + defines.set("toolchain","mingw"); + defines.set("mingw", "mingw"); + } + defines.set("xcompile", "1"); defines.set("BINDIR", arm64 ? "WindowsArm64" : m64 ? "Windows64":"Windows"); } else diff --git a/tools/hxcpp/Compiler.hx b/tools/hxcpp/Compiler.hx index e93674865..5531497dd 100644 --- a/tools/hxcpp/Compiler.hx +++ b/tools/hxcpp/Compiler.hx @@ -640,8 +640,10 @@ class Compiler if (mPCH == "msvc") { args.push( mPCHCreate + header + ".h" ); - var symbol = "link" + Md5.encode( PathManager.combine(dir, file + mExt) ); - args.push( "-Yl" + symbol ); + if (!BuildTool.isMsvcLlvm()) { + var symbol = "link" + Md5.encode( PathManager.combine(dir, file + mExt) ); + args.push( "-Yl" + symbol ); + } // Create a temp file for including ... var tmp_cpp = dir + "/" + file + ".cpp"; @@ -695,7 +697,7 @@ class Compiler mPCH = inPCH; createCompilerVersion(); final regex = ~/clang/i; - if (inPCH != null && regex.match(mCompilerVersionString)) { + if (inPCH != null && regex.match(mCompilerVersionString) && !BuildTool.isMsvcLlvm()) { mPCH = "clang"; } switch (mPCH) { diff --git a/tools/hxcpp/Setup.hx b/tools/hxcpp/Setup.hx index d2bd8fefd..899cc3bf4 100644 --- a/tools/hxcpp/Setup.hx +++ b/tools/hxcpp/Setup.hx @@ -781,7 +781,8 @@ class Setup public static function setupMSVC(ioDefines:Hash, in64:Bool, inArm64, isWinRT:Bool) { var detectMsvc = !ioDefines.exists("NO_AUTO_MSVC") && - !ioDefines.exists("HXCPP_MSVC_CUSTOM"); + !ioDefines.exists("HXCPP_MSVC_CUSTOM") && + !ioDefines.exists("HXCPP_MSVC_ROOT"); if (ioDefines.exists("HXCPP_MSVC_VER")) { @@ -901,6 +902,8 @@ class Setup } } + if (ioDefines.exists("HXCPP_MSVC_LLVM")) return; + try { var proc = new Process("cl.exe",[]);