Re: Creating/using precompiled headers and static libraries

Bram Moolenaar <[email protected]> Mon, 26 Apr 2004 11:50:36 +0200
Newsgroups gmane.comp.tools.aap.user
Message-ID <[email protected]>
Thore Karlsen 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.

You can have many dependencies.  But only one with build commands.

> [... 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.

Suppose there is a situation where you want to add a value twice, you
might get it more than twice without the patch.  Thus using "add_VAR"
would not work very well anyway.  Unless a much more complicated method
is used to solve the problem.  Would have to remember that the attribute
has been used for the current value of the variable in the current scope.
That's very complicated.

> >> 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.

Mostly having two ways to build a target means there is something wrong
in the recipe.  Thus it is good to give an error message for this
situation.

If it is just a matter of giving a message we could support an attribute
"buildmessage" that is printed when the target is being build.

A more flexible approach would be to have "pre" and "post" build
commands.  But that might get complicated.  Aap already offers so many
mechanisms, adding more will make it even more complex.

> 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.

Contributions that solve practical needs are very welcome.

> >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.

Does this also work with the MSVC tools that are now available for free?
We could actually make a package for that, to install the compiler when
needed...

> 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.

I would think so.  Other tools may also be able to do this, thus we
probably need something in the default recipe to handle the generic case
and have the tool handle the details.  Although it might be better to
use a module for this.  The D module could be an example.

> 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. :)

Share and enjoy!

-- 
How To Keep A Healthy Level Of Insanity:
5. Put decaf in the coffee maker for 3 weeks. Once everyone has gotten
   over their caffeine addictions, switch to expresso.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
 \\\  Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///


-------------------------------------------------------
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