1# Platform port library 2 3# Target file may define TCUTIL_PLATFORM_SRCS 4if (NOT DEFINED TCUTIL_PLATFORM_SRCS) 5 if (DE_OS_IS_WIN32) 6 set(TCUTIL_PLATFORM_SRCS 7 win32/tcuWin32Platform.hpp 8 win32/tcuWin32Platform.cpp 9 win32/tcuWGLContextFactory.hpp 10 win32/tcuWGLContextFactory.cpp 11 win32/tcuWGL.hpp 12 win32/tcuWGL.cpp 13 win32/tcuWin32API.h 14 win32/tcuWin32Window.cpp 15 win32/tcuWin32Window.hpp 16 win32/tcuWin32EGLNativeDisplayFactory.hpp 17 win32/tcuWin32EGLNativeDisplayFactory.cpp 18 win32/tcuWin32VulkanPlatform.hpp 19 win32/tcuWin32VulkanPlatform.cpp 20 ) 21 22 elseif ((DE_OS_IS_UNIX OR DE_OS_IS_OSX) AND (DEQP_USE_X11 OR DEQP_USE_WAYLAND OR DEQP_USE_HEADLESS)) 23 24 set(TCUTIL_PLATFORM_SRCS 25 lnx/tcuLnx.cpp 26 lnx/tcuLnx.hpp 27 lnx/tcuLnxPlatform.cpp 28 lnx/tcuLnxPlatform.hpp 29 lnx/tcuLnxEglPlatform.hpp 30 lnx/tcuLnxEglPlatform.cpp 31 lnx/tcuLnxVulkanPlatform.hpp 32 lnx/tcuLnxVulkanPlatform.cpp 33 ) 34 35 include_directories(lnx) 36 37 if (DEQP_USE_X11) 38 add_definitions(-DDEQP_SUPPORT_X11=1) 39 include_directories(lnx/X11) 40 41 message(STATUS "DEQP_SUPPORT_GLX = ${DEQP_SUPPORT_GLX}") 42 43 if (DEQP_SUPPORT_GLX) 44 add_definitions(-DDEQP_SUPPORT_GLX=1) 45 endif () 46 47 set(TCUTIL_PLATFORM_SRCS 48 ${TCUTIL_PLATFORM_SRCS} 49 lnx/X11/tcuLnxX11.cpp 50 lnx/X11/tcuLnxX11.hpp 51 lnx/X11/tcuLnxX11EglDisplayFactory.hpp 52 lnx/X11/tcuLnxX11EglDisplayFactory.cpp 53 ) 54 55 if (DEQP_USE_XCB) 56 set(TCUTIL_PLATFORM_SRCS 57 ${TCUTIL_PLATFORM_SRCS} 58 lnx/X11/tcuLnxX11Xcb.hpp 59 lnx/X11/tcuLnxX11Xcb.cpp 60 ) 61 endif() 62 63 if (DEQP_SUPPORT_GLX) 64 set(TCUTIL_PLATFORM_SRCS 65 ${TCUTIL_PLATFORM_SRCS} 66 lnx/X11/tcuLnxX11GlxPlatform.hpp 67 lnx/X11/tcuLnxX11GlxPlatform.cpp 68 ) 69 endif() 70 endif() 71 72 if (DEQP_USE_WAYLAND) 73 add_definitions(-DDEQP_SUPPORT_WAYLAND=1) 74 include_directories(lnx/wayland) 75 76 pkg_get_variable(WAYLAND_PROTOCOLS_DIR wayland-protocols pkgdatadir) 77 78 if (NOT WAYLAND_SCANNER) 79 pkg_get_variable(WAYLAND_SCANNER wayland-scanner wayland_scanner) 80 endif() 81 82 set(DEQP_XDG_SHELL_PROTOCOL ${WAYLAND_PROTOCOLS_DIR}/stable/xdg-shell/xdg-shell.xml) 83 set(DEQP_XDG_SHELL_GEN_OUTPUTS_DIR ${PROJECT_BINARY_DIR}/framework/platform) 84 set(DEQP_XDG_SHELL_OUTPUTS 85 ${DEQP_XDG_SHELL_GEN_OUTPUTS_DIR}/xdg-shell.c 86 ${DEQP_XDG_SHELL_GEN_OUTPUTS_DIR}/xdg-shell.h) 87 88 add_custom_command( 89 COMMAND ${WAYLAND_SCANNER} ARGS client-header ${DEQP_XDG_SHELL_PROTOCOL} xdg-shell.h 90 COMMAND ${WAYLAND_SCANNER} ARGS public-code ${DEQP_XDG_SHELL_PROTOCOL} xdg-shell.c 91 DEPENDS ${DEQP_XDG_SHELL_PROTOCOL} 92 OUTPUT ${DEQP_XDG_SHELL_OUTPUTS}) 93 94 add_custom_target( 95 deqp-xdg-shell ALL 96 DEPENDS ${DEQP_XDG_SHELL_OUTPUTS}) 97 98 set(TCUTIL_PLATFORM_SRCS 99 ${TCUTIL_PLATFORM_SRCS} 100 lnx/wayland/tcuLnxWayland.hpp 101 lnx/wayland/tcuLnxWayland.cpp 102 lnx/wayland/tcuLnxWaylandEglDisplayFactory.cpp 103 lnx/wayland/tcuLnxWaylandEglDisplayFactory.hpp 104 ${DEQP_XDG_SHELL_GEN_OUTPUTS_DIR}/xdg-shell.c 105 ${DEQP_XDG_SHELL_GEN_OUTPUTS_DIR}/xdg-shell.h 106 ) 107 include_directories(${DEQP_XDG_SHELL_GEN_OUTPUTS_DIR}) 108 include_directories(wayland) 109 endif() 110 111 if (DEQP_USE_HEADLESS) 112 add_definitions(-DDEQP_SUPPORT_HEADLESS=1) 113 endif() 114 115 elseif (DE_OS_IS_UNIX AND DEQP_USE_SURFACELESS) 116 add_definitions(-DDEQP_SURFACELESS=1) 117 set(TCUTIL_PLATFORM_SRCS 118 surfaceless/tcuSurfacelessPlatform.hpp 119 surfaceless/tcuSurfacelessPlatform.cpp 120 ) 121 122 elseif (DE_OS_IS_ANDROID) 123 set(TCUTIL_PLATFORM_SRCS 124 android/tcuAndroidExecService.cpp 125 android/tcuAndroidExecService.hpp 126 ) 127 128 if (DE_ANDROID_API GREATER 8) 129 # Add NativeActivity code 130 set(TCUTIL_PLATFORM_SRCS 131 ${TCUTIL_PLATFORM_SRCS} 132 android/tcuAndroidAssets.cpp 133 android/tcuAndroidAssets.hpp 134 android/tcuAndroidNativeActivity.cpp 135 android/tcuAndroidNativeActivity.hpp 136 android/tcuAndroidPlatform.cpp 137 android/tcuAndroidPlatform.hpp 138 android/tcuAndroidRenderActivity.cpp 139 android/tcuAndroidRenderActivity.hpp 140 android/tcuAndroidTestActivity.cpp 141 android/tcuAndroidTestActivity.hpp 142 android/tcuAndroidUtil.cpp 143 android/tcuAndroidUtil.hpp 144 android/tcuAndroidWindow.cpp 145 android/tcuAndroidWindow.hpp 146 ) 147 endif () 148 149 elseif (DE_OS_IS_IOS) 150 set(TCUTIL_PLATFORM_SRCS 151 ios/tcuIOSApp.mm 152 ios/tcuIOSApp.h 153 ios/tcuIOSPlatform.mm 154 ios/tcuIOSPlatform.hh 155 ) 156 157 elseif (DE_OS_IS_OSX) 158 set(TCUTIL_PLATFORM_SRCS 159 osx/tcuOSXPlatform.cpp 160 osx/tcuOSXPlatform.hpp 161 osx/tcuOSXVulkanPlatform.cpp 162 osx/tcuOSXVulkanPlatform.hpp 163 osx/tcuOSXMetalView.mm 164 osx/tcuOSXMetalView.hpp 165 ) 166 list(APPEND TCUTIL_PLATFORM_LIBS ${QUARTZCORE_LIBRARY} ${COCOA_LIBRARY}) 167 168 elseif (DE_OS_IS_FUCHSIA) 169 set(TCUTIL_PLATFORM_SRCS 170 fuchsia/tcuFuchsiaPlatform.cpp 171 ) 172 173 else () 174 set(TCUTIL_PLATFORM_SRCS 175 vanilla/tcuVanillaPlatform.cpp 176 ) 177 178 endif () 179endif () 180 181include_directories(${PROJECT_BINARY_DIR}/external/vulkancts/framework/vulkan) 182 183add_library(tcutil-platform STATIC ${TCUTIL_PLATFORM_SRCS}) 184if (DEQP_USE_WAYLAND) 185 add_dependencies(tcutil-platform deqp-xdg-shell) 186endif() 187 188# Add vkutil to the deps before tcutil so that it picks up the c++11 dependencies 189target_link_libraries(tcutil-platform vkutil) 190 191target_link_libraries(tcutil-platform tcutil ${TCUTIL_PLATFORM_LIBS}) 192 193# Always link to glutil as some platforms such as Win32 always support GL 194target_link_libraries(tcutil-platform glutil) 195 196# Always link to eglutil 197target_link_libraries(tcutil-platform eglutil) 198 199# X11 libraries 200if (DEQP_USE_X11) 201 find_package(X11 REQUIRED) 202 target_link_libraries(tcutil-platform ${X11_LIBRARIES}) 203 if (DEQP_USE_XCB) 204 find_package(XCB REQUIRED) 205 target_link_libraries(tcutil-platform ${XCB_LIBRARIES}) 206 target_compile_definitions(tcutil-platform PUBLIC DEQP_SUPPORT_XCB=1) 207 endif () 208 if (DEQP_SUPPORT_GLX) 209 # GLX functions don't currently have wrappers, so link directly to libGL. 210 target_link_libraries(tcutil-platform GL) 211 endif () 212 if (DEQP_USE_WAYLAND) 213 find_package(Wayland REQUIRED) 214 target_link_libraries(tcutil-platform ${WAYLAND_LIBRARIES}) 215 target_compile_definitions(tcutil-platform PUBLIC DEQP_SUPPORT_WAYLAND=1) 216 endif () 217endif () 218 219if (DE_OS_IS_WIN32) 220 target_link_libraries(tcutil-platform "version") 221endif() 222 223# Add similar library for Vulkan SC ( uses same code as vkutil, but with different INL files. These 224# are picked up via the version of vkutil that is linked against ) 225add_library(tcutil-sc-platform STATIC ${TCUTIL_PLATFORM_SRCS}) 226 227# Add vkscutil to the deps before tcutil so that it picks up the c++11 dependencies 228target_link_libraries(tcutil-sc-platform vkscutil) 229 230target_link_libraries(tcutil-sc-platform tcutil ${TCUTIL_PLATFORM_LIBS}) 231 232# Always link to glutil as some platforms such as Win32 always support GL 233target_link_libraries(tcutil-sc-platform glutil) 234 235# Always link to eglutil 236target_link_libraries(tcutil-sc-platform eglutil) 237 238# X11 libraries 239if (DEQP_USE_X11) 240 find_package(X11 REQUIRED) 241 target_link_libraries(tcutil-sc-platform ${X11_LIBRARIES}) 242 if (DEQP_USE_XCB) 243 find_package(XCB REQUIRED) 244 target_link_libraries(tcutil-sc-platform ${XCB_LIBRARIES}) 245 target_compile_definitions(tcutil-sc-platform PUBLIC DEQP_SUPPORT_XCB=1) 246 endif () 247 if (DEQP_SUPPORT_GLX) 248 # GLX functions don't currently have wrappers, so link directly to libGL. 249 target_link_libraries(tcutil-sc-platform GL) 250 endif () 251 if (DEQP_USE_WAYLAND) 252 find_package(Wayland REQUIRED) 253 target_link_libraries(tcutil-sc-platform ${WAYLAND_LIBRARIES}) 254 target_compile_definitions(tcutil-sc-platform PUBLIC DEQP_SUPPORT_WAYLAND=1) 255 endif () 256endif () 257 258if (DE_OS_IS_WIN32) 259 target_link_libraries(tcutil-sc-platform "version") 260endif() 261 262