How to use Boost in Visual Studio 2010

后端 未结 13 1248
情歌与酒
情歌与酒 2020-11-22 07:14

What is a good step by step explanation on how to use the Boost library in an empty project in Visual Studio?

13条回答
  •  余生分开走
    2020-11-22 07:36

    This thread has been around a while, and I thought I'd add something about HOW to build Boost as fast as possible on your specific hardware.

    If you have a 4 or 6-core use -j5 or -j7 respectively. Certainly not the standard build nor -j2 unless you indeed have dual core.

    I'm running a Sandy Bridge Extreme with stock clocked 3930K (6-core) on my main station, but have a 2600k (4-core) on older backup box, and the trend is I get the best Boost compile times with N + 1 build processes where N is the number of physical cores. N+2 reaches a point of diminishing returns and the times go up.

    Notes: Hyperthreading is enabled, 32GB RAM DDR3, Samsung 840 EVO SSD.

    -j7 on 6-core (2 minutes and 51 seconds) (Win7 Ultimate x64)(Visual Studio 2013)

    PS C:\Boost\boost_1_56_0> measure-command { .\b2 -j7 --build-type=complete msvc stage }
    
    Days              : 0
    Hours             : 0
    Minutes           : 2
    Seconds           : 51
    Milliseconds      : 128
    Ticks             : 1711281830
    TotalDays         : 0.0019806502662037
    TotalHours        : 0.0475356063888889
    TotalMinutes      : 2.85213638333333
    TotalSeconds      : 171.128183
    TotalMilliseconds : 171128.183
    

    -j6 on 6-core (3 minutes and 2 seconds) (Win7 Ultimate x64)(Visual Studio 2013)

    PS C:\Boost\boost_1_56_0> measure-command { .\b2 -j6 --build-type=complete msvc stage }
    
    Days              : 0
    Hours             : 0
    Minutes           : 3
    Seconds           : 2
    Milliseconds      : 809
    Ticks             : 1828093904
    TotalDays         : 0.00211584942592593
    TotalHours        : 0.0507803862222222
    TotalMinutes      : 3.04682317333333
    TotalSeconds      : 182.8093904
    TotalMilliseconds : 182809.3904
    

    -j8 on 6-core (3 minutes and 17 seconds) (Win7 Ultimate x64)(Visual Studio 2013)

    PS C:\Boost\boost_1_56_0> measure-command { .\b2 -j8 --build-type=complete msvc stage }
    
    Days              : 0
    Hours             : 0
    Minutes           : 3
    Seconds           : 17
    Milliseconds      : 652
    Ticks             : 1976523915
    TotalDays         : 0.00228764342013889
    TotalHours        : 0.0549034420833333
    TotalMinutes      : 3.294206525
    TotalSeconds      : 197.6523915
    TotalMilliseconds : 197652.3915
    

    -j7 build on 6-core

    Config

    Building the Boost C++ Libraries.
    
    
    Performing configuration checks
    
        - 32-bit                   : yes (cached)
        - arm                      : no  (cached)
        - mips1                    : no  (cached)
        - power                    : no  (cached)
        - sparc                    : no  (cached)
        - x86                      : yes (cached)
        - has_icu builds           : no  (cached)
    warning: Graph library does not contain MPI-based parallel components.
    note: to enable them, add "using mpi ;" to your user-config.jam
        - zlib                     : no  (cached)
        - iconv (libc)             : no  (cached)
        - iconv (separate)         : no  (cached)
        - icu                      : no  (cached)
        - icu (lib64)              : no  (cached)
        - message-compiler         : yes (cached)
        - compiler-supports-ssse3  : yes (cached)
        - compiler-supports-avx2   : yes (cached)
        - gcc visibility           : no  (cached)
        - long double support      : yes (cached)
    warning: skipping optional Message Passing Interface (MPI) library.
    note: to enable MPI support, add "using mpi ;" to user-config.jam.
    note: to suppress this message, pass "--without-mpi" to bjam.
    note: otherwise, you can safely ignore this message.
        - zlib                     : no  (cached)
    

    I note the 64-bit build takes a bit longer, I need to do the same comparison for those and update.

提交回复
热议问题