Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt14
-rw-r--r--build_files/cmake/Modules/FindSDL2.cmake72
2 files changed, 81 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 29f8c815cf0..561d7f18ff5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -838,17 +838,21 @@ if(UNIX AND NOT APPLE)
if(WITH_SDL)
if(WITH_SDL_DYNLOAD)
- set(SDLMAIN_LIBRARY)
set(SDL_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/extern/sdlew/include/SDL2")
set(SDL_LIBRARY)
- set(SDL_LIBRARY_TEMP)
else()
- find_package_wrapper(SDL)
+ find_package_wrapper(SDL2)
+ if(SDL2_FOUND)
+ # Use same names for both versions of SDL until we move to 2.x.
+ set(SDL_INCLUDE_DIR "${SDL2_INCLUDE_DIR}")
+ set(SDL_LIBRARY "${SDL2_LIBRARY}")
+ set(SDL_FOUND "${SDL2_FOUND}")
+ else()
+ find_package_wrapper(SDL)
+ endif()
mark_as_advanced(
- SDLMAIN_LIBRARY
SDL_INCLUDE_DIR
SDL_LIBRARY
- SDL_LIBRARY_TEMP
)
# unset(SDLMAIN_LIBRARY CACHE)
if(NOT SDL_FOUND)
diff --git a/build_files/cmake/Modules/FindSDL2.cmake b/build_files/cmake/Modules/FindSDL2.cmake
new file mode 100644
index 00000000000..2a835cf94fa
--- /dev/null
+++ b/build_files/cmake/Modules/FindSDL2.cmake
@@ -0,0 +1,72 @@
+# - Find SDL library
+# Find the native SDL includes and library
+# This module defines
+# SDL2_INCLUDE_DIRS, where to find SDL.h, Set when SDL2_INCLUDE_DIR is found.
+# SDL2_LIBRARIES, libraries to link against to use SDL.
+# SDL2_ROOT_DIR, The base directory to search for SDL.
+# This can also be an environment variable.
+# SDL2_FOUND, If false, do not try to use SDL.
+#
+# also defined, but not for general use are
+# SDL2_LIBRARY, where to find the SDL library.
+
+#=============================================================================
+# Copyright 2015 Blender Foundation.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+
+# If SDL2_ROOT_DIR was defined in the environment, use it.
+IF(NOT SDL2_ROOT_DIR AND NOT $ENV{SDL2_ROOT_DIR} STREQUAL "")
+ SET(SDL2_ROOT_DIR $ENV{SDL2_ROOT_DIR})
+ENDIF()
+
+SET(_sdl2_SEARCH_DIRS
+ ${SDL2_ROOT_DIR}
+ ~/Library/Frameworks
+ /Library/Frameworks
+ /usr/local
+ /usr
+ /sw # Fink
+ /opt/local # DarwinPorts
+ /opt/csw # Blastwave
+)
+
+FIND_PATH(SDL2_INCLUDE_DIR
+ NAMES
+ SDL.h
+ HINTS
+ ${_sdl2_SEARCH_DIRS}
+ PATH_SUFFIXES
+ include/SDL2 include
+)
+
+FIND_LIBRARY(SDL2_LIBRARY
+ NAMES
+ SDL2
+ HINTS
+ ${_sdl2_SEARCH_DIRS}
+ PATH_SUFFIXES
+ lib64 lib
+ )
+
+# handle the QUIETLY and REQUIRED arguments and set SDL2_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2 DEFAULT_MSG
+ SDL2_LIBRARY SDL2_INCLUDE_DIR)
+
+IF(SDL2_FOUND)
+ SET(SDL2_LIBRARIES ${SDL2_LIBRARY})
+ SET(SDL2_INCLUDE_DIRS ${SDL2_INCLUDE_DIR})
+ENDIF(SDL2_FOUND)
+
+MARK_AS_ADVANCED(
+ SDL2_INCLUDE_DIR
+ SDL2_LIBRARY
+)