Fix mingw build (#610)

* fix compilation for mingw
* add *.user to ignor
pull/611/head
Slyshyk Oleksiy 2017-06-29 22:33:31 +03:00 zatwierdzone przez Jerry Jacobs
rodzic dc8eb3e739
commit bf5870050f
5 zmienionych plików z 18 dodań i 8 usunięć

1
.gitignore vendored
Wyświetl plik

@ -1,2 +1,3 @@
build
obj-*
*.user*

Wyświetl plik

@ -32,6 +32,11 @@ if (STLINK_HAVE_SYS_MMAN_H)
add_definitions(-DSTLINK_HAVE_SYS_MMAN_H)
endif()
CHECK_INCLUDE_FILE(unistd.h STLINK_HAVE_UNISTD_H)
if (STLINK_HAVE_UNISTD_H)
add_definitions(-DSTLINK_HAVE_UNISTD_H)
endif()
if (CMAKE_BUILD_TYPE STREQUAL "")
set(CMAKE_BUILD_TYPE "Debug")
endif()
@ -73,10 +78,10 @@ include_directories(include)
include_directories(${PROJECT_BINARY_DIR}/include)
include_directories(src/mingw)
if (MSVC)
include_directories(src/win32)
include_directories(src/getopt)
# Use string.h rather than strings.h and disable annoying warnings
add_definitions(-DHAVE_STRING_H -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS /wd4710)
include_directories(src/win32)
include_directories(src/getopt)
# Use string.h rather than strings.h and disable annoying warnings
add_definitions(-DHAVE_STRING_H -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS /wd4710)
endif ()
###

Wyświetl plik

@ -271,9 +271,9 @@ char *win32_strsep (char **stringp, const char *delim)
/* NOTREACHED */
}
#ifdef STLINK_HAVE_SYS_MMAN_H
void usleep(DWORD waitTime)
{
#ifdef _MSC_VER
if (waitTime >= 1000)
{
// Don't do long busy-waits.
@ -290,7 +290,6 @@ void usleep(DWORD waitTime)
CloseHandle(timer);
return;
}
#endif
LARGE_INTEGER perf_cnt, start, now;
QueryPerformanceFrequency(&perf_cnt);
@ -300,6 +299,7 @@ void usleep(DWORD waitTime)
QueryPerformanceCounter((LARGE_INTEGER*) &now);
} while ((now.QuadPart - start.QuadPart) / (float)perf_cnt.QuadPart * 1000 * 1000 < waitTime);
}
#endif
#endif

Wyświetl plik

@ -9,7 +9,9 @@
#include <io.h>
#include <WinSock2.h>
#if defined(_MSC_VER)
#pragma comment(lib, "ws2_32.lib")
#endif
#include <unistd.h>
#if defined(_MSC_VER)
@ -69,7 +71,9 @@ char *win32_strsep(char **stringp, const char *delim);
ssize_t win32_read_socket(SOCKET fd, void *buf, int n);
ssize_t win32_write_socket(SOCKET fd, void *buf, int n);
#ifdef STLINK_HAVE_SYS_MMAN_H
static inline void sleep(unsigned ms) { Sleep(ms); }
void usleep(DWORD waitTime);
#endif
#endif //defined(__MINGW32__) || defined(_MSC_VER)

Wyświetl plik

@ -6,8 +6,8 @@
#include <sys/time.h>
#endif
#include <sys/types.h>
#if defined(_MSC_VER)
#include <mingw.h>
#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable: 4200 4255 4668 4820)
#include <libusb.h>