CMakeLists.txt
changeset 9758 cf4d3ee2b37b
parent 9731 a8140c580b85
child 9853 3d08cb641cd5
equal deleted inserted replaced
9757:74ad518ae505 9758:cf4d3ee2b37b
   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("$ENV{DXSDK_DIR}" STREQUAL "")
   903     if(NOT CMAKE_COMPILER_IS_MINGW)
   904       message_error("DIRECTX requires the \$DXSDK_DIR environment variable to be set")
   904       if("$ENV{DXSDK_DIR}" STREQUAL "")
   905     endif()
   905         message_error("DIRECTX requires the \$DXSDK_DIR environment variable to be set")
   906     set(CMAKE_REQUIRED_FLAGS "/I\"$ENV{DXSDK_DIR}\\Include\"")
   906       endif()
       
   907       set(CMAKE_REQUIRED_FLAGS "/I\"$ENV{DXSDK_DIR}\\Include\"")
       
   908     endif()
   907     check_include_file(d3d9.h HAVE_D3D_H)
   909     check_include_file(d3d9.h HAVE_D3D_H)
   908     check_include_file(d3d11_1.h HAVE_D3D11_H)
   910     check_include_file(d3d11_1.h HAVE_D3D11_H)
   909     check_include_file(ddraw.h HAVE_DDRAW_H)
   911     check_include_file(ddraw.h HAVE_DDRAW_H)
   910     check_include_file(dsound.h HAVE_DSOUND_H)
   912     check_include_file(dsound.h HAVE_DSOUND_H)
   911     check_include_file(dinput.h HAVE_DINPUT_H)
   913     check_include_file(dinput.h HAVE_DINPUT_H)
   912     check_include_file(xaudio2.h HAVE_XAUDIO2_H)
   914     check_include_file(xaudio2.h HAVE_XAUDIO2_H)
   913     check_include_file(xinput.h HAVE_XINPUT_H)
   915     check_include_file(xinput.h HAVE_XINPUT_H)
   914     check_include_file(dxgi.h HAVE_DXGI_H)
   916     check_include_file(dxgi.h HAVE_DXGI_H)
   915     if(HAVE_D3D_H OR HAVE_D3D11_H OR HAVE_DDRAW_H OR HAVE_DSOUND_H OR HAVE_DINPUT_H OR HAVE_XAUDIO2_H)
   917     if(HAVE_D3D_H OR HAVE_D3D11_H OR HAVE_DDRAW_H OR HAVE_DSOUND_H OR HAVE_DINPUT_H OR HAVE_XAUDIO2_H)
   916       set(HAVE_DIRECTX TRUE)
   918       set(HAVE_DIRECTX TRUE)
       
   919       if(NOT CMAKE_COMPILER_IS_MINGW)
   917       # TODO: change $ENV{DXSDL_DIR} to get the path from the include checks
   920       # TODO: change $ENV{DXSDL_DIR} to get the path from the include checks
   918       link_directories($ENV{DXSDK_DIR}\\lib\\${PROCESSOR_ARCH})
   921         link_directories($ENV{DXSDK_DIR}\\lib\\${PROCESSOR_ARCH})
   919       include_directories($ENV{DXSDK_DIR}\\Include)
   922         include_directories($ENV{DXSDK_DIR}\\Include)
       
   923       endif()
   920     endif()
   924     endif()
   921     set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
   925     set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
   922   endif()
   926   endif()
   923 
   927 
   924   if(SDL_AUDIO)
   928   if(SDL_AUDIO)
  1018   if(SDL_JOYSTICK)
  1022   if(SDL_JOYSTICK)
  1019     file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/windows/*.c)
  1023     file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/windows/*.c)
  1020     set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES})
  1024     set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES})
  1021     if(HAVE_DINPUT_H)
  1025     if(HAVE_DINPUT_H)
  1022       set(SDL_JOYSTICK_DINPUT 1)
  1026       set(SDL_JOYSTICK_DINPUT 1)
  1023       list(APPEND EXTRA_LIBS dinput8 dxguid dxerr)
  1027       list(APPEND EXTRA_LIBS dinput8 dxguid)
       
  1028       if(CMAKE_COMPILER_IS_MINGW)
       
  1029         list(APPEND EXTRA_LIBS dxerr8)
       
  1030       else()
       
  1031         list(APPEND EXTRA_LIBS dxerr)
       
  1032       endif()
  1024     endif()
  1033     endif()
  1025     if(HAVE_XINPUT_H)
  1034     if(HAVE_XINPUT_H)
  1026       set(SDL_JOYSTICK_XINPUT 1)
  1035       set(SDL_JOYSTICK_XINPUT 1)
  1027     endif()
  1036     endif()
  1028     if(NOT HAVE_DINPUT_H AND NOT HAVE_XINPUT_H)
  1037     if(NOT HAVE_DINPUT_H AND NOT HAVE_XINPUT_H)