Wiki Roadmap Timeline Tickets New Ticket Source Search Help / Guide About Trac Login

root/premake.lua

Revision 758:f04dde6e882c, 2.7 kB (checked in by Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>, 2 months ago)

Added initial D2 support, D2 frontend and changes to codegen to make things compile.

Line 
1 project.name = ldc
2
3 -- options
4
5 -- we always make vtables opaque, it simply kills performance...
6 OPAQUE_VTBLS = 1
7
8 -- use of boehm gc
9 USE_BOEHM_GC = 0
10 if OS ~= "windows" then
11     addoption("enable-boehm-gc", "Enable use of the Boehm GC (broken!)")
12
13     if options["enable-boehm-gc"] then
14         USE_BOEHM_GC = 1
15     end
16 end
17
18 -- are we on a Posix system?
19 POSIX = 1
20 if OS == "windows" then
21     POSIX = 0
22 end
23
24
25 -- guess the host machine description
26 -- also allow overriding it
27
28 addoption("target-override", "Override the default target machine");
29
30 TRIPLE = "";
31 if options["target-override"] then
32     TRIPLE = options["target-override"]
33 else
34     os.execute("sh config.guess > default-target-triple.tmp")
35     TRIPLE = io.open("default-target-triple.tmp"):read()
36 end
37
38 io.write("Default target: '"..TRIPLE.."'\n");
39
40 -- x86 ABI support
41 X86_REVERSE_PARAMS = 1
42 X86_PASS_IN_EAX = 1
43
44 -- D version
45 DMDV2 = true
46
47 if DMDV2 then
48     DMD_V_DEF = "DMDV2=1"
49     DMD_DIR = "dmd2"
50 else
51     DMD_V_DEF = "DMDV1=1"
52     DMD_DIR = "dmd"
53 end
54
55 -- idgen
56 package = newpackage()
57 package.name = "idgen"
58 package.kind = "exe"
59 package.language = "c++"
60 package.files = { DMD_DIR.."/idgen.c" }
61 package.buildoptions = { "-x c++" }
62 package.postbuildcommands = { "./idgen", "mv -f id.c id.h "..DMD_DIR }
63 package.defines = { DMD_V_DEF }
64
65 -- impcnvgen
66 package = newpackage()
67 package.name = "impcnvgen"
68 package.kind = "exe"
69 package.language = "c++"
70 package.files = { DMD_DIR.."/impcnvgen.c" }
71 package.buildoptions = { "-x c++" }
72 package.postbuildcommands = { "./impcnvgen", "mv -f impcnvtab.c "..DMD_DIR }
73 package.defines = { DMD_V_DEF }
74
75 -- ldc
76 package = newpackage()
77 package.bindir = "bin"
78 package.name = DMDV2 and "ldc2" or "ldc"
79 package.kind = "exe"
80 package.language = "c++"
81 package.files = { matchfiles(DMD_DIR.."/*.c"), matchfiles("gen/*.cpp"), matchfiles("ir/*.cpp") }
82 package.excludes = { DMD_DIR.."/idgen.c", DMD_DIR.."/impcnvgen.c" }
83 package.buildoptions = { "-x c++", "`llvm-config --cxxflags`" }
84 package.linkoptions = {
85     -- long but it's faster than just 'all'
86     "`llvm-config --libs bitwriter linker ipo instrumentation backend`",
87     "`llvm-config --ldflags`",
88 }
89 package.defines = {
90     "IN_LLVM",
91     "_DH",
92     DMD_V_DEF,
93     "OPAQUE_VTBLS="..OPAQUE_VTBLS,
94     "USE_BOEHM_GC="..USE_BOEHM_GC,
95     "POSIX="..POSIX,
96     "DEFAULT_TARGET_TRIPLE=\\\""..TRIPLE.."\\\"",
97     "X86_REVERSE_PARAMS="..X86_REVERSE_PARAMS,
98     "X86_PASS_IN_EAX="..X86_PASS_IN_EAX,
99 }
100
101 package.config.Release.defines = { "LLVMD_NO_LOGGER" }
102 package.config.Debug.buildoptions = { "-g -O0" }
103
104 --package.targetprefix = "llvm"
105 package.includepaths = { ".", DMD_DIR }
106
107 --package.postbuildcommands = { "cd runtime; ./build.sh; cd .." }
108
109 if USE_BOEHM_GC == 1 then
110     package.links = { "gc" }
111 end
Note: See TracBrowser for help on using the browser.
Copyright © 2008, LDC Development Team.