Refactor X11 and wayland platforms to run alongside each other
[platform/upstream/VK-GL-CTS.git] / targets / default / default.cmake
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
22 message("*** Default target")
23
24 set(DEQP_TARGET_NAME    "Default")
25
26 # For static linking
27 find_library(GLES2_LIBRARY              NAMES libGLESv2 GLESv2)
28 find_library(EGL_LIBRARY                NAMES libEGL EGL)
29
30 find_path(GLES2_INCLUDE_PATH    GLES2/gl2.h)
31 find_path(GLES3_INCLUDE_PATH    GLES3/gl3.h)
32 find_path(EGL_INCLUDE_PATH              EGL/egl.h)
33
34 if (GLES2_LIBRARY AND GLES2_INCLUDE_PATH)
35         set(DEQP_GLES2_LIBRARIES ${GLES2_LIBRARY})
36         include_directories(${GLES2_INCLUDE_PATH})
37 endif ()
38
39 if (GLES2_LIBRARY AND GLES3_INCLUDE_PATH)
40         # Assume that GLESv2 provides ES3 symbols if GLES3/gl3.h was found
41         set(DEQP_GLES3_LIBRARIES ${GLES2_LIBRARY})
42 endif ()
43
44 if (EGL_LIBRARY AND EGL_INCLUDE_PATH)
45         set(DEQP_EGL_LIBRARIES ${EGL_LIBRARY})
46         include_directories(${EGL_INCLUDE_PATH})
47 endif ()
48
49 # X11 / GLX?
50 if (DE_OS_IS_UNIX)
51         find_package(X11)
52         if (X11_FOUND)
53                 set(DEQP_USE_X11 ON)
54         endif ()
55
56         set(DEQP_PLATFORM_LIBRARIES ${X11_LIBRARIES})
57         include_directories(${X11_INCLUDE_DIR})
58
59         set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/targets/default")
60
61         # Use XCB target if available
62         set(DEQP_USE_XCB OFF)
63         find_package(XCB)
64         if (XCB_FOUND)
65                 set(DEQP_USE_XCB ON)
66                 set(DEQP_PLATFORM_LIBRARIES ${XCB_LIBRARIES})
67                 include_directories(${XCB_INCLUDE_DIR})
68         endif ()
69         find_package(Wayland)
70         if (WAYLAND_FOUND)
71                 set(DEQP_USE_WAYLAND ON)
72                 set(DEQP_PLATFORM_LIBRARIES ${WAYLAND_LIBRARIES})
73                 include_directories(${WAYLAND_INCLUDE_DIR})
74         endif ()
75 endif ()