mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 13:10:12 +03:00
Adapt default sc.ini
to MsCoff by default
The old configuration still used OPTLINk for `-m32` which obviously doesn't support MsCoff files. Also added a test file that builds and executes a small program using the configurations in `ini` and `build.d` (as allmost all other tests run with `-conf=`).
This commit is contained in:
parent
6fbacaa5b2
commit
b1470acab8
5 changed files with 95 additions and 3 deletions
|
@ -7,15 +7,16 @@ version=7.51 Build 020
|
|||
DFLAGS="-I%@P%\..\..\src\phobos" "-I%@P%\..\..\src\druntime\import"
|
||||
|
||||
; optlink only reads from the Environment section so we need this redundancy
|
||||
; from the Environment32 section (bugzilla 11302)
|
||||
; from the Environment32omf section (bugzilla 11302)
|
||||
LIB="%@P%\..\lib"
|
||||
|
||||
|
||||
[Environment32]
|
||||
LIB=%@P%\..\lib32mscoff
|
||||
|
||||
[Environment32omf]
|
||||
LIB="%@P%\..\lib"
|
||||
LINKCMD=%@P%\optlink.exe
|
||||
|
||||
|
||||
[Environment64]
|
||||
LIB=%@P%\..\lib64
|
||||
|
||||
|
|
|
@ -309,6 +309,9 @@ alias dmdConf = makeRule!((builder, rule) {
|
|||
DFLAGS="-I%@P%\..\..\..\..\..\druntime\import" "-I%@P%\..\..\..\..\..\phobos"
|
||||
LIB="%@P%\..\..\..\..\..\phobos"
|
||||
|
||||
[Environment32]
|
||||
DFLAGS=%DFLAGS% -L/OPT:NOICF
|
||||
|
||||
[Environment64]
|
||||
DFLAGS=%DFLAGS% -L/OPT:NOICF
|
||||
|
||||
|
|
78
test/dshell/defaults.d
Normal file
78
test/dshell/defaults.d
Normal file
|
@ -0,0 +1,78 @@
|
|||
/// Verifies that DMD using default settings work as expected
|
||||
/// when using the default configuration + some example programs
|
||||
module defaults;
|
||||
|
||||
import std.algorithm;
|
||||
import std.file;
|
||||
import std.path;
|
||||
import std.stdio;
|
||||
|
||||
import dshell;
|
||||
|
||||
int main(const string[] args)
|
||||
{
|
||||
// dshellPrebuiltInit("dshell", "defaults");
|
||||
|
||||
try
|
||||
{
|
||||
testConfigurations();
|
||||
return 0;
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
writeln(t.msg);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
void testConfigurations()
|
||||
{
|
||||
// Compilation targets
|
||||
const string[] targets = [ MODEL ];
|
||||
|
||||
// Configuration file
|
||||
version (Windows)
|
||||
const string config = `bin\sc.ini`;
|
||||
else version (OSX)
|
||||
const string config = `bin/dmd.conf`;
|
||||
else
|
||||
const string config = `bin` ~ MODEL ~ `/dmd.conf`;
|
||||
|
||||
// Static configuration file for the final release
|
||||
string configPath = buildNormalizedPath(dirName(__FILE_FULL_PATH__), "..", "..", "ini", OS, config);
|
||||
|
||||
// Flag sets to test
|
||||
string[] extraFlags = [
|
||||
// Minimal configuration generated by build.d
|
||||
"",
|
||||
// Predefined, full configuration located in ini
|
||||
"-conf=" ~ configPath
|
||||
];
|
||||
|
||||
version (Windows) if (MODEL == "32omf")
|
||||
{
|
||||
// 32-OMF tries to use `optlink.exe` located next to `sc.ini`
|
||||
// and also doesn't like the LIB setup, so skip it for now
|
||||
extraFlags = [""];
|
||||
}
|
||||
|
||||
foreach (const target; targets)
|
||||
{
|
||||
foreach (const flags; extraFlags)
|
||||
{
|
||||
run(
|
||||
`$DMD ` ~ flags ~ ` -g -m` ~ target
|
||||
~ ` -I$EXTRA_FILES/defaults `
|
||||
~ DFLAGS
|
||||
~ ` $EXTRA_FILES/defaults/hello.d `
|
||||
~ ` -of=$OUTPUT_BASE/hello$EXE `,
|
||||
);
|
||||
|
||||
auto pipe = std.process.pipe();
|
||||
run(`$OUTPUT_BASE/hello$EXE`, pipe.writeEnd, stderr);
|
||||
const output = cast(string) pipe.readEnd.byChunk(4096).join();
|
||||
stdout.writeln(output);
|
||||
assert(output.canFind("Hello, World from D!"));
|
||||
}
|
||||
}
|
||||
}
|
9
test/dshell/extra-files/defaults/hello.d
Normal file
9
test/dshell/extra-files/defaults/hello.d
Normal file
|
@ -0,0 +1,9 @@
|
|||
// A common yet underrated D program
|
||||
module defaults.hello;
|
||||
|
||||
import std.stdio;
|
||||
|
||||
void main()
|
||||
{
|
||||
writeln("Hello, World from D!");
|
||||
}
|
|
@ -39,6 +39,7 @@ struct Vars
|
|||
return result;
|
||||
}
|
||||
static string opDispatch(string name)() { return get(name); }
|
||||
static void opDispatch(string name)(string value) { set(name, value); }
|
||||
}
|
||||
|
||||
private alias requiredEnvVars = AliasSeq!(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue