Fix compilation for Windows with MinGW

pull/4364/head
Mosè Giordano 6 years ago
parent 3abbd85808
commit 55a6479ea2
  1. 4
      Makefile
  2. 2
      src/darkunistd.h
  3. 2
      src/gemm.c
  4. 6
      src/getopt.h
  5. 6
      src/gettimeofday.h

@ -73,6 +73,10 @@ endif
CFLAGS+=$(OPTS) CFLAGS+=$(OPTS)
ifneq (,$(findstring MSYS_NT,$(OS)))
LDFLAGS+=-lws2_32
endif
ifeq ($(OPENCV), 1) ifeq ($(OPENCV), 1)
COMMON+= -DOPENCV COMMON+= -DOPENCV
CFLAGS+= -DOPENCV CFLAGS+= -DOPENCV

@ -7,7 +7,7 @@
* Please add functionality as needed * Please add functionality as needed
*/ */
#include <Winsock2.h> #include <winsock2.h>
#include <direct.h> /* for _getcwd() and _chdir() */ #include <direct.h> /* for _getcwd() and _chdir() */
#include "getopt.h" #include "getopt.h"
#include <io.h> #include <io.h>

@ -512,7 +512,7 @@ static inline int popcnt_32(uint32_t val32) {
//---------------------------- //----------------------------
#if (defined(__AVX__) && defined(__x86_64__)) || defined(_WIN64) #if (defined(__AVX__) && defined(__x86_64__)) || (defined(_WIN64) && !defined(__MINGW32__))
#ifdef _WIN64 #ifdef _WIN64
#include <intrin.h> #include <intrin.h>

@ -67,7 +67,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <Windows.h> #include <windows.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -190,13 +190,13 @@ extern "C" {
* Parse long options in argc/argv argument vector. * Parse long options in argc/argv argument vector.
* Returns -1 if short_too is set and the option does not match long_options. * Returns -1 if short_too is set and the option does not match long_options.
*/ */
static int parse_long_options(char* const* nargv, const char* options, const struct option* long_options, int* idx, int short_too); /* static int parse_long_options(char* const* nargv, const char* options, const struct option* long_options, int* idx, int short_too); */
/* /*
* getopt_internal -- * getopt_internal --
* Parse argc/argv argument vector. Called by user level routines. * Parse argc/argv argument vector. Called by user level routines.
*/ */
static int getopt_internal(int nargc, char* const* nargv, const char* options, const struct option* long_options, int* idx, int flags); /* static int getopt_internal(int nargc, char* const* nargv, const char* options, const struct option* long_options, int* idx, int flags); */
/* /*
* getopt_long -- * getopt_long --

@ -1,9 +1,9 @@
#ifdef _WIN32 #ifdef _WIN32
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <Windows.h> #include <windows.h>
#include <Winsock2.h> #include <winsock2.h>
#include <stdint.h> #include <stdint.h>
#include < time.h > #include <time.h>
#include "darknet.h" #include "darknet.h"
#define CLOCK_REALTIME (1) #define CLOCK_REALTIME (1)

Loading…
Cancel
Save