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
rev   line source
kamm@663 1 project.name = ldc
lindquist@1 2
lindquist@268 3 -- options
lindquist@295 4
lindquist@295 5 -- we always make vtables opaque, it simply kills performance...
lindquist@268 6 OPAQUE_VTBLS = 1
lindquist@295 7
lindquist@295 8 -- use of boehm gc
kamm@544 9 USE_BOEHM_GC = 0
kamm@544 10 if OS ~= "windows" then
kamm@544 11 addoption("enable-boehm-gc", "Enable use of the Boehm GC (broken!)")
lindquist@295 12
kamm@544 13 if options["enable-boehm-gc"] then
lindquist@295 14 USE_BOEHM_GC = 1
lindquist@295 15 end
lindquist@285 16 end
lindquist@268 17
tomas@571 18 -- are we on a Posix system?
tomas@571 19 POSIX = 1
tomas@571 20 if OS == "windows" then
tomas@571 21 POSIX = 0
tomas@571 22 end
tomas@571 23
tomas@699 24
tomas@699 25 -- guess the host machine description
tomas@699 26 -- also allow overriding it
tomas@699 27
tomas@699 28 addoption("target-override", "Override the default target machine");
tomas@699 29
tomas@699 30 TRIPLE = "";
tomas@699 31 if options["target-override"] then
tomas@699 32 TRIPLE = options["target-override"]
tomas@699 33 else
tomas@711 34 os.execute("sh config.guess > default-target-triple.tmp")
tomas@711 35 TRIPLE = io.open("default-target-triple.tmp"):read()
tomas@699 36 end
tomas@699 37
tomas@711 38 io.write("Default target: '"..TRIPLE.."'\n");
tomas@711 39
lindquist@336 40 -- D version - don't change these !!!
lindquist@336 41 DMDV1 = "1"
lindquist@336 42
lindquist@268 43 -- idgen
lindquist@1 44 package = newpackage()
lindquist@1 45 package.name = "idgen"
lindquist@1 46 package.kind = "exe"
lindquist@1 47 package.language = "c++"
lindquist@1 48 package.files = { "dmd/idgen.c" }
lindquist@1 49 package.buildoptions = { "-x c++" }
lindquist@35 50 package.postbuildcommands = { "./idgen", "mv -f id.c id.h dmd" }
lindquist@336 51 package.defines = { "DMDV1="..DMDV1 }
lindquist@1 52
lindquist@268 53 -- impcnvgen
lindquist@1 54 package = newpackage()
lindquist@1 55 package.name = "impcnvgen"
lindquist@1 56 package.kind = "exe"
lindquist@1 57 package.language = "c++"
lindquist@1 58 package.files = { "dmd/impcnvgen.c" }
lindquist@1 59 package.buildoptions = { "-x c++" }
lindquist@35 60 package.postbuildcommands = { "./impcnvgen", "mv -f impcnvtab.c dmd" }
lindquist@336 61 package.defines = { "DMDV1="..DMDV1 }
lindquist@336 62
kamm@663 63 -- ldc
lindquist@1 64 package = newpackage()
lindquist@35 65 package.bindir = "bin"
kamm@663 66 package.name = "ldc"
lindquist@1 67 package.kind = "exe"
lindquist@1 68 package.language = "c++"
lindquist@136 69 package.files = { matchfiles("dmd/*.c"), matchfiles("gen/*.cpp"), matchfiles("ir/*.cpp") }
lindquist@366 70 package.excludes = { "dmd/idgen.c", "dmd/impcnvgen.c" }
lindquist@1 71 package.buildoptions = { "-x c++", "`llvm-config --cxxflags`" }
lindquist@131 72 package.linkoptions = {
lindquist@131 73 -- long but it's faster than just 'all'
kamm@673 74 "`llvm-config --libs bitwriter linker ipo instrumentation backend`",
lindquist@193 75 "`llvm-config --ldflags`",
lindquist@131 76 }
lindquist@193 77 package.defines = {
lindquist@193 78 "IN_LLVM",
lindquist@193 79 "_DH",
lindquist@268 80 "OPAQUE_VTBLS="..OPAQUE_VTBLS,
lindquist@268 81 "USE_BOEHM_GC="..USE_BOEHM_GC,
lindquist@336 82 "DMDV1="..DMDV1,
tomas@571 83 "POSIX="..POSIX,
tomas@699 84 "DEFAULT_TARGET_TRIPLE=\\\""..TRIPLE.."\\\"",
lindquist@193 85 }
lindquist@1 86 package.config.Release.defines = { "LLVMD_NO_LOGGER" }
lindquist@86 87 package.config.Debug.buildoptions = { "-g -O0" }
lindquist@1 88 --package.targetprefix = "llvm"
lindquist@4 89 package.includepaths = { ".", "dmd" }
lindquist@1 90 --package.postbuildcommands = { "cd runtime; ./build.sh; cd .." }
lindquist@268 91 if USE_BOEHM_GC == 1 then
lindquist@268 92 package.links = { "gc" }
lindquist@268 93 end