squeaky-pl / japronto

Screaming-fast Python 3.5+ HTTP toolkit integrated with pipelining HTTP server based on uvloop and picohttpparser.
MIT License
8.61k stars 581 forks source link

Native Windows support #60

Closed gwicksted closed 7 years ago

gwicksted commented 7 years ago

Compilation with msvc requires a few modifications ('.o' vs '.obj' and '*.o' vs 'lib*.lib' and several compiler/linker arg differences like -Wl,-rpath= vs /LIBPATH:)

I have compilation working (VS 2015/2017 win 10 x64) but haven't gone on to test it at all.

Just sharing what I ran into in case you intend to support this in the future.

Also requires a compatibility library/header for:

void __get_cpuid(unsigned i, unsigned int * eax, unsigned int * ebx, unsigned int * ecx, unsigned int * edx)
size_t MAX(const size_t a, const size_t b);
void* memmem(const void *l, size_t l_len, const void *s, size_t s_len);
int bcmp(const void * p1, const void * p2, size_t n);
void bcopy(const void * src, void * dst, size_t n);
void bzero(void * p, size_t n);
char* index(const char * s, int c);
char* rindex(const char * s, int c);
int strcasecmp(const char* s1, const char* s2);
int strncasecmp(const char* s1, const char* s2, size_t n);
int ffs(int v);
__declspec(align(16)) static const char ranges1[] 
// instead of
static const char ranges1[] __attribute__((aligned(16))) 

That and a few sprinklings of #ifdef _WIN32 or #ifdef _MSC_VER in a few places like strings.h and sys/*

And this one of course:

#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN 1
#include <winsock2.h>
#include <windows.h>
#pragma comment(lib, "ws2_32.lib")
#else
#include <netinet/in.h>
#include <netinet/tcp.h>
#endif
gwicksted commented 7 years ago

Nevermind! uvloop doesn't support Windows yet....