I use Boost (1.54.0, bjam 2011.12.1. OS=NT) with STLport (5.2.1) on a Windows CE development project. I first started with a single Windows CE platform SDK and all went mostly fine. But now I need to support several Windows CE platform SDKs, each with its own system headers and compilation flags.
First, I've build STLport for each of these platforms (say PLATFORM1 and PLATFORM2), and put the STLport libraries to, say, c:\lib\STLport-5.2.1\lib\PLATFORM1
and c:\lib\STLport-5.2.1\lib\PLATFORM2
.
Then, in the user-config.jam
I have:
using stlport : 5.2.1~PLATFORM1 : c:/lib/STLport-5.2.1/stlport : c:/lib/STLport-5.2.1/lib/PLATFORM1 ;
using stlport : 5.2.1~PLATFORM2 : c:/lib/STLport-5.2.1/stlport : c:/lib/STLport-5.2.1/lib/PLATFORM2 ;
Then, for PLATFORM1 I build Boost libraries by running bjam.exe with the stdlib=stlport-5.2.1~PLATFORM1
flag, while building for PLATFORM2 uses stdlib=stlport-5.2.1~PLATFORM2
.
But wrong STLport library path is used by bjam for PLATFORM2. E.g., running bjam with the -n flag shows the following linking commands for the platforms (note the wrong LIBPATH parameter in the second call):
link.exe ... /out:"building\...\stdlib-stlport-5.2.1~PLATOFRM1\threading-multi\boost_xxx.dll" ... /LIBPATH:"c:\lib\STLport-5.2.1\lib\PLATFORM1"
link.exe ... /out:"building\...\stdlib-stlport-5.2.1~PLATOFRM2\threading-multi\boost_xxx.dll" ... /LIBPATH:"c:\lib\STLport-5.2.1\lib\PLATFORM1"
Basically, it always uses the first using stlport
directive from the user-config.jam, no matter what version I'm passing to the stdlib parameter.
Am I doing something wrong? What is the correct way to setup environment to be able to build Boost with different STLport binaries?
I solved the problem by using a special variable to define STLport libraries location. Basically, I did it the following way.
In the user-config.jam
I changed all my STLport toolset initializations to a single one:
using stlport : 5.2.1 : c:/lib/STLport-5.2.1/stlport : c:/lib/STLport-5.2.1/lib/$(STLPORTLIBSUBDIR) ;
Also, to peek the variable, I added the following line somewhere before the using directive:
local STLPORTLIBSUBDIR = [ modules.peek : STLPORTLIBSUBDIR ] ;
And then, to build Boost libraries for PLATFORM1, I need to pass bjam the following parameters:
stdlib=stlport-5.2.1
and -sSTLPORTLIBSUBDIR=PLATFORM1