Changeset View
Changeset View
Standalone View
Standalone View
find-modules/FindEGL.cmake
Show First 20 Lines • Show All 69 Lines • ▼ Show 20 Line(s) | |||||
70 | # in the FIND_PATH() and FIND_LIBRARY() calls | 70 | # in the FIND_PATH() and FIND_LIBRARY() calls | ||
71 | find_package(PkgConfig) | 71 | find_package(PkgConfig) | ||
72 | pkg_check_modules(PKG_EGL QUIET egl) | 72 | pkg_check_modules(PKG_EGL QUIET egl) | ||
73 | 73 | | |||
74 | set(EGL_DEFINITIONS ${PKG_EGL_CFLAGS_OTHER}) | 74 | set(EGL_DEFINITIONS ${PKG_EGL_CFLAGS_OTHER}) | ||
75 | 75 | | |||
76 | find_path(EGL_INCLUDE_DIR | 76 | find_path(EGL_INCLUDE_DIR | ||
77 | NAMES | 77 | NAMES | ||
78 | egl.h | 78 | EGL/egl.h | ||
79 | HINTS | 79 | HINTS | ||
80 | ${PKG_EGL_INCLUDE_DIRS} | 80 | ${PKG_EGL_INCLUDE_DIRS} | ||
81 | PATH_SUFFIXES | | |||
82 | EGL | | |||
83 | ) | 81 | ) | ||
84 | find_library(EGL_LIBRARY | 82 | find_library(EGL_LIBRARY | ||
85 | NAMES | 83 | NAMES | ||
86 | EGL | 84 | EGL | ||
87 | HINTS | 85 | HINTS | ||
88 | ${PKG_EGL_LIBRARY_DIRS} | 86 | ${PKG_EGL_LIBRARY_DIRS} | ||
89 | ) | 87 | ) | ||
90 | 88 | | |||
91 | # NB: We do *not* use the version information from pkg-config, as that | 89 | # NB: We do *not* use the version information from pkg-config, as that | ||
92 | # is the implementation version (eg: the Mesa version) | 90 | # is the implementation version (eg: the Mesa version) | ||
93 | if(EGL_INCLUDE_DIR) | 91 | if(EGL_INCLUDE_DIR) | ||
94 | # egl.h has defines of the form EGL_VERSION_x_y for each supported | 92 | # egl.h has defines of the form EGL_VERSION_x_y for each supported | ||
95 | # version; so the header for EGL 1.1 will define EGL_VERSION_1_0 and | 93 | # version; so the header for EGL 1.1 will define EGL_VERSION_1_0 and | ||
96 | # EGL_VERSION_1_1. Finding the highest supported version involves | 94 | # EGL_VERSION_1_1. Finding the highest supported version involves | ||
97 | # finding all these defines and selecting the highest numbered. | 95 | # finding all these defines and selecting the highest numbered. | ||
98 | file(READ "${EGL_INCLUDE_DIR}/egl.h" _EGL_header_contents) | 96 | file(READ "${EGL_INCLUDE_DIR}/EGL/egl.h" _EGL_header_contents) | ||
99 | string(REGEX MATCHALL | 97 | string(REGEX MATCHALL | ||
100 | "[ \t]EGL_VERSION_[0-9_]+" | 98 | "[ \t]EGL_VERSION_[0-9_]+" | ||
101 | _EGL_version_lines | 99 | _EGL_version_lines | ||
102 | "${_EGL_header_contents}" | 100 | "${_EGL_header_contents}" | ||
103 | ) | 101 | ) | ||
104 | unset(_EGL_header_contents) | 102 | unset(_EGL_header_contents) | ||
105 | foreach(_EGL_version_line ${_EGL_version_lines}) | 103 | foreach(_EGL_version_line ${_EGL_version_lines}) | ||
106 | string(REGEX REPLACE | 104 | string(REGEX REPLACE | ||
▲ Show 20 Lines • Show All 60 Lines • Show Last 20 Lines |