Skip to content

Commit

Permalink
CMake fixes for MingW (thanks, Ozkan!).
Browse files Browse the repository at this point in the history
- ignore DXSDK_DIR for mingw environment
- use dxerr8 instead of dxerr for mingw.

Partially fixes Bugzilla #3016.
  • Loading branch information
icculus committed Jun 19, 2015
1 parent dd8c647 commit 3a84f7b
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions CMakeLists.txt
Expand Up @@ -900,10 +900,12 @@ elseif(WINDOWS)

# 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)
Expand All @@ -914,9 +916,11 @@ elseif(WINDOWS)
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()
Expand Down Expand Up @@ -1020,7 +1024,12 @@ elseif(WINDOWS)
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)
Expand Down

0 comments on commit 3a84f7b

Please sign in to comment.