On 2012-11-28 21:25, 1100110 wrote:

Good question.  You could require it to be in the file passed to the
compiler, which I like.

RDMD will pass all files to the compiler, how would it know which one to look in? Or should RDMD handle the pragma?

Or you could simply look for pragma(build) at
the same time you look for imports.  look *once* per file.

That won't work. Example:

module foo;

import bar.baz;

module main;

pragma(build, "-I/usr/local/include/d/barlib/");

If compiler sees the "foo" module first it will fail to find "bar.baz" since it doesn't yet know about the import path added in the "main" module.

I don't know how the compiler handles the arguments passed internally.
You know what? Just say it's in the file passed to rdmd.  If you need
something more complex that a simple place to put the args, you need
something bigger than what this can give.

Yes, that's what I'm trying to say. Why settle with that when we could support both simple projects with a single source file and more complex ones with many files.

rdmd main.d

cat main.d
module main

import std.stdio;
import std.string;
static import(file.jpg);//I forget the syntax...
pragma(build, "-jviews -src -O -release -inline");
pragma(lib, "ssl");
pragma(lib, "dl");
pragma(lib, "event_pthreads");

void main(){} blah blah blah...
EOF

If that doesn't cover 99% of your use-case, you obviously need something
way bigger.

How about this use case, building a library. RDMD cannot handle this.

Tell people to compile using rdmd main.d.  If args are passed on the
cmdline, then don't even bother looking for pragma(build).


--
/Jacob Carlborg

Reply via email to