From 629d05efb3abef5cf8295dbb4044ce272f2f8f14 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Thu, 25 Jul 2019 19:13:24 -0300 Subject: [PATCH] Re-apply megasource-specific changes to SDL's cmakelists file. --- libs/SDL2/CMakeLists.txt | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/libs/SDL2/CMakeLists.txt b/libs/SDL2/CMakeLists.txt index bd59d89b..eecad921 100644 --- a/libs/SDL2/CMakeLists.txt +++ b/libs/SDL2/CMakeLists.txt @@ -279,7 +279,8 @@ if(EMSCRIPTEN) endif() # When defined, respect CMake's BUILD_SHARED_LIBS setting: -set(SDL_STATIC_ENABLED_BY_DEFAULT ON) +set(SDL_STATIC_ENABLED_BY_DEFAULT OFF) +set(SDL_SHARED_ENABLED_BY_DEFAULT ON) if (NOT DEFINED SDL_SHARED_ENABLED_BY_DEFAULT) # ...unless decided already (as for EMSCRIPTEN) @@ -1217,6 +1218,8 @@ elseif(WINDOWS) endif() endif() + set(SDL_LINK_DIR ${PARENT_SCOPE}) + # Check for DirectX if(DIRECTX) if(DEFINED MSVC_VERSION AND NOT ${MSVC_VERSION} LESS 1700) @@ -1259,7 +1262,7 @@ elseif(WINDOWS) set(HAVE_DIRECTX TRUE) if(NOT CMAKE_COMPILER_IS_MINGW AND NOT USE_WINSDK_DIRECTX) # 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} ${SDL_LINK_DIR}) include_directories($ENV{DXSDK_DIR}\\Include) endif() endif() @@ -1271,6 +1274,8 @@ elseif(WINDOWS) check_include_file(audioclient.h HAVE_AUDIOCLIENT_H) check_include_file(endpointvolume.h HAVE_ENDPOINTVOLUME_H) + link_directories(${SDL_LINK_DIR}) + if(SDL_AUDIO) set(SDL_AUDIO_DRIVER_WINMM 1) file(GLOB WINMM_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/winmm/*.c) @@ -1789,7 +1794,7 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") # Always build SDLmain add_library(SDL2main STATIC ${SDLMAIN_SOURCES}) -target_include_directories(SDL2main PUBLIC "$" $) +target_include_directories(SDL2main PUBLIC include) set(_INSTALL_LIBS "SDL2main") if (NOT ANDROID) set_target_properties(SDL2main PROPERTIES DEBUG_POSTFIX ${SDL_CMAKE_DEBUG_POSTFIX}) @@ -1797,6 +1802,7 @@ endif() if(SDL_SHARED) add_library(SDL2 SHARED ${SOURCE_FILES} ${VERSION_SOURCES}) + install(TARGETS SDL2 RUNTIME DESTINATION . LIBRARY DESTINATION .) if(APPLE) set_target_properties(SDL2 PROPERTIES MACOSX_RPATH 1 @@ -1820,7 +1826,7 @@ if(SDL_SHARED) endif() set(_INSTALL_LIBS "SDL2" ${_INSTALL_LIBS}) target_link_libraries(SDL2 ${EXTRA_LIBS} ${EXTRA_LDFLAGS}) - target_include_directories(SDL2 PUBLIC "$" $) + target_include_directories(SDL2 PUBLIC include) if (NOT ANDROID) set_target_properties(SDL2 PROPERTIES DEBUG_POSTFIX ${SDL_CMAKE_DEBUG_POSTFIX}) endif() @@ -1875,6 +1881,10 @@ if(SDL_TEST) add_subdirectory(test) endif() +if(MEGA) + return() +endif() + ##### Installation targets ##### install(TARGETS ${_INSTALL_LIBS} EXPORT SDL2Targets LIBRARY DESTINATION "lib${LIB_SUFFIX}"