-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.nims
60 lines (46 loc) · 1.33 KB
/
config.nims
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
include "version.nims"
var TC = "gcc"
#var TC = "clang"
#var TC = "vcc"
#var TC = "tcc"
if TC != "vcc":
if "" == findExe(TC): # GCC is default compiler if TC dosn't exist on the PATH
TC = "gcc"
if "" == findExe(TC): # if dosn't exist gcc, try clang
TC = "clang"
#const LTO = true # further reudce code size
const LTO = false
#switch "passL","-static-libgcc" # for 32bit Windows ?
switch "define", "release"
#switch "define", "danger"
#switch "opt", "size"
# Reduce code size further
when false:
#switch "mm","arc" # nim-1.6.8 or later
switch "gc","arc"
switch "define","useMalloc"
switch "define","noSignalHandler"
#switch "panics","on"
#switch "verbosity","2"
proc commonOpt() =
switch "passL", "-s"
switch "passC", "-ffunction-sections"
switch "passC", "-fdata-sections"
switch "passC", "-Wl,--gc-sections"
switch "passL", "-Wl,--gc-sections"
#const NIMCACHE = ".nimcache_" & TC
switch "nimcache", ".nimcache"
case TC
of "gcc":
commonOpt()
when LTO: # These options let link time slow while reducing code size.
switch "passC", "-flto"
switch "passL", "-flto"
of "clang":
commonOpt()
#switch "passC","-flto=auto"
#switch "passL","-flto"
switch "cc", TC
echo ""
echo "#### Compiler: [ ",TC," ] ####"
echo ""