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:

Win7 + VS2015 + CMake3.6.1-GUI + Makefile 编译开源库的更多相关文章

  1. 无法链接glew的解决办法-编译开源库出现: error LNK2001: 无法解析的外部符号

    无法链接glew的解决办法-编译开源库出现: error LNK2001: 无法解析的外部符号 参考官方配置指南:http://glew.sourceforge.net/install.html 1. ...

  2. Makefile 编译静态库文件及链接静态库

    本文为原创文章,转载需指明该文链接 1.代码目录结构如下: comm/ comm/inc/apue.h  3 atexit.c Makefile  5 staticlib/lib/ staticlib ...

  3. Win7 + VS2015 + CMake3.6.1-GUI编译库

    CMake生成Unicode版本VC工程 Just add this line in your top CMakeLists.txt file:     add_definitions(-DUNICO ...

  4. 在Windows下使用nmake+Makefile+编译ZThread库(附例子)

    ----------2015/01/09/23:21更新----------------------------------- 关于保留DEBUG信息的一个简单例子,见这篇随笔 ----------2 ...

  5. Makefile 编译动态库文件及链接动态库

    本文为原创文章,转载请指明该文链接 文件目录结构如下 dynamiclibapp.c Makefile comm/inc/apue.h comm/errorhandle.c dynamiclib/Ma ...

  6. Makefile 编译静态库

    CC = gcc AR = ar FLAGS = -Wall -lpthread CLOUD = cloud_server OBJ += cloud_server.o LIB = libccloud. ...

  7. Win7 64位 VS2015及MinGW环境编译矢量库agg-2.5和cairo-1.14.6

    书接上文,昨天装了MinGW,主要原因之一是要用到MSYS,所以顺手把FFMPEG又编译了一遍. 回到主题,其实我是想编译矢量库,因为最近要学习一些计算几何算法,所以找个方便的2D画图库就很重要. 说 ...

  8. Win7 VS2015及MinGW环境编译矢量库agg-2.5和cairo-1.14.6

    书接上文,昨天装了MinGW,主要原因之一是要用到MSYS,所以顺手把FFMPEG又编译了一遍. 回到主题,其实我是想编译矢量库,因为最近要学习一些计算几何算法,所以找个方便的2D画图库就很重要. 说 ...

  9. Win7 VS2015环境编译cegui-0.8.5

    首先是去官网下载源码与依赖库 http://cegui.org.uk/ 然后得提一下,编译DX11版本带Effects11框架的话会有问题,也就是默认情况编译有问题,这是因为VS2015升级后编译器对 ...

随机推荐

  1. extract a page from a multiple pages pdf on Ubuntu OS

    extract a page from a multiple pages pdf 1 extract a page from a multiple pages pdf use pdftk packag ...

  2. Python基础(八)装饰器

    今天我们来介绍一下可以提升python代码逼格的东西——装饰器.在学习装饰器之前我们先来复习一下函数的几个小点,方便更好的理解装饰器的含义. 一.知识点复习 1, 在函数中f1和f1()有什么不同,f ...

  3. photon Unity RPC 调用流程

    本文章由cartzhang编写,转载请注明出处. 所有权利保留. 文章链接:http://blog.csdn.net/cartzhang/article/details/51425225 作者:car ...

  4. pace.js – 网页自动加载进度条插件

    网站顶部的页面加载进度条是怎么实现的,页面的加载进度百分比,有时候获取是比较麻烦的,当然也可以利用一些优秀的JavaScript插件来实现,今天就为大家介绍这样子的一款插件:pace.js. [官方网 ...

  5. Codeforces Round #235 (Div. 2)

    A. Vanya and Cards time limit per test 1 second memory limit per test 256 megabytes input standard i ...

  6. Uva122 Trees on the level

    Background Trees are fundamental in many branches of computer science. Current state-of-the art para ...

  7. Ext.data.JsonStore的使用

    最近在维护一个Ext.js写的贷前服务系统,Ext.data.JsonStore相当于前台页面的一个数据仓库,负责保存后台传过来的Json数据,具体用法如下: var store12=new Ext. ...

  8. Maven使用GitHub项目目录搭建远程仓库

    使用GtiHub的项目目录搭建第三方远程仓库,能免除使用服务器搭建Nexus私服,而且空间也是免费的.但是这种方式只适合小规模发布,毕竟搜索和版本控制是一个问题,如果需要更复杂的功能就只能转向Nexu ...

  9. 微軟将弃用 System.Data.OracleClient

    http://www.cnblogs.com/WizardWu/archive/2010/05/17/1737009.html 微軟将从 .NET 4 以后的版本弃用 System.Data.Orac ...

  10. doT js模板入门 3

    for 循环前推断循环的list是否为空 <script id="invoiceListDot" type="text/x-dot-template"&g ...