Skip to content

Instantly share code, notes, and snippets.

@Lekensteyn
Created March 18, 2016 00:23
Show Gist options
  • Save Lekensteyn/e4586370b36d7b76d932 to your computer and use it in GitHub Desktop.
Save Lekensteyn/e4586370b36d7b76d932 to your computer and use it in GitHub Desktop.
hacky cmake patch for libev-4.22 (for use with MSVC 2013 https://github.com/tatsuhiro-t/nghttp2/pull/544)
diff -Nur libev-4.22.orig/cmakeconfig.h.in libev-4.22/cmakeconfig.h.in
--- libev-4.22.orig/cmakeconfig.h.in 1970-01-01 01:00:00.000000000 +0100
+++ libev-4.22/cmakeconfig.h.in 2016-03-18 01:18:55.167666371 +0100
@@ -0,0 +1 @@
+/* Dummy file */
diff -Nur libev-4.22.orig/CMakeLists.txt libev-4.22/CMakeLists.txt
--- libev-4.22.orig/CMakeLists.txt 1970-01-01 01:00:00.000000000 +0100
+++ libev-4.22/CMakeLists.txt 2016-03-18 01:17:27.359666381 +0100
@@ -0,0 +1,17 @@
+cmake_minimum_required(VERSION 3.0)
+project(ev VERSION 4.22 LANGUAGES C)
+
+#include(CheckIncludeFile)
+#foreach(header sys/inotify.h sys/epoll.h sys/event.h port.h poll.h sys/select.h sys/eventfd.h sys/signalfd.h)
+# string(REGEX REPLACE "[^a-z]" "_" var "${header}")
+# string(TOUPPER "${var}" var)
+# check_include_file(${header} HAVE_${var})
+#endforeach()
+
+
+#AC_CHECK_FUNCS(inotify_init epoll_ctl kqueue port_create poll select eventfd signalfd)
+
+include_directories("${CMAKE_BINARY_DIR}")
+add_library(ev ev.c event.c)
+
+configure_file(cmakeconfig.h.in config.h)
diff -Nur libev-4.22.orig/ev.c libev-4.22/ev.c
--- libev-4.22.orig/ev.c 2015-12-20 22:12:53.000000000 +0100
+++ libev-4.22/ev.c 2016-03-18 01:17:27.359666381 +0100
@@ -1942,7 +1942,7 @@
return ncur;
}
-static void * noinline ecb_cold
+static noinline void * ecb_cold
array_realloc (int elem, void *base, int *cur, int cnt)
{
*cur = array_nextsize (elem, *cur, cnt);
diff -Nur libev-4.22.orig/event.h libev-4.22/event.h
--- libev-4.22.orig/event.h 2014-05-22 20:53:16.000000000 +0200
+++ libev-4.22/event.h 2016-03-18 01:17:27.359666381 +0100
@@ -60,11 +60,18 @@
extern "C" {
#endif
+#if 0
/* we need sys/time.h for struct timeval only */
#if !defined (WIN32) || defined (__MINGW32__)
# include <time.h> /* mingw seems to need this, for whatever reason */
# include <sys/time.h>
#endif
+#elif defined(WIN32)
+struct timeval {
+ long tv_sec;
+ long tv_usec;
+};
+#endif
struct event_base;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment