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 ) 17 18 if (DEQP_SUPPORT_EGL) 19 set(TCUTIL_PLATFORM_SRCS 20 ${TCUTIL_PLATFORM_SRCS} 21 win32/tcuWin32EGLNativeDisplayFactory.hpp 22 win32/tcuWin32EGLNativeDisplayFactory.cpp 23 ) 24 endif() 25 elseif ((DE_OS_IS_UNIX OR DE_OS_IS_OSX) AND DEQP_USE_X11) 26 set(TCUTIL_PLATFORM_SRCS 27 X11/tcuX11.cpp 28 X11/tcuX11.hpp 29 X11/tcuX11Platform.hpp 30 X11/tcuX11Platform.cpp 31 ) 32 if (DEQP_SUPPORT_EGL) 33 set(TCUTIL_PLATFORM_SRCS 34 ${TCUTIL_PLATFORM_SRCS} 35 X11/tcuX11EglPlatform.hpp 36 X11/tcuX11EglPlatform.cpp 37 ) 38 endif() 39 if (DEQP_SUPPORT_GLX) 40 set(TCUTIL_PLATFORM_SRCS 41 ${TCUTIL_PLATFORM_SRCS} 42 X11/tcuX11GlxPlatform.hpp 43 X11/tcuX11GlxPlatform.cpp 44 ) 45 endif() 46 if (NOT (DEQP_SUPPORT_EGL OR DEQP_SUPPORT_GLX)) 47 message(FATAL_ERROR "At least one of EGL and GLX must be enabled for X11") 48 endif () 49 elseif (DE_OS_IS_ANDROID) 50 set(TCUTIL_PLATFORM_SRCS 51 android/tcuAndroidExecService.cpp 52 android/tcuAndroidExecService.hpp 53 ) 54 55 if (DE_ANDROID_API GREATER 8) 56 # Add NativeActivity code 57 set(TCUTIL_PLATFORM_SRCS 58 ${TCUTIL_PLATFORM_SRCS} 59 android/tcuAndroidAssets.cpp 60 android/tcuAndroidAssets.hpp 61 android/tcuAndroidInternals.cpp 62 android/tcuAndroidInternals.hpp 63 android/tcuAndroidNativeActivity.cpp 64 android/tcuAndroidNativeActivity.hpp 65 android/tcuAndroidPlatform.cpp 66 android/tcuAndroidPlatform.hpp 67 android/tcuAndroidRenderActivity.cpp 68 android/tcuAndroidRenderActivity.hpp 69 android/tcuAndroidTestActivity.cpp 70 android/tcuAndroidTestActivity.hpp 71 android/tcuAndroidUtil.cpp 72 android/tcuAndroidUtil.hpp 73 android/tcuAndroidWindow.cpp 74 android/tcuAndroidWindow.hpp 75 ) 76 endif () 77 78 elseif (DE_OS_IS_IOS) 79 set(TCUTIL_PLATFORM_SRCS 80 ios/tcuIOSApp.mm 81 ios/tcuIOSApp.h 82 ios/tcuIOSPlatform.mm 83 ios/tcuIOSPlatform.hh 84 ) 85 86 elseif (DE_OS_IS_OSX) 87 set(TCUTIL_PLATFORM_SRCS 88 osx/tcuOSXPlatform.cpp 89 osx/tcuOSXPlatform.hpp 90 ) 91 92 else () 93 set(TCUTIL_PLATFORM_SRCS 94 vanilla/tcuVanillaPlatform.cpp 95 ) 96 97 endif () 98endif () 99 100add_library(tcutil-platform STATIC ${TCUTIL_PLATFORM_SRCS}) 101target_link_libraries(tcutil-platform tcutil ${TCUTIL_PLATFORM_LIBS}) 102 103# Always link to glutil as some platforms such as Win32 always support GL 104target_link_libraries(tcutil-platform glutil) 105 106# Link to eglutil if platform supports EGL 107if (DEQP_SUPPORT_EGL) 108 target_link_libraries(tcutil-platform eglutil eglwrapper) 109endif () 110 111# X11 libraries 112if (DEQP_USE_X11) 113 find_package(X11 REQUIRED) 114 target_link_libraries(tcutil-platform ${X11_LIBRARIES}) 115 if (DEQP_SUPPORT_GLX) 116 # GLX functions don't currently have wrappers, so link directly to libGL. 117 target_link_libraries(tcutil-platform GL) 118 endif () 119endif () 120