nim.cfg 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  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. # example of how to setup a cross-compiler:
  14. arm.linux.gcc.exe = "arm-linux-gcc"
  15. arm.linux.gcc.linkerexe = "arm-linux-gcc"
  16. mips.linux.gcc.exe = "mips-openwrt-linux-gcc"
  17. mips.linux.gcc.linkerexe = "mips-openwrt-linux-gcc"
  18. path="$lib/deprecated/core"
  19. path="$lib/deprecated/pure"
  20. path="$lib/pure/collections"
  21. path="$lib/pure/concurrency"
  22. path="$lib/impure"
  23. path="$lib/wrappers"
  24. path="$lib/wrappers/linenoise"
  25. path="$lib/windows"
  26. path="$lib/posix"
  27. path="$lib/js"
  28. path="$lib/pure/unidecode"
  29. path="$lib/arch"
  30. path="$lib/core"
  31. path="$lib/pure"
  32. @if nimbabel:
  33. nimblepath="$home/.nimble/pkgs/"
  34. @if not windows:
  35. nimblepath="/opt/nimble/pkgs/"
  36. @else:
  37. # TODO:
  38. @end
  39. @end
  40. @if release or quick:
  41. obj_checks:off
  42. field_checks:off
  43. range_checks:off
  44. bound_checks:off
  45. overflow_checks:off
  46. assertions:off
  47. stacktrace:off
  48. linetrace:off
  49. debugger:off
  50. line_dir:off
  51. dead_code_elim:on
  52. @end
  53. @if release:
  54. opt:speed
  55. @end
  56. @if unix:
  57. @if not bsd or haiku:
  58. # -fopenmp
  59. gcc.options.linker = "-ldl"
  60. gcc.cpp.options.linker = "-ldl"
  61. clang.options.linker = "-ldl"
  62. clang.cpp.options.linker = "-ldl"
  63. tcc.options.linker = "-ldl"
  64. @end
  65. @if bsd or haiku:
  66. # BSD got posix_spawn only recently, so we deactivate it for osproc:
  67. define:useFork
  68. # at least NetBSD has problems with thread local storage:
  69. tlsEmulation:on
  70. @end
  71. @if haiku:
  72. # -fopenmp
  73. gcc.options.linker = "-lroot -lnetwork"
  74. gcc.cpp.options.linker = "-lroot -lnetwork"
  75. clang.options.linker = "-lroot -lnetwork"
  76. clang.cpp.options.linker = "-lroot -lnetwork"
  77. tcc.options.linker = "-lroot -lnetwork"
  78. @end
  79. @end
  80. @if android:
  81. cc = clang
  82. @if termux:
  83. gcc.options.linker = "-landroid-glob"
  84. gcc.cpp.options.linker = "-landroid-glob"
  85. clang.options.linker = "-landroid-glob"
  86. clang.cpp.options.linker = "-landroid-glob"
  87. tcc.options.linker = "-landroid-glob"
  88. define:"useShPath:/system/bin/sh"
  89. @end
  90. @end
  91. # Configuration for the Intel C/C++ compiler:
  92. @if windows:
  93. icl.options.speed = "/Ox /arch:SSE2"
  94. icl.options.always = "/nologo"
  95. @end
  96. # Configuration for the GNU C/C++ compiler:
  97. @if windows:
  98. #gcc.path = r"$nim\dist\mingw\bin"
  99. @if gcc:
  100. tlsEmulation:on
  101. @end
  102. @end
  103. @if macosx or freebsd:
  104. cc = clang
  105. tlsEmulation:on
  106. gcc.options.always = "-w"
  107. gcc.cpp.options.always = "-w -fpermissive"
  108. @elif windows:
  109. gcc.options.always = "-w -mno-ms-bitfields"
  110. gcc.cpp.options.always = "-w -fpermissive -mno-ms-bitfields"
  111. @else:
  112. gcc.options.always = "-w"
  113. gcc.cpp.options.always = "-w -fpermissive"
  114. @end
  115. # Configuration for Objective-C compiler:
  116. #
  117. # Options for GNUStep. GNUStep configuration varies wildly, so you'll probably
  118. # have to add additional compiler and linker flags on a per-project basis.
  119. gcc.objc.options.linker = "-lobjc -lgnustep-base"
  120. llvm_gcc.objc.options.linker = "-lobjc -lgnustep-base"
  121. clang.objc.options.linker = "-lobjc -lgnustep-base"
  122. # Options for Mac OS X. Mac OS X uses its own Objective-C stack that is
  123. # totally different from GNUStep.
  124. @if macosx:
  125. gcc.objc.options.linker = "-framework Foundation"
  126. llvm_gcc.objc.options.linker = "-framework Foundation"
  127. clang.objc.options.linker = "-framework Foundation"
  128. @end
  129. # Options for FreeBSD, OpenBSD, NetBSD linker to add locations for searching
  130. # shared libraries.
  131. @if freebsd or openbsd or netbsd:
  132. gcc.options.linker = "-Wl,-rpath=.:/usr/local/lib:/usr/pkg/lib:/usr/X11R6/lib"
  133. gcc.cpp.options.linker = "-Wl,-rpath=.:/usr/local/lib:/usr/pkg/lib:/usr/X11R6/lib"
  134. llvm_gcc.options.linker = "-Wl,-rpath=.:/usr/local/lib:/usr/pkg/lib:/usr/X11R6/lib"
  135. llvm_gcc.cpp.options.linker = "-Wl,-rpath=.:/usr/local/lib:/usr/pkg/lib:/usr/X11R6/lib"
  136. clang.options.linker = "-Wl,-rpath=.:/usr/local/lib:/usr/pkg/lib:/usr/X11R6/lib"
  137. clang.cpp.options.linker = "-Wl,-rpath=.:/usr/local/lib:/usr/pkg/lib:/usr/X11R6/lib"
  138. @end
  139. # Configuration for the VxWorks
  140. # This has been tested with VxWorks 6.9 only
  141. @if vxworks:
  142. # For now we only support compiling RTPs applications (i.e. no DKMs)
  143. gcc.options.always = "-mrtp -fno-strict-aliasing -D_C99 -D_HAS_C9X -std=c99 -fasm -Wall -Wno-write-strings"
  144. # The linker config must add the VxWorks common library for the selected
  145. # processor which is usually found in:
  146. # "$WIND_BASE/target/lib/usr/lib/PROCESSOR_FAMILY/PROCESSOR_TYPE/common",
  147. # where PROCESSOR_FAMILY and PROCESSOR_TYPE are those supported by the VxWorks
  148. # compiler (e.g. ppc/PPC32 or mips/MIPSI64, etc)
  149. # For now we only support the PowerPC CPU
  150. 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"
  151. @end
  152. gcc.options.speed = "-O3 -fno-strict-aliasing"
  153. gcc.options.size = "-Os"
  154. @if windows:
  155. gcc.options.debug = "-g3 -O0 -gdwarf-3"
  156. @else:
  157. gcc.options.debug = "-g3 -O0"
  158. @end
  159. gcc.cpp.options.speed = "-O3 -fno-strict-aliasing"
  160. gcc.cpp.options.size = "-Os"
  161. gcc.cpp.options.debug = "-g3 -O0"
  162. #passl = "-pg"
  163. # Configuration for the LLVM GCC compiler:
  164. llvm_gcc.options.debug = "-g"
  165. llvm_gcc.options.always = "-w"
  166. llvm_gcc.options.speed = "-O2"
  167. llvm_gcc.options.size = "-Os"
  168. # Configuration for the LLVM CLang compiler:
  169. clang.options.debug = "-g"
  170. clang.options.always = "-w"
  171. clang.options.speed = "-O3"
  172. clang.options.size = "-Os"
  173. # Configuration for the Visual C/C++ compiler:
  174. vcc.exe = "vccexe.exe"
  175. vcc.cpp.exe = "vccexe.exe"
  176. vcc.linkerexe = "vccexe.exe"
  177. vcc.cpp.linkerexe = "vccexe.exe"
  178. # set the options for specific platforms:
  179. vcc.options.always = "/nologo"
  180. vcc.cpp.options.always %= "${vcc.options.always} /EHsc"
  181. vcc.options.linker = "/nologo /DEBUG /Zi /F33554432" # set the stack size to 32 MiB
  182. vcc.cpp.options.linker %= "${vcc.options.linker}"
  183. @if i386:
  184. vcc.options.always %= "--platform:x86 ${vcc.options.always}"
  185. vcc.cpp.options.always %= "--platform:x86 ${vcc.cpp.options.always}"
  186. vcc.options.linker %= "--platform:x86 ${vcc.options.linker}"
  187. vcc.cpp.options.linker %= "--platform:x86 ${vcc.cpp.options.linker}"
  188. @elif amd64:
  189. vcc.options.always %= "--platform:amd64 ${vcc.options.always}"
  190. vcc.cpp.options.always %= "--platform:amd64 ${vcc.cpp.options.always}"
  191. vcc.options.linker %= "--platform:amd64 ${vcc.options.linker}"
  192. vcc.cpp.options.linker %= "--platform:amd64 ${vcc.cpp.options.linker}"
  193. @elif arm:
  194. vcc.options.always %= "--platform:arm ${vcc.options.always}"
  195. vcc.cpp.options.always %= "--platform:arm ${vcc.cpp.options.always}"
  196. vcc.options.linker %= "--platform:arm ${vcc.options.linker}"
  197. vcc.cpp.options.linker %= "--platform:arm ${vcc.cpp.options.linker}"
  198. @end
  199. vcc.options.debug = "/Zi /FS /Od"
  200. vcc.cpp.options.debug = "/Zi /FS /Od"
  201. vcc.options.speed = "/O2"
  202. vcc.cpp.options.speed = "/O2"
  203. vcc.options.size = "/O1"
  204. vcc.cpp.options.size = "/O1"
  205. # Configuration for the Tiny C Compiler:
  206. tcc.options.always = "-w"