views:

20

answers:

1

I am using the following Jamfile ( in directory /home/morpheus/base/CDef ) :


lib CDef : [ glob *.cpp ] : static ;

install libCDef : CDef : LIB "/home/morpheus/base_install/lib" : release ;

install _libCDef_D : CDef : LIB "/home/morpheus/base_install/libdebug" : debug ;


I was wondering if the two install lines can be changed to one which has both the debug and release directives.

Also to use the libraries in a different Jamfile in a different directory ( /home/morpheus/FSLR ) I am using the following Jamfile to build the exe callFSLR :


lib CDef : : release CDef /home/morpheus/base_install/lib ; lib CDef : : debug CDef /home/morpheus/base_install/libdebug ;

exe callFSLR : call_FSLR.cpp CDef : : debug release ;

install install-bin : callFSLR : "/home/morpheus/base_install/bin" release ;


I believe using "use-project" to refer to CDef in the Jamfile /home/morpheus/base/CDef/Jamfile is probably adviseable ?

A: 

(I think some stuff is missing from your jam rules, possibly due to formatting.)

Yes, you definitely can define both the debug and production targets with the same rule, using conditional requirements. An example is even the documentation of the install rule.

I believe your original rules look like

install libCDef
  : CDef
  : <install-type>LIB
    <location>"/home/morpheus/base_install/lib"
  : <variant>release ;

install _libCDef_D
  : CDef
  : <install-type>LIB
    <location>"/home/morpheus/base_install/libdebug"
  : <variant>debug ;

You'll want to make the location feature dependendent on the variant, like so:

install libCDef
  : CDef
  : <install-type>LIB
    <variant>release:<location>"/home/morpheus/base_install/lib"
    <variant>debug:<location>"/home/morpheus/base_install/libdebug"
  ;

As for the second question, yes, use-project would help, although it shouldn't be necessary. You want to do this

exe callFSLR : call_FSLR.cpp ../base/CDef//CDef ;

../base/CDef//CDef refers to the target named CDef defined in the project (directory) ../base/CDef. This refers to the library rule, so boost build will use the version of the library in the bin directory, not the version created by the install rule. (This might matter if you have dynamic library issues.) Also, you don't need the lib CDef immediately above this rule.

To avoid the clumsiness of the ../base/CDef, you could use the use-project rule to make a new definition for the project. Then should you reorganize the directory structure, you only have one place to change it.

use-project /CDef-project : ../base/CDef ;

exe callFSLR : call_FSLR.cpp /CDef-project//CDef ;

Another possibility, if you are going to use the one target in this one Jamfile, is to use the alias rule.

alias CDef : ../base/CDef//CDef ;

exe callFSLR : call_FSLR.cpp CDef ;
AFoglia
When I used the following jamfile :lib CDef : [ glob *.cpp ] : <link>static ;install libCDef : CDef : <install-type>LIB <variant>release:<location>"/home/morpheus/base_install/lib" <variant>debug:<location>"/home/morpheus/base_install/libdebug" ;only the debug variants were built. I deleted the previously compiled release version of the lib but still it was not rebuilt.
Humble Debugger
My mistake, I just needed to add ": release debug " after thatfor this to work.
Humble Debugger