<br><br><div class="gmail_quote">2011/11/15 Bill Hoffman <span dir="ltr"><<a href="mailto:bill.hoffman@kitware.com">bill.hoffman@kitware.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

On 11/15/2011 1:11 PM, Nicolas Desprès wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
2011/11/15 Bill Hoffman <<a href="mailto:bill.hoffman@kitware.com" target="_blank">bill.hoffman@kitware.com</a><br>
<mailto:<a href="mailto:bill.hoffman@kitware.com" target="_blank">bill.hoffman@kitware.<u></u>com</a>>><div class="im"><br>
<br>
    On 11/15/2011 12:54 PM, Nicolas Desprès wrote:<br>
<br>
        Too much in my opinion. Specially the && operator of the shell.<br>
        Using<br>
        cmake -E is the first step. I am planning to suggest an evolution of<br>
        Ninja to fix this issue. Actually, it is the main issue which<br>
        stop me<br>
        while writing the beginning of this generator.<br>
        Cheers,<br>
<br>
<br>
    What type of evolution will Ninja need?   I suppose it could use<br>
    cmake scripts and exectue_process which can do && type things pretty<br>
    easy.<br>
<br>
<br>
Writting cmake script is one solution but since (at least when I started<br>
the Ninja Generator) Ninja uses $in as input file for the build<br>
statement it can be hard to pass to the cmake script.  I had a<br>
discussion on this email some month ago about how to pass argument to<br>
the cmake script. Maybe it will work using -D option. Not sure about<br>
that. It is old in my mind and I have to check this out again.<br>
</div></blockquote>
<br>
-D will work, but is a bit ugly.  I see the ninja build files do not have a rule per file, but rather have production rules most of the time?</blockquote><div><br></div><div>Actually you have rule statement like this one for instance:</div>

<div><div><br></div><div># Rule for compiling CXX files.</div><div>rule CXX_COMPILER</div><div>  depfile = $out.d</div><div>  command = /usr/bin/c++   $DEFINES -MMD -MF $out.d $FLAGS -o $out -c $in</div><div>  description = Building CXX object $out</div>

</div><div><br></div><div>Where you can describe only one command and not a list of command. And you have build statement where you mention outputs, inputs the rule to deals with them and overload some variables. For example:</div>

<div><br></div><div><div>build Source/kwsys/CMakeFiles/cmsys.dir/SystemTools.cxx.o: CXX_COMPILER ../Source/kwsys/SystemTools.cxx</div><div>  DEFINES = -DKWSYS_NAMESPACE=cmsys</div><div>  FLAGS = -g -ISource -ISource/kwsys</div>

</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
In a general manner I wanted to prevent Ninja to spawn a shell which in<br>
turn parse the command since it is not that portable on Windows and thus<br>
to provide an alternative syntax to just spawn a process. Something<br>
closer to "execute_process" than "system" to say it shortly.<br>
<br>
</blockquote>
<br></div>
OK, so ninja does not have a native execute_process.  How is anyone doing anything with ninja on windows  right now?<br></blockquote><div><br></div><div>Sorry for the delayed answer.  I wanted to take the time to have a look at Ninja's source code to give the right answer. So actually, there is two implementations of the Subprocess class. The one for Linux spawn a /bin/sh whereas the one for Windows uses CreateProcessA():</div>

<div><br></div><div><div>  // Do not prepend 'cmd /c' on Windows, this breaks command</div><div>  // lines greater than 8,191 chars.</div><div>  if (!CreateProcessA(NULL, (char*)command.c_str(), NULL, NULL,</div>
<div>
                      /* inherit handles */ TRUE, 0,</div><div>                      NULL, NULL,</div><div>                      &startup_info, &process_info)) {</div><div>    Win32Fatal("CreateProcess");</div>

<div>  }</div></div><div><br></div><div>So actually contrary to what I said before the Windows implementation is quite good.</div></div><div><br></div><div>Finally, the only thing missing would be the ability to call several commands if a cmake script is not enough.</div>

<div><br></div>Cheers,<br clear="all"><div><br></div>-- <br>Nicolas Desprès<br><br>