libevent windows build

libevent

windows编译lib(http://libevent.org/)

32位release

1、打开命令提示窗口,以vs2008为例,”开始/所有程序/Microsoft Visual Studio 2008/Visual Studio Tools/Visual Studio 2008 命令提示”,运行”Visual Studio 2008 命令提示”
2、在”Visual Studio 2008 命令提示”程序里,cd x:\xxxxxxxxx\libevent\src\libevent-2.1.4-alpha,执行nmake /f Makefile.nmake static_libs
3、生成”libevent.lib”, “libevent_core.lib”, “libevent_extras.lib”
4、默认生成32位release

32位debug

1、修改”Makefile.nmake”文件,”CFLAGS”选项,把”/Ox”修改为”/Od /MDd /Zi”
2、运行”Visual Studio 2008 命令提示”, 执行nmake /f Makefile.nmake static_libs

64位release

1、运行”Visual Studio 2008 x64 win64 命令提示”, 执行nmake /f Makefile.nmake static_libs

64位debug

1、修改”Makefile.nmake”文件,”CFLAGS”选项,把”/Ox”修改为”/Od /MDd /Zi”
2、运行”Visual Studio 2008 x64 win64 命令提示”, 执行nmake /f Makefile.nmake static_libs

makefile.nmake

# WATCH OUT!  This makefile is a work in progress.  It is probably missing
# tons of important things.  DO NOT RELY ON IT TO BUILD A GOOD LIBEVENT.

# Needed for correctness
CFLAGS=/IWIN32-Code /Iinclude /Icompat /DWIN32 /DHAVE_CONFIG_H /I.

# For optimization and warnings
CFLAGS=$(CFLAGS) /Ox /W3 /wd4996 /nologo

# XXXX have a debug mode

LIBFLAGS=/nologo

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
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

ALL_OBJS=$(CORE_OBJS) $(WIN_OBJS) $(EXTRA_OBJS)
STATIC_LIBS=libevent_core.lib libevent_extras.lib libevent.lib


all: static_libs tests

static_libs: $(STATIC_LIBS)

libevent_core.lib: $(CORE_OBJS) $(WIN_OBJS)
    lib $(LIBFLAGS) $(CORE_OBJS) $(WIN_OBJS) /out:libevent_core.lib 

libevent_extras.lib: $(EXTRA_OBJS)
    lib $(LIBFLAGS) $(EXTRA_OBJS) /out:libevent_extras.lib

libevent.lib: $(CORE_OBJS) $(WIN_OBJS) $(EXTRA_OBJS)
    lib $(LIBFLAGS) $(CORE_OBJS) $(EXTRA_OBJS) $(WIN_OBJS) /out:libevent.lib

clean:
    del $(ALL_OBJS)
    del $(STATIC_LIBS)
    cd test
    $(MAKE) /F Makefile.nmake clean

tests:
    cd test
    $(MAKE) /F Makefile.nmake

说明:
CFLAGS:编译选项,Ox Od MDd Zi
all:默认编译生成项
static_libs:生成静态库选项

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值