This is an automated email from the ASF dual-hosted git repository. wohali pushed a commit to branch fix-windows-build in repository https://gitbox.apache.org/repos/asf/couchdb-hyper.git
commit 55414a376f2e85e281cf43f8dc1209fa7f577624 Author: Joan Touzet <[email protected]> AuthorDate: Wed Jul 18 11:19:11 2018 -0400 Fix hyper build for win32 --- .gitignore | 7 ++++++- c_src/hyper_carray.c | 12 +++++++++++- rebar.config | 5 +++-- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 425b33e..5cc0eb6 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,9 @@ erl_crash.dump *.so *.o *.d -.rebar \ No newline at end of file +*.dll +*.exp +*.lib +*.pdb +*.swp +.rebar diff --git a/c_src/hyper_carray.c b/c_src/hyper_carray.c index 896f409..1db1377 100644 --- a/c_src/hyper_carray.c +++ b/c_src/hyper_carray.c @@ -55,7 +55,11 @@ struct hyper_carray { uint8_t *items; }; +#ifdef _WIN32 +typedef struct hyper_carray *carray_ptr; +#else typedef struct hyper_carray *restrict carray_ptr; +#endif #define HYPER_CARRAY_SIZE sizeof(struct hyper_carray) @@ -84,16 +88,22 @@ static void carray_alloc(unsigned int precision, carray_ptr * arr) memset(*arr, 0, header_size); (*arr)->precision = precision; (*arr)->size = nitems; - (*arr)->items = res + header_size; + (*arr)->items = (uint8_t *) res + header_size; } /* * Given an hyper_carray and a valid index, set the value at that index to * max(current value, given value). */ +#ifdef _WIN32 +static void carray_merge_item(carray_ptr arr, + unsigned int index, + unsigned int value) +#else static inline void carray_merge_item(carray_ptr arr, unsigned int index, unsigned int value) +#endif { uint8_t *item = arr->items + index; *item = (value > *item) ? value : *item; diff --git a/rebar.config b/rebar.config index 6015992..6d6df3c 100644 --- a/rebar.config +++ b/rebar.config @@ -9,6 +9,7 @@ ]}. {port_env, [ - {"CC", "cc"}, - {"CFLAGS", "$CFLAGS -std=c99 -Wall -Werror -O3"} + {"(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin|gnu)", + "CFLAGS", "$CFLAGS -std=c99 -Wall -Werror -O3"}, + {"win32", "CXXFLAGS", "$CXXFLAGS /O2 /DNDEBUG"} ]}.
