nim.cfg 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. # Configuration file for the Nim Compiler.
  2. # (c) 2017 Andreas Rumpf
  3. # Feel free to edit the default values as you need.
  4. # You may set environment variables with
  5. # @putenv "key" "val"
  6. # Environment variables can be accessed like so:
  7. # gcc.path %= "$CC_PATH"
  8. cc = gcc
  9. # additional options always passed to the compiler:
  10. --parallel_build: "0" # 0 to auto-detect number of processors
  11. hint[LineTooLong]=off
  12. #hint[XDeclaredButNotUsed]=off
  13. # Examples of how to setup a cross-compiler:
  14. # Cross-compiling for Raspberry Pi.
  15. # (This compiler is available in gcc-arm-linux-gnueabihf package on Ubuntu)
  16. arm.linux.gcc.exe = "arm-linux-gnueabihf-gcc"
  17. arm.linux.gcc.linkerexe = "arm-linux-gnueabihf-gcc"
  18. # For OpenWRT, you will also need to adjust PATH to point to your toolchain.
  19. mips.linux.gcc.exe = "mips-openwrt-linux-gcc"
  20. mips.linux.gcc.linkerexe = "mips-openwrt-linux-gcc"
  21. path="$lib/deprecated/core"
  22. path="$lib/deprecated/pure"
  23. path="$lib/pure/collections"
  24. path="$lib/pure/concurrency"
  25. path="$lib/impure"
  26. path="$lib/wrappers"
  27. path="$lib/wrappers/linenoise"
  28. path="$lib/windows"
  29. path="$lib/posix"
  30. path="$lib/js"
  31. path="$lib/pure/unidecode"
  32. path="$lib/arch"
  33. path="$lib/core"
  34. path="$lib/pure"
  35. @if nimbabel:
  36. nimblepath="$home/.nimble/pkgs/"
  37. @if not windows:
  38. nimblepath="/opt/nimble/pkgs/"
  39. @else:
  40. # TODO:
  41. @end
  42. @end
  43. @if release or quick:
  44. obj_checks:off
  45. field_checks:off
  46. range_checks:off
  47. bound_checks:off
  48. overflow_checks:off
  49. assertions:off
  50. stacktrace:off
  51. linetrace:off
  52. debugger:off
  53. line_dir:off
  54. dead_code_elim:on
  55. @if nimHasNilChecks:
  56. nilchecks:off
  57. @end
  58. @end
  59. @if release:
  60. opt:speed
  61. @end
  62. @if unix and mingw:
  63. # Cross compile for Windows from Linux/OSX using MinGW
  64. os = windows
  65. i386.windows.gcc.path = "/usr/bin"
  66. i386.windows.gcc.exe = "i686-w64-mingw32-gcc"
  67. i386.windows.gcc.linkerexe = "i686-w64-mingw32-gcc"
  68. amd64.windows.gcc.path = "/usr/bin"
  69. amd64.windows.gcc.exe = "x86_64-w64-mingw32-gcc"
  70. amd64.windows.gcc.linkerexe = "x86_64-w64-mingw32-gcc"
  71. @end
  72. @if unix:
  73. @if not bsd or haiku:
  74. # -fopenmp
  75. gcc.options.linker = "-ldl"
  76. gcc.cpp.options.linker = "-ldl"
  77. clang.options.linker = "-ldl"
  78. clang.cpp.options.linker = "-ldl"
  79. tcc.options.linker = "-ldl"
  80. @end
  81. @if bsd:
  82. # BSD got posix_spawn only recently, so we deactivate it for osproc:
  83. define:useFork
  84. # at least NetBSD has problems with thread local storage:
  85. tlsEmulation:on
  86. @end
  87. @if haiku:
  88. gcc.options.linker = "-Wl,--as-needed -lnetwork"
  89. gcc.cpp.options.linker = "-Wl,--as-needed -lnetwork"
  90. clang.options.linker = "-Wl,--as-needed -lnetwork"
  91. clang.cpp.options.linker = "-Wl,--as-needed -lnetwork"
  92. tcc.options.linker = "-Wl,--as-needed -lnetwork"
  93. @end
  94. @end
  95. @if android:
  96. cc = clang
  97. @if termux:
  98. gcc.options.linker = "-landroid-glob"
  99. gcc.cpp.options.linker = "-landroid-glob"
  100. clang.options.linker = "-landroid-glob"
  101. clang.cpp.options.linker = "-landroid-glob"
  102. tcc.options.linker = "-landroid-glob"
  103. @end
  104. @end
  105. @if nintendoswitch:
  106. cc = "switch_gcc"
  107. switch_gcc.options.linker = "-g -march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIE"
  108. switch_gcc.cpp.options.linker = "-g -march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIE"
  109. switch_gcc.options.always = "-g -Wall -O2 -ffunction-sections -march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIE -D__SWITCH__"
  110. switch_gcc.cpp.options.always = "-g -Wall -O2 -ffunction-sections -march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIE -D__SWITCH__ -fno-rtti -fno-exceptions -std=gnu++11"
  111. @end
  112. # Configuration for the Intel C/C++ compiler:
  113. @if windows:
  114. icl.options.speed = "/Ox /arch:SSE2"
  115. icl.options.always = "/nologo"
  116. @end
  117. # Configuration for the GNU C/C++ compiler:
  118. @if windows:
  119. #gcc.path = r"$nim\dist\mingw\bin"
  120. @if gcc or tcc:
  121. tlsEmulation:on
  122. @end
  123. @end
  124. @if macosx or freebsd:
  125. cc = clang
  126. tlsEmulation:on
  127. gcc.options.always = "-w"
  128. gcc.cpp.options.always = "-w -fpermissive"
  129. @elif windows:
  130. gcc.options.always = "-w -mno-ms-bitfields"
  131. gcc.cpp.options.always = "-w -fpermissive -mno-ms-bitfields"
  132. @else:
  133. gcc.options.always = "-w"
  134. gcc.cpp.options.always = "-w -fpermissive"
  135. @end
  136. # Configuration for Objective-C compiler:
  137. #
  138. # Options for GNUStep. GNUStep configuration varies wildly, so you'll probably
  139. # have to add additional compiler and linker flags on a per-project basis.
  140. gcc.objc.options.linker = "-lobjc -lgnustep-base"
  141. llvm_gcc.objc.options.linker = "-lobjc -lgnustep-base"
  142. clang.objc.options.linker = "-lobjc -lgnustep-base"
  143. # Options for Mac OS X. Mac OS X uses its own Objective-C stack that is
  144. # totally different from GNUStep.
  145. @if macosx:
  146. gcc.objc.options.linker = "-framework Foundation"
  147. llvm_gcc.objc.options.linker = "-framework Foundation"
  148. clang.objc.options.linker = "-framework Foundation"
  149. @end
  150. # Options for FreeBSD, OpenBSD, NetBSD linker to add locations for searching
  151. # shared libraries.
  152. @if freebsd or openbsd or netbsd:
  153. gcc.options.linker = "-Wl,-rpath=.:/usr/local/lib:/usr/pkg/lib:/usr/X11R6/lib"
  154. gcc.cpp.options.linker = "-Wl,-rpath=.:/usr/local/lib:/usr/pkg/lib:/usr/X11R6/lib"
  155. llvm_gcc.options.linker = "-Wl,-rpath=.:/usr/local/lib:/usr/pkg/lib:/usr/X11R6/lib"
  156. llvm_gcc.cpp.options.linker = "-Wl,-rpath=.:/usr/local/lib:/usr/pkg/lib:/usr/X11R6/lib"
  157. clang.options.linker = "-Wl,-rpath=.:/usr/local/lib:/usr/pkg/lib:/usr/X11R6/lib"
  158. clang.cpp.options.linker = "-Wl,-rpath=.:/usr/local/lib:/usr/pkg/lib:/usr/X11R6/lib"
  159. @end
  160. # Configuration for the VxWorks
  161. # This has been tested with VxWorks 6.9 only
  162. @if vxworks:
  163. # For now we only support compiling RTPs applications (i.e. no DKMs)
  164. gcc.options.always = "-mrtp -fno-strict-aliasing -D_C99 -D_HAS_C9X -std=c99 -fasm -Wall -Wno-write-strings"
  165. # The linker config must add the VxWorks common library for the selected
  166. # processor which is usually found in:
  167. # "$WIND_BASE/target/lib/usr/lib/PROCESSOR_FAMILY/PROCESSOR_TYPE/common",
  168. # where PROCESSOR_FAMILY and PROCESSOR_TYPE are those supported by the VxWorks
  169. # compiler (e.g. ppc/PPC32 or mips/MIPSI64, etc)
  170. # For now we only support the PowerPC CPU
  171. gcc.options.linker %= "-L $WIND_BASE/target/lib/usr/lib/ppc/PPC32/common -mrtp -fno-strict-aliasing -D_C99 -D_HAS_C9X -std=c99 -fasm -Wall -Wno-write-strings"
  172. @end
  173. gcc.options.speed = "-O3 -fno-strict-aliasing"
  174. gcc.options.size = "-Os"
  175. @if windows:
  176. gcc.options.debug = "-g3 -O0 -gdwarf-3"
  177. @else:
  178. gcc.options.debug = "-g3 -O0"
  179. @end
  180. gcc.cpp.options.speed = "-O3 -fno-strict-aliasing"
  181. gcc.cpp.options.size = "-Os"
  182. gcc.cpp.options.debug = "-g3 -O0"
  183. #passl = "-pg"
  184. # Configuration for the LLVM GCC compiler:
  185. llvm_gcc.options.debug = "-g"
  186. llvm_gcc.options.always = "-w"
  187. llvm_gcc.options.speed = "-O2"
  188. llvm_gcc.options.size = "-Os"
  189. # Configuration for the LLVM CLang compiler:
  190. clang.options.debug = "-g"
  191. clang.cpp.options.debug = "-g"
  192. clang.options.always = "-w"
  193. clang.options.speed = "-O3"
  194. clang.options.size = "-Os"
  195. @if windows:
  196. clang_cl.cpp.options.always %= "${clang_cl.options.always} /EHsc"
  197. @if not release:
  198. clang_cl.options.linker = "/Z7"
  199. clang_cl.cpp.options.linker = "/Z7"
  200. @end
  201. clang.options.debug = "-g -gcodeview"
  202. clang.cpp.options.debug = "-g -gcodeview"
  203. @if not release:
  204. clang.options.linker = "-g"
  205. clang.cpp.options.linker = "-g"
  206. @end
  207. @end
  208. # Configuration for the Visual C/C++ compiler:
  209. # VCCEXE is a tool that invokes the Visual Studio Developer Command Prompt
  210. # before calling the compiler.
  211. # Please make sure either Visual Studio or C++ Build SKU is installed when using the vcc compiler backend.
  212. vcc.exe = "vccexe.exe"
  213. vcc.cpp.exe = "vccexe.exe"
  214. vcc.linkerexe = "vccexe.exe"
  215. vcc.cpp.linkerexe = "vccexe.exe"
  216. # set the options for specific platforms:
  217. vcc.options.always = "/nologo"
  218. @if release:
  219. # no debug symbols in release builds
  220. @else:
  221. vcc.options.always %= "${vcc.options.always} /Z7" # Get VCC to output full debug symbols in the obj file
  222. @end
  223. vcc.cpp.options.always %= "${vcc.options.always} /EHsc"
  224. vcc.options.linker = "/nologo /DEBUG /Zi /F33554432" # set the stack size to 32 MiB
  225. vcc.cpp.options.linker %= "${vcc.options.linker}"
  226. @if i386:
  227. vcc.options.always = "--platform:x86 /nologo"
  228. vcc.cpp.options.always = "--platform:x86 /nologo /EHsc"
  229. vcc.options.linker = "--platform:x86 /nologo /DEBUG /Zi /F33554432" # set the stack size to 32 MiB
  230. vcc.cpp.options.linker = "--platform:x86 /nologo /DEBUG /Zi /F33554432" # set the stack size to 32 MiB
  231. @elif amd64:
  232. vcc.options.always = "--platform:amd64 /nologo"
  233. vcc.cpp.options.always = "--platform:amd64 /nologo /EHsc"
  234. vcc.options.linker = "--platform:amd64 /nologo /DEBUG /Zi /F33554432" # set the stack size to 32 MiB
  235. vcc.cpp.options.linker = "--platform:amd64 /nologo /DEBUG /Zi /F33554432" # set the stack size to 32 MiB
  236. @elif arm:
  237. vcc.options.always = "--platform:arm /nologo"
  238. vcc.cpp.options.always = "--platform:arm /nologo /EHsc"
  239. vcc.options.linker = "--platform:arm /nologo /DEBUG /Zi /F33554432" # set the stack size to 32 MiB
  240. vcc.cpp.options.linker = "--platform:arm /nologo /DEBUG /Zi /F33554432" # set the stack size to 32 MiB
  241. @else:
  242. vcc.options.always = "/nologo"
  243. vcc.cpp.options.always = "/nologo /EHsc"
  244. vcc.options.linker = "/nologo /DEBUG /Zi /F33554432" # set the stack size to 32 MiB
  245. vcc.cpp.options.linker = "/nologo /DEBUG /Zi /F33554432" # set the stack size to 32 MiB
  246. @end
  247. vcc.options.debug = "/Zi /FS /Od"
  248. vcc.cpp.options.debug = "/Zi /FS /Od"
  249. vcc.options.speed = "/O2"
  250. vcc.cpp.options.speed = "/O2"
  251. vcc.options.size = "/O1"
  252. vcc.cpp.options.size = "/O1"
  253. # Configuration for the Tiny C Compiler:
  254. tcc.options.always = "-w"
  255. # Configuration for the Genode toolchain
  256. @if genode:
  257. noCppExceptions # avoid std C++
  258. tlsEmulation:on # no TLS segment register magic
  259. gcc.path = "/usr/local/genode-gcc/bin"
  260. @if i386 or amd64:
  261. gcc.exe = "genode-x86-gcc"
  262. gcc.cpp.exe = "genode-x86-g++"
  263. gcc.cpp.linkerexe = "genode-x86-ld"
  264. @elif arm:
  265. gcc.exe = "genode-arm-gcc"
  266. gcc.cpp.exe = "genode-arm-g++"
  267. gcc.cpp.linkerexe = "genode-arm-ld"
  268. @end
  269. @end