0 | |
---
|
1 | |
cmake/Modules/FindSDL2.cmake | 191 -------------------------------------------
|
2 | |
1 file changed, 191 deletions(-)
|
3 | |
|
4 | |
Index: b/cmake/Modules/FindSDL2.cmake
|
5 | |
===================================================================
|
6 | |
--- a/cmake/Modules/FindSDL2.cmake
|
7 | |
+++ /dev/null
|
8 | |
@@ -1,191 +0,0 @@
|
9 | |
-# Locate SDL2 library
|
10 | |
-# This module defines
|
11 | |
-# SDL2_LIBRARY, the name of the library to link against
|
12 | |
-# SDL2_FOUND, if false, do not try to link to SDL
|
13 | |
-# SDL2_INCLUDE_DIR, where to find SDL.h
|
14 | |
-#
|
15 | |
-# This module responds to the the flag:
|
16 | |
-# SDL2_BUILDING_LIBRARY
|
17 | |
-# If this is defined, then no SDL_main will be linked in because
|
18 | |
-# only applications need main().
|
19 | |
-# Otherwise, it is assumed you are building an application and this
|
20 | |
-# module will attempt to locate and set the the proper link flags
|
21 | |
-# as part of the returned SDL_LIBRARY variable.
|
22 | |
-#
|
23 | |
-# Don't forget to include SDLmain.h and SDLmain.m your project for the
|
24 | |
-# OS X framework based version. (Other versions link to -lSDL2main which
|
25 | |
-# this module will try to find on your behalf.) Also for OS X, this
|
26 | |
-# module will automatically add the -framework Cocoa on your behalf.
|
27 | |
-#
|
28 | |
-#
|
29 | |
-# Additional Note: If you see an empty SDL2_LIBRARY_TEMP in your configuration
|
30 | |
-# and no SDL2_LIBRARY, it means CMake did not find your SDL library
|
31 | |
-# (SDL.dll, libsdl.so, SDL.framework, etc).
|
32 | |
-# Set SDL_LIBRARY_TEMP to point to your SDL library, and configure again.
|
33 | |
-# Similarly, if you see an empty SDLMAIN_LIBRARY, you should set this value
|
34 | |
-# as appropriate. These values are used to generate the final SDL_LIBRARY
|
35 | |
-# variable, but when these values are unset, SDL_LIBRARY does not get created.
|
36 | |
-#
|
37 | |
-#
|
38 | |
-# $SDL2DIR is an environment variable that would
|
39 | |
-# correspond to the ./configure --prefix=$SDL2DIR
|
40 | |
-# used in building SDL.
|
41 | |
-# l.e.galup 9-20-02
|
42 | |
-#
|
43 | |
-# Modified by Eric Wing.
|
44 | |
-# Added code to assist with automated building by using environmental variables
|
45 | |
-# and providing a more controlled/consistent search behavior.
|
46 | |
-# Added new modifications to recognize OS X frameworks and
|
47 | |
-# additional Unix paths (FreeBSD, etc).
|
48 | |
-# Also corrected the header search path to follow "proper" SDL guidelines.
|
49 | |
-# Added a search for SDLmain which is needed by some platforms.
|
50 | |
-# Added a search for threads which is needed by some platforms.
|
51 | |
-# Added needed compile switches for MinGW.
|
52 | |
-#
|
53 | |
-# On OSX, this will prefer the Framework version (if found) over others.
|
54 | |
-# People will have to manually change the cache values of
|
55 | |
-# SDL_LIBRARY to override this selection or set the CMake environment
|
56 | |
-# CMAKE_INCLUDE_PATH to modify the search paths.
|
57 | |
-#
|
58 | |
-# Note that the header path has changed from SDL/SDL.h to just SDL.h
|
59 | |
-# This needed to change because "proper" SDL convention
|
60 | |
-# is #include "SDL.h", not <SDL/SDL.h>. This is done for portability
|
61 | |
-# reasons because not all systems place things in SDL/ (see FreeBSD).
|
62 | |
-
|
63 | |
-#=============================================================================
|
64 | |
-# Copyright 2003-2009 Kitware, Inc.
|
65 | |
-#
|
66 | |
-# Distributed under the OSI-approved BSD License (the "License");
|
67 | |
-# see accompanying file Copyright.txt for details.
|
68 | |
-#
|
69 | |
-# This software is distributed WITHOUT ANY WARRANTY; without even the
|
70 | |
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
71 | |
-# See the License for more information.
|
72 | |
-#=============================================================================
|
73 | |
-# (To distributed this file outside of CMake, substitute the full
|
74 | |
-# License text for the above reference.)
|
75 | |
-
|
76 | |
-FIND_PATH(SDL2_INCLUDE_DIR SDL.h
|
77 | |
- HINTS
|
78 | |
- $ENV{SDL2DIR}
|
79 | |
- PATH_SUFFIXES include/SDL2 include
|
80 | |
- PATHS
|
81 | |
- ~/Library/Frameworks
|
82 | |
- /Library/Frameworks
|
83 | |
- /usr/local/include/SDL2
|
84 | |
- /usr/include/x86_64-linux-gnu/SDL2 # Ubuntu Focal (?)
|
85 | |
- /sw # Fink
|
86 | |
- /opt/local # DarwinPorts
|
87 | |
- /opt/csw # Blastwave
|
88 | |
- /opt
|
89 | |
- C:/MinGW #Win32
|
90 | |
-)
|
91 | |
-MESSAGE(STATUS "SDL2_INCLUDE_DIR is ${SDL2_INCLUDE_DIR}")
|
92 | |
-
|
93 | |
-FIND_LIBRARY(SDL2_LIBRARY_TEMP
|
94 | |
- NAMES SDL2
|
95 | |
- HINTS
|
96 | |
- $ENV{SDL2DIR}
|
97 | |
- PATH_SUFFIXES lib64 lib
|
98 | |
- PATHS
|
99 | |
- /sw
|
100 | |
- /opt/local
|
101 | |
- /opt/csw
|
102 | |
- /opt
|
103 | |
- C:/MinGW
|
104 | |
-)
|
105 | |
-
|
106 | |
-#MESSAGE(STATUS "SDL2_LIBRARY_TEMP is ${SDL2_LIBRARY_TEMP}")
|
107 | |
-
|
108 | |
-IF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework")
|
109 | |
-# Non-OS X framework versions expect you to also dynamically link to
|
110 | |
-# SDLmain. This is mainly for Windows and OS X. Other (Unix) platforms
|
111 | |
-# seem to provide SDLmain for compatibility even though they don't
|
112 | |
-# necessarily need it.
|
113 | |
-FIND_LIBRARY(SDL2MAIN_LIBRARY
|
114 | |
- NAMES SDL2main
|
115 | |
- HINTS
|
116 | |
- $ENV{SDL2DIR}
|
117 | |
- PATH_SUFFIXES lib64 lib
|
118 | |
- PATHS
|
119 | |
- /sw
|
120 | |
- /opt/local
|
121 | |
- /opt/csw
|
122 | |
- /opt
|
123 | |
- C:/MinGW
|
124 | |
-)
|
125 | |
-ENDIF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework")
|
126 | |
-
|
127 | |
-MESSAGE(STATUS "SDL2MAIN_LIBRARY is ${SDL2MAIN_LIBRARY}")
|
128 | |
-
|
129 | |
-
|
130 | |
-# SDL may require threads on your system.
|
131 | |
-# The Apple build may not need an explicit flag because one of the
|
132 | |
-# frameworks may already provide it.
|
133 | |
-# But for non-OSX systems, I will use the CMake Threads package.
|
134 | |
-IF(NOT APPLE)
|
135 | |
- FIND_PACKAGE(Threads)
|
136 | |
-ENDIF(NOT APPLE)
|
137 | |
-
|
138 | |
-# MinGW needs an additional library, mwindows
|
139 | |
-# It's total link flags should look like -lmingw32 -lSDLmain -lSDL -lmwindows
|
140 | |
-# (Actually on second look, I think it only needs one of the m* libraries.)
|
141 | |
-IF(MINGW)
|
142 | |
- SET(MINGW32_LIBRARY mingw32 CACHE STRING "mwindows for MinGW")
|
143 | |
-ENDIF(MINGW)
|
144 | |
-
|
145 | |
-
|
146 | |
-SET(SDL2_FOUND "NO")
|
147 | |
-IF(SDL2_LIBRARY_TEMP)
|
148 | |
- # For SDLmain
|
149 | |
- IF(NOT SDL2_BUILDING_LIBRARY)
|
150 | |
- IF(SDL2MAIN_LIBRARY)
|
151 | |
- SET(SDL2_LIBRARY_TEMP ${SDL2MAIN_LIBRARY} ${SDL2_LIBRARY_TEMP})
|
152 | |
- ENDIF(SDL2MAIN_LIBRARY)
|
153 | |
- ENDIF(NOT SDL2_BUILDING_LIBRARY)
|
154 | |
-
|
155 | |
- # For OS X, SDL uses Cocoa as a backend so it must link to Cocoa.
|
156 | |
- # CMake doesn't display the -framework Cocoa string in the UI even
|
157 | |
- # though it actually is there if I modify a pre-used variable.
|
158 | |
- # I think it has something to do with the CACHE STRING.
|
159 | |
- # So I use a temporary variable until the end so I can set the
|
160 | |
- # "real" variable in one-shot.
|
161 | |
- IF(APPLE)
|
162 | |
- SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} "-framework Cocoa")
|
163 | |
- ENDIF(APPLE)
|
164 | |
-
|
165 | |
- # For threads, as mentioned Apple doesn't need this.
|
166 | |
- # In fact, there seems to be a problem if I used the Threads package
|
167 | |
- # and try using this line, so I'm just skipping it entirely for OS X.
|
168 | |
- IF(NOT APPLE)
|
169 | |
- SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} ${CMAKE_THREAD_LIBS_INIT})
|
170 | |
- ENDIF(NOT APPLE)
|
171 | |
-
|
172 | |
- # For MinGW library
|
173 | |
- IF(MINGW)
|
174 | |
- SET(SDL2_LIBRARY_TEMP ${MINGW32_LIBRARY} ${SDL2_LIBRARY_TEMP})
|
175 | |
- ENDIF(MINGW)
|
176 | |
-
|
177 | |
- # Set the final string here so the GUI reflects the final state.
|
178 | |
- SET(SDL2_LIBRARY ${SDL2_LIBRARY_TEMP} CACHE STRING "Where the SDL2 Library can be found")
|
179 | |
- SET(SDL2_LIBRARY ${SDL2_LIBRARY_TEMP})
|
180 | |
-
|
181 | |
- # Set the temp variable to INTERNAL so it is not seen in the CMake GUI
|
182 | |
- SET(SDL2_LIBRARY_TEMP "${SDL2_LIBRARY_TEMP}" CACHE INTERNAL "")
|
183 | |
- IF(NOT SDL2MAIN_LIBRARY)
|
184 | |
- IF(WIN32)
|
185 | |
- MESSAGE(FATAL_ERROR "$Could NOT find SDL2 (missing: SDL2main)")
|
186 | |
- ENDIF(WIN32)
|
187 | |
- ENDIF(NOT SDL2MAIN_LIBRARY)
|
188 | |
-
|
189 | |
- IF(NOT SDL2_LIBRARY)
|
190 | |
- IF(WIN32)
|
191 | |
- MESSAGE(FATAL_ERROR "$Could NOT find SDL2 (missing: SDL2)")
|
192 | |
- ENDIF(WIN32)
|
193 | |
- ENDIF(NOT SDL2_LIBRARY)
|
194 | |
-
|
195 | |
- SET(SDL2_FOUND "YES")
|
196 | |
-ENDIF(SDL2_LIBRARY_TEMP)
|
197 | |
-
|
198 | |
-#MESSAGE(STATUS "SDL2_LIBRARY is ${SDL2_LIBRARY}")
|
199 | |
-
|