nim.cfg 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  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. # Haiku currently have problems with TLS
  89. # https://dev.haiku-os.org/ticket/14342
  90. tlsEmulation:on
  91. gcc.options.linker = "-Wl,--as-needed -lnetwork"
  92. gcc.cpp.options.linker = "-Wl,--as-needed -lnetwork"
  93. clang.options.linker = "-Wl,--as-needed -lnetwork"
  94. clang.cpp.options.linker = "-Wl,--as-needed -lnetwork"
  95. tcc.options.linker = "-Wl,--as-needed -lnetwork"
  96. @end
  97. @end
  98. @if android:
  99. cc = clang
  100. @if termux:
  101. gcc.options.linker = "-landroid-glob"
  102. gcc.cpp.options.linker = "-landroid-glob"
  103. clang.options.linker = "-landroid-glob"
  104. clang.cpp.options.linker = "-landroid-glob"
  105. tcc.options.linker = "-landroid-glob"
  106. @end
  107. @end
  108. @if nintendoswitch:
  109. cc = "switch_gcc"
  110. switch_gcc.options.linker = "-g -march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIE"
  111. switch_gcc.cpp.options.linker = "-g -march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIE"
  112. switch_gcc.options.always = "-g -Wall -O2 -ffunction-sections -march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIE -D__SWITCH__"
  113. 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"
  114. @end
  115. # Configuration for the Intel C/C++ compiler:
  116. @if windows:
  117. icl.options.speed = "/Ox /arch:SSE2"
  118. icl.options.always = "/nologo"
  119. @end
  120. # Configuration for the GNU C/C++ compiler:
  121. @if windows:
  122. #gcc.path = r"$nim\dist\mingw\bin"
  123. @if gcc or tcc:
  124. tlsEmulation:on
  125. @end
  126. @end
  127. @if macosx or freebsd:
  128. cc = clang
  129. tlsEmulation:on
  130. gcc.options.always = "-w"
  131. gcc.cpp.options.always = "-w -fpermissive"
  132. @elif windows:
  133. gcc.options.always = "-w -mno-ms-bitfields"
  134. gcc.cpp.options.always = "-w -fpermissive -mno-ms-bitfields"
  135. @else:
  136. gcc.options.always = "-w"
  137. gcc.cpp.options.always = "-w -fpermissive"
  138. @end
  139. # Configuration for Objective-C compiler:
  140. #
  141. # Options for GNUStep. GNUStep configuration varies wildly, so you'll probably
  142. # have to add additional compiler and linker flags on a per-project basis.
  143. gcc.objc.options.linker = "-lobjc -lgnustep-base"
  144. llvm_gcc.objc.options.linker = "-lobjc -lgnustep-base"
  145. clang.objc.options.linker = "-lobjc -lgnustep-base"
  146. # Options for Mac OS X. Mac OS X uses its own Objective-C stack that is
  147. # totally different from GNUStep.
  148. @if macosx:
  149. gcc.objc.options.linker = "-framework Foundation"
  150. llvm_gcc.objc.options.linker = "-framework Foundation"
  151. clang.objc.options.linker = "-framework Foundation"
  152. @end
  153. # Options for FreeBSD, OpenBSD, NetBSD linker to add locations for searching
  154. # shared libraries.
  155. @if freebsd or openbsd or netbsd:
  156. gcc.options.linker = "-Wl,-rpath=.:/usr/local/lib:/usr/pkg/lib:/usr/X11R6/lib"
  157. gcc.cpp.options.linker = "-Wl,-rpath=.:/usr/local/lib:/usr/pkg/lib:/usr/X11R6/lib"
  158. llvm_gcc.options.linker = "-Wl,-rpath=.:/usr/local/lib:/usr/pkg/lib:/usr/X11R6/lib"
  159. llvm_gcc.cpp.options.linker = "-Wl,-rpath=.:/usr/local/lib:/usr/pkg/lib:/usr/X11R6/lib"
  160. clang.options.linker = "-Wl,-rpath=.:/usr/local/lib:/usr/pkg/lib:/usr/X11R6/lib"
  161. clang.cpp.options.linker = "-Wl,-rpath=.:/usr/local/lib:/usr/pkg/lib:/usr/X11R6/lib"
  162. @end
  163. # Configuration for the VxWorks
  164. # This has been tested with VxWorks 6.9 only
  165. @if vxworks:
  166. # For now we only support compiling RTPs applications (i.e. no DKMs)
  167. gcc.options.always = "-mrtp -fno-strict-aliasing -D_C99 -D_HAS_C9X -std=c99 -fasm -Wall -Wno-write-strings"
  168. # The linker config must add the VxWorks common library for the selected
  169. # processor which is usually found in:
  170. # "$WIND_BASE/target/lib/usr/lib/PROCESSOR_FAMILY/PROCESSOR_TYPE/common",
  171. # where PROCESSOR_FAMILY and PROCESSOR_TYPE are those supported by the VxWorks
  172. # compiler (e.g. ppc/PPC32 or mips/MIPSI64, etc)
  173. # For now we only support the PowerPC CPU
  174. 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"
  175. @end
  176. gcc.options.speed = "-O3 -fno-strict-aliasing"
  177. gcc.options.size = "-Os"
  178. @if windows:
  179. gcc.options.debug = "-g3 -O0 -gdwarf-3"
  180. @else:
  181. gcc.options.debug = "-g3 -O0"
  182. @end
  183. gcc.cpp.options.speed = "-O3 -fno-strict-aliasing"
  184. gcc.cpp.options.size = "-Os"
  185. gcc.cpp.options.debug = "-g3 -O0"
  186. #passl = "-pg"
  187. # Configuration for the LLVM GCC compiler:
  188. llvm_gcc.options.debug = "-g"
  189. llvm_gcc.options.always = "-w"
  190. llvm_gcc.options.speed = "-O2"
  191. llvm_gcc.options.size = "-Os"
  192. # Configuration for the LLVM CLang compiler:
  193. clang.options.debug = "-g"
  194. clang.options.always = "-w"
  195. clang.options.speed = "-O3"
  196. clang.options.size = "-Os"
  197. # Configuration for the Visual C/C++ compiler:
  198. # VCCEXE is a tool that invokes the Visual Studio Developer Command Prompt
  199. # before calling the compiler.
  200. # Please make sure either Visual Studio or C++ Build SKU is installed when using the vcc compiler backend.
  201. vcc.exe = "vccexe.exe"
  202. vcc.cpp.exe = "vccexe.exe"
  203. vcc.linkerexe = "vccexe.exe"
  204. vcc.cpp.linkerexe = "vccexe.exe"
  205. # set the options for specific platforms:
  206. vcc.options.always = "/nologo"
  207. @if release:
  208. # no debug symbols in release builds
  209. @else:
  210. vcc.options.always %= "${vcc.options.always} /Z7" # Get VCC to output full debug symbols in the obj file
  211. @end
  212. vcc.cpp.options.always %= "${vcc.options.always} /EHsc"
  213. vcc.options.linker = "/nologo /DEBUG /Zi /F33554432" # set the stack size to 32 MiB
  214. vcc.cpp.options.linker %= "${vcc.options.linker}"
  215. @if i386:
  216. vcc.options.always = "--platform:x86 /nologo"
  217. vcc.cpp.options.always = "--platform:x86 /nologo /EHsc"
  218. vcc.options.linker = "--platform:x86 /nologo /DEBUG /Zi /F33554432" # set the stack size to 32 MiB
  219. vcc.cpp.options.linker = "--platform:x86 /nologo /DEBUG /Zi /F33554432" # set the stack size to 32 MiB
  220. @elif amd64:
  221. vcc.options.always = "--platform:amd64 /nologo"
  222. vcc.cpp.options.always = "--platform:amd64 /nologo /EHsc"
  223. vcc.options.linker = "--platform:amd64 /nologo /DEBUG /Zi /F33554432" # set the stack size to 32 MiB
  224. vcc.cpp.options.linker = "--platform:amd64 /nologo /DEBUG /Zi /F33554432" # set the stack size to 32 MiB
  225. @elif arm:
  226. vcc.options.always = "--platform:arm /nologo"
  227. vcc.cpp.options.always = "--platform:arm /nologo /EHsc"
  228. vcc.options.linker = "--platform:arm /nologo /DEBUG /Zi /F33554432" # set the stack size to 32 MiB
  229. vcc.cpp.options.linker = "--platform:arm /nologo /DEBUG /Zi /F33554432" # set the stack size to 32 MiB
  230. @else:
  231. vcc.options.always = "/nologo"
  232. vcc.cpp.options.always = "/nologo /EHsc"
  233. vcc.options.linker = "/nologo /DEBUG /Zi /F33554432" # set the stack size to 32 MiB
  234. vcc.cpp.options.linker = "/nologo /DEBUG /Zi /F33554432" # set the stack size to 32 MiB
  235. @end
  236. vcc.options.debug = "/Zi /FS /Od"
  237. vcc.cpp.options.debug = "/Zi /FS /Od"
  238. vcc.options.speed = "/O2"
  239. vcc.cpp.options.speed = "/O2"
  240. vcc.options.size = "/O1"
  241. vcc.cpp.options.size = "/O1"
  242. # Configuration for the Tiny C Compiler:
  243. tcc.options.always = "-w"
  244. # Configuration for the Genode toolchain
  245. @if genode:
  246. gcc.path = "/usr/local/genode-gcc/bin"
  247. gcc.cpp.options.always = "-D__GENODE__ -fno-stack-protector"
  248. @if i386 or amd64:
  249. gcc.exe = "genode-x86-gcc"
  250. gcc.cpp.exe = "genode-x86-g++"
  251. @elif arm:
  252. gcc.exe = "genode-arm-gcc"
  253. gcc.cpp.exe = "genode-arm-g++"
  254. @end
  255. @end