zoukankan      html  css  js  c++  java
  • Boost1.6x+win7+VC2015编译

    下载


    通过boost官方网站, 或直接在source forge下载boost_1_6x_0. 

    可选包


    Zlib library, 环境变量: ZLIB_SOURCE

    bzip2, 环境变量: BZIP2_SOURCE

    ICU i18n, 环境变量HAVE_ICU=1, ICU_PATH

    expat, 环境变量: EXPAT_INCLUDE (头文件包含目录) 和 EXPAT_LIBPATH (库目录)

    在Windows上编译Boost


    下载完Boost源文件压缩包后, 创建boost-src目录, 并把源文件解压到此目录. 假设你想把Boost安装到boost-dir目录, boost-build目录是中间临时文件. 在命令行执行下面的步骤:

    编译器的选择(x86_amd64, amd64等的区别)(注:2)

    • 32/64 位系统编译在32位系统上运行 => x86
    • 32 系统上编译64位系统上运行 => x86_amd64
    • 64 系统上编译在64位系统上运行 => amd64

    1.初始化VC编译环境:

    • 32位系统上, 初始化32位VC编译环境:

        "C:Program FilesMicrosoft Visual Studio 14.0VCvcvarsall.bat" x86

    • 32位系统上, 要生成64位的boost库, 初始化64位VC++编译环境:

         "C:Program FilesMicrosoft Visual Studio 14.0VCvcvarsall.bat" x86_amd64

    • 64位操作系统上, 安装的32位Visual Studio, Visual Studio 一般安装在 C:Program Files (x86):

        "C:Program Files (x86)Microsoft Visual Studio 14.0VCvcvarsall.bat" x86

    • 64位操作系统上, 安装的32位Visual Studio, 生成64位库:

        "C:Program Files (x86)Microsoft Visual Studio 14.0VCvcvarsall.bat" amd64

    2. 生成Boost编译系统:

      cd /d drive:path ooost-src
      bootstrap.bat

    3. 解压bzip2和zlib源压缩包, 备注解压的目录.

    4. 编译和安装:

    • 32位库

      b2 install --libdir=boost-dirlibs --includedir= boost-dirinclude --build-dir=boost-build --layout=tagged variant=debug,release threading=multi link=shared runtime-link=shared -sZLIB_SOURCE=<zlib-src-dir> -sBZIP2_SOURCE=<bzip2-src-dir>

    •  64位库

      b2 install --libdir=boost-dirlibs64 --includedir= boostdirinclude --build-dir=boost-build64 --layout=tagged variant=debug,release threading=multi link=shared runtime-link=shared address-model=64 –sZLIB_SOURCE=<zlib-src-dir> -sBZIP2_SOURCE=<bzip2-src-dir>

    我的实例:


    "C:Program Files (x86)Microsoft Visual Studio 14.0VCvcvarsall.bat" x64
    cd /d F:DevelopLibsoost_1_6x_0
    bootstrap.bat

    1. 编译和安装32位库:
    b2 install --libdir=G:yyuildlibs --includedir=G:yyuildinclude --build-dir=boost-build --layout=tagged variant=debug,release threading=multi link=shared runtime-link=shared

    2. 编译和安装64位库:
    b2 install --libdir=G:yyuildlibs64 --includedir=G:yyuildinclude --build-dir=boost-build64--layout=tagged variant=debug,release threading=multi link=shared runtime-link=shared address-model=64 architecture=x86

    3. 编译和安装64位库(方式2):

    b2 install --prefix=F:Developinx64oost-1_62 --build-dir=boost-build64 --layout=tagged variant=debug,release threading=multi link=shared runtime-link=shared address-model=64 architecture=x86 --with-thread --with-graph --with-date_time

    4. 编译和安装64位库(2017-3-2 1.63):

      b2 install --prefix=F:Developinx64oost-1_63 --build-dir=F:DevelopuildVC14oost-1_63-build64 address-model=64 architecture=x86 --with-thread
     默认值:
      --build-type=minimal   在Windows上, 生成基于共享运行库的debug和release静态多线程库
      --layout=versioned    在Windows上默认,Boost二进制文件名称包括Boost版本号、编译器名称和版本和编码生成属性。
                      Boost头文件安装在<HDRDIR>子目录 <HDRDIR>的名字包含Boost版本号。

    5. 编译和安装64位库(boost.python)(2017-3-18 1.63):

     b2 install --prefix=D:Developinvc14x64oost-1_63 --build-dir=D:Developuildvc14oost-1_63-build64 address-model=64 architecture=x86 toolset=msvc-14.0 --with-python link=shared

    Boost的自动链接功能:


    Boost默认启用自动链接功能, 建议采用关闭自动链接功能。
      在附加预定义宏 加 BOOST_ALL_NO_LIB ,这样就关闭了BOOST的自动链接LIB的功能。然后把需要的lib库在附加库里手动加入。

    修订:

    1. 2016-11-09: 64位编译需要加入CPU架构参数: architecture=x86
    2. 2016-11-23: 编译器的选择(x86_amd64, amd64等的区别), 内容进行了整理, boost更新到1.62.0
    3. 2017-03-02: 使用默认参数编译, boost更新到1.63.0
    4. 2017-04-15: 建议关闭boost自动链接功能

  • 相关阅读:
    IE与FF有关javascript差异的点点滴滴 F
    document.documentElement与document.body F
    CSS模块化开发 F
    关于使用“JS获取屏幕,浏览器,网页高度宽度”的个人思考 F
    GUI F
    关于mousemove和scroll事件的一点技巧 F
    博客换肤 F
    一个日历的简单实现 F
    忠烈杨家将观后感 F
    Vim的配置
  • 原文地址:https://www.cnblogs.com/yaoyu126/p/5547297.html
Copyright © 2011-2022 走看看