summaryrefslogtreecommitdiff
path: root/externals/cmake-modules
diff options
context:
space:
mode:
authorGravatar Brian Clinkenbeard2020-02-10 19:56:33 -0800
committerGravatar Brian Clinkenbeard2020-02-10 19:56:33 -0800
commit68043dd2337feab0b0ccc9868cd535b2254335ea (patch)
treebb97a502f85b24bb018a3f99c9e564fa09251ed2 /externals/cmake-modules
parentMerge pull request #3372 from ReinUsesLisp/fix-back-stencil (diff)
downloadyuzu-68043dd2337feab0b0ccc9868cd535b2254335ea.tar.gz
yuzu-68043dd2337feab0b0ccc9868cd535b2254335ea.tar.xz
yuzu-68043dd2337feab0b0ccc9868cd535b2254335ea.zip
use config mode for finding SDL2 with CMake
Diffstat (limited to 'externals/cmake-modules')
-rw-r--r--externals/cmake-modules/FindSDL2.cmake239
1 files changed, 0 insertions, 239 deletions
diff --git a/externals/cmake-modules/FindSDL2.cmake b/externals/cmake-modules/FindSDL2.cmake
deleted file mode 100644
index 22ce752c5..000000000
--- a/externals/cmake-modules/FindSDL2.cmake
+++ /dev/null
@@ -1,239 +0,0 @@
1
2# This module defines
3# SDL2_LIBRARY, the name of the library to link against
4# SDL2_FOUND, if false, do not try to link to SDL2
5# SDL2_INCLUDE_DIR, where to find SDL.h
6# SDL2_DLL_DIR, where to find SDL2.dll if it exists
7#
8# This module responds to the the flag:
9# SDL2_BUILDING_LIBRARY
10# If this is defined, then no SDL2main will be linked in because
11# only applications need main().
12# Otherwise, it is assumed you are building an application and this
13# module will attempt to locate and set the the proper link flags
14# as part of the returned SDL2_LIBRARY variable.
15#
16# Don't forget to include SDLmain.h and SDLmain.m your project for the
17# OS X framework based version. (Other versions link to -lSDL2main which
18# this module will try to find on your behalf.) Also for OS X, this
19# module will automatically add the -framework Cocoa on your behalf.
20#
21#
22# Additional Note: If you see an empty SDL2_LIBRARY_TEMP in your configuration
23# and no SDL2_LIBRARY, it means CMake did not find your SDL2 library
24# (SDL2.dll, libsdl2.so, SDL2.framework, etc).
25# Set SDL2_LIBRARY_TEMP to point to your SDL2 library, and configure again.
26# Similarly, if you see an empty SDL2MAIN_LIBRARY, you should set this value
27# as appropriate. These values are used to generate the final SDL2_LIBRARY
28# variable, but when these values are unset, SDL2_LIBRARY does not get created.
29#
30#
31# $SDL2DIR is an environment variable that would
32# correspond to the ./configure --prefix=$SDL2DIR
33# used in building SDL2.
34# l.e.galup 9-20-02
35#
36# Modified by Eric Wing.
37# Added code to assist with automated building by using environmental variables
38# and providing a more controlled/consistent search behavior.
39# Added new modifications to recognize OS X frameworks and
40# additional Unix paths (FreeBSD, etc).
41# Also corrected the header search path to follow "proper" SDL guidelines.
42# Added a search for SDL2main which is needed by some platforms.
43# Added a search for threads which is needed by some platforms.
44# Added needed compile switches for MinGW.
45#
46# On OSX, this will prefer the Framework version (if found) over others.
47# People will have to manually change the cache values of
48# SDL2_LIBRARY to override this selection or set the CMake environment
49# CMAKE_INCLUDE_PATH to modify the search paths.
50#
51# Note that the header path has changed from SDL2/SDL.h to just SDL.h
52# This needed to change because "proper" SDL convention
53# is #include "SDL.h", not <SDL2/SDL.h>. This is done for portability
54# reasons because not all systems place things in SDL2/ (see FreeBSD).
55
56#=============================================================================
57# Copyright 2003-2009 Kitware, Inc.
58#
59# Distributed under the OSI-approved BSD License (the "License").
60#
61# This software is distributed WITHOUT ANY WARRANTY; without even the
62# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
63# See the License for more information.
64#=============================================================================
65# CMake - Cross Platform Makefile Generator
66# Copyright 2000-2016 Kitware, Inc.
67# Copyright 2000-2011 Insight Software Consortium
68# All rights reserved.
69#
70# Redistribution and use in source and binary forms, with or without
71# modification, are permitted provided that the following conditions
72# are met:
73#
74# * Redistributions of source code must retain the above copyright
75# notice, this list of conditions and the following disclaimer.
76#
77# * Redistributions in binary form must reproduce the above copyright
78# notice, this list of conditions and the following disclaimer in the
79# documentation and/or other materials provided with the distribution.
80#
81# * Neither the names of Kitware, Inc., the Insight Software Consortium,
82# nor the names of their contributors may be used to endorse or promote
83# products derived from this software without specific prior written
84# permission.
85#
86# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
87# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
88# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
89# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
90# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
91# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
92# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
93# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
94# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
95# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
96# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
97#
98# ------------------------------------------------------------------------------
99#
100# The above copyright and license notice applies to distributions of
101# CMake in source and binary form. Some source files contain additional
102# notices of original copyright by their contributors; see each source
103# for details. Third-party software packages supplied with CMake under
104# compatible licenses provide their own copyright notices documented in
105# corresponding subdirectories.
106#
107# ------------------------------------------------------------------------------
108#
109# CMake was initially developed by Kitware with the following sponsorship:
110#
111# * National Library of Medicine at the National Institutes of Health
112# as part of the Insight Segmentation and Registration Toolkit (ITK).
113#
114# * US National Labs (Los Alamos, Livermore, Sandia) ASC Parallel
115# Visualization Initiative.
116#
117# * National Alliance for Medical Image Computing (NAMIC) is funded by the
118# National Institutes of Health through the NIH Roadmap for Medical Research,
119# Grant U54 EB005149.
120#
121# * Kitware, Inc.
122#
123
124message("<FindSDL2.cmake>")
125
126SET(SDL2_SEARCH_PATHS
127 ~/Library/Frameworks
128 /Library/Frameworks
129 /usr/local
130 /usr
131 /sw # Fink
132 /opt/local # DarwinPorts
133 /opt/csw # Blastwave
134 /opt
135 ${SDL2_PATH}
136)
137
138if(CMAKE_SIZEOF_VOID_P EQUAL 8)
139 set(VC_LIB_PATH_SUFFIX lib/x64)
140else()
141 set(VC_LIB_PATH_SUFFIX lib/x86)
142endif()
143
144FIND_LIBRARY(SDL2_LIBRARY_TEMP
145 NAMES SDL2
146 HINTS
147 $ENV{SDL2DIR}
148 PATH_SUFFIXES lib64 lib ${VC_LIB_PATH_SUFFIX}
149 PATHS ${SDL2_SEARCH_PATHS}
150)
151
152IF(SDL2_LIBRARY_TEMP)
153 if(MSVC)
154 get_filename_component(SDL2_DLL_DIR_TEMP ${SDL2_LIBRARY_TEMP} DIRECTORY)
155 if(EXISTS ${SDL2_DLL_DIR_TEMP}/SDL2.dll)
156 set(SDL2_DLL_DIR ${SDL2_DLL_DIR_TEMP})
157 unset(SDL2_DLL_DIR_TEMP)
158 endif()
159 endif()
160
161 FIND_PATH(SDL2_INCLUDE_DIR SDL.h
162 HINTS
163 $ENV{SDL2DIR}
164 PATH_SUFFIXES include/SDL2 include
165 PATHS ${SDL2_SEARCH_PATHS}
166 )
167
168 IF(NOT SDL2_BUILDING_LIBRARY)
169 IF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework")
170 # Non-OS X framework versions expect you to also dynamically link to
171 # SDL2main. This is mainly for Windows and OS X. Other (Unix) platforms
172 # seem to provide SDL2main for compatibility even though they don't
173 # necessarily need it.
174 FIND_LIBRARY(SDL2MAIN_LIBRARY
175 NAMES SDL2main
176 HINTS
177 $ENV{SDL2DIR}
178 PATH_SUFFIXES lib64 lib
179 PATHS ${SDL2_SEARCH_PATHS}
180 )
181 ENDIF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework")
182 ENDIF(NOT SDL2_BUILDING_LIBRARY)
183
184 # SDL2 may require threads on your system.
185 # The Apple build may not need an explicit flag because one of the
186 # frameworks may already provide it.
187 # But for non-OSX systems, I will use the CMake Threads package.
188 IF(NOT APPLE)
189 FIND_PACKAGE(Threads)
190 ENDIF(NOT APPLE)
191
192 # MinGW needs an additional library, mwindows
193 # It's total link flags should look like -lmingw32 -lSDL2main -lSDL2 -lmwindows
194 # (Actually on second look, I think it only needs one of the m* libraries.)
195 IF(MINGW)
196 SET(MINGW32_LIBRARY mingw32 CACHE STRING "mwindows for MinGW")
197 ENDIF(MINGW)
198
199 # For SDL2main
200 IF(NOT SDL2_BUILDING_LIBRARY)
201 IF(SDL2MAIN_LIBRARY)
202 SET(SDL2_LIBRARY_TEMP ${SDL2MAIN_LIBRARY} ${SDL2_LIBRARY_TEMP})
203 ENDIF(SDL2MAIN_LIBRARY)
204 ENDIF(NOT SDL2_BUILDING_LIBRARY)
205
206 # For OS X, SDL2 uses Cocoa as a backend so it must link to Cocoa.
207 # CMake doesn't display the -framework Cocoa string in the UI even
208 # though it actually is there if I modify a pre-used variable.
209 # I think it has something to do with the CACHE STRING.
210 # So I use a temporary variable until the end so I can set the
211 # "real" variable in one-shot.
212 IF(APPLE)
213 SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} "-framework Cocoa")
214 ENDIF(APPLE)
215
216 # For threads, as mentioned Apple doesn't need this.
217 # In fact, there seems to be a problem if I used the Threads package
218 # and try using this line, so I'm just skipping it entirely for OS X.
219 IF(NOT APPLE)
220 SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} ${CMAKE_THREAD_LIBS_INIT})
221 ENDIF(NOT APPLE)
222
223 # For MinGW library
224 IF(MINGW)
225 SET(SDL2_LIBRARY_TEMP ${MINGW32_LIBRARY} ${SDL2_LIBRARY_TEMP})
226 ENDIF(MINGW)
227
228 # Set the final string here so the GUI reflects the final state.
229 SET(SDL2_LIBRARY ${SDL2_LIBRARY_TEMP} CACHE STRING "Where the SDL2 Library can be found")
230
231 # Unset the temp variable to INTERNAL so it is not seen in the CMake GUI
232 UNSET(SDL2_LIBRARY_TEMP)
233ENDIF(SDL2_LIBRARY_TEMP)
234
235message("</FindSDL2.cmake>")
236
237INCLUDE(FindPackageHandleStandardArgs)
238
239FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2 REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR)