diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-05-29 15:28:52 -0400 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-05-29 15:28:52 -0400 |
commit | 8c9d046123f0978ea3f770838a2321d85ffda977 (patch) | |
tree | 907b417f40a91f88ba3b080f254159eb2b071188 /cmake | |
parent | 0dbd1d249d0138c460eaf6ca39568d8d87666cfb (diff) | |
download | ether-8c9d046123f0978ea3f770838a2321d85ffda977.tar.gz ether-8c9d046123f0978ea3f770838a2321d85ffda977.tar.bz2 ether-8c9d046123f0978ea3f770838a2321d85ffda977.zip |
started implementing color tinting on lighting
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/FindSDL2_Image.cmake | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/cmake/FindSDL2_Image.cmake b/cmake/FindSDL2_Image.cmake new file mode 100644 index 0000000..de842ca --- /dev/null +++ b/cmake/FindSDL2_Image.cmake | |||
@@ -0,0 +1,98 @@ | |||
1 | # Distributed under the OSI-approved BSD 3-Clause License. See accompanying | ||
2 | # file Copyright.txt or https://cmake.org/licensing for details. | ||
3 | |||
4 | #.rst: | ||
5 | # FindSDL2_image | ||
6 | # ------------- | ||
7 | # | ||
8 | # Locate SDL2_image library | ||
9 | # | ||
10 | # This module defines: | ||
11 | # | ||
12 | # :: | ||
13 | # | ||
14 | # SDL2_IMAGE_LIBRARIES, the name of the library to link against | ||
15 | # SDL2_IMAGE_INCLUDE_DIRS, where to find the headers | ||
16 | # SDL2_IMAGE_FOUND, if false, do not try to link against | ||
17 | # SDL2_IMAGE_VERSION_STRING - human-readable string containing the | ||
18 | # version of SDL_image | ||
19 | # | ||
20 | # | ||
21 | # | ||
22 | # For backward compatibility the following variables are also set: | ||
23 | # | ||
24 | # :: | ||
25 | # | ||
26 | # SDL2IMAGE_LIBRARY (same value as SDL_IMAGE_LIBRARIES) | ||
27 | # SDL2IMAGE_INCLUDE_DIR (same value as SDL_IMAGE_INCLUDE_DIRS) | ||
28 | # SDL2IMAGE_FOUND (same value as SDL_IMAGE_FOUND) | ||
29 | # | ||
30 | # | ||
31 | # | ||
32 | # $SDL2DIR is an environment variable that would correspond to the | ||
33 | # ./configure --prefix=$SDL2DIR used in building SDL. | ||
34 | # | ||
35 | # Created by Eric Wing. This was influenced by the FindSDL.cmake | ||
36 | # module, but with modifications to recognize OS X frameworks and | ||
37 | # additional Unix paths (FreeBSD, etc). | ||
38 | |||
39 | if(NOT SDL2_IMAGE_INCLUDE_DIR AND SDL2IMAGE_INCLUDE_DIR) | ||
40 | set(SDL2_IMAGE_INCLUDE_DIR ${SDL2IMAGE_INCLUDE_DIR} CACHE PATH "directory cache entry initialized from old variable name") | ||
41 | endif() | ||
42 | find_path(SDL2_IMAGE_INCLUDE_DIR SDL_image.h | ||
43 | HINTS | ||
44 | ENV SDL2IMAGEDIR | ||
45 | ENV SDL2DIR | ||
46 | ${SDL2_DIR} | ||
47 | PATH_SUFFIXES SDL2 | ||
48 | # path suffixes to search inside ENV{SDL2DIR} | ||
49 | include/SDL2 include | ||
50 | ) | ||
51 | |||
52 | if(CMAKE_SIZEOF_VOID_P EQUAL 8) | ||
53 | set(VC_LIB_PATH_SUFFIX lib/x64) | ||
54 | else() | ||
55 | set(VC_LIB_PATH_SUFFIX lib/x86) | ||
56 | endif() | ||
57 | |||
58 | if(NOT SDL2_IMAGE_LIBRARY AND SDL2IMAGE_LIBRARY) | ||
59 | set(SDL2_IMAGE_LIBRARY ${SDL2IMAGE_LIBRARY} CACHE FILEPATH "file cache entry initialized from old variable name") | ||
60 | endif() | ||
61 | find_library(SDL2_IMAGE_LIBRARY | ||
62 | NAMES SDL2_image | ||
63 | HINTS | ||
64 | ENV SDL2IMAGEDIR | ||
65 | ENV SDL2DIR | ||
66 | ${SDL2_DIR} | ||
67 | PATH_SUFFIXES lib ${VC_LIB_PATH_SUFFIX} | ||
68 | ) | ||
69 | |||
70 | if(SDL2_IMAGE_INCLUDE_DIR AND EXISTS "${SDL2_IMAGE_INCLUDE_DIR}/SDL_image.h") | ||
71 | file(STRINGS "${SDL2_IMAGE_INCLUDE_DIR}/SDL_image.h" SDL2_IMAGE_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL_IMAGE_MAJOR_VERSION[ \t]+[0-9]+$") | ||
72 | file(STRINGS "${SDL2_IMAGE_INCLUDE_DIR}/SDL_image.h" SDL2_IMAGE_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL_IMAGE_MINOR_VERSION[ \t]+[0-9]+$") | ||
73 | file(STRINGS "${SDL2_IMAGE_INCLUDE_DIR}/SDL_image.h" SDL2_IMAGE_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL_IMAGE_PATCHLEVEL[ \t]+[0-9]+$") | ||
74 | string(REGEX REPLACE "^#define[ \t]+SDL_IMAGE_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_IMAGE_VERSION_MAJOR "${SDL_IMAGE_VERSION_MAJOR_LINE}") | ||
75 | string(REGEX REPLACE "^#define[ \t]+SDL_IMAGE_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_IMAGE_VERSION_MINOR "${SDL_IMAGE_VERSION_MINOR_LINE}") | ||
76 | string(REGEX REPLACE "^#define[ \t]+SDL_IMAGE_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL2_IMAGE_VERSION_PATCH "${SDL_IMAGE_VERSION_PATCH_LINE}") | ||
77 | set(SDL2_IMAGE_VERSION_STRING ${SDL2_IMAGE_VERSION_MAJOR}.${SDL2_IMAGE_VERSION_MINOR}.${SDL2_IMAGE_VERSION_PATCH}) | ||
78 | unset(SDL2_IMAGE_VERSION_MAJOR_LINE) | ||
79 | unset(SDL2_IMAGE_VERSION_MINOR_LINE) | ||
80 | unset(SDL2_IMAGE_VERSION_PATCH_LINE) | ||
81 | unset(SDL2_IMAGE_VERSION_MAJOR) | ||
82 | unset(SDL2_IMAGE_VERSION_MINOR) | ||
83 | unset(SDL2_IMAGE_VERSION_PATCH) | ||
84 | endif() | ||
85 | |||
86 | set(SDL2_IMAGE_LIBRARIES ${SDL2_IMAGE_LIBRARY}) | ||
87 | set(SDL2_IMAGE_INCLUDE_DIRS ${SDL2_IMAGE_INCLUDE_DIR}) | ||
88 | |||
89 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2_image | ||
90 | REQUIRED_VARS SDL2_IMAGE_LIBRARIES SDL2_IMAGE_INCLUDE_DIRS | ||
91 | VERSION_VAR SDL2_IMAGE_VERSION_STRING) | ||
92 | |||
93 | # for backward compatibility | ||
94 | set(SDL2IMAGE_LIBRARY ${SDL2_IMAGE_LIBRARIES}) | ||
95 | set(SDL2IMAGE_INCLUDE_DIR ${SDL2_IMAGE_INCLUDE_DIRS}) | ||
96 | set(SDL2IMAGE_FOUND ${SDL2_IMAGE_FOUND}) | ||
97 | |||
98 | mark_as_advanced(SDL2_IMAGE_LIBRARY SDL2_IMAGE_INCLUDE_DIR) \ No newline at end of file | ||