简体   繁体   中英

Build Boost 1.52 Libraries using Visual Studio 2012 to target Windows XP

"Visual Studio 2012 Update 1" enabled support for a Windows XP target using toolset "vc110_xp".

How do I configure Boost 1.52 to build libraries using the vc110_xp toolset ?

I found the easiest way was to edit \\Program Files (x86)\\Microsoft Visual Studio 11.0\\VC\\vcvarsall.bat add lines to change the LIB , INCLUDE , PATH and CL variables after the defaults were loaded. Boost.Build uses this batch file so you don't need to make any other changes.

For example here is the new :x86 section

:x86
if not exist "%~dp0bin\vcvars32.bat" goto missing
call "%~dp0bin\vcvars32.bat"

set INCLUDE=%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\Include;%INCLUDE%
set PATH=%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\Bin;%PATH%
set LIB=%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\Lib;%LIB%
set CL=/D_USING_V110_SDK71_;%CL%

goto :SetVisualStudioVersion

Wth the four set 's being the additions. A similar thing can be done for the :amd64 section, though I'm hesitant to post it as I've only tested XP 32bit myself, I've been happy to target Vista+ for 64bit builds.

Change the content of the below files in boost folder( which is downloaded and extracted)

Folder : boost_1_54_0\\tools\\build\\v2\\tools

Files:

  1. msvc.jam

content changed :

for 32 bit :
          toolset.flags msvc LINKFLAGS <user-interface>console : /subsystem:console,5.01 ;

for 64 bit:
          toolset.flags msvc LINKFLAGS <user-interface>console : /subsystem:console,5.02 ;
  1. msvc.py

content changed :

for 32 bit :
          toolset.flags('msvc', 'LINKFLAGS', ['<user-interface>console'], ['/subsystem:console,5.01'])

for 64 bit:
          toolset.flags('msvc', 'LINKFLAGS', ['<user-interface>console'], ['/subsystem:console,5.02'])

Folder : boost_1_54_0\\tools\\build\\v2\\engine

Files:

  1. build.bat

content changed :

    for 32 bit/ 64 bit :
       1.   fix the Visual Studio Path Exactly like instead of "%ProgramFiles%- change
               to  %ProgramFiles(x86)%

       2.   Add " /D _USING_V110_SDK71_ " to BOOST_JAM_CC =cl command before Skip_VC11

Open vs2012 developer Command prompt and type the following commands

** update 7.1A SDK path as per your installation

  1. call "%ProgramFiles(x86)%\\Microsoft Visual Studio 11.0\\VC\\bin\\vcvars32.bat"

  2. set INCLUDE=%ProgramFiles(x86)%\\Microsoft SDKs\\Windows\\7.1A\\Include;%INCLUDE%

  3. set PATH=%ProgramFiles(x86)%\\Microsoft SDKs\\Windows\\7.1A\\Bin;%PATH%

  4. set LIB=%ProgramFiles(x86)%\\Microsoft SDKs\\Windows\\7.1A\\Lib;%LIB%

  5. bootstrap

  6. Pick the command as per the OS Type (32/64 bit)

    for 32 bit :

    b2 toolset=msvc-11.0 variant=debug,release link=shared runtime-link=shared address-model=32

    for 64 bit :

    b2 toolset=msvc-11.0 variant=debug,release link=shared runtime-link=shared address-model=64

To compile any sample for release and debug versions follow this:

Open vs2012 developer Command prompt and type the following commands

  1. call "%ProgramFiles(x86)%\\Microsoft Visual Studio 11.0\\VC\\bin\\vcvars32.bat"

  2. set INCLUDE=%ProgramFiles(x86)%\\Microsoft SDKs\\Windows\\7.1A\\Include;%INCLUDE%

  3. set PATH=%ProgramFiles(x86)%\\Microsoft SDKs\\Windows\\7.1A\\Bin;%PATH%

  4. set LIB=%ProgramFiles(x86)%\\Microsoft SDKs\\Windows\\7.1A\\Lib;%LIB%

  5. go to the directory of the sample : ex: boost_1_54_0\\libs\\test\\tools\\console_test_runner

  6. type the following command

     <path>\\boost_1_54_0\\bjam.exe --v2 toolset=msvc-11.0 variant=debug,release link=shared threading=multi runtime-link=shared 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM