Index: cmake/LLDBDependencies.cmake =================================================================== --- cmake/LLDBDependencies.cmake +++ cmake/LLDBDependencies.cmake @@ -91,8 +91,8 @@ if ( CMAKE_SYSTEM_NAME MATCHES "Windows" ) list(APPEND LLDB_USED_LIBS lldbPluginProcessWindowsCommon - Ws2_32 - Rpcrt4 + ws2_32 + rpcrt4 ) endif () Index: cmake/modules/AddLLDB.cmake =================================================================== --- cmake/modules/AddLLDB.cmake +++ cmake/modules/AddLLDB.cmake @@ -49,7 +49,7 @@ endif() #PIC not needed on Win - if (NOT MSVC) + if (NOT WIN32) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") endif() Index: cmake/modules/LLDBConfig.cmake =================================================================== --- cmake/modules/LLDBConfig.cmake +++ cmake/modules/LLDBConfig.cmake @@ -242,8 +242,10 @@ endif() # Use the Unicode (UTF-16) APIs by default on Win32 -if (CMAKE_SYSTEM_NAME MATCHES "Windows") - add_definitions( /D _UNICODE /D UNICODE ) +if (MSVC) + add_definitions( /D _UNICODE /D UNICODE ) +elseif (MINGW) + add_definitions( -D_UNICODE -DUNICODE ) endif() set(LLDB_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) Index: include/lldb/Host/windows/windows.h =================================================================== --- include/lldb/Host/windows/windows.h +++ include/lldb/Host/windows/windows.h @@ -11,9 +11,11 @@ #define LLDB_lldb_windows_h_ #define NTDDI_VERSION NTDDI_VISTA +#undef _WIN32_WINNT // undef a previous definition to avoid warning #define _WIN32_WINNT _WIN32_WINNT_VISTA #define WIN32_LEAN_AND_MEAN #define NOGDI +#undef NOMINMAX // undef a previous definition to avoid warning #define NOMINMAX #include #undef GetUserName Index: source/API/SystemInitializerFull.cpp =================================================================== --- source/API/SystemInitializerFull.cpp +++ source/API/SystemInitializerFull.cpp @@ -107,7 +107,7 @@ #include "Plugins/Process/FreeBSD/ProcessFreeBSD.h" #endif -#if defined(_MSC_VER) +#if defined(_WIN32) #include "Plugins/Process/Windows/Common/ProcessWindows.h" #include "lldb/Host/windows/windows.h" #endif @@ -332,7 +332,7 @@ ObjCPlusPlusLanguage::Initialize(); OCamlLanguage::Initialize(); -#if defined(_MSC_VER) +#if defined(_WIN32) ProcessWindows::Initialize(); #endif #if defined(__FreeBSD__) Index: source/Core/Mangled.cpp =================================================================== --- source/Core/Mangled.cpp +++ source/Core/Mangled.cpp @@ -9,9 +9,9 @@ // FreeBSD9-STABLE requires this to know about size_t in cxxabi.h #include -#if defined(_MSC_VER) +#if defined(_WIN32) #include "lldb/Host/windows/windows.h" -#include +#include #pragma comment(lib, "dbghelp.lib") #endif Index: source/Host/common/File.cpp =================================================================== --- source/Host/common/File.cpp +++ source/Host/common/File.cpp @@ -222,7 +222,7 @@ } do { -#ifdef _WIN32 +#ifdef _MSC_VER std::wstring wpath; if (!llvm::ConvertUTF8toWide(path, wpath)) { m_descriptor = -1; Index: source/Host/windows/Host.cpp =================================================================== --- source/Host/windows/Host.cpp +++ source/Host/windows/Host.cpp @@ -29,7 +29,7 @@ #include "llvm/Support/ConvertUTF.h" // Windows includes -#include +#include using namespace lldb; using namespace lldb_private; Index: source/Host/windows/HostProcessWindows.cpp =================================================================== --- source/Host/windows/HostProcessWindows.cpp +++ source/Host/windows/HostProcessWindows.cpp @@ -16,7 +16,7 @@ #include "llvm/ADT/STLExtras.h" #include "llvm/Support/ConvertUTF.h" -#include +#include using namespace lldb_private; Index: source/Host/windows/ProcessRunLock.cpp =================================================================== --- source/Host/windows/ProcessRunLock.cpp +++ source/Host/windows/ProcessRunLock.cpp @@ -10,16 +10,6 @@ #include "lldb/Host/ProcessRunLock.h" #include "lldb/Host/windows/windows.h" -namespace { -#if defined(__MINGW32__) -// Taken from WinNT.h -typedef struct _RTL_SRWLOCK { PVOID Ptr; } RTL_SRWLOCK, *PRTL_SRWLOCK; - -// Taken from WinBase.h -typedef RTL_SRWLOCK SRWLOCK, *PSRWLOCK; -#endif -} - static PSRWLOCK GetLock(lldb::rwlock_t lock) { return static_cast(lock); } Index: source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.cpp =================================================================== --- source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.cpp +++ source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.cpp @@ -16,7 +16,7 @@ #ifdef _WIN32 #include "lldb/Host/windows/windows.h" -#include // for MiniDumpWriteDump +#include // for MiniDumpWriteDump #endif namespace lldb_private { Index: source/Plugins/Process/Windows/Common/ExceptionRecord.h =================================================================== --- source/Plugins/Process/Windows/Common/ExceptionRecord.h +++ source/Plugins/Process/Windows/Common/ExceptionRecord.h @@ -12,7 +12,7 @@ #include "lldb/Host/windows/windows.h" #include "lldb/lldb-forward.h" -#include +#include #include #include Index: source/Target/ProcessLaunchInfo.cpp =================================================================== --- source/Target/ProcessLaunchInfo.cpp +++ source/Target/ProcessLaunchInfo.cpp @@ -294,7 +294,7 @@ __FUNCTION__); int open_flags = O_RDWR | O_NOCTTY; -#if !defined(_MSC_VER) +#if !defined(_WIN32) // We really shouldn't be specifying platform specific flags // that are intended for a system call in generic code. But // this will have to do for now. Index: tools/driver/Driver.cpp =================================================================== --- tools/driver/Driver.cpp +++ tools/driver/Driver.cpp @@ -1208,13 +1208,13 @@ } int -#ifdef WIN32 +#ifdef _MSC_VER wmain(int argc, wchar_t const *wargv[]) #else main(int argc, char const *argv[]) #endif { -#ifdef _WIN32 +#ifdef _MSC_VER // Convert wide arguments to UTF-8 std::vector argvStrings(argc); std::vector argvPointers(argc); Index: tools/lldb-mi/MICmnStreamStdin.cpp =================================================================== --- tools/lldb-mi/MICmnStreamStdin.cpp +++ tools/lldb-mi/MICmnStreamStdin.cpp @@ -9,7 +9,7 @@ // Third Party Headers #ifdef _MSC_VER -#include +#include #endif #include // For std::strerror() Index: tools/lldb-mi/MIUtilDebug.cpp =================================================================== --- tools/lldb-mi/MIUtilDebug.cpp +++ tools/lldb-mi/MIUtilDebug.cpp @@ -9,7 +9,7 @@ // Third party headers: #ifdef _WIN32 -#include +#include #endif // In-house headers: