From 642ce799ecde26f79984e32a9337ec1bf1c2e751 Mon Sep 17 00:00:00 2001 From: Neelesh Chandola Date: Wed, 19 Dec 2018 14:05:25 +0530 Subject: [PATCH] Add support for clang-cl (#9977) --- compiler/extccomp.nim | 10 +++++++++- compiler/options.nim | 2 +- config/nim.cfg | 5 +++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/compiler/extccomp.nim b/compiler/extccomp.nim index 69705db43c..ef371d5d04 100644 --- a/compiler/extccomp.nim +++ b/compiler/extccomp.nim @@ -153,6 +153,13 @@ compiler vcc: structStmtFmt: "$3$n$1 $2", props: {hasCpp, hasAssume, hasDeclspec}) +compiler clangcl: + result = vcc() + result.name = "clang_cl" + result.compilerExe = "clang-cl" + result.cppCompiler = "clang-cl" + result.linkerExe = "clang-cl" + # Intel C/C++ Compiler compiler icl: result = vcc() @@ -353,7 +360,8 @@ const pcc(), ucc(), icl(), - icc()] + icc(), + clangcl()] hExt* = ".h" diff --git a/compiler/options.nim b/compiler/options.nim index 7569598d01..49d2f74049 100644 --- a/compiler/options.nim +++ b/compiler/options.nim @@ -132,7 +132,7 @@ type TSystemCC* = enum ccNone, ccGcc, ccNintendoSwitch, ccLLVM_Gcc, ccCLang, ccLcc, ccBcc, ccDmc, ccWcc, ccVcc, - ccTcc, ccPcc, ccUcc, ccIcl, ccIcc + ccTcc, ccPcc, ccUcc, ccIcl, ccIcc, ccClangCl CfileFlag* {.pure.} = enum Cached, ## no need to recompile this time diff --git a/config/nim.cfg b/config/nim.cfg index e6175784e3..b52c71c942 100644 --- a/config/nim.cfg +++ b/config/nim.cfg @@ -226,6 +226,11 @@ clang.options.speed = "-O3" clang.options.size = "-Os" @if windows: + clang_cl.cpp.options.always %= "${clang_cl.options.always} /EHsc" + @if not release: + clang_cl.options.linker = "/Z7" + clang_cl.cpp.options.linker = "/Z7" + @end clang.options.debug = "-g -gcodeview" clang.cpp.options.debug = "-g -gcodeview" @if not release: