03231942bb
So far it was bound to whether we build for GLES. But this is semantically wrong. It might be possible that even on desktop gl epoxy is built without GLX support, thus we need to reflect this. This change ensures that epoxy/glx.h is only included if available, that relevant code is bound to it and that checks are in place to enforce EGL if not build with glx support. In addtion the glxbackend.cpp is now only included in the build set if available.
56 lines
2.6 KiB
CMake
56 lines
2.6 KiB
CMake
# - Try to find libepoxy
|
|
# Once done this will define
|
|
#
|
|
# epoxy_FOUND - System has libepoxy
|
|
# epoxy_LIBRARY - The libepoxy library
|
|
# epoxy_INCLUDE_DIR - The libepoxy include dir
|
|
# epoxy_DEFINITIONS - Compiler switches required for using libepoxy
|
|
# epoxy_HAS_GLX - Whether GLX support is available
|
|
|
|
# Copyright (c) 2014 Fredrik Höglund <fredrik@kde.org>
|
|
#
|
|
# Redistribution and use in source and binary forms, with or without
|
|
# modification, are permitted provided that the following conditions
|
|
# are met:
|
|
# 1. Redistributions of source code must retain the above copyright
|
|
# notice, this list of conditions and the following disclaimer.
|
|
# 2. Redistributions in binary form must reproduce the above copyright
|
|
# notice, this list of conditions and the following disclaimer in the
|
|
# documentation and/or other materials provided with the distribution.
|
|
# 3. Neither the name of the University nor the names of its contributors
|
|
# may be used to endorse or promote products derived from this software
|
|
# without specific prior written permission.
|
|
#
|
|
# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
# SUCH DAMAGE.
|
|
|
|
if (NOT WIN32)
|
|
find_package(PkgConfig)
|
|
pkg_check_modules(PKG_epoxy QUIET epoxy)
|
|
|
|
set(epoxy_DEFINITIONS ${PKG_epoxy_CFLAGS})
|
|
|
|
find_path(epoxy_INCLUDE_DIR NAMES epoxy/gl.h HINTS ${PKG_epoxy_INCLUDEDIR} ${PKG_epoxy_INCLUDE_DIRS})
|
|
find_library(epoxy_LIBRARY NAMES epoxy HINTS ${PKG_epoxy_LIBDIR} ${PKG_epoxy_LIBRARY_DIRS})
|
|
find_file(epoxy_GLX_HEADER NAMES epoxy/glx.h HINTS ${epoxy_INCLUDE_DIR})
|
|
|
|
if (epoxy_GLX_HEADER STREQUAL "epoxy_GLX_HEADER-NOTFOUND")
|
|
set(epoxy_HAS_GLX FALSE CACHE BOOL "whether glx is available")
|
|
else ()
|
|
set(epoxy_HAS_GLX TRUE CACHE BOOL "whether glx is available")
|
|
endif()
|
|
|
|
include(FindPackageHandleStandardArgs)
|
|
find_package_handle_standard_args(epoxy DEFAULT_MSG epoxy_LIBRARY epoxy_INCLUDE_DIR)
|
|
|
|
mark_as_advanced(epoxy_INCLUDE_DIR epoxy_LIBRARY epoxy_HAS_GLX)
|
|
endif()
|