CMake fixes for MingW (thanks, Ozkan!).
- ignore DXSDK_DIR for mingw environment
- use dxerr8 instead of dxerr for mingw.
Partially fixes Bugzilla #3016.
--- a/CMakeLists.txt Thu Jun 18 12:20:46 2015 -0300
+++ b/CMakeLists.txt Thu Jun 18 22:34:39 2015 -0400
@@ -900,10 +900,12 @@
# Check for DirectX
if(DIRECTX)
- if("$ENV{DXSDK_DIR}" STREQUAL "")
- message_error("DIRECTX requires the \$DXSDK_DIR environment variable to be set")
+ if(NOT CMAKE_COMPILER_IS_MINGW)
+ 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()
- set(CMAKE_REQUIRED_FLAGS "/I\"$ENV{DXSDK_DIR}\\Include\"")
check_include_file(d3d9.h HAVE_D3D_H)
check_include_file(d3d11_1.h HAVE_D3D11_H)
check_include_file(ddraw.h HAVE_DDRAW_H)
@@ -914,9 +916,11 @@
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)
set(HAVE_DIRECTX TRUE)
+ if(NOT CMAKE_COMPILER_IS_MINGW)
# TODO: change $ENV{DXSDL_DIR} to get the path from the include checks
- link_directories($ENV{DXSDK_DIR}\\lib\\${PROCESSOR_ARCH})
- include_directories($ENV{DXSDK_DIR}\\Include)
+ link_directories($ENV{DXSDK_DIR}\\lib\\${PROCESSOR_ARCH})
+ include_directories($ENV{DXSDK_DIR}\\Include)
+ endif()
endif()
set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
endif()
@@ -1020,7 +1024,12 @@
set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES})
if(HAVE_DINPUT_H)
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()
if(HAVE_XINPUT_H)
set(SDL_JOYSTICK_XINPUT 1)