Sfoglia il codice sorgente

Re-applied previous megasource-specific changes to SDL's cmakelists:

 * Enable SDL_SHARED.
 * Disable SDL_STATIC.
 * Set SDL_LINK_DIR in parent scope.
 * Use custom install() directive.
 * Add target_include_directories.
Alex Szpakowski 10 anni fa
parent
commit
b7a3a04be2
1 ha cambiato i file con 12 aggiunte e 3 eliminazioni
  1. 12 3
      libs/SDL2/CMakeLists.txt

+ 12 - 3
libs/SDL2/CMakeLists.txt

@@ -289,8 +289,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
 # 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_STATIC ON CACHE BOOL "Build a static version of the library")
+set(SDL_SHARED ON CACHE BOOL "Build a shared version of the library")
+set(SDL_STATIC OFF CACHE BOOL "Build a static version of the library")
 
 # General source files
 file(GLOB SOURCE_FILES
@@ -918,7 +918,9 @@ elseif(WINDOWS)
       set(HAVE_DIRECTX TRUE)
       if(NOT CMAKE_COMPILER_IS_MINGW)
       # 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)
       endif()
     endif()
@@ -1375,6 +1377,7 @@ set(_INSTALL_LIBS "SDL2main")
 
 if(SDL_SHARED)
   add_library(SDL2 SHARED ${SOURCE_FILES})
+  install(TARGETS SDL2 RUNTIME DESTINATION . LIBRARY DESTINATION .)
   if(UNIX)
     set_target_properties(SDL2 PROPERTIES
       VERSION ${LT_VERSION}
@@ -1388,6 +1391,7 @@ if(SDL_SHARED)
   endif()
  set(_INSTALL_LIBS "SDL2" ${_INSTALL_LIBS})
  target_link_libraries(SDL2 ${EXTRA_LIBS} ${EXTRA_LDFLAGS})
+ target_include_directories(SDL2 PUBLIC include)
 endif()
 
 if(SDL_STATIC)
@@ -1406,6 +1410,11 @@ if(SDL_STATIC)
 endif()
 
 ##### Installation targets #####
+
+if (MEGA)
+  return()
+endif()
+
 install(TARGETS ${_INSTALL_LIBS}
   LIBRARY DESTINATION "lib${LIB_SUFFIX}"
   ARCHIVE DESTINATION "lib${LIB_SUFFIX}"