Commit 74cab047 authored by Mike Wey's avatar Mike Wey
Browse files

Compile with debug info when -debug is passed to rdmd.

Closes #269
parent 9bf1c664
......@@ -16,11 +16,15 @@ import std.string;
string dcflags;
string ldflags;
debug {} else string DEBUG = "";
version(DigitalMars)
{
string DC = "dmd";
string OUTPUT = "-of";
debug string DEBUG = "-debug -g";
version(CRuntime_DigitalMars)
string PLATFORM = "-m32";
else version(X86)
......@@ -35,6 +39,8 @@ else version(LDC)
string DC = "ldc2";
string OUTPUT = "-od=objects -oq -of";
debug string DEBUG = "-d-debug -g";
version(X86)
string PLATFORM = "-m32";
else version(X86_64)
......@@ -45,6 +51,8 @@ else version(GNU)
string DC = "gdc";
string OUTPUT = "-o ";
debug string DEBUG = "-fdebug -g";
version(X86)
string PLATFORM = "-m32";
else version(X86_64)
......@@ -128,7 +136,7 @@ void build(string dir, string lib)
objects ~= directory ~".obj ";
objects ~= "gtk1.obj gtk2.obj gtk3.obj gtk4.obj";
executeShell(format("%s -lib %s %s%s.lib %s", DC, ldflags, OUTPUT, lib, objects));
executeShell(format("dmd -lib %s %s%s.lib %s", ldflags, OUTPUT, lib, objects));
foreach(string obj; objects.split())
std.file.remove(obj);
......@@ -136,13 +144,13 @@ void build(string dir, string lib)
else
{
buildObj(dFiles(dir), lib);
executeShell(format("%s -lib %s %s%s.lib %s.obj", DC, ldflags, OUTPUT, lib, lib));
executeShell(format("dmd -lib %s %s%s.lib %s.obj", ldflags, OUTPUT, lib, lib));
std.file.remove(lib ~".obj");
}
}
else
{
std.file.write("build.rf", format("%s -c -lib %s %s -Igenerated/gtkd %s%s.lib %s", PLATFORM, dcflags, ldflags, OUTPUT ,lib, dFiles(dir)));
std.file.write("build.rf", format("%s -c -lib %s %s %s -Igenerated/gtkd %s%s.lib %s", PLATFORM, dcflags, ldflags, DEBUG, OUTPUT ,lib, dFiles(dir)));
auto pid = spawnProcess([DC, "@build.rf"]);
if ( wait(pid) != 0 )
......@@ -150,12 +158,12 @@ void build(string dir, string lib)
}
version(LDC)std.file.rmdirRecurse("objects");
std.file.remove("build.rf");
// std.file.remove("build.rf");
}
void buildObj(string files, string objName)
{
std.file.write("build.rf", format("-c %s -Igenerated/gtkd %s%s.obj %s", dcflags, OUTPUT, objName, files));
std.file.write("build.rf", format("-c %s %s -Igenerated/gtkd %s%s.obj %s", dcflags, DEBUG, OUTPUT, objName, files));
auto pid = spawnProcess(["dmd", "@build.rf"]);
if ( wait(pid) != 0 )
exit(1);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment