Fix errors encountered when compiling for v140_xp target

This commit is contained in:
N.E.C 2016-10-02 13:05:26 -07:00
parent 1620ff58c8
commit 671646be26
2 changed files with 37 additions and 14 deletions

View File

@ -9,6 +9,8 @@ endif()
include( CheckCXXSourceCompiles ) include( CheckCXXSourceCompiles )
include( CheckFunctionExists ) include( CheckFunctionExists )
include( CheckCXXCompilerFlag ) include( CheckCXXCompilerFlag )
include( CheckIncludeFile )
include( CheckIncludeFiles )
include( CheckLibraryExists ) include( CheckLibraryExists )
include( FindPkgConfig ) include( FindPkgConfig )
@ -118,7 +120,13 @@ if( WIN32 )
PATHS ENV DXSDK_DIR PATHS ENV DXSDK_DIR
PATH_SUFFIXES Include ) PATH_SUFFIXES Include )
if( NOT D3D_INCLUDE_DIR ) if( NOT D3D_INCLUDE_DIR )
message( SEND_ERROR "Could not find DirectX 9 header files" ) # Modern versions of the Windows SDK include d3d9.h. Unfortunately,
# CMake cannot find this file via find_path, so we check for it using
# CHECK_INCLUDE_FILE.
CHECK_INCLUDE_FILE( d3d9.h D3D9_H_FOUND )
if ( NOT D3D9_H_FOUND )
message( SEND_ERROR "Could not find DirectX 9 header files" )
endif()
else() else()
include_directories( ${D3D_INCLUDE_DIR} ) include_directories( ${D3D_INCLUDE_DIR} )
endif() endif()
@ -127,35 +135,41 @@ if( WIN32 )
PATHS ENV DXSDK_DIR PATHS ENV DXSDK_DIR
PATH_SUFFIXES Include ) PATH_SUFFIXES Include )
if( NOT XINPUT_INCLUDE_DIR ) if( NOT XINPUT_INCLUDE_DIR )
message( WARNING "Could not find xinput.h. XInput will be disabled." ) # Modern versions of the Windows SDK include xinput.h. Unfortunately,
add_definitions( -DNO_XINPUT ) # 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() else()
include_directories( ${XINPUT_INCLUDE_DIR} ) include_directories( ${XINPUT_INCLUDE_DIR} )
endif() endif()
find_library( DX_dxguid_LIBRARY dxguid
PATHS ENV DXSDK_DIR
PATH_SUFFIXES Lib Lib/${XBITS} )
find_library( DX_dinput8_LIBRARY dinput8 find_library( DX_dinput8_LIBRARY dinput8
PATHS ENV DXSDK_DIR PATHS ENV DXSDK_DIR
PATH_SUFFIXES Lib Lib/${XBITS} ) PATH_SUFFIXES Lib Lib/${XBITS} )
find_library( DX_dxguid_LIBRARY dxguid
PATHS ENV DXSDK_DIR
PATH_SUFFIXES Lib Lib/${XBITS} )
set( DX_LIBS_FOUND YES ) # Modern versions of the Windows SDK include dinput8.lib. Unfortunately,
if( NOT DX_dxguid_LIBRARY ) # CMake cannot find these libraries via find_library.
set( DX_LIBS_FOUND NO )
endif()
if( NOT DX_dinput8_LIBRARY ) if( NOT DX_dinput8_LIBRARY )
set( DX_LIBS_FOUND NO ) # If we got this far, assume dinput8.lib is in the system library path.
set( DX_dinput8_LIBRARY dinput8 )
endif() endif()
if( NOT DX_LIBS_FOUND ) # Modern versions of the Windows SDK do NOT include dxguid.lib. Its contents
message( FATAL_ERROR "Could not find DirectX 9 libraries" ) # 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()
set( ZDOOM_LIBS set( ZDOOM_LIBS
wsock32 wsock32
winmm winmm
"${DX_dxguid_LIBRARY}"
"${DX_dinput8_LIBRARY}" "${DX_dinput8_LIBRARY}"
ole32 ole32
user32 user32
@ -166,6 +180,9 @@ if( WIN32 )
setupapi setupapi
oleaut32 oleaut32
DelayImp ) DelayImp )
if( DX_dxguid_LIBRARY )
list( APPEND ZDOOM_LIBS "${DX_dxguid_LIBRARY}" )
endif()
else() else()
if( APPLE ) if( APPLE )
set( FMOD_SEARCH_PATHS "/Developer/FMOD Programmers API Mac/api" ) set( FMOD_SEARCH_PATHS "/Developer/FMOD Programmers API Mac/api" )

View File

@ -27,6 +27,12 @@
// MACROS ------------------------------------------------------------------ // MACROS ------------------------------------------------------------------
// This macro is defined by newer versions of xinput.h. In case we are
// compiling with an older version, define it here.
#ifndef XUSER_MAX_COUNT
#define XUSER_MAX_COUNT 4
#endif
// TYPES ------------------------------------------------------------------- // TYPES -------------------------------------------------------------------
typedef DWORD (WINAPI *XInputGetStateType)(DWORD index, XINPUT_STATE *state); typedef DWORD (WINAPI *XInputGetStateType)(DWORD index, XINPUT_STATE *state);