Skip to content

Commit e2ee106

Browse files
committed
fix mingw compile error
1 parent 0325f2d commit e2ee106

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ option(WITH_MBEDTLS "with mbedtls library" OFF)
2929

3030
option(WITH_KCP "compile event/kcp" OFF)
3131

32-
if(WIN32)
32+
if(WIN32 OR MINGW)
3333
option(WITH_WEPOLL "compile event/wepoll -> use iocp" ON)
3434
option(ENABLE_WINDUMP "Windows MiniDumpWriteDump" OFF)
3535
option(BUILD_FOR_MT "build for /MT" OFF)
@@ -126,7 +126,7 @@ endif()
126126
if(WITH_CURL)
127127
add_definitions(-DWITH_CURL)
128128
set(LIBS ${LIBS} curl)
129-
if(WIN32)
129+
if(WIN32 OR MINGW)
130130
set(LIBS ${LIBS} wldap32 advapi32 crypt32)
131131
endif()
132132
endif()
@@ -156,7 +156,7 @@ if(WITH_MBEDTLS)
156156
set(LIBS ${LIBS} mbedtls mbedx509 mbedcrypto)
157157
endif()
158158

159-
if(WIN32)
159+
if(WIN32 OR MINGW)
160160
add_definitions(-DWIN32_LEAN_AND_MEAN -D_CRT_SECURE_NO_WARNINGS -D_WIN32_WINNT=0x0600)
161161
set(LIBS ${LIBS} secur32 crypt32 winmm iphlpapi ws2_32)
162162
if(ENABLE_WINDUMP)
@@ -167,7 +167,7 @@ endif()
167167

168168
if(ANDROID)
169169
set(LIBS ${LIBS} log)
170-
elseif(UNIX)
170+
elseif(UNIX AND NOT MINGW)
171171
set(LIBS ${LIBS} pthread m dl)
172172
if(CMAKE_COMPILER_IS_GNUCC)
173173
set(LIBS ${LIBS} rt)
@@ -181,7 +181,7 @@ endif()
181181
# see Makefile
182182
set(ALL_SRCDIRS . base ssl event event/kcp util cpputil evpp protocol http http/client http/server mqtt)
183183
set(CORE_SRCDIRS . base ssl event)
184-
if(WIN32)
184+
if(WIN32 OR MINGW)
185185
if(WITH_WEPOLL)
186186
set(CORE_SRCDIRS ${CORE_SRCDIRS} event/wepoll)
187187
endif()

http/server/FileCache.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include "httpdef.h" // import http_content_type_str_by_suffix
99
#include "http_page.h" // import make_index_of_page
1010

11-
#ifdef OS_WIN
11+
#ifdef _MSC_VER
1212
#include <codecvt>
1313
#endif
1414

@@ -20,7 +20,7 @@ FileCache::FileCache() {
2020
}
2121

2222
static int hv_open(char const* filepath, int flags) {
23-
#ifdef OS_WIN
23+
#ifdef _MSC_VER
2424
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> conv;
2525
auto wfilepath = conv.from_bytes(filepath);
2626
int fd = _wopen(wfilepath.c_str(), flags);

0 commit comments

Comments
 (0)