使用Boost的多个STLport配置

Using multiple STLport configurations with Boost

本文关键字:STLport 配置 Boost 使用      更新时间:2023-10-16

我使用Boost (1.54.0, bjam 2011.12.1)。OS=NT)与STLport(5.2.1)在Windows CE开发项目。我首先从一个Windows CE平台SDK开始,一切都很顺利。但是现在我需要支持几个Windows CE平台sdk,每个sdk都有自己的系统头文件和编译标志。

首先,我为这些平台(例如PLATFORM1和PLATFORM2)构建了STLport,并将STLport库放在c:libSTLport-5.2.1libPLATFORM1c:libSTLport-5.2.1libPLATFORM2上。

然后,在user-config.jam中我有:

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 ;

然后,对于PLATFORM1,我通过运行带有stdlib=stlport-5.2.1~PLATFORM1标志的bjam.exe来构建Boost库,而构建PLATFORM2使用stdlib=stlport-5.2.1~PLATFORM2

但是bjam对PLATFORM2使用了错误的STLport库路径。例如,带-n标志运行bjam会显示以下平台链接命令(注意第二个调用中错误的LIBPATH参数):

link.exe ... /out:"building...stdlib-stlport-5.2.1~PLATOFRM1threading-multiboost_xxx.dll" ... /LIBPATH:"c:libSTLport-5.2.1libPLATFORM1"
link.exe ... /out:"building...stdlib-stlport-5.2.1~PLATOFRM2threading-multiboost_xxx.dll" ... /LIBPATH:"c:libSTLport-5.2.1libPLATFORM1"

基本上,它总是使用用户配置中的第一个using stlport指令。无论我传递给stdlib参数的是哪个版本。我做错了什么吗?设置环境以能够使用不同的STLport二进制文件构建Boost的正确方法是什么?

我通过使用一个特殊变量来定义STLport库的位置来解决这个问题。基本上,我是这样做的。

user-config.jam中,我将所有STLport工具集初始化更改为单个:

c:/lib/stlport -5.2.1/stlport:c:/lib/STLport-5.2.1/lib/美元(STLPORTLIBSUBDIR) ,
此外,为了查看变量,我在using指令之前添加了以下行:

local STLPORTLIBSUBDIR = [modules. conf]

然后,为PLATFORM1构建Boost库,我需要向bjam传递以下参数:

stdlib=stlport-5.2.1-sSTLPORTLIBSUBDIR=PLATFORM1