1#------------------------------------------------------------------------- 2# drawElements CMake utilities 3# ---------------------------- 4# 5# Copyright 2016 The Android Open Source Project 6# Copyright (c) 2016 The Khronos Group Inc. 7# 8# Licensed under the Apache License, Version 2.0 (the "License"); 9# you may not use this file except in compliance with the License. 10# You may obtain a copy of the License at 11# 12# http://www.apache.org/licenses/LICENSE-2.0 13# 14# Unless required by applicable law or agreed to in writing, software 15# distributed under the License is distributed on an "AS IS" BASIS, 16# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17# See the License for the specific language governing permissions and 18# limitations under the License. 19# 20#------------------------------------------------------------------------- 21 22message("*** Default target") 23 24set(DEQP_TARGET_NAME "Default") 25 26if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") 27link_directories(/usr/local/lib) 28endif () 29 30# For static linking 31find_library(GLES2_LIBRARY NAMES libGLESv2 GLESv2) 32find_library(EGL_LIBRARY NAMES libEGL EGL) 33 34find_path(GLES2_INCLUDE_PATH GLES2/gl2.h) 35find_path(GLES3_INCLUDE_PATH GLES3/gl3.h) 36find_path(EGL_INCLUDE_PATH EGL/egl.h) 37 38if (GLES2_LIBRARY AND GLES2_INCLUDE_PATH) 39 if (GLES_ALLOW_DIRECT_LINK) 40 set(DEQP_GLES2_LIBRARIES ${GLES2_LIBRARY}) 41 endif () 42 include_directories(${GLES2_INCLUDE_PATH}) 43endif () 44 45if (GLES2_LIBRARY AND GLES3_INCLUDE_PATH AND GLES_ALLOW_DIRECT_LINK) 46 # Assume that GLESv2 provides ES3 symbols if GLES3/gl3.h was found 47 set(DEQP_GLES3_LIBRARIES ${GLES2_LIBRARY}) 48endif () 49 50if (EGL_LIBRARY AND EGL_INCLUDE_PATH) 51 if (GLES_ALLOW_DIRECT_LINK) 52 set(DEQP_EGL_LIBRARIES ${EGL_LIBRARY}) 53 endif () 54 include_directories(${EGL_INCLUDE_PATH}) 55endif () 56 57# X11 / GLX? 58if (DE_OS_IS_UNIX) 59 find_package(X11) 60 if (X11_FOUND) 61 set(DEQP_USE_X11 ON) 62 set(DEQP_SUPPORT_GLX ON) 63 endif () 64 65 set(DEQP_PLATFORM_LIBRARIES ${X11_LIBRARIES}) 66 include_directories(${X11_INCLUDE_DIR}) 67 68 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/targets/default") 69 70 # Use XCB target if available 71 set(DEQP_USE_XCB OFF) 72 find_package(XCB) 73 if (XCB_FOUND) 74 set(DEQP_USE_XCB ON) 75 set(DEQP_PLATFORM_LIBRARIES ${XCB_LIBRARIES}) 76 include_directories(${XCB_INCLUDE_DIR}) 77 endif () 78 find_package(Wayland) 79 if (WAYLAND_FOUND) 80 set(DEQP_USE_WAYLAND ON) 81 set(DEQP_PLATFORM_LIBRARIES ${WAYLAND_LIBRARIES}) 82 include_directories(${WAYLAND_INCLUDE_DIR}) 83 endif () 84endif () 85 86# Win32? 87if (DE_OS_IS_WIN32) 88 set(DEQP_SUPPORT_WGL ON) 89endif () 90 91# MacOS? 92if (DE_OS_IS_OSX) 93 find_package(OpenGL REQUIRED) 94 find_library(COCOA_LIBRARY Cocoa) 95 find_library(QUARTZCORE_LIBRARY QuartzCore) 96 set(DEQP_PLATFORM_LIBRARIES ${OPENGL_LIBRARIES} ${COCOA_LIBRARY} ${QUARTZCORE_LIBRARY}) 97 include_directories(${OPENGL_INCLUDE_DIRS}) 98endif() 99