On 11/28/2012 01:32 PM, Jacob Carlborg wrote:
On 2012-11-28 20:23, 1100110 wrote:

pragma(build, "rdmd -Jviews -Isrc/debug --version=debug");

How would the compiler handle flags which add new import paths? Should
it first scan all source files after this special pragma(build). Then
rescan the source files again to see if any new pragma(build) was found.
Then, yet again, it need to rescan the files for the regular compile phase.


Oops, should have left off rdmd... It was meant to be an alternate place for command-line flags.

Good question. You could require it to be in the file passed to the compiler, which I like. Or you could simply look for pragma(build) at the same time you look for imports. look *once* per file.

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.


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.

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

Reply via email to