CMakeLists.txt
changeset 9979 e3d651c5fe31
parent 9854 dbcbdc2940ef
child 9980 224187458d03
equal deleted inserted replaced
9978:a80ea42a4adc 9979:e3d651c5fe31
   898   file(GLOB CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/windows/*.c)
   898   file(GLOB CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/windows/*.c)
   899   set(SOURCE_FILES ${SOURCE_FILES} ${CORE_SOURCES})
   899   set(SOURCE_FILES ${SOURCE_FILES} ${CORE_SOURCES})
   900 
   900 
   901   # Check for DirectX
   901   # Check for DirectX
   902   if(DIRECTX)
   902   if(DIRECTX)
   903     if(NOT CMAKE_COMPILER_IS_MINGW)
   903     if(DEFINED MSVC_VERSION AND NOT ${MSVC_VERSION} LESS 1700)
       
   904         set(USE_WINSDK_DIRECTX TRUE)
       
   905     endif()
       
   906     if(NOT CMAKE_COMPILER_IS_MINGW AND NOT USE_WINSDK_DIRECTX)
   904       if("$ENV{DXSDK_DIR}" STREQUAL "")
   907       if("$ENV{DXSDK_DIR}" STREQUAL "")
   905         message_error("DIRECTX requires the \$DXSDK_DIR environment variable to be set")
   908         message_error("DIRECTX requires the \$DXSDK_DIR environment variable to be set")
   906       endif()
   909       endif()
   907       set(CMAKE_REQUIRED_FLAGS "/I\"$ENV{DXSDK_DIR}\\Include\"")
   910       set(CMAKE_REQUIRED_FLAGS "/I\"$ENV{DXSDK_DIR}\\Include\"")
   908     endif()
   911     endif()
   924     check_include_file(dinput.h HAVE_DINPUT_H)
   927     check_include_file(dinput.h HAVE_DINPUT_H)
   925     check_include_file(xaudio2.h HAVE_XAUDIO2_H)
   928     check_include_file(xaudio2.h HAVE_XAUDIO2_H)
   926     check_include_file(dxgi.h HAVE_DXGI_H)
   929     check_include_file(dxgi.h HAVE_DXGI_H)
   927     if(HAVE_D3D_H OR HAVE_D3D11_H OR HAVE_DDRAW_H OR HAVE_DSOUND_H OR HAVE_DINPUT_H OR HAVE_XAUDIO2_H)
   930     if(HAVE_D3D_H OR HAVE_D3D11_H OR HAVE_DDRAW_H OR HAVE_DSOUND_H OR HAVE_DINPUT_H OR HAVE_XAUDIO2_H)
   928       set(HAVE_DIRECTX TRUE)
   931       set(HAVE_DIRECTX TRUE)
   929       if(NOT CMAKE_COMPILER_IS_MINGW)
   932       if(NOT CMAKE_COMPILER_IS_MINGW AND NOT USE_WINSDK_DIRECTX)
   930       # TODO: change $ENV{DXSDL_DIR} to get the path from the include checks
   933       # TODO: change $ENV{DXSDL_DIR} to get the path from the include checks
   931         link_directories($ENV{DXSDK_DIR}\\lib\\${PROCESSOR_ARCH})
   934         link_directories($ENV{DXSDK_DIR}\\lib\\${PROCESSOR_ARCH})
   932         include_directories($ENV{DXSDK_DIR}\\Include)
   935         include_directories($ENV{DXSDK_DIR}\\Include)
   933       endif()
   936       endif()
   934     endif()
   937     endif()
  1042     if(HAVE_DINPUT_H)
  1045     if(HAVE_DINPUT_H)
  1043       set(SDL_JOYSTICK_DINPUT 1)
  1046       set(SDL_JOYSTICK_DINPUT 1)
  1044       list(APPEND EXTRA_LIBS dinput8 dxguid)
  1047       list(APPEND EXTRA_LIBS dinput8 dxguid)
  1045       if(CMAKE_COMPILER_IS_MINGW)
  1048       if(CMAKE_COMPILER_IS_MINGW)
  1046         list(APPEND EXTRA_LIBS dxerr8)
  1049         list(APPEND EXTRA_LIBS dxerr8)
  1047       else()
  1050       elseif (NOT USE_WINSDK_DIRECTX)
  1048         list(APPEND EXTRA_LIBS dxerr)
  1051         list(APPEND EXTRA_LIBS dxerr)
  1049       endif()
  1052       endif()
  1050     endif()
  1053     endif()
  1051     if(HAVE_XINPUT_H)
  1054     if(HAVE_XINPUT_H)
  1052       set(SDL_JOYSTICK_XINPUT 1)
  1055       set(SDL_JOYSTICK_XINPUT 1)