diff --git a/CMakeLists.txt b/CMakeLists.txt index 730e4a8..51d75ae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,10 +2,6 @@ cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR) project (winflexbison) -if(NOT MSVC) - message( FATAL_ERROR "Visual Studio Build supported only" ) -endif() - add_definitions(-D_CRT_SECURE_NO_WARNINGS) if(CMAKE_BUILD_TYPE STREQUAL "Debug") diff --git a/common/m4/lib/clean-temp.h b/common/m4/lib/clean-temp.h index 96a51af..0dfbc15 100644 --- a/common/m4/lib/clean-temp.h +++ b/common/m4/lib/clean-temp.h @@ -107,7 +107,9 @@ extern int cleanup_temp_dir_contents (struct temp_dir *dir); Return 0 upon success, or -1 if there was some problem. */ extern int cleanup_temp_dir (struct temp_dir *dir); +#ifndef __MINGW32__ typedef int mode_t; +#endif /* Open a temporary file in a temporary directory. Registers the resulting file descriptor to be closed. */ diff --git a/common/misc/gethrxtime.c b/common/misc/gethrxtime.c index 1bbc09f..1220084 100644 --- a/common/misc/gethrxtime.c +++ b/common/misc/gethrxtime.c @@ -18,6 +18,10 @@ /* Written by Paul Eggert. */ #include +#ifdef __MINGW32__ +#include +#include +#endif #define GETHRXTIME_INLINE _GL_EXTERN_INLINE #include "gethrxtime.h" @@ -63,9 +67,18 @@ gethrxtime (void) clock that might jump backwards, since it's the best we can do. */ { struct timespec ts; - //gettime(&ts); - timespec_get(&ts, TIME_UTC); + #ifndef __MINGW32__ + //gettime(&ts); + timespec_get(&ts, TIME_UTC); return xtime_make (ts.tv_sec, ts.tv_nsec); + #else + uint64_t t; + GetSystemTimeAsFileTime((LPFILETIME)&t); + enum { + hundredsOfNanosecondsInASecond = 10000000 + }; + return xtime_make (t / hundredsOfNanosecondsInASecond, t % hundredsOfNanosecondsInASecond); + #endif } # endif # endif