annotate premake.lua @ 883:b52d5de7783f

GC defines and linkage changes.
author Christian Kamm <kamm incasoftware de>
date Thu, 08 Jan 2009 18:20:02 +0100
parents f04dde6e882c
children
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
tomas@724 40 -- x86 ABI support
kamm@730 41 X86_REVERSE_PARAMS = 1
kamm@739 42 X86_PASS_IN_EAX = 1
tomas@724 43
tomas@758 44 -- D version
tomas@758 45 DMDV2 = true
tomas@758 46
tomas@758 47 if DMDV2 then
tomas@758 48 DMD_V_DEF = "DMDV2=1"
tomas@758 49 DMD_DIR = "dmd2"
tomas@758 50 else
tomas@758 51 DMD_V_DEF = "DMDV1=1"
tomas@758 52 DMD_DIR = "dmd"
tomas@758 53 end
lindquist@336 54
lindquist@268 55 -- idgen
lindquist@1 56 package = newpackage()
lindquist@1 57 package.name = "idgen"
lindquist@1 58 package.kind = "exe"
lindquist@1 59 package.language = "c++"
tomas@758 60 package.files = { DMD_DIR.."/idgen.c" }
lindquist@1 61 package.buildoptions = { "-x c++" }
tomas@758 62 package.postbuildcommands = { "./idgen", "mv -f id.c id.h "..DMD_DIR }
tomas@758 63 package.defines = { DMD_V_DEF }
lindquist@1 64
lindquist@268 65 -- impcnvgen
lindquist@1 66 package = newpackage()
lindquist@1 67 package.name = "impcnvgen"
lindquist@1 68 package.kind = "exe"
lindquist@1 69 package.language = "c++"
tomas@758 70 package.files = { DMD_DIR.."/impcnvgen.c" }
lindquist@1 71 package.buildoptions = { "-x c++" }
tomas@758 72 package.postbuildcommands = { "./impcnvgen", "mv -f impcnvtab.c "..DMD_DIR }
tomas@758 73 package.defines = { DMD_V_DEF }
lindquist@336 74
kamm@663 75 -- ldc
lindquist@1 76 package = newpackage()
lindquist@35 77 package.bindir = "bin"
tomas@758 78 package.name = DMDV2 and "ldc2" or "ldc"
lindquist@1 79 package.kind = "exe"
lindquist@1 80 package.language = "c++"
tomas@758 81 package.files = { matchfiles(DMD_DIR.."/*.c"), matchfiles("gen/*.cpp"), matchfiles("ir/*.cpp") }
tomas@758 82 package.excludes = { DMD_DIR.."/idgen.c", DMD_DIR.."/impcnvgen.c" }
lindquist@1 83 package.buildoptions = { "-x c++", "`llvm-config --cxxflags`" }
lindquist@131 84 package.linkoptions = {
lindquist@131 85 -- long but it's faster than just 'all'
kamm@673 86 "`llvm-config --libs bitwriter linker ipo instrumentation backend`",
lindquist@193 87 "`llvm-config --ldflags`",
lindquist@131 88 }
lindquist@193 89 package.defines = {
lindquist@193 90 "IN_LLVM",
lindquist@193 91 "_DH",
tomas@758 92 DMD_V_DEF,
lindquist@268 93 "OPAQUE_VTBLS="..OPAQUE_VTBLS,
lindquist@268 94 "USE_BOEHM_GC="..USE_BOEHM_GC,
tomas@571 95 "POSIX="..POSIX,
tomas@699 96 "DEFAULT_TARGET_TRIPLE=\\\""..TRIPLE.."\\\"",
tomas@724 97 "X86_REVERSE_PARAMS="..X86_REVERSE_PARAMS,
tomas@724 98 "X86_PASS_IN_EAX="..X86_PASS_IN_EAX,
lindquist@193 99 }
tomas@758 100
lindquist@1 101 package.config.Release.defines = { "LLVMD_NO_LOGGER" }
lindquist@86 102 package.config.Debug.buildoptions = { "-g -O0" }
tomas@758 103
lindquist@1 104 --package.targetprefix = "llvm"
tomas@758 105 package.includepaths = { ".", DMD_DIR }
tomas@758 106
lindquist@1 107 --package.postbuildcommands = { "cd runtime; ./build.sh; cd .." }
tomas@758 108
lindquist@268 109 if USE_BOEHM_GC == 1 then
lindquist@268 110 package.links = { "gc" }
lindquist@268 111 end