CMake fixes for MingW (thanks, Ozkan!).

- ignore DXSDK_DIR for mingw environment
- use dxerr8 instead of dxerr for mingw.

Partially fixes Bugzilla #3016.
This commit is contained in:
Ryan C. Gordon 2015-06-18 22:34:39 -04:00
parent dd8c64779b
commit 3a84f7b520

View file

@ -900,10 +900,12 @@ elseif(WINDOWS)
# Check for DirectX # Check for DirectX
if(DIRECTX) if(DIRECTX)
if("$ENV{DXSDK_DIR}" STREQUAL "") if(NOT CMAKE_COMPILER_IS_MINGW)
message_error("DIRECTX requires the \$DXSDK_DIR environment variable to be set") if("$ENV{DXSDK_DIR}" STREQUAL "")
message_error("DIRECTX requires the \$DXSDK_DIR environment variable to be set")
endif()
set(CMAKE_REQUIRED_FLAGS "/I\"$ENV{DXSDK_DIR}\\Include\"")
endif() endif()
set(CMAKE_REQUIRED_FLAGS "/I\"$ENV{DXSDK_DIR}\\Include\"")
check_include_file(d3d9.h HAVE_D3D_H) check_include_file(d3d9.h HAVE_D3D_H)
check_include_file(d3d11_1.h HAVE_D3D11_H) check_include_file(d3d11_1.h HAVE_D3D11_H)
check_include_file(ddraw.h HAVE_DDRAW_H) check_include_file(ddraw.h HAVE_DDRAW_H)
@ -914,9 +916,11 @@ elseif(WINDOWS)
check_include_file(dxgi.h HAVE_DXGI_H) check_include_file(dxgi.h HAVE_DXGI_H)
if(HAVE_D3D_H OR HAVE_D3D11_H OR HAVE_DDRAW_H OR HAVE_DSOUND_H OR HAVE_DINPUT_H OR HAVE_XAUDIO2_H) if(HAVE_D3D_H OR HAVE_D3D11_H OR HAVE_DDRAW_H OR HAVE_DSOUND_H OR HAVE_DINPUT_H OR HAVE_XAUDIO2_H)
set(HAVE_DIRECTX TRUE) set(HAVE_DIRECTX TRUE)
if(NOT CMAKE_COMPILER_IS_MINGW)
# TODO: change $ENV{DXSDL_DIR} to get the path from the include checks # TODO: change $ENV{DXSDL_DIR} to get the path from the include checks
link_directories($ENV{DXSDK_DIR}\\lib\\${PROCESSOR_ARCH}) link_directories($ENV{DXSDK_DIR}\\lib\\${PROCESSOR_ARCH})
include_directories($ENV{DXSDK_DIR}\\Include) include_directories($ENV{DXSDK_DIR}\\Include)
endif()
endif() endif()
set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
endif() endif()
@ -1020,7 +1024,12 @@ elseif(WINDOWS)
set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES})
if(HAVE_DINPUT_H) if(HAVE_DINPUT_H)
set(SDL_JOYSTICK_DINPUT 1) set(SDL_JOYSTICK_DINPUT 1)
list(APPEND EXTRA_LIBS dinput8 dxguid dxerr) list(APPEND EXTRA_LIBS dinput8 dxguid)
if(CMAKE_COMPILER_IS_MINGW)
list(APPEND EXTRA_LIBS dxerr8)
else()
list(APPEND EXTRA_LIBS dxerr)
endif()
endif() endif()
if(HAVE_XINPUT_H) if(HAVE_XINPUT_H)
set(SDL_JOYSTICK_XINPUT 1) set(SDL_JOYSTICK_XINPUT 1)