From 220dd54acfd5527c7c569811013b178fc462898e Mon Sep 17 00:00:00 2001 From: Araq Date: Thu, 24 Mar 2011 01:26:52 +0100 Subject: [PATCH] support for clang --- config/nimrod.cfg | 7 +++++++ rod/extccomp.nim | 18 ++++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/config/nimrod.cfg b/config/nimrod.cfg index 56ee74ddee..7e8d4b777a 100755 --- a/config/nimrod.cfg +++ b/config/nimrod.cfg @@ -60,6 +60,7 @@ hint[LineTooLong]=off @if unix: @if not bsd: gcc.options.linker = "-ldl" + clang.options.linker = "-ldl" tcc.options.linker = "-ldl" @end @end @@ -96,6 +97,12 @@ llvm_gcc.options.always = "-w" llvm_gcc.options.speed = "-O2" llvm_gcc.options.size = "-Os" +# Configuration for the LLVM CLang compiler: +clang.options.debug = "-g" +clang.options.always = "-w" +clang.options.speed = "-O3" +clang.options.size = "-Os" + # Configuration for the Visual C/C++ compiler: vcc.options.linker = r"/F33554432" # set the stack size to 8 MB vcc.options.debug = "/RTC1 /ZI" diff --git a/rod/extccomp.nim b/rod/extccomp.nim index ea64c16b65..a673c5ca0c 100755 --- a/rod/extccomp.nim +++ b/rod/extccomp.nim @@ -15,8 +15,8 @@ import type TSystemCC* = enum - ccNone, ccGcc, ccLLVM_Gcc, ccLcc, ccBcc, ccDmc, ccWcc, ccVcc, ccTcc, ccPcc, - ccUcc, ccIcc, ccGpp + ccNone, ccGcc, ccLLVM_Gcc, ccCLang, ccLcc, ccBcc, ccDmc, ccWcc, ccVcc, + ccTcc, ccPcc, ccUcc, ccIcc, ccGpp TInfoCCProp* = enum # properties of the C compiler: hasSwitchRange, # CC allows ranges in switch statements (GNU C) hasComputedGoto, # CC has computed goto (GNU C extension) @@ -72,6 +72,20 @@ const debug: "", pic: "-fPIC", asmStmtFrmt: "asm($1);$n", props: {hasSwitchRange, hasComputedGoto, hasCpp}), + (name: "clang", + objExt: "o", + optSpeed: " -O3 -ffast-math ", + optSize: " -Os -ffast-math ", + compilerExe: "clang", + compileTmpl: "-c $options $include -o $objfile $file", + buildGui: " -mwindows", + buildDll: " -shared", + linkerExe: "clang", + linkTmpl: "$options $buildgui $builddll -o $exefile $objfiles", + includeCmd: " -I", + debug: "", pic: "-fPIC", + asmStmtFrmt: "asm($1);$n", + props: {hasSwitchRange, hasComputedGoto, hasCpp}), (name: "lcc", objExt: "obj", optSpeed: " -O -p6 ",