mirror of
https://github.com/love2d/megasource.git
synced 2026-08-20 04:30:45 +02:00
Make some necessary changes to SDL.
* Enable SDL_SHARED. * Disable SDL_STATIC. * Set SDL_LINK_DIR in parent scope. * Use custom install() directive. * Add target_include_directories.
This commit is contained in:
@@ -281,8 +281,8 @@ set_option(VIDEO_VIVANTE "Use Vivante EGL video driver" ${UNIX_SYS})
|
|||||||
|
|
||||||
# TODO: We should (should we?) respect cmake's ${BUILD_SHARED_LIBS} flag here
|
# TODO: We should (should we?) respect cmake's ${BUILD_SHARED_LIBS} flag here
|
||||||
# The options below are for compatibility to configure's default behaviour.
|
# The options below are for compatibility to configure's default behaviour.
|
||||||
set(SDL_SHARED ${SDL_SHARED_ENABLED_BY_DEFAULT} CACHE BOOL "Build a shared version of the library")
|
set(SDL_SHARED ON CACHE BOOL "Build a shared version of the library")
|
||||||
set(SDL_STATIC ON CACHE BOOL "Build a static version of the library")
|
set(SDL_STATIC OFF CACHE BOOL "Build a static version of the library")
|
||||||
|
|
||||||
# General source files
|
# General source files
|
||||||
file(GLOB SOURCE_FILES
|
file(GLOB SOURCE_FILES
|
||||||
@@ -898,7 +898,9 @@ elseif(WINDOWS)
|
|||||||
if(HAVE_D3D_H OR HAVE_D3D11_H OR HAVE_DDRAW_H OR HAVE_DSOUND_H OR HAVE_DINPUT_H OR HAVE_XAUDIO2_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)
|
set(HAVE_DIRECTX TRUE)
|
||||||
# TODO: change $ENV{DXSDL_DIR} to get the path from the include checks
|
# TODO: change $ENV{DXSDL_DIR} to get the path from the include checks
|
||||||
link_directories($ENV{DXSDK_DIR}\\lib\\${PROCESSOR_ARCH})
|
set(SDL_LINK_DIR $ENV{DXSDK_DIR}\\lib\\${PROCESSOR_ARCH})
|
||||||
|
set(SDL_LINK_DIR ${SDL_LINK_DIR} PARENT_SCOPE)
|
||||||
|
link_directories(${SDL_LINK_DIR})
|
||||||
include_directories($ENV{DXSDK_DIR}\\Include)
|
include_directories($ENV{DXSDK_DIR}\\Include)
|
||||||
endif()
|
endif()
|
||||||
set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
|
set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
|
||||||
@@ -1348,6 +1350,7 @@ set(_INSTALL_LIBS "SDL2main")
|
|||||||
|
|
||||||
if(SDL_SHARED)
|
if(SDL_SHARED)
|
||||||
add_library(SDL2 SHARED ${SOURCE_FILES})
|
add_library(SDL2 SHARED ${SOURCE_FILES})
|
||||||
|
install(TARGETS SDL2 RUNTIME DESTINATION . LIBRARY DESTINATION .)
|
||||||
if(UNIX)
|
if(UNIX)
|
||||||
set_target_properties(SDL2 PROPERTIES
|
set_target_properties(SDL2 PROPERTIES
|
||||||
VERSION ${LT_VERSION}
|
VERSION ${LT_VERSION}
|
||||||
@@ -1361,6 +1364,7 @@ if(SDL_SHARED)
|
|||||||
endif()
|
endif()
|
||||||
set(_INSTALL_LIBS "SDL2" ${_INSTALL_LIBS})
|
set(_INSTALL_LIBS "SDL2" ${_INSTALL_LIBS})
|
||||||
target_link_libraries(SDL2 ${EXTRA_LIBS} ${EXTRA_LDFLAGS})
|
target_link_libraries(SDL2 ${EXTRA_LIBS} ${EXTRA_LDFLAGS})
|
||||||
|
target_include_directories(SDL2 PUBLIC include)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(SDL_STATIC)
|
if(SDL_STATIC)
|
||||||
@@ -1379,6 +1383,11 @@ if(SDL_STATIC)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
##### Installation targets #####
|
##### Installation targets #####
|
||||||
|
|
||||||
|
if (MEGA)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
install(TARGETS ${_INSTALL_LIBS}
|
install(TARGETS ${_INSTALL_LIBS}
|
||||||
LIBRARY DESTINATION "lib${LIB_SUFFIX}"
|
LIBRARY DESTINATION "lib${LIB_SUFFIX}"
|
||||||
ARCHIVE DESTINATION "lib${LIB_SUFFIX}")
|
ARCHIVE DESTINATION "lib${LIB_SUFFIX}")
|
||||||
|
|||||||
Reference in New Issue
Block a user