当前位置: 首页 > news >正文

Win7 + VS2015 + CMake3.6.1-GUI + Makefile 编译开源库

CMake生成Unicode版本VC工程

    Just add this line in your top CMakeLists.txt file:
    add_definitions(-DUNICODE -D_UNICODE)

        if(MSVC)
            add_definitions(-DUNICODE -D_UNICODE)
        endif()

基本配置

    配置生成库输出目录 ExportDir=F:\Develop\bin\x64
    Add Entry:
        CMAKE_INSTALL_PREFIX F:\Develop\bin\x64\xxx

# Only enable release and debug builds
IF(CMAKE_CONFIGURATION_TYPES)
  SET(CMAKE_CONFIGURATION_TYPES Release Debug )
  SET(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING
    "Reset the configurations to what we need"
    FORCE)
ENDIF()
        
if(MSVC)
    set(CMAKE_DEBUG_POSTFIX "d")
endif()

zlib-1.2.8 

    修改CMakeLists.txt, 加入字符编码
        if(MSVC)
            add_definitions(-DUNICODE -D_UNICODE)
        endif()
    配置CMAKE_INSTALL_PREFIX参数, 指定头文件及编译包Install目录. ($(ExportDir)\zlib-1.2.8)
    Config –> Generate
    打开zlib.sln进行批生成

OpenSSL-1.0.2k

    1. 编译 见《INSTALL.W64》 To build for Win64/x64
        32  $ perl Configure VC-WIN32 no-asm --prefix=$(ExportDir)\OpenSSL-1.0.2
        64  $ perl Configure VC-WIN64A no-asm --prefix=$(ExportDir)\OpenSSL-1.0.2
            > perl Configure VC-WIN64A no-asm --prefix=F:\Develop\bin\x64\OpenSSL-1.0.2
     > ms\do_win64a
     > nmake -f ms\ntdll.mak
            > nmake -f ms\ntdll.mak install
     > cd out32dll
            > ..\ms\test
    2. 环境变量设置
        OPENSSL_BASE = $(ExportDir)\OpenSSL-1.0.2
        OPENSSL_ROOT_DIR = $(ExportDir)\OpenSSL-1.0.2
    3. 包含目录
        $(OPENSSL_BASE)\include;
    4. 库目录
        $(OPENSSL_BASE)\lib;
    5. 库文件
        libeay32.lib;ssleay32.lib;

OpenSSL-1.1.0b

    1. 编译 (Win64默认为 UNICODE, 不需要加 -DUNICODE -D_UNICODE)
        32  $ perl Configure VC-WIN32 no-asm --prefix=$(ExportDir)\OpenSSL-1.1
        64  $ perl Configure VC-WIN64A no-asm --prefix=$(ExportDir)\OpenSSL-1.1
            perl Configure VC-WIN64A no-asm --prefix=F:\Develop\bin\x64\OpenSSL-1.1
            $ nmake
            $ nmake test
            $ nmake install
    2. 环境变量设置
        OPENSSL_BASE = $(ExportDir)\OpenSSL
        OPENSSL_ROOT_DIR = $(ExportDir)\OpenSSL
    3. 包含目录
        $(OPENSSL_BASE)\include;
    4. 库目录
        $(OPENSSL_BASE)\lib;
    5. 库文件
        libcrypto.lib;libssl.lib;

libpng-1.6.28

    配置CMAKE_INSTALL_PREFIX参数, 指定头文件及编译包Install目录. ($(ExportDir)\jpeg-9b)
        F:\Develop\bin\x64\libpng-1.6.28
    
        ZLIB_INCLUDE_DIR  
        ZLIB_LIBRARY_DEBUG
        ZLIB_LIBRARY_RELEASE
        ld-version-script OFF
        PNG_TESTS
    Config –> Generate
    打开zlib.sln进行批生成

jpeg-9b

    方式1: 使用CMakeLists.txt
    配置CMAKE_INSTALL_PREFIX参数, 指定头文件及编译包Install目录. ($(ExportDir)\libpng-1.6.28)
        F:\Develop\bin\x64\jpeg-9b
        LIBJPEG_SOURCE_DIR F:/Develop/libs/jpeg-9b
        
    方式2:
        0. 把Win32.mak(C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include\Win32.Mak)拷贝到源文件目录
        1. Open the command prompt, change to the main directory and execute the command line
            NMAKE /f makefile.vc setup-v10
           This will move jconfig.vc to jconfig.h and makefiles to project files.
           (Note that the renaming is critical!)
        2. Open the solution file jpeg.sln, build the library project.
           (If you are using Visual Studio more recent than 2010 (v10), you'll
           probably get a message saying that the project files are being updated.)
        3. Open the solution file apps.sln, build the application projects.
        4. To perform the self-test, execute the command line
            NMAKE /f makefile.vc  test-build
        5. Move the application .exe files from `app`\Release to an
           appropriate location on your path.

