Hi, Your script doesn't generate config.h and event-config.h.
New CMakeLists.txt is attached. It makes full checks and generates config.h and event-config.h. It was not tested on windows but I think it will work after slight modification. 2009/7/24 Brodie Thiesfield <[email protected]>: > Hi all, > > It's been a while since I looked in at libevent. I appreciate greatly > the fact that libevent 1.4.11 now builds out of the box on Windows. > > Since I am using cmake now for my internal build harness, I found it > easy to create a cmake build script for libevent. This will generate > the all projects and solutions for Windows compilers (all versions). > It is more convenient for me, and since it might be useful for others, > I have made it available on this site: > > http://code.jellycan.com/memcached/ > > It creates the libevent static library, and builds the regress test > harness, and the event-test and signal-test samples. Either nmake > scripts, or solution/projects (or other cmake supported generate > types) are possible. > > Best Regards, > Brodie > _______________________________________________ > Libevent-users mailing list > [email protected] > http://monkeymail.org/mailman/listinfo/libevent-users >
# author - Alexey Ozeritsky
cmake_minimum_required(VERSION 2.6)
project(libevent)
INCLUDE (CMakeForceCompiler)
SET(CMAKE_SYSTEM_NAME Generic)
CMAKE_FORCE_C_COMPILER(arm_v5t_le-gcc GNU)
CMAKE_FORCE_CXX_COMPILER(arm_v5t_le-g++ GNU)
SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
include(CheckFunctionExists)
include(CheckIncludeFile)
include(CheckTypeSize)
include(FindZLIB) # -> HAVE_LIBZ
include(FindThreads) # -> HAVE_PTHREAD
list(APPEND SRC
buffer.c
# bufferevent_pair.c # 2.0
evdns.c event_tagging.c evrpc.c evutil.c log.c signal.c
evbuffer.c # 1.4
# bufferevent.c # 2.0
# bufferevent_sock.c # 2.0
event.c
# evmap.c # 2.0
http.c strlcpy.c
# bufferevent_filter.c # 2.0
)
CHECK_FUNCTION_EXISTS(epoll_create HAVE_EPOLL)
CHECK_FUNCTION_EXISTS(epoll_ctl HAVE_EPOLL_CTL)
CHECK_FUNCTION_EXISTS(eventfd HAVE_EVENTFD)
CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME)
CHECK_FUNCTION_EXISTS(fcntl HAVE_FCNTL)
CHECK_FUNCTION_EXISTS(getaddrinfo HAVE_GETADDRINFO)
CHECK_FUNCTION_EXISTS(getnameinfo HAVE_GETNAMEINFO)
CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY)
CHECK_FUNCTION_EXISTS(inet_aton HAVE_INET_ATON)
CHECK_FUNCTION_EXISTS(inet_ntop HAVE_INET_NTOP)
CHECK_FUNCTION_EXISTS(inet_pton HAVE_INET_PTON)
CHECK_FUNCTION_EXISTS(kqueue HAVE_KQUEUE)
CHECK_FUNCTION_EXISTS(mmap HAVE_MMAP)
CHECK_FUNCTION_EXISTS(pipe HAVE_PIPE)
CHECK_FUNCTION_EXISTS(poll HAVE_POLL)
CHECK_FUNCTION_EXISTS(port_create HAVE_PORT_CREATE)
CHECK_FUNCTION_EXISTS(select HAVE_SELECT)
CHECK_FUNCTION_EXISTS(sendfile HAVE_SENDFILE)
CHECK_FUNCTION_EXISTS(sigaction HAVE_SIGACTION)
CHECK_FUNCTION_EXISTS(signal HAVE_SIGNAL)
CHECK_FUNCTION_EXISTS(splice HAVE_SPLICE)
CHECK_FUNCTION_EXISTS(strlcpy HAVE_STRLCPY)
CHECK_FUNCTION_EXISTS(strsep HAVE_STRSEP)
CHECK_FUNCTION_EXISTS(strtok_r HAVE_STRTOK_R)
CHECK_FUNCTION_EXISTS(strtoll HAVE_STRTOLL)
CHECK_FUNCTION_EXISTS(vasprintf HAVE_VASPRINTF)
CHECK_INCLUDE_FILE(dlfcn.h HAVE_DLFCN_H)
CHECK_INCLUDE_FILE(arpa/inet.h HAVE_ARPA_INET_H)
CHECK_INCLUDE_FILE(fcntl.h HAVE_FCNTL_H)
CHECK_INCLUDE_FILE(inttypes.h HAVE_INTTYPES_H)
CHECK_INCLUDE_FILE(memory.h HAVE_MEMORY_H)
CHECK_INCLUDE_FILE(netinet/in6.h HAVE_NETINET_IN6_H)
CHECK_INCLUDE_FILE(netinet/in.h HAVE_NETINET_IN_H)
CHECK_INCLUDE_FILE(poll.h HAVE_POLL_H)
CHECK_INCLUDE_FILE(port.h HAVE_PORT_H)
CHECK_INCLUDE_FILE(signal.h HAVE_SIGNAL_H)
CHECK_INCLUDE_FILE(stdarg.h HAVE_STDARG_H)
CHECK_INCLUDE_FILE(stddef.h HAVE_STDDEF_H)
CHECK_INCLUDE_FILE(stdint.h HAVE_STDINT_H)
CHECK_INCLUDE_FILE(stdlib.h HAVE_STDLIB_H)
CHECK_INCLUDE_FILE(strings.h HAVE_STRINGS_H)
CHECK_INCLUDE_FILE(string.h HAVE_STRING_H)
CHECK_INCLUDE_FILE(sys/devpoll.h HAVE_SYS_DEVPOLL_H)
CHECK_INCLUDE_FILE(sys/epoll.h HAVE_SYS_EPOLL_H)
CHECK_INCLUDE_FILE(sys/eventfd.h HAVE_SYS_EVENTFD_H)
CHECK_INCLUDE_FILE(sys/event.h HAVE_SYS_EVENT_H)
CHECK_INCLUDE_FILE(sys/ioctl.h HAVE_SYS_IOCTL_H)
CHECK_INCLUDE_FILE(sys/mman.h HAVE_SYS_MMAN_H)
CHECK_INCLUDE_FILE(sys/param.h HAVE_SYS_PARAM_H)
CHECK_INCLUDE_FILE(sys/queue.h HAVE_SYS_QUEUE_H)
CHECK_INCLUDE_FILE(sys/select.h HAVE_SYS_SELECT_H)
CHECK_INCLUDE_FILE(sys/sendfile.h HAVE_SYS_SENDFILE_H)
CHECK_INCLUDE_FILE(sys/socket.h HAVE_SYS_SOCKET_H)
CHECK_INCLUDE_FILE(sys/stat.h HAVE_SYS_STAT_H)
CHECK_INCLUDE_FILE(sys/time.h HAVE_SYS_TIME_H)
CHECK_INCLUDE_FILE(sys/types.h HAVE_SYS_TYPES_H)
CHECK_INCLUDE_FILE(sys/uio.h HAVE_SYS_UIO_H)
CHECK_TYPE_SIZE(int SIZEOF_INT BUILTIN_TYPES_ONLY)
CHECK_TYPE_SIZE(short SIZEOF_SHORT BUILTIN_TYPES_ONLY)
CHECK_TYPE_SIZE(long SIZEOF_LONG BUILTIN_TYPES_ONLY)
CHECK_TYPE_SIZE("long long" SIZEOF_LONG_LONG BUILTIN_TYPES_ONLY)
if (HAVE_NETINET_IN6_H)
SET(CMAKE_EXTRA_INCLUDE_FILES sys/types.h netinet/in.h sys/socket.h
netinet/in6.h)
else (HAVE_NETINET_IN6_H)
SET(CMAKE_EXTRA_INCLUDE_FILES sys/types.h netinet/in.h sys/socket.h)
endif (HAVE_NETINET_IN6_H)
CHECK_TYPE_SIZE("struct in6_addr" HAVE_STRUCT_IN6_ADDR)
if (HAVE_SELECT)
list(APPEND SRC select.c)
endif (HAVE_SELECT)
if (HAVE_POLL)
list(APPEND SRC poll.c)
endif (HAVE_POLL)
if (HAVE_KQUEUE)
list(APPEND SRC kqueue.c)
endif (HAVE_KQUEUE)
if (HAVE_DEVPOLL)
list(APPEND SRC devpoll.c)
endif (HAVE_DEVPOLL)
list(APPEND REGRESS_SRC
# test/regress_buffer.c # 2.0
test/regress.c
# test/regress_et.c # 2.0
test/regress_http.c
# test/regress_util.c # 2.0
# test/regress_bufferevent.c # 2.0
test/regress_dns.c test/regress.gen.c
# test/regress_main.c # 2.0
test/regress_rpc.c
# test/tinytest.c # 2.0
)
# 2.0
#if (CMAKE_USE_PTHREADS_INIT)
# set(HAVE_PTHREAD 1)
# list(APPEND SRC evthread_pthread.c)
# list(APPEND REGRESS_SRC test/regress_pthread.c)
#endif (CMAKE_USE_PTHREADS_INIT)
# 2.0
#if (ZLIB_FOUND)
# set(HAVE_LIBZ 1)
# list(APPEND REGRESS_SRC test/regress_zlib.c)
#endif (ZLIB_FOUND)
if (HAVE_EPOLL)
list(APPEND SRC epoll_sub.c epoll.c)
endif (HAVE_EPOLL)
if (HAVE_EPORT)
list(APPEND SRC evport.c)
endif (HAVE_EPORT)
if (WIN32)
list(APPEND SRC evthread_win32.c event_iocp.c buffer_iocp.c
event_iocp.c)
endif (WIN32)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/config.h)
file (READ ${CMAKE_CURRENT_BINARY_DIR}/config.h CONFIG)
string(REPLACE "#define " "#define _EVENT_" CONFIG ${CONFIG})
string(REPLACE "#undef " "#undef _EVENT_" CONFIG ${CONFIG})
string(REPLACE "#ifndef LIBEVENT_CONFIG_H" "#ifndef _EVENT_LIBEVENT_CONFIG_H"
CONFIG ${CONFIG})
file(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/event-config.h ${CONFIG})
add_definitions(-DHAVE_CONFIG_H)
include_directories(./ ./compat ./include)
add_library(event ${SRC})
add_executable(event-test sample/event-test.c)
add_executable(time-test sample/time-test.c)
add_executable(signal-test sample/signal-test.c)
target_link_libraries(event-test event)
target_link_libraries(time-test event)
target_link_libraries(signal-test event)
add_executable(test-init test/test-init.c)
add_executable(test-eof test/test-eof.c)
add_executable(test-weof test/test-weof.c)
add_executable(test-time test/test-time.c)
target_link_libraries(test-init event)
target_link_libraries(test-eof event)
target_link_libraries(test-weof event)
target_link_libraries(test-time event)
add_executable(regress ${REGRESS_SRC})
target_link_libraries(regress event ${ZLIB_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
# libevent 2.0
#add_executable(bench_cascade test/bench_cascade.c)
#add_executable(bench_http test/bench_http.c)
#target_link_libraries(bench_cascade event2)
#target_link_libraries(bench_http event2)
config.h.cmake
Description: Binary data
_______________________________________________ Libevent-users mailing list [email protected] http://monkeymail.org/mailman/listinfo/libevent-users
