<define> not working?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

<define> not working?

scaringi_stephen
Hello,

As you can tell from the subject, I'm new to BB. I'm looking at BB to
possibly convert some of our MS VS projects. I've checked out the latest
from CVS and compiled bjam:

C:\boost-build\example\hello>bjam --version
Boost.Build V2 (Milestone 10)
Boost.Jam 03.1.12

Running the simple hello example works fine. But when I add a <define> to
the jamfile, I don't see a /D flag on the command line. Here's the jamroot
file:

exe hello : hello.cpp : <define>TESTING ;

And here's the output from bjam:

C:\boost-build\example\hello>bjam -n
...found 9 targets...
...updating 2 targets...
msvc.compile.c++ bin\msvc\debug\hello.obj

    call "C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\bin\vcvars32.bat"  >nul
cl /Zm800 -nologo -TP  /Z7 /Od /Ob0 /W4 /GR /MDd /Zc:forScope /Zc:wchar_t
/Wp64 /GB /wd4675 /EHs  @"bin\msvc\debug\hello.obj.rsp" -c
-Fo"bin\msvc\debug\hello.obj"

Shouldn't there be a /D "TESTING" argument passed to cl?

If I replace the <define>TESTING with <cxxflags>"/D \"TESTING\"", then it
shows up.

Thanks for any help you can provide,
-Stephen
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: <define> not working?

Phillip Seaver
[hidden email] wrote:

<snip>

> exe hello : hello.cpp : <define>TESTING ;
>
> And here's the output from bjam:
>
> C:\boost-build\example\hello>bjam -n
> ...found 9 targets...
> ...updating 2 targets...
> msvc.compile.c++ bin\msvc\debug\hello.obj
>
>     call "C:\Program Files\Microsoft Visual Studio .NET
> 2003\Vc7\bin\vcvars32.bat"  >nul
> cl /Zm800 -nologo -TP  /Z7 /Od /Ob0 /W4 /GR /MDd /Zc:forScope /Zc:wchar_t
> /Wp64 /GB /wd4675 /EHs  @"bin\msvc\debug\hello.obj.rsp" -c
> -Fo"bin\msvc\debug\hello.obj"
>
> Shouldn't there be a /D "TESTING" argument passed to cl?
>
> If I replace the <define>TESTING with <cxxflags>"/D \"TESTING\"", then it
> shows up.
>
> Thanks for any help you can provide,
> -Stephen

msvc builds use "response" files to hold the includes, defines, and
source file.  That's the @"bin\msvc\debug\hello.obj.rsp" part of the
command-line above.

If it successfully compiled, it deletes the .rsp file, but if the
compile fails, it leaves the .rsp file there and you would be able to
see the defines and includes passed in.

Phillip


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: <define> not working?

Reece Dunn
In reply to this post by scaringi_stephen
scaringi_stephen wrote:
>Hello,
>
>As you can tell from the subject, I'm new to BB. I'm looking at BB to
>possibly convert some of our MS VS projects. I've checked out the latest
>from CVS and compiled bjam:
>
>Running the simple hello example works fine. But when I add a <define> to
>the jamfile, I don't see a /D flag on the command line. Here's the jamroot
>file:

<define> and <include> values are added to the response files (to save
command line space!).

>/Wp64 /GB /wd4675 /EHs  @"bin\msvc\debug\hello.obj.rsp" -c
>
>Shouldn't there be a /D "TESTING" argument passed to cl?

Look in the bin\msvc\debug\hello.obj.rsp file mentioned above.

>If I replace the <define>TESTING with <cxxflags>"/D \"TESTING\"", then it
>shows up.

That's because <cxxflags> values are explicitly added to the command line
and not the response file.

NOTE: If you don't see the /DTESTING line in the response file, try deleting
it and re-running the build.

- Reece


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: <define> not working?

scaringi_stephen
In reply to this post by scaringi_stephen
> Look in the bin\msvc\debug\hello.obj.rsp file mentioned above.

Wow, it was right under my nose in the .rsp file. Thanks for the help,

-Stephen
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: <define> not working?

scaringi_stephen
In reply to this post by scaringi_stephen
 
> Phillip Seaver:
> If it successfully compiled, it deletes the .rsp file, but if the
> compile fails, it leaves the .rsp file there and you would be able to
> see the defines and includes passed in.

Thanks for pointing out the .rsp files. I'm not seeing the behavior you
mention above. Whether or not the compile succeeds, BB always leaves the
.rsp files around. Even when I do a "bjam --clean", the .rsp files are left
behind. Is there a flag to delete the .rsp files?

-Stephen
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: <define> not working?

Reece Dunn
scaringi_stephen wrote:
> > Phillip Seaver:
> > If it successfully compiled, it deletes the .rsp file, but if the
> > compile fails, it leaves the .rsp file there and you would be able to
> > see the defines and includes passed in.
>
>Thanks for pointing out the .rsp files. I'm not seeing the behavior you
>mention above. Whether or not the compile succeeds, BB always leaves the
>.rsp files around. Even when I do a "bjam --clean", the .rsp files are left
>behind. Is there a flag to delete the .rsp files?

If you use the latest CVS version, the RSP files should always be generated.
AFAIK, there isn't any --clean support for response files and the printing
of RSP files when you tell bjam to output the list of commands that it would
perform without performing them is currently broken (i.e. it doesn't print
out how to generate the response file).

- Reece


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build