mirror of
https://github.com/love2d/megasource.git
synced 2026-08-12 08:30:59 +02:00
Apply some fixes to SDL's cmakelists:
* Do a proper check for xinput support * Enable OpenGL ES and EGL * Don't try to link with the default set of libraries (since we don't want to link with the C runtime) * Enable /arch:SSE to avoid linker errors
This commit is contained in:
@@ -906,13 +906,23 @@ elseif(WINDOWS)
|
||||
endif()
|
||||
set(CMAKE_REQUIRED_FLAGS "/I\"$ENV{DXSDK_DIR}\\Include\"")
|
||||
endif()
|
||||
|
||||
if(HAVE_WIN32_CC)
|
||||
# xinput.h may need windows.h, but doesn't include it itself.
|
||||
check_c_source_compiles("
|
||||
#include <windows.h>
|
||||
#include <xinput.h>
|
||||
int main(int argc, char **argv) { }" HAVE_XINPUT_H)
|
||||
else()
|
||||
check_include_file(xinput.h HAVE_XINPUT_H)
|
||||
endif()
|
||||
|
||||
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)
|
||||
check_include_file(dsound.h HAVE_DSOUND_H)
|
||||
check_include_file(dinput.h HAVE_DINPUT_H)
|
||||
check_include_file(xaudio2.h HAVE_XAUDIO2_H)
|
||||
check_include_file(xinput.h HAVE_XINPUT_H)
|
||||
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)
|
||||
@@ -1019,6 +1029,13 @@ elseif(WINDOWS)
|
||||
set(SDL_VIDEO_RENDER_OGL 1)
|
||||
set(HAVE_VIDEO_OPENGL TRUE)
|
||||
endif()
|
||||
|
||||
if(VIDEO_OPENGLES)
|
||||
set(SDL_VIDEO_OPENGL_EGL 1)
|
||||
set(SDL_VIDEO_OPENGL_ES2 1)
|
||||
set(SDL_VIDEO_RENDER_OGL_ES2 1)
|
||||
set(HAVE_VIDEO_OPENGLES TRUE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(SDL_JOYSTICK)
|
||||
@@ -1066,6 +1083,8 @@ elseif(WINDOWS)
|
||||
list(APPEND EXTRA_LDFLAGS "-mwindows")
|
||||
set(SDL_CFLAGS "${SDL_CFLAGS} -Dmain=SDL_main")
|
||||
list(APPEND SDL_LIBS "-lmingw32" "-lSDL2main" "-mwindows")
|
||||
elseif(MSVC)
|
||||
add_definitions(/arch:SSE)
|
||||
endif()
|
||||
elseif(APPLE)
|
||||
# TODO: rework this for proper MacOS X, iOS and Darwin support
|
||||
@@ -1388,6 +1407,11 @@ if(SDL_SHARED)
|
||||
VERSION ${SDL_VERSION}
|
||||
SOVERSION ${LT_REVISION}
|
||||
OUTPUT_NAME "SDL2")
|
||||
if(MSVC)
|
||||
set_target_properties(SDL2 PROPERTIES LINK_FLAGS_RELEASE "/NODEFAULTLIB")
|
||||
set_target_properties(SDL2 PROPERTIES LINK_FLAGS_DEBUG "/NODEFAULTLIB")
|
||||
set_target_properties(SDL2 PROPERTIES STATIC_LIBRARY_FLAGS "/NODEFAULTLIB")
|
||||
endif()
|
||||
endif()
|
||||
set(_INSTALL_LIBS "SDL2" ${_INSTALL_LIBS})
|
||||
target_link_libraries(SDL2 ${EXTRA_LIBS} ${EXTRA_LDFLAGS})
|
||||
|
||||
Reference in New Issue
Block a user