Skip to content

Commit

Permalink
- Fixed build with MinGW-w64 (TDM-GCC 5.1). Note that the resulting b…
Browse files Browse the repository at this point in the history
…inary will crash under -O3 until the alignment violation is taken care of in FRemapTable::Alloc.

- It appears that CMake added native support for building rc files with MinGW at some point so removed manual rc compiling code.
  • Loading branch information
Blzut3 committed Nov 23, 2016
1 parent c28bcca commit 789315b
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 72 deletions.
10 changes: 1 addition & 9 deletions src/CMakeLists.txt
Expand Up @@ -728,15 +728,7 @@ if( WIN32 )
set( SYSTEM_SOURCES ${PLAT_WIN32_SOURCES} )
set( OTHER_SYSTEM_SOURCES ${PLAT_POSIX_SOURCES} ${PLAT_SDL_SOURCES} ${PLAT_OSX_SOURCES} ${PLAT_COCOA_SOURCES} ${PLAT_UNIX_SOURCES} )

if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
# CMake is not set up to compile and link rc files with GCC. :(
add_custom_command( OUTPUT zdoom-rc.o
COMMAND windres -o zdoom-rc.o -i ${CMAKE_CURRENT_SOURCE_DIR}/win32/zdoom.rc
DEPENDS win32/zdoom.rc )
set( SYSTEM_SOURCES ${SYSTEM_SOURCES} zdoom-rc.o )
else()
set( SYSTEM_SOURCES ${SYSTEM_SOURCES} win32/zdoom.rc )
endif()
set( SYSTEM_SOURCES ${SYSTEM_SOURCES} win32/zdoom.rc )
elseif( APPLE )
if( OSX_COCOA_BACKEND )
set( SYSTEM_SOURCES_DIR posix posix/cocoa )
Expand Down
2 changes: 1 addition & 1 deletion src/i_module.cpp
Expand Up @@ -97,5 +97,5 @@ bool FModule::Open(const char* lib)

void *FModule::GetSym(const char* name)
{
return GetProcAddress((HMODULE)handle, name);
return (void *)GetProcAddress((HMODULE)handle, name);
}
2 changes: 1 addition & 1 deletion src/v_video.cpp
Expand Up @@ -72,7 +72,7 @@ FRenderer *Renderer;
IMPLEMENT_ABSTRACT_CLASS (DCanvas)
IMPLEMENT_ABSTRACT_CLASS (DFrameBuffer)

#if defined(_DEBUG) && defined(_M_IX86)
#if defined(_DEBUG) && defined(_M_IX86) && !defined(__MINGW32__)
#define DBGBREAK { __asm int 3 }
#else
#define DBGBREAK
Expand Down
48 changes: 0 additions & 48 deletions src/win32/i_crash.cpp
Expand Up @@ -75,54 +75,6 @@
#include <time.h>
#include <zlib.h>

#if defined(_WIN64) && defined(__GNUC__)
struct KNONVOLATILE_CONTEXT_POINTERS {
union {
PDWORD64 IntegerContext[16];
struct {
PDWORD64 Rax;
PDWORD64 Rcx;
PDWORD64 Rdx;
PDWORD64 Rbx;
PDWORD64 Rsp;
PDWORD64 Rbp;
PDWORD64 Rsi;
PDWORD64 Rdi;
PDWORD64 R8;
PDWORD64 R9;
PDWORD64 R10;
PDWORD64 R11;
PDWORD64 R12;
PDWORD64 R13;
PDWORD64 R14;
PDWORD64 R15;
};
};
};
typedef
EXCEPTION_DISPOSITION
NTAPI
EXCEPTION_ROUTINE (
struct _EXCEPTION_RECORD *ExceptionRecord,
PVOID EstablisherFrame,
struct _CONTEXT *ContextRecord,
PVOID DispatcherContext
);
NTSYSAPI
EXCEPTION_ROUTINE *
NTAPI
RtlVirtualUnwind (
DWORD HandlerType,
DWORD64 ImageBase,
DWORD64 ControlPc,
PRUNTIME_FUNCTION FunctionEntry,
PCONTEXT ContextRecord,
PVOID *HandlerData,
PDWORD64 EstablisherFrame,
KNONVOLATILE_CONTEXT_POINTERS *ContextPointers
);
#endif

// MACROS ------------------------------------------------------------------

#define REMOTE_HOST "localhost"
Expand Down
5 changes: 5 additions & 0 deletions src/win32/i_keyboard.cpp
Expand Up @@ -21,6 +21,11 @@

#define DINPUT_BUFFERSIZE 32

// MinGW-w64 (TDM5.1 - 2016/11/21)
#ifndef DIK_PREVTRACK
#define DIK_PREVTRACK DIK_CIRCUMFLEX
#endif

// TYPES -------------------------------------------------------------------

class FDInputKeyboard : public FKeyboard
Expand Down
2 changes: 1 addition & 1 deletion src/win32/i_rawps2.cpp
Expand Up @@ -389,7 +389,7 @@ bool FRawPS2Controller::ProcessInput(RAWHID *raw, int code)
{
// w32api has an incompatible definition of bRawData.
// (But the version that comes with MinGW64 is fine.)
#if defined(__GNUC__) && !defined(_WIN64)
#if defined(__GNUC__) && !defined(__MINGW64_VERSION_MAJOR)
BYTE *rawdata = &raw->bRawData;
#else
BYTE *rawdata = raw->bRawData;
Expand Down
1 change: 1 addition & 0 deletions src/win32/i_specialpaths.cpp
Expand Up @@ -33,6 +33,7 @@
**
*/

#define _WIN32_WINNT 0x0601
#include <windows.h>
#include <lmcons.h>
#include <shlobj.h>
Expand Down
11 changes: 11 additions & 0 deletions src/win32/i_xinput.cpp
Expand Up @@ -33,6 +33,17 @@
#define XUSER_MAX_COUNT 4
#endif

// MinGW
#ifndef XINPUT_DLL
#define XINPUT_DLL_A "xinput1_3.dll"
#define XINPUT_DLL_W L"xinput1_3.dll"
#ifdef UNICODE
#define XINPUT_DLL XINPUT_DLL_W
#else
#define XINPUT_DLL XINPUT_DLL_A
#endif
#endif

// TYPES -------------------------------------------------------------------

typedef DWORD (WINAPI *XInputGetStateType)(DWORD index, XINPUT_STATE *state);
Expand Down
17 changes: 5 additions & 12 deletions tools/updaterevision/CMakeLists.txt
@@ -1,19 +1,12 @@
cmake_minimum_required( VERSION 2.8.7 )

if( WIN32 )
if( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE OR ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/trustinfo.o
COMMAND windres -o ${CMAKE_CURRENT_BINARY_DIR}/trustinfo.o -i ${CMAKE_CURRENT_SOURCE_DIR}/trustinfo.rc
DEPENDS trustinfo.rc )
set( TRUSTINFO trustinfo.o )
if( MSVC_VERSION GREATER 1399 )
# VC 8+ adds a manifest automatically to the executable. We need to
# merge ours with it.
set( MT_MERGE ON )
else()
if( MSVC_VERSION GREATER 1399 )
# VC 8+ adds a manifest automatically to the executable. We need to
# merge ours with it.
set( MT_MERGE ON )
else( MSVC_VERSION GREATER 1399 )
set( TRUSTINFO trustinfo.rc )
endif( MSVC_VERSION GREATER 1399 )
set( TRUSTINFO trustinfo.rc )
endif()
else( WIN32 )
set( TRUSTINFO "" )
Expand Down

0 comments on commit 789315b

Please sign in to comment.