CMakeLists.txt
changeset 9758 cf4d3ee2b37b
parent 9731 a8140c580b85
child 9853 3d08cb641cd5
     1.1 --- a/CMakeLists.txt	Thu Jun 18 12:20:46 2015 -0300
     1.2 +++ b/CMakeLists.txt	Thu Jun 18 22:34:39 2015 -0400
     1.3 @@ -900,10 +900,12 @@
     1.4  
     1.5    # Check for DirectX
     1.6    if(DIRECTX)
     1.7 -    if("$ENV{DXSDK_DIR}" STREQUAL "")
     1.8 -      message_error("DIRECTX requires the \$DXSDK_DIR environment variable to be set")
     1.9 +    if(NOT CMAKE_COMPILER_IS_MINGW)
    1.10 +      if("$ENV{DXSDK_DIR}" STREQUAL "")
    1.11 +        message_error("DIRECTX requires the \$DXSDK_DIR environment variable to be set")
    1.12 +      endif()
    1.13 +      set(CMAKE_REQUIRED_FLAGS "/I\"$ENV{DXSDK_DIR}\\Include\"")
    1.14      endif()
    1.15 -    set(CMAKE_REQUIRED_FLAGS "/I\"$ENV{DXSDK_DIR}\\Include\"")
    1.16      check_include_file(d3d9.h HAVE_D3D_H)
    1.17      check_include_file(d3d11_1.h HAVE_D3D11_H)
    1.18      check_include_file(ddraw.h HAVE_DDRAW_H)
    1.19 @@ -914,9 +916,11 @@
    1.20      check_include_file(dxgi.h HAVE_DXGI_H)
    1.21      if(HAVE_D3D_H OR HAVE_D3D11_H OR HAVE_DDRAW_H OR HAVE_DSOUND_H OR HAVE_DINPUT_H OR HAVE_XAUDIO2_H)
    1.22        set(HAVE_DIRECTX TRUE)
    1.23 +      if(NOT CMAKE_COMPILER_IS_MINGW)
    1.24        # TODO: change $ENV{DXSDL_DIR} to get the path from the include checks
    1.25 -      link_directories($ENV{DXSDK_DIR}\\lib\\${PROCESSOR_ARCH})
    1.26 -      include_directories($ENV{DXSDK_DIR}\\Include)
    1.27 +        link_directories($ENV{DXSDK_DIR}\\lib\\${PROCESSOR_ARCH})
    1.28 +        include_directories($ENV{DXSDK_DIR}\\Include)
    1.29 +      endif()
    1.30      endif()
    1.31      set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
    1.32    endif()
    1.33 @@ -1020,7 +1024,12 @@
    1.34      set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES})
    1.35      if(HAVE_DINPUT_H)
    1.36        set(SDL_JOYSTICK_DINPUT 1)
    1.37 -      list(APPEND EXTRA_LIBS dinput8 dxguid dxerr)
    1.38 +      list(APPEND EXTRA_LIBS dinput8 dxguid)
    1.39 +      if(CMAKE_COMPILER_IS_MINGW)
    1.40 +        list(APPEND EXTRA_LIBS dxerr8)
    1.41 +      else()
    1.42 +        list(APPEND EXTRA_LIBS dxerr)
    1.43 +      endif()
    1.44      endif()
    1.45      if(HAVE_XINPUT_H)
    1.46        set(SDL_JOYSTICK_XINPUT 1)