mac 下使用Xcode 5.1 编译Vmime笔记

mac os x 使用Xcode 5.1 编译Vmime笔记


1、准备

  安装Xcode 5.1
  //安装Cmake

  依赖第三方库
   ICU Library or iconv 函数实现 文本字符集转化
   GNU SASL Library 支持SASL 邮箱登录认证
   OpenSSL or GUN TLS Library 支持SSL and TLS
   Boost C++ Library or using C++11 支持shared_ptr<>
  (详情请见vmime-book.pdf)

2、依赖库编译

  ICU Library and OpenSSL Xcode环境中存在,不自己编译了
  下载编译 gsasl库
  先下载 libntlm 0.3.1 or later 支持 NTLM
  下载 GNU GSS Library 支持GSSAPI
  编译这些库使用 ./configure CC=“gcc -arch i386” 进行编译设置 使其支持MacOS Xcode universal i386使用
  (详情请见 库目录下INSTALL文件)

3、下载Vmime库,使用Xcode进行编译

  使用Xcode 新建Vmime工程选择动态库dynamic Library
  引入库目录src目录下所有文件
  设置Search Paths>>Header Search Paths 添加include路径
  /Volumes/home/Projects/vmime-master/src
  /Volumes/home/Projects/vmime-master
  /Volumes/home/Projects/boost_1_57_0
  /usr/local/include 依赖库头文件

  设置Linking>>Other Linker Flags 引入依赖库
  /usr/lib/libssl.dylib
  /usr/lib/libcrypto.dylib
  /usr/lib/libiconv.dylib
  /usr/local/lib/libgsasl.dylib 上面编译安装的gsasl库

  (以上路径修改为你的电脑上的实际路径)
 
  设置Build Locations>>BuildProducts Path 更改生成目标位置

  新建config.h 配置文件

#ifndef _VMIME_CONFIG_H__
#define _VMIME_CONFIG_H__

typedef   signed char    vmime_int8;
typedef unsigned char    vmime_uint8;
typedef   signed short   vmime_int16;
typedef unsigned short   vmime_uint16;
typedef   signed int     vmime_int32;
typedef unsigned int     vmime_uint32;

#ifdef _MSC_VER
typedef   signed __int64 vmime_int64;
typedef unsigned __int64 vmime_uint64;
#else
typedef   signed long long vmime_int64;
typedef unsigned long long vmime_uint64;
#endif

#define VMIME_PACKAGE "vmime"
#define VMIME_VERSION "0.9.2"
#define VMIME_API     "1.0.0"

#define VMIME_EXPORT
#define VMIME_DEPRECATED
#define VMIME_SHAREDPTR_USE_CXX          0
#define VMIME_SHARED_PTR_USE_BOOST       1


#define VMIME_PLATFORM_IS_WINDOWS        0
#define VMIME_PLATFORM_IS_POSIX          1

#define VMIME_BYTE_ORDER_BIG_ENDIAN      1
#define VMIME_BYTE_ORDER_LITTLE_ENDIAN   0  // Windows is always little endian

#define VMIME_CHARSETCONV_LIB_IS_ICONV   1  // requires libiconv library
#define VMIME_CHARSETCONV_LIB_IS_ICU     0
#define VMIME_CHARSETCONV_LIB_IS_WIN     0  // requires Windows (uses MultiByteToWideChar)

// required for file attachments and Maildir
#define VMIME_HAVE_FILESYSTEM_FEATURES   1

// Enable SASL support (otherwise exception "All authentication methods failed)
#define VMIME_HAVE_SASL_SUPPORT          1 // requires libgsasl library

#define VMIME_HAVE_TLS_SUPPORT           1
#define VMIME_TLS_SUPPORT_LIB_IS_OPENSSL 1 // requires openssl library
#define VMIME_TLS_SUPPORT_LIB_IS_GNUTLS  0 // requires gnutls  library (does not work correctly on Windows!)
#define VMIME_HAVE_GNUTLS_PRIORITY_FUNCS 0

// VMIME_HAVE_MESSAGING_FEATURES must be enabled, otherwise lots of errors!
#define VMIME_HAVE_MESSAGING_FEATURES       1 // enable IMAP, POP3, SMTP...
#define VMIME_HAVE_MESSAGING_PROTO_POP3     1
#define VMIME_HAVE_MESSAGING_PROTO_IMAP     1
#define VMIME_HAVE_MESSAGING_PROTO_SMTP     1
#define VMIME_HAVE_MESSAGING_PROTO_MAILDIR  0 // store emails in folders on disk
#define VMIME_HAVE_MESSAGING_PROTO_SENDMAIL 0 // starts an external process
#define VMIME_SENDMAIL_PATH      ""

#define VMIME_HAVE_GETTID         0
#define VMIME_HAVE_SYSCALL        1

#define VMIME_HAVE_GETADDRINFO    0 // getaddrinfo() exists (Winsock 2.0)
#define VMIME_HAVE_GETNAMEINFO    0 // getnameinfo() exists (Winsock 2.0)
#define VMIME_HAVE_PTHREAD        1 // PTHREAD_LIB
#define VMIME_HAVE_LOCALTIME_R    1 // Unix
#define VMIME_HAVE_LOCALTIME_S    0 // Windows
#define VMIME_HAVE_GMTIME_R       1 // Unix
#define VMIME_HAVE_GMTIME_S       0 // Windows
#define VMIME_HAVE_STRCPY_S       0 // strcpy_s() exists
#define VMIME_HAVE_SIZE_T         0 // size_t exists


// ----------- Trace Output --------------

// Trace output via TRACE() is written to the user defined callback vmime::traceCallback
// (also works in non-console applications)
// Depending on what you do with the Trace output, you can decide to print it only in Debug builds or in both
//#if _DEBUG
//#define VMIME_TRACE   1
//#else // NDEBUG
//#define VMIME_TRACE   1
//#endif
//
//
//#if VMIME_TRACE
 The log level is an integer between 0 and 9. Higher values mean more verbosity.
 Higher values should be used with care, since they may reveal sensitive information.
 Use a log level of 10 to enable all debugging options.
//#define GNUTLS_LOGLEVEL   3
//#define GNUTLS_DEBUG      1
//
//#define TRACE   vmime::Trace  // See base.cpp
//#else
//#define TRACE   Error:Enclose_all_TRACE_macros_in_if_VMIME_TRACE_endif
//#endif

// --------------------------------

#endif
 

  选择32-bit进行编译,生成目标文件libVmime.dylib

4 、新建控制台工程进行测试使用 测试代码库目录下examples



测试发信成功 

  

 
    
 
   
     
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值