liburl是一个免费开源的,而且使用简单的网络库,支持DICT, FILE, FTP, FTPS, Gopher, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, Telnet,TFTP协议。支持SSL认证, HTTP POST, HTTP PUT, FTP上传, 代理, cookies,文件传输恢复等等。而且支持多种操作系统,比如Windows,linux,Mac OS X等等。liburl使用很广泛,在很多软件里都可以看到liburl的身影(查看安装包里是否带有liburl的dll文件)。
官网已经提供了编译好的版本,今天我们需要用VS2012自带的Developer Command Prompt for VS2012工具编译liburl代码。
1)首先从http://curl.haxx.se/download/curl-7.38.0.zip下载代码包,放到本地某个目录解压;
2)打开VS2012的Developer Command Prompt for VS2012工具,cd到liburl的winbuild文件夹里,接下来我以静态编译为例子。然后敲入nmake /f Makefile.vc mode=static mode-vc11,回车,即可编译。如下图所示
编译中:
3)最后我们可以在liburl的builds目录里找到编译后得到的文件。
如果我们要使用SSL,zlib功能,需要另外下载,可以到http://windows.php.net/downloads/php-sdk/deps/下载,如下是官方提供的编译时可能用到的一些命令:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
nmake /f Makefile.vc mode=<static or dll> <options> where <options> is one or many of: VC=<6,7,8,9,10,11,12> - VC versions WITH_DEVEL=<path> - Paths for the development files (SSL, zlib, etc.) Defaults to sibbling directory deps: ../deps Libraries can be fetched at http://windows.php.net/downloads/php-sdk/deps/ Uncompress them into the deps folder. WITH_SSL=<dll or static> - Enable OpenSSL support, DLL or static WITH_ZLIB=<dll or static> - Enable zlib support, DLL or static WITH_SSH2=<dll or static> - Enable libSSH2 support, DLL or static ENABLE_SSPI=<yes or no> - Enable SSPI support, defaults to yes ENABLE_IPV6=<yes or no> - Enable IPv6, defaults to yes ENABLE_IDN=<yes or no> - Enable use of Windows IDN APIs, defaults to yes Requires Windows Vista or later, or installation from: http://www.microsoft.com/downloads/details.aspx?FamilyID=AD6158D7-DDBA-416A-9109-07607425A815 ENABLE_WINSSL=<yes or no> - Enable native Windows SSL support, defaults to yes GEN_PDB=<yes or no> - Generate Program Database (debug symbols for release build) DEBUG=<yes or no> - Debug builds MACHINE=<x86 or x64> - Target architecture (default is x86) |
文章评论