Boost logo

Boost-Build :

From: Phillip Seaver (phil_at_[hidden])
Date: 2006-06-05 08:40:34


Kostas Kostiadis wrote:
> Hello all,
>
> Googling around at the weekend I found out the ms10 was ancient, so I got
> the nightly build and discovered that the install rule will do almost
> exactly what I wanted for my distro...That's the good news :)
>
> However, there is still the issue of renaming the final target.
> Is there a way to do something like
>
> PROJ_NAME = hello ;
>
> Install bin : $(PROJ_NAME)
> : <variant>debug:<name>$(PROJ_NAME)_d
> : <variant>release:<name>$(PROJ_NAME)_r
> ;
>
>
> I know you can do things like <variant>release:<location>bin/release, but
> it's quite important that my executables live in the same place.
> (BTW, this doesn't have to be part of the install rule. If there is a way
> to build the targets like that in the first place, that's even better).
>

You can use the <tag> feature on your "exe" (and "lib", if you need it)
rules. This may be more complicated than you need, though. :-)

For lib and executable files, it adds "_d" to the end of the base name
("foo_d" on Unix and "foo_d.exe" on Windows) for debug builds and "_sym"
for release builds with debugging symbols. For libraries, it adds "_st"
if it's a single-threaded build. It changes the name of the built file,
then all you have to do is do "install name : foo : <location> bin ;"
(note the case of "install").

rule apago_tag ( name : type ? : property-set ) {
   local tags ;
   if [ type.is-subtype $(type) EXE ] || [ type.is-subtype $(type) LIB ] {
      local v = [ $(property-set).get <variant> ] ;
      local suffix ;
      local extension = [ type.generated-target-suffix $(type) : $(property-set)
 ] ;
      extension = .$(extension) ;
      if $(v) = debug {
         suffix = _d ;
      } else {
         if [ $(property-set).get <debug-symbols> ] = "on" {
            suffix = _sym ;
         }
      }
      if [ type.is-subtype $(type) LIB ] && [ $(property-set).get <threading> ]
= "single" {
         suffix ?= "" ;
         suffix = $(suffix)_st ;
      }
      if $(suffix) {
         return $(name)$(suffix)$(extension:E="") ;
      }
   }
}


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk