windows编译libevent
程序员文章站
2022-06-17 14:33:41
...
这里简单介绍windows编译礼拜libevent,主要环境vs2017,libevent版本2.1.8。
先下载libevent源码:http://libevent.org/
解压:libevent-2.1.8-stable
打开vs2017开发人员命令提示符,进入解压的目录输入:nmake \f Makefile.nmake, 这样可以编译出32位的静态库,把静态库保存,删除所有生成文件,打开vs2017本机X64命令提示工具,进入解压目录,先打开文件Makefile.nmake,找到如下位置:
LIBFLAGS=/nologo
后面加入 /MACHINE:X64,如下:!IFDEF OPENSSL_DIR
SSL_CFLAGS=/I$(OPENSSL_DIR)\include /DEVENT__HAVE_OPENSSL
!ELSE
SSL_CFLAGS=
!ENDIF
# Needed for correctness
CFLAGS=/IWIN32-Code /IWIN32-Code/nmake /Iinclude /Icompat /DHAVE_CONFIG_H /I. $(SSL_CFLAGS)
# For optimization and warnings
CFLAGS=$(CFLAGS) /Ox /W3 /wd4996 /nologo
# XXXX have a debug mode
LIBFLAGS=/nologo /MACHINE:X64
CORE_OBJS=event.obj buffer.obj bufferevent.obj bufferevent_sock.obj \
bufferevent_pair.obj listener.obj evmap.obj log.obj evutil.obj \
strlcpy.obj signal.obj bufferevent_filter.obj evthread.obj \
bufferevent_ratelim.obj evutil_rand.obj evutil_time.obj
WIN_OBJS=win32select.obj evthread_win32.obj buffer_iocp.obj \
event_iocp.obj bufferevent_async.obj
EXTRA_OBJS=event_tagging.obj http.obj evdns.obj evrpc.obj