tiff-4.0.7

    配置CMAKE_INSTALL_PREFIX参数, ($(ExportDir)\tiff-4.0.7)
        F:\Develop\bin\x64\tiff-4.0.7
        配置zlib, jpeg

freetype-2.7

    配置CMAKE_INSTALL_PREFIX参数, ($(ExportDir)\freetype-2.7)
        F:\Develop\bin\x64\freetype-2.7
        配置zlib

giflib-5.1.4

    配置CMAKE_INSTALL_PREFIX参数, ($(ExportDir)\giflib-5.1.4)
        F:\Develop\bin\x64\giflib-5.1.4
        配置GIFLIB_SOURCE_DIR

minizip

    配置CMAKE_INSTALL_PREFIX参数, ($(ExportDir)\minizip)
        F:\Develop\bin\x64\minizip
        ZLIB_ROOT F:\Develop\bin\x64\zlib-1.2.8

glut

    配置CMAKE_INSTALL_PREFIX参数, ($(ExportDir)\glut)
        F:\Develop\bin\x64\glut
        GLUT_SOURCE_DIR F:\Develop\GitRepos\OpenSceneGraph3rdParty\glut

libssh2-1.8.0

    修改CMakeLists.txt, 加入字符编码
        if(MSVC)
            add_definitions(-DUNICODE -D_UNICODE)
        endif()
    配置CMAKE_INSTALL_PREFIX参数, 指定头文件及编译包Install目录. ($(ExportDir)\libssh2-1.8)
        F:\Develop\bin\x64\libssh2-1.8
        关闭test,examples
    Config –> Generate
    打开 libssh2.sln
        为debug输出目标名加上d后缀
        进行批生成
        手动拷贝src/debug目录下的libssh2d.lib到lib目录

curl-7.52.1

    配置CMAKE_INSTALL_PREFIX参数, 指定头文件及编译包Install目录. ($(ExportDir)\curl-7.52.1)
        Zlib相关参数, F:/Develop/bin/x64/zlib-1.2.11
    OpenSSL相关参数, F:/Develop/bin/x64/OpenSSL-1.0.2
    OPENSSL_ROOT_DIR, F:/Develop/bin/x64/OpenSSL-1.0.2
    ENABLE_MANUAL, OFF
        BUILD_RELEASE_DEBUG_DIRS
    Config –> Generate
    打开 CURL.sln进行批生成
    拷贝 Output\lib\Release\libcurl.dll
    拷贝 Output\lib\Debug\libcurl.dll 为 libcurld.dll
    拷贝 Output\lib\Debug\libcurl.pdb 为 libcurld.pdb

curl-7_51_0

    修改CMakeLists.txt, 加入字符编码
        if(MSVC)
            add_definitions(-DUNICODE -D_UNICODE)
        endif()
    配置CMAKE_INSTALL_PREFIX参数, 指定头文件及编译包Install目录. ($(ExportDir)\curl-7_51)
        Zlib相关参数, F:/Develop/bin/x64/zlib/lib
        BUILD_RELEASE_DEBUG_DIRS
    Config –> Generate
    打开 CURL.sln进行批生成
    拷贝 Output\lib\Release\libcurl.dll
    拷贝 Output\lib\Debug\libcurl.dll 为 libcurld.dll
    拷贝 Output\lib\Debug\libcurl.pdb 为 libcurld.pdb

glew 2.0.0

    打开VC12目录下的glew.sln,升级到VC14
        设置字符集
    使用x64编译 debug, release版本
    拷贝 bin\debug(release)\x64下文件到 $(ExportDir)\glew-2.0.0\bin
    拷贝 lib\debug(release)\x64下文件到 $(ExportDir)\glew-2.0.0\lib
    拷贝 include目录到$(ExportDir)\glew-2.0.0

iconv 1.14

    按照http://www.codeproject.com/Articles/302012/How-to-Build-libiconv-with-Microsoft-Visual-Studio说明进行配置
    debug配置->常规-> 目标文件名: $(ProjectName)d
    生成后,把
        debug(release)\libiconv(d).lib拷贝到 $(ExportDir)\lib
        iconv.h拷贝到 $(ExportDir)\include
        debug(release)\libiconv(d).dll(pdb)拷贝到 $(ExportDir)\bin

libxml2-2.9.4

    将其中的iconv.h放入$(ExportDir)\bin\include目录中,将其中的libiconv.lib放入$(ExportDir)\bin\lib中,并改名为iconv.lib.(没有相应目录就新建一个)。
    修改libxml2\win32\Makefile.msvc
    POST_TAG = ""
    !if "$(DEBUG)" == "1"
    POST_TAG = "d"
    !endif
    XML_SO = $(XML_BASENAME)$(POST_TAG).dll
    XML_IMP = $(XML_BASENAME)$(POST_TAG).lib
    XML_DEF = $(XML_BASENAME).def
    XML_A = $(XML_BASENAME)$(POST_TAG)_a.lib
    XML_A_DLL = $(XML_BASENAME)$(POST_TAG)_a_dll.lib


    cscript configure.js compiler=msvc prefix=$(ExportDir)\bin  include=$(ExportDir)\bin\include lib=$(ExportDir)\bin\lib debug=yes(no)
    cscript configure.js compiler=msvc prefix=F:\Develop\bin\x64\bin include=F:\Develop\bin\x64\bin\include lib=F:\Develop\bin\x64\bin\lib debug=yes
        手工拷贝文件
    cscript configure.js compiler=msvc prefix=F:\Develop\bin\x64\bin include=F:\Develop\bin\x64\bin\include lib=F:\Develop\bin\x64\bin\lib debug=no
        nmake install

CGAL-4.9

    修改CMakeLists.txt, 加入字符编码
        if(MSVC)
            add_definitions(-DUNICODE -D_UNICODE)
        endif()
    配置CMAKE_INSTALL_PREFIX参数, 指定头文件及编译包Install目录. ($(ExportDir)\CGAL)
        F:/Develop/bin/x64/CGAL
        Zlib相关参数, F:/Develop/bin/x64/zlib/lib

 

历史:

2017-01-31: OpenSSL-1.0.2K编译
2017-02-12:

转载于:https://www.cnblogs.com/yaoyu126/p/6040119.html

相关文章:

  • [工具]利用EasyRTSPClient工具检查摄像机RTSP流不能播放原因以及排查音视频数据无法播放问题...
  • web前端:css基本操作
  • DUILIB圆形头象
  • #include
  • The content of element type configuration must match (properties?,settings?,typeAliases?,typeHa...
  • xCode8支持iOS7.0
  • C#跨窗体传值的几种方法分析(很详细)
  • 数据结构:二叉树的链式存储
  • 用正则表示式分析网页
  • iOS AFNetworking 打印从服务器返回的错误提示信息
  • Ubuntu16.04安装网易云音乐
  • OC 图片圆角实现
  • 常用设计模式之适配器
  • 加速度传感器检测物体倾角的原理
  • codeforces 734E(DFS,树的直径(最长路))
  • Bytom交易说明(账户管理模式)
  • happypack两次报错的问题
  • Koa2 之文件上传下载
  • mysql 数据库四种事务隔离级别
  • nfs客户端进程变D,延伸linux的lock
  • oldjun 检测网站的经验
  • 干货 | 以太坊Mist负责人教你建立无服务器应用
  • 构造函数(constructor)与原型链(prototype)关系
  • 将回调地狱按在地上摩擦的Promise
  • 模型微调
  • 前端技术周刊 2019-01-14:客户端存储
  • 前端技术周刊 2019-02-11 Serverless
  • 收藏好这篇,别再只说“数据劫持”了
  • 通过来模仿稀土掘金个人页面的布局来学习使用CoordinatorLayout
  • 学习笔记TF060:图像语音结合,看图说话
  • 一文看透浏览器架构
  • 交换综合实验一
  • 新海诚画集[秒速5センチメートル:樱花抄·春]
  • ​LeetCode解法汇总2808. 使循环数组所有元素相等的最少秒数
  • ​Linux Ubuntu环境下使用docker构建spark运行环境(超级详细)
  • ​一帧图像的Android之旅 :应用的首个绘制请求
  • ![CDATA[ ]] 是什么东东
  • #ubuntu# #git# repository git config --global --add safe.directory
  • (007)XHTML文档之标题——h1~h6
  • (3)Dubbo启动时qos-server can not bind localhost22222错误解决
  • (4.10~4.16)
  • (6)添加vue-cookie
  • (八)Flask之app.route装饰器函数的参数
  • (超简单)构建高可用网络应用:使用Nginx进行负载均衡与健康检查
  • (简单) HDU 2612 Find a way,BFS。
  • (译)计算距离、方位和更多经纬度之间的点
  • (转贴)用VML开发工作流设计器 UCML.NET工作流管理系统
  • *++p:p先自+,然后*p,最终为3 ++*p:先*p,即arr[0]=1,然后再++,最终为2 *p++:值为arr[0],即1,该语句执行完毕后,p指向arr[1]
  • .NET中使用Protobuffer 实现序列化和反序列化
  • .Net转Java自学之路—SpringMVC框架篇六(异常处理)
  • .sdf和.msp文件读取
  • /var/log/cvslog 太大
  • @JsonFormat与@DateTimeFormat注解的使用
  • @RequestBody与@ModelAttribute
  • @WebServiceClient注解,wsdlLocation 可配置