From 747653911c088227ae0717179f83190a896f61e9 Mon Sep 17 00:00:00 2001 From: Philip Wernersbach Date: Sun, 15 Mar 2015 19:07:42 -0400 Subject: [PATCH 1/2] Add compiler-specific configuration options for all compilers. --- compiler/extccomp.nim | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/compiler/extccomp.nim b/compiler/extccomp.nim index 8888632b95..a68e7f7348 100644 --- a/compiler/extccomp.nim +++ b/compiler/extccomp.nim @@ -363,7 +363,16 @@ proc nameToCC*(name: string): TSystemCC = proc getConfigVar(c: TSystemCC, suffix: string): string = # use ``cpu.os.cc`` for cross compilation, unless ``--compileOnly`` is given # for niminst support - let fullSuffix = (if gCmd == cmdCompileToCpp: ".cpp" & suffix else: suffix) + let fullSuffix = + if gCmd == cmdCompileToCpp: + ".cpp" & suffix + elif gCmd == cmdCompileToOC: + ".objc" & suffix + elif gCmd == cmdCompileToJS: + ".js" & suffix + else: + suffix + if (platform.hostOS != targetOS or platform.hostCPU != targetCPU) and optCompileOnly notin gGlobalOptions: let fullCCname = platform.CPU[targetCPU].name & '.' & From 5be4e7b9f057f207c8f19176c9d0a58bee41ad4e Mon Sep 17 00:00:00 2001 From: Philip Wernersbach Date: Sun, 15 Mar 2015 19:08:58 -0400 Subject: [PATCH 2/2] Add linker flags for the Objective-C compilation mode. Fixes Araq/Nim#2153. --- config/nim.cfg | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/config/nim.cfg b/config/nim.cfg index cb3f897d40..ccb9977db4 100644 --- a/config/nim.cfg +++ b/config/nim.cfg @@ -112,6 +112,22 @@ path="$lib/pure/unidecode" gcc.cpp.options.always = "-w -fpermissive" @end +# Configuration for Objective-C compiler: +# +# Options for GNUStep. GNUStep configuration varies wildly, so you'll probably +# have to add additional compiler and linker flags on a per-project basis. +gcc.objc.options.linker = "-lobjc -lgnustep-base" +llvm_gcc.objc.options.linker = "-lobjc -lgnustep-base" +clang.objc.options.linker = "-lobjc -lgnustep-base" + +# Options for Mac OS X. Mac OS X uses its own Objective-C stack that is +# totally different from GNUStep. +@if macosx: + gcc.objc.options.linker = "-framework Foundation" + llvm_gcc.objc.options.linker = "-framework Foundation" + clang.objc.options.linker = "-framework Foundation" +@end + # Configuration for the VxWorks # This has been tested with VxWorks 6.9 only @if vxworks: