Boost + Visual Studio 2010 + Windows Platform SDK

2019-04-12 16:47发布

问题:

Could someone tell me a command line switch for bjam or something else that will make boost compile with VS2010 using the new Windows Platform SDK 7.1 toolchain? It's an option you can set in a normal visual studio project. The default is v100 a variant of the platform 7.0 toolchain. Thanks in advance.

回答1:

Try this in your environment

set SdkTools=c:\Program Files\Microsoft SDKs\Windows\v7.1\Bin 

call "%SdkTools%\SetEnv.Cmd" /xp /x86 

assuming that's where you have the Windows SDK installed. Info is from here - there may be more to do, but this looks on the right track to me.



回答2:

To build boost 1.43.0 libraries for VS 2010:

  • Download and extract to C:\Temp\boost_1_43_0
  • Start Visual Studio 2010 Command Prompt
  • Build BJam

cd C:\Temp\boost_1_43_0\tools\jam\src

build.bat

  • Build Boost using BJam

cd C:\Temp\boost_1_43_0

tools\jam\src\bin.ntx86\bjam.exe --with-regex link=static runtime-link=static threading=multi variant=debug,release address-model=32,64

  • Check bin.v2 or stage/lib for output. Note naming conventions.

May need to build in two phases with just address-model=32 then with just address-model=64. In this case we are choosing to build libs that statically link to the C runtime and to statically link to the boost lib itself.

Use --with to build non-header based libs like regex. Note stage/lib will be overwritten after each address-model build, but all libs are always kept in bin.v2.