Re: Creating/using precompiled headers and static libraries

Thore Karlsen <sid-m3MN3Z/L/[email protected]> Sun, 25 Apr 2004 13:39:07 -0500
Newsgroups gmane.comp.tools.aap.user
Organization I've resigned.
Message-ID <[email protected]>
On Sun, 25 Apr 2004 16:10:58 +0200, Bram Moolenaar wrote:

[...]

>> 1. IPP.lib is linked correctly with Common.lib, but IPP.lib is not a
>> dependency, so it's not automatically created. How do I fix this?

>There is currently no automatic dependency for used libraries.  You can
>add it explicitly:
>
>	$BDIR/Common.lib : $BDIR/IPP.lib

Thanks, that did the trick. It didn't occur to me that you could have
both a dependency and a production command at the same time.

[... add_VAR adds string multiple times ...]

>Would it be acceptable that the string from "add_VAR" is not added when
>it's already present?  Thus always avoid duplicates?  I can't think of a
>situation where it would be desired to have the value twice.
>
>Try this patch:

[...]

This patch worked great. I'm wondering if there is a case where you
might want to add a value twice. I'm thinking there might be, but I
can't come up with a good example right now.

>> 3. How can I print a message before starting a build? I'd like to print
>> "Creating Common.lib" or something to separate the various subprojects I
>> need to build.

>I can't think of a simple way to do this.  Would require defining your
>ownd dependency or action.

One thing that would really be nice is pre- and
post-compile/build/production actions, if that makes sense.

I tried doing something like this:

$BDIR/Common.lib : $BDIR/IPP.lib
	:print --- Starting Common.lib
:lib $BDIR/Common.lib
	{ add_LIBS = $BDIR/IPP.lib } :
	Common/stdafx.cpp
	$COMMON_PROJECT_FILES

But then I got this error:

  "Both a build rule and a dependency with build commands defined"

Makes sense, but it would be nice to have the possibility of doing
something like this. I have 16 subprojects, and I would love to be able
to see when the building of one starts and finishes. It would make the
output easier to follow, since I have hundreds of source files.

>> Also, is there a better/easier/cleaner way to do the above precompiled
>> header stuff? Basically what I need to do is:
>> 
>> - Compile all the .c/.cpp files in a recursive directory structure
>> - Compile stdafx.cpp _first_ with an extra flag /Yc"stdafx.h" to create 
>>   the PCH
>> - Compile all other files with an extra flag /Yu"stdafx.h" to use PCH

>I would think you are doing it the right way.  Could only be simplified
>when the tool supports it somehow.

Thanks, that's fine with me. I don't have a problem with doing it this
way if I know that's the way it should be done. I just don't want to be
missing something obvious and going things in a suboptimal way. :)

>> Thanks for any help you can give me. This looks very promising, and
>> looks like just what I need for my project, but the learning threshold
>> is very high and the documentation and simple examples hasn't gotten me
>> far.

>I'm glad you appear to understand Aap quite well.  It does take a bit of
>time to learn, since it offers so many features.

Indeed. :) And that's exactly what I need, because I have fairly complex
needs. I'll try to contribute as much as I can to the project to help it
along.

>Your changes to support static libraries could be useful for others.
>Can the changes to msvc.py be included in the distribution?

Absolutely. I'm going to submit it, I just wanted to get it to compile
DLLs as well. I also have a DLL subproject that I'll test that on.

One question:

MSVC comes with its own IDL compiler, and I have currently made a custom
action and rule in my recipe for compiling my IDL files. Does it make
sense to add support for compiling IDL files in msvc.py, since it's part
of the MSVC toolset? The same thing also goes for RC (resource) files,
since MSVC comes with its own resource compiler.

Also, thanks for all the great work on your projects. I'm a big fan of
Vim, so I knew AAP had to be great as well. :)

-- 
Be seeing you.



-------------------------------------------------------
This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek
For a limited time only, get FREE Ground shipping on all orders of $35
or more. Hurry up and shop folks, this offer expires April 30th!
http://www.thinkgeek.com/freeshipping/?cpg=12297