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)) 23 24 set(TCUTIL_PLATFORM_SRCS 25 lnx/tcuLnx.cpp 26 lnx/tcuLnx.cpp 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 set(TCUTIL_PLATFORM_SRCS 77 ${TCUTIL_PLATFORM_SRCS} 78 lnx/wayland/tcuLnxWayland.hpp 79 lnx/wayland/tcuLnxWayland.cpp 80 lnx/wayland/tcuLnxWaylandEglDisplayFactory.cpp 81 lnx/wayland/tcuLnxWaylandEglDisplayFactory.hpp 82 ) 83 include_directories(wayland) 84 endif() 85 86 elseif (DE_OS_IS_ANDROID) 87 set(TCUTIL_PLATFORM_SRCS 88 android/tcuAndroidExecService.cpp 89 android/tcuAndroidExecService.hpp 90 ) 91 92 if (DE_ANDROID_API GREATER 8) 93 # Add NativeActivity code 94 set(TCUTIL_PLATFORM_SRCS 95 ${TCUTIL_PLATFORM_SRCS} 96 android/tcuAndroidAssets.cpp 97 android/tcuAndroidAssets.hpp 98 android/tcuAndroidInternals.cpp 99 android/tcuAndroidInternals.hpp 100 android/tcuAndroidNativeActivity.cpp 101 android/tcuAndroidNativeActivity.hpp 102 android/tcuAndroidPlatform.cpp 103 android/tcuAndroidPlatform.hpp 104 android/tcuAndroidRenderActivity.cpp 105 android/tcuAndroidRenderActivity.hpp 106 android/tcuAndroidTestActivity.cpp 107 android/tcuAndroidTestActivity.hpp 108 android/tcuAndroidUtil.cpp 109 android/tcuAndroidUtil.hpp 110 android/tcuAndroidWindow.cpp 111 android/tcuAndroidWindow.hpp 112 ) 113 endif () 114 115 elseif (DE_OS_IS_IOS) 116 set(TCUTIL_PLATFORM_SRCS 117 ios/tcuIOSApp.mm 118 ios/tcuIOSApp.h 119 ios/tcuIOSPlatform.mm 120 ios/tcuIOSPlatform.hh 121 ) 122 123 elseif (DE_OS_IS_OSX) 124 set(TCUTIL_PLATFORM_SRCS 125 osx/tcuOSXPlatform.cpp 126 osx/tcuOSXPlatform.hpp 127 ) 128 129 else () 130 set(TCUTIL_PLATFORM_SRCS 131 vanilla/tcuVanillaPlatform.cpp 132 ) 133 134 endif () 135endif () 136 137add_library(tcutil-platform STATIC ${TCUTIL_PLATFORM_SRCS}) 138 139# Add vkutil to the deps before tcutil so that it picks up the c++11 dependencies 140target_link_libraries(tcutil-platform vkutil) 141 142target_link_libraries(tcutil-platform tcutil ${TCUTIL_PLATFORM_LIBS}) 143 144# Always link to glutil as some platforms such as Win32 always support GL 145target_link_libraries(tcutil-platform glutil) 146 147# Always link to eglutil 148target_link_libraries(tcutil-platform eglutil) 149 150# X11 libraries 151if (DEQP_USE_X11) 152 find_package(X11 REQUIRED) 153 target_link_libraries(tcutil-platform ${X11_LIBRARIES}) 154 if (DEQP_USE_XCB) 155 find_package(XCB REQUIRED) 156 target_link_libraries(tcutil-platform ${XCB_LIBRARIES}) 157 add_definitions(-DDEQP_SUPPORT_XCB=1) 158 endif () 159 if (DEQP_SUPPORT_GLX) 160 # GLX functions don't currently have wrappers, so link directly to libGL. 161 target_link_libraries(tcutil-platform GL) 162 endif () 163 if (DEQP_USE_WAYLAND) 164 find_package(Wayland REQUIRED) 165 target_link_libraries(tcutil-platform ${WAYLAND_LIBRARIES}) 166 add_definitions(-DDEQP_SUPPORT_WAYLAND=1) 167 endif () 168endif () 169