Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. from macros import error
  2. type Compiler = enum gcc = "gcc", clang = "clang"
  3. var cross {.used.} = false
  4. proc setCompiler(s: string, compiler = gcc, cpp = false) {.used.} =
  5. let c = findExe s
  6. let cpp = (if cpp: ".cpp" else: "")
  7. if c.len == 0:
  8. error s & " binary wasn't found in $PATH."
  9. switch $compiler & cpp & ".exe", c
  10. switch $compiler & cpp & ".linkerexe", c
  11. when defined(musl):
  12. setCompiler "x86_64-linux-musl-gcc"
  13. switch "passL", "-static"
  14. elif defined(x86):
  15. cross = true
  16. setCompiler "i686-pc-linux-gnu-gcc"
  17. switch "cpu", "i386"
  18. switch "passL", "--sysroot=/usr/i686-pc-linux-gnu/"
  19. elif defined(arm):
  20. cross = true
  21. switch "cpu", "arm"
  22. switch "passL", "--sysroot=/usr/arm-linux-gnueabihf/"
  23. elif defined(wasm):
  24. cross = true
  25. let linkerOptions = "-nostdlib -Wl,--no-entry,--allow-undefined,--gc-sections,--strip-all"
  26. switch "o", projectName() & ".wasm"
  27. switch "cpu", "i386"
  28. switch "cc", "clang"
  29. switch "d", "danger"
  30. switch "opt", "size"
  31. switch "stackTrace", "off"
  32. switch "nomain"
  33. switch "d", "nimNoLibc"
  34. switch "d", "noSignalHandler"
  35. switch "passC", "--target=wasm32-unknown-unknown-wasm"
  36. switch "passC", "-mexception-handling"
  37. switch "passC", "-nostdlib"
  38. switch "passL", "--target=wasm32-unknown-unknown-wasm"
  39. switch "clang.options.linker", linkerOptions
  40. switch "clang.cpp.options.linker", linkerOptions
  41. when defined(release) or defined(danger):
  42. switch "excessiveStackTrace", "off"
  43. if not cross:
  44. switch "passC", "-march=native"
  45. switch "passC", "-floop-interchange -ftree-loop-distribution -floop-strip-mine -floop-block"
  46. switch "passC", "-ftree-vectorize"
  47. switch "passC", "-flto"
  48. switch "passL", "-fuse-linker-plugin"
  49. switch "passL", "-s"
  50. when defined(danger):
  51. switch "panics", "on"
  52. when defined(hotcodereloading):
  53. switch "nimcache", "nimcache"
  54. elif defined(danger):
  55. switch "nimcache", "/tmp/nim/" & projectName() & "_d"
  56. elif defined(release):
  57. switch "nimcache", "/tmp/nim/" & projectName() & "_r"
  58. else:
  59. switch "nimcache", "/tmp/nim/" & projectName()
  60. switch "styleCheck", "hint"
  61. switch "hint", "Processing:off"
  62. switch "hint", "Dependency:on"