From 7e95bd2078a9ea2575531d3703d250b71608cdb3 Mon Sep 17 00:00:00 2001 From: monktan89 Date: Thu, 3 Nov 2022 10:51:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DMSVC=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 10 +++++----- api/CMakeLists.txt | 5 ++++- server/Process.h | 4 +++- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 29ad24ae..a6a9ea7a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -172,12 +172,12 @@ if(UNIX) "-Wno-unused-function;-Wno-unused-parameter;-Wno-unused-variable" "-Wno-error=extra;-Wno-error=missing-field-initializers;-Wno-error=type-limits") elseif(WIN32) - set(COMPILE_OPTIONS_DEFAULT - # TODO: /wd4819 应该是不会生效 - "/wd4566;/wd4819" - # warning C4530: C++ exception handler used, but unwind semantics are not enabled. - "/EHsc") if (MSVC) + set(COMPILE_OPTIONS_DEFAULT + # TODO: /wd4819 应该是不会生效 + "/wd4566;/wd4819" + # warning C4530: C++ exception handler used, but unwind semantics are not enabled. + "/EHsc") # disable Windows logo list(APPEND COMPILE_OPTIONS_DEFAULT "/nologo") list(APPEND CMAKE_STATIC_LINKER_FLAGS "/nologo") diff --git a/api/CMakeLists.txt b/api/CMakeLists.txt index eeef25a1..42061925 100644 --- a/api/CMakeLists.txt +++ b/api/CMakeLists.txt @@ -38,7 +38,10 @@ if(IOS) endif () set(COMPILE_DEFINITIONS ${MK_COMPILE_DEFINITIONS}) -list(APPEND COMPILE_DEFINITIONS GENERATE_EXPORT) + +if (MSVC) + list(APPEND COMPILE_DEFINITIONS GENERATE_EXPORT) +endif () if(ENABLE_API_STATIC_LIB) add_library(mk_api STATIC ${API_SRC_LIST}) diff --git a/server/Process.h b/server/Process.h index db752232..d514edb5 100644 --- a/server/Process.h +++ b/server/Process.h @@ -11,8 +11,10 @@ #ifndef ZLMEDIAKIT_PROCESS_H #define ZLMEDIAKIT_PROCESS_H -#ifdef _WIN32 +#if defined(_WIN32) +#if !defined(__MINGW32__) typedef int pid_t; +#endif #else #include #endif // _WIN32