annotate premake.lua @ 711:eed2de0c67a0

Changed premake script to write target triple to a file, then read that, instead of using popen
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Mon, 20 Oct 2008 23:33:59 +0200
parents 06576ece1a1b
children 6de2ed4f0abe
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
663
6aaa3d3c1183 First part of rename to LDC.
Christian Kamm <kamm incasoftware de>
parents: 582
diff changeset
1 project.name = ldc
1
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
2
268
23d0d9855cad [svn r289] Fixed: right shift >> was broken for unsigned types.
lindquist
parents: 237
diff changeset
3 -- options
295
895e1b50cf2a [svn r316] Fixed array slice assignments like: int[] arr = ...; arr[] = 42;
lindquist
parents: 285
diff changeset
4
895e1b50cf2a [svn r316] Fixed array slice assignments like: int[] arr = ...; arr[] = 42;
lindquist
parents: 285
diff changeset
5 -- we always make vtables opaque, it simply kills performance...
268
23d0d9855cad [svn r289] Fixed: right shift >> was broken for unsigned types.
lindquist
parents: 237
diff changeset
6 OPAQUE_VTBLS = 1
295
895e1b50cf2a [svn r316] Fixed array slice assignments like: int[] arr = ...; arr[] = 42;
lindquist
parents: 285
diff changeset
7
895e1b50cf2a [svn r316] Fixed array slice assignments like: int[] arr = ...; arr[] = 42;
lindquist
parents: 285
diff changeset
8 -- use of boehm gc
544
1c7220171d41 Disable boehm gc by default. Use --enable-boehm-gc on premake to enable.
Christian Kamm <kamm incasoftware de>
parents: 366
diff changeset
9 USE_BOEHM_GC = 0
1c7220171d41 Disable boehm gc by default. Use --enable-boehm-gc on premake to enable.
Christian Kamm <kamm incasoftware de>
parents: 366
diff changeset
10 if OS ~= "windows" then
1c7220171d41 Disable boehm gc by default. Use --enable-boehm-gc on premake to enable.
Christian Kamm <kamm incasoftware de>
parents: 366
diff changeset
11 addoption("enable-boehm-gc", "Enable use of the Boehm GC (broken!)")
295
895e1b50cf2a [svn r316] Fixed array slice assignments like: int[] arr = ...; arr[] = 42;
lindquist
parents: 285
diff changeset
12
544
1c7220171d41 Disable boehm gc by default. Use --enable-boehm-gc on premake to enable.
Christian Kamm <kamm incasoftware de>
parents: 366
diff changeset
13 if options["enable-boehm-gc"] then
295
895e1b50cf2a [svn r316] Fixed array slice assignments like: int[] arr = ...; arr[] = 42;
lindquist
parents: 285
diff changeset
14 USE_BOEHM_GC = 1
895e1b50cf2a [svn r316] Fixed array slice assignments like: int[] arr = ...; arr[] = 42;
lindquist
parents: 285
diff changeset
15 end
285
297690b5d4a5 [svn r306] Fixed: it's now possible to compile and link llvmdc with MinGW32 and msys on Win32 :D I tried it myself ;) Building the runtime still needs some work, but it's a step in the right direction.
lindquist
parents: 268
diff changeset
16 end
268
23d0d9855cad [svn r289] Fixed: right shift >> was broken for unsigned types.
lindquist
parents: 237
diff changeset
17
571
cbd6c8073a32 Changed all '#if linux || __APPLE__' to '#if POSIX' so we can support other platforms too, thanx for the suggestion anders.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 544
diff changeset
18 -- are we on a Posix system?
cbd6c8073a32 Changed all '#if linux || __APPLE__' to '#if POSIX' so we can support other platforms too, thanx for the suggestion anders.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 544
diff changeset
19 POSIX = 1
cbd6c8073a32 Changed all '#if linux || __APPLE__' to '#if POSIX' so we can support other platforms too, thanx for the suggestion anders.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 544
diff changeset
20 if OS == "windows" then
cbd6c8073a32 Changed all '#if linux || __APPLE__' to '#if POSIX' so we can support other platforms too, thanx for the suggestion anders.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 544
diff changeset
21 POSIX = 0
cbd6c8073a32 Changed all '#if linux || __APPLE__' to '#if POSIX' so we can support other platforms too, thanx for the suggestion anders.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 544
diff changeset
22 end
cbd6c8073a32 Changed all '#if linux || __APPLE__' to '#if POSIX' so we can support other platforms too, thanx for the suggestion anders.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 544
diff changeset
23
699
ed9a9e6dd1cc Started changing target triple stuff, part of fixing #97
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 673
diff changeset
24
ed9a9e6dd1cc Started changing target triple stuff, part of fixing #97
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 673
diff changeset
25 -- guess the host machine description
ed9a9e6dd1cc Started changing target triple stuff, part of fixing #97
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 673
diff changeset
26 -- also allow overriding it
ed9a9e6dd1cc Started changing target triple stuff, part of fixing #97
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 673
diff changeset
27
ed9a9e6dd1cc Started changing target triple stuff, part of fixing #97
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 673
diff changeset
28 addoption("target-override", "Override the default target machine");
ed9a9e6dd1cc Started changing target triple stuff, part of fixing #97
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 673
diff changeset
29
ed9a9e6dd1cc Started changing target triple stuff, part of fixing #97
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 673
diff changeset
30 TRIPLE = "";
ed9a9e6dd1cc Started changing target triple stuff, part of fixing #97
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 673
diff changeset
31 if options["target-override"] then
ed9a9e6dd1cc Started changing target triple stuff, part of fixing #97
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 673
diff changeset
32 TRIPLE = options["target-override"]
ed9a9e6dd1cc Started changing target triple stuff, part of fixing #97
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 673
diff changeset
33 else
711
eed2de0c67a0 Changed premake script to write target triple to a file, then read that, instead of using popen
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 703
diff changeset
34 os.execute("sh config.guess > default-target-triple.tmp")
eed2de0c67a0 Changed premake script to write target triple to a file, then read that, instead of using popen
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 703
diff changeset
35 TRIPLE = io.open("default-target-triple.tmp"):read()
699
ed9a9e6dd1cc Started changing target triple stuff, part of fixing #97
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 673
diff changeset
36 end
ed9a9e6dd1cc Started changing target triple stuff, part of fixing #97
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 673
diff changeset
37
711
eed2de0c67a0 Changed premake script to write target triple to a file, then read that, instead of using popen
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 703
diff changeset
38 io.write("Default target: '"..TRIPLE.."'\n");
eed2de0c67a0 Changed premake script to write target triple to a file, then read that, instead of using popen
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 703
diff changeset
39
336
aaade6ded589 [svn r357] Merged DMD 1.033
lindquist
parents: 295
diff changeset
40 -- D version - don't change these !!!
aaade6ded589 [svn r357] Merged DMD 1.033
lindquist
parents: 295
diff changeset
41 DMDV1 = "1"
aaade6ded589 [svn r357] Merged DMD 1.033
lindquist
parents: 295
diff changeset
42
268
23d0d9855cad [svn r289] Fixed: right shift >> was broken for unsigned types.
lindquist
parents: 237
diff changeset
43 -- idgen
1
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
44 package = newpackage()
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
45 package.name = "idgen"
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
46 package.kind = "exe"
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
47 package.language = "c++"
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
48 package.files = { "dmd/idgen.c" }
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
49 package.buildoptions = { "-x c++" }
35
3cfcb944304e [svn r39] * Updated to DMD 1.022 with the exception of:
lindquist
parents: 4
diff changeset
50 package.postbuildcommands = { "./idgen", "mv -f id.c id.h dmd" }
336
aaade6ded589 [svn r357] Merged DMD 1.033
lindquist
parents: 295
diff changeset
51 package.defines = { "DMDV1="..DMDV1 }
1
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
52
268
23d0d9855cad [svn r289] Fixed: right shift >> was broken for unsigned types.
lindquist
parents: 237
diff changeset
53 -- impcnvgen
1
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
54 package = newpackage()
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
55 package.name = "impcnvgen"
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
56 package.kind = "exe"
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
57 package.language = "c++"
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
58 package.files = { "dmd/impcnvgen.c" }
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
59 package.buildoptions = { "-x c++" }
35
3cfcb944304e [svn r39] * Updated to DMD 1.022 with the exception of:
lindquist
parents: 4
diff changeset
60 package.postbuildcommands = { "./impcnvgen", "mv -f impcnvtab.c dmd" }
336
aaade6ded589 [svn r357] Merged DMD 1.033
lindquist
parents: 295
diff changeset
61 package.defines = { "DMDV1="..DMDV1 }
aaade6ded589 [svn r357] Merged DMD 1.033
lindquist
parents: 295
diff changeset
62
663
6aaa3d3c1183 First part of rename to LDC.
Christian Kamm <kamm incasoftware de>
parents: 582
diff changeset
63 -- ldc
1
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
64 package = newpackage()
35
3cfcb944304e [svn r39] * Updated to DMD 1.022 with the exception of:
lindquist
parents: 4
diff changeset
65 package.bindir = "bin"
663
6aaa3d3c1183 First part of rename to LDC.
Christian Kamm <kamm incasoftware de>
parents: 582
diff changeset
66 package.name = "ldc"
1
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
67 package.kind = "exe"
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
68 package.language = "c++"
136
0e28624814e8 [svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents: 131
diff changeset
69 package.files = { matchfiles("dmd/*.c"), matchfiles("gen/*.cpp"), matchfiles("ir/*.cpp") }
366
1d3026702f65 [svn r387] Removed unused MD5 stuff.
lindquist
parents: 336
diff changeset
70 package.excludes = { "dmd/idgen.c", "dmd/impcnvgen.c" }
1
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
71 package.buildoptions = { "-x c++", "`llvm-config --cxxflags`" }
131
5825d48b27d1 [svn r135] * Merged DMD 1.025 *
lindquist
parents: 125
diff changeset
72 package.linkoptions = {
5825d48b27d1 [svn r135] * Merged DMD 1.025 *
lindquist
parents: 125
diff changeset
73 -- long but it's faster than just 'all'
673
37a7688a7494 Add basics for direct assembly output.
Christian Kamm <kamm incasoftware de>
parents: 663
diff changeset
74 "`llvm-config --libs bitwriter linker ipo instrumentation backend`",
193
aca17e55b7a5 [svn r209] Fixed: exotic array to pointer casts were broken.
lindquist
parents: 136
diff changeset
75 "`llvm-config --ldflags`",
131
5825d48b27d1 [svn r135] * Merged DMD 1.025 *
lindquist
parents: 125
diff changeset
76 }
193
aca17e55b7a5 [svn r209] Fixed: exotic array to pointer casts were broken.
lindquist
parents: 136
diff changeset
77 package.defines = {
aca17e55b7a5 [svn r209] Fixed: exotic array to pointer casts were broken.
lindquist
parents: 136
diff changeset
78 "IN_LLVM",
aca17e55b7a5 [svn r209] Fixed: exotic array to pointer casts were broken.
lindquist
parents: 136
diff changeset
79 "_DH",
268
23d0d9855cad [svn r289] Fixed: right shift >> was broken for unsigned types.
lindquist
parents: 237
diff changeset
80 "OPAQUE_VTBLS="..OPAQUE_VTBLS,
23d0d9855cad [svn r289] Fixed: right shift >> was broken for unsigned types.
lindquist
parents: 237
diff changeset
81 "USE_BOEHM_GC="..USE_BOEHM_GC,
336
aaade6ded589 [svn r357] Merged DMD 1.033
lindquist
parents: 295
diff changeset
82 "DMDV1="..DMDV1,
571
cbd6c8073a32 Changed all '#if linux || __APPLE__' to '#if POSIX' so we can support other platforms too, thanx for the suggestion anders.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 544
diff changeset
83 "POSIX="..POSIX,
699
ed9a9e6dd1cc Started changing target triple stuff, part of fixing #97
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 673
diff changeset
84 "DEFAULT_TARGET_TRIPLE=\\\""..TRIPLE.."\\\"",
193
aca17e55b7a5 [svn r209] Fixed: exotic array to pointer casts were broken.
lindquist
parents: 136
diff changeset
85 }
1
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
86 package.config.Release.defines = { "LLVMD_NO_LOGGER" }
86
fd32135dca3e [svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents: 35
diff changeset
87 package.config.Debug.buildoptions = { "-g -O0" }
1
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
88 --package.targetprefix = "llvm"
4
e116aa1488e6 [svn r8] changed backend includes to always use the gen/<foo>.h prefix
lindquist
parents: 1
diff changeset
89 package.includepaths = { ".", "dmd" }
1
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
90 --package.postbuildcommands = { "cd runtime; ./build.sh; cd .." }
268
23d0d9855cad [svn r289] Fixed: right shift >> was broken for unsigned types.
lindquist
parents: 237
diff changeset
91 if USE_BOEHM_GC == 1 then
23d0d9855cad [svn r289] Fixed: right shift >> was broken for unsigned types.
lindquist
parents: 237
diff changeset
92 package.links = { "gc" }
23d0d9855cad [svn r289] Fixed: right shift >> was broken for unsigned types.
lindquist
parents: 237
diff changeset
93 end