- Fixed compilation with MinGW and did some cleanup.

This commit is contained in:
drfrag 2020-01-09 13:46:31 +01:00 committed by alexey.lysiuk
parent e6aaab3c32
commit 68f338b134
5 changed files with 16 additions and 42 deletions

View File

@ -70,36 +70,17 @@ if( WIN32 )
add_definitions( -D_WIN32 )
if( ( MSVC14 AND NOT CMAKE_GENERATOR_TOOLSET STREQUAL "v140_xp" ) OR # For VS 2015.
( MSVC15 AND NOT CMAKE_GENERATOR_TOOLSET STREQUAL "v141_xp" ) ) # For VS 2017.
if( MSVC ) # For VS 2017 and later.
# for modern Windows SDKs the DirectX headers should be available by default.
set( DX_dinput8_LIBRARY dinput8 )
else()
find_path( XINPUT_INCLUDE_DIR xinput.h
PATHS ENV DXSDK_DIR
PATH_SUFFIXES Include )
if( NOT XINPUT_INCLUDE_DIR )
# Modern versions of the Windows SDK include xinput.h. Unfortunately,
# CMake cannot find this file via find_path, so we check for it using
# CHECK_INCLUDE_FILES. windows.h must be included before xinput.h.
CHECK_INCLUDE_FILES( "windows.h;xinput.h" XINPUT_H_FOUND )
if( NOT XINPUT_H_FOUND )
message( WARNING "Could not find xinput.h. XInput will be disabled." )
add_definitions( -DNO_XINPUT )
endif()
else()
include_directories( ${XINPUT_INCLUDE_DIR} )
endif()
find_library( DX_dinput8_LIBRARY dinput8
PATHS ENV DXSDK_DIR
PATH_SUFFIXES Lib Lib/${XBITS} )
if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
find_library( DX_dxguid_LIBRARY dxguid
PATHS ENV DXSDK_DIR
PATH_SUFFIXES Lib Lib/${XBITS} )
endif()
find_library( DX_dxguid_LIBRARY dxguid
PATHS ENV DXSDK_DIR
PATH_SUFFIXES Lib Lib/${XBITS} )
# Modern versions of the Windows SDK include dinput8.lib. Unfortunately,
# CMake cannot find these libraries via find_library.
@ -108,12 +89,10 @@ if( WIN32 )
set( DX_dinput8_LIBRARY dinput8 )
endif()
if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
# Modern versions of the Windows SDK do NOT include dxguid.lib. Its contents
# were moved to dinput8.lib.
if( NOT DX_dxguid_LIBRARY )
message( STATUS "Could not find dxguid.lib. Build may fail on old Windows SDKs.")
endif()
# Modern versions of the Windows SDK do NOT include dxguid.lib. Its contents
# were moved to dinput8.lib.
if( NOT DX_dxguid_LIBRARY )
message( STATUS "Could not find dxguid.lib. Build may fail on old Windows SDKs.")
endif()
endif()
@ -140,6 +119,7 @@ if( WIN32 )
if( DX_dxguid_LIBRARY )
list( APPEND ZDOOM_LIBS "${DX_dxguid_LIBRARY}" )
endif()
list( APPEND ZDOOM_LIBS d3d9 )
endif()
else()
if( APPLE )

View File

@ -78,7 +78,7 @@ void RenderMemory::Clear()
static void* Aligned_Alloc(size_t alignment, size_t size)
{
void* ptr;
#if defined _MSC_VER
#if defined (_MSC_VER) || defined (__MINGW32__)
ptr = _aligned_malloc(size, alignment);
if (!ptr)
throw std::bad_alloc();

View File

@ -2238,6 +2238,7 @@ remove them if not needed.
#define VMA_NULL nullptr
#endif
#ifndef __MINGW32__
#if defined(__APPLE__) || defined(__ANDROID__) || defined(__OpenBSD__) || (defined(__GLIBCXX__) && !defined(_GLIBCXX_HAVE_ALIGNED_ALLOC))
#include <cstdlib>
void *aligned_alloc(size_t alignment, size_t size)
@ -2254,6 +2255,7 @@ void *aligned_alloc(size_t alignment, size_t size)
return VMA_NULL;
}
#endif
#endif
// Normal assert to check for programmer's errors, especially in Debug configuration.
#ifndef VMA_ASSERT

View File

@ -31,8 +31,6 @@
**
*/
#ifndef NO_XINPUT
// HEADER FILES ------------------------------------------------------------
#define WIN32_LEAN_AND_MEAN
@ -831,13 +829,3 @@ void I_StartupXInput()
}
}
#else // NO_XINPUT
#include "i_input.h"
void I_StartupXInput()
{
JoyDevices[INPUT_XInput] = NULL;
}
#endif

View File

@ -13,6 +13,10 @@ extern HWND Window;
#include <d3d9.h>
#pragma comment(lib, "d3d9.lib")
#ifndef D3DPRESENT_FORCEIMMEDIATE
#define D3DPRESENT_FORCEIMMEDIATE 0x00000100L // MinGW
#endif
namespace
{
int SrcWidth = 0;