注册 登录
自由的生活_软路由 返回首页

心想事成的个人空间 https://bbs.routerclub.com/?681 [收藏] [复制] [分享] [RSS]

日志

用vs2008编译libevent

已有 1782 次阅读2009-8-31 09:42 |

在网上gg了N久。终于找到编译的方法。
libevent 1.4.12可能用vs2008就能直接编译.
这里介绍有1.4.5可以被vs2003编译的包。

libevent 1.4.12

Happily, libevent will now build out of the box on Windows (at least with VC2003 and VC2008, I haven't tested others). I don't like their projects though, so I created a cmake build system for it.

cmake files: libevent-cmake.zip

How to use:

  1. Download and install cmake 2.6 for Windows

  2. Download libevent 1.4.12 from the libevent website and extract all files

  3. Download the libevent-cmake package above and extract it into the libevent directory created above

  4. Open a command prompt in the libevent top directory

  5. Execute the vcvars32.bat or vsvars32.bat or vsvars64.bat file from the Visual Studio directory to allow building on the command line.

    e.g. "C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Tools\vsvars32.bat"

  6. Call the cross-build.cmd batch file suppling the version of Visual Studio as the first parameter. See the contents of the cross-build.cmd file for all possibilities.

    This will build the Visual Studio project and solution files for libevent, samples and tests and then build them for all configurations (debug, release, etc). All generated files are stored in a sub-directory using the name of the tools.

    e.g. "cross-build.cmd msvc-7.1" for Visual Studio 7 .NET 2003. All files will be in the "msvc-7.1" subdirectory.

  7. You can link to the library in the appropriate lib directory: libevent/{toolset}/lib/{config}/libevent.lib

    e.g. libevent/msvc-7.1/lib/release/libevent.lib

  8. You can run the samples and tests in the appropriate bin directory: libevent/{toolset}/bin/{config}/

    e.g. libevent/msvc-7.1/bin/debug/regress.exe

Notes:

  • Although cmake is designed to create cross-platform build systems, these scripts will only work on Windows in their current form. They would need some work to make them build on other platforms.
  • Use of the cross-build.cmd script is optional. It is part of my automated build system and so I just included it.
  • Enjoy, it's nice to have Windows build support from the libevent team. Thanks!

路过

雷人

握手

鲜花

鸡蛋

评论 (0 个评论)

facelist doodle 涂鸦板

您需要登录后才可以评论 登录 | 注册

QQ|Archiver|手机版|小黑屋|软路由 ( 渝ICP备15001194号-1|渝公网安备 50011602500124号 )

GMT+8, 2024-5-9 15:11 , Processed in 0.038536 second(s), 5 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2023 Discuz! Team.

返回顶部