Merge vk-gl-cts/vulkan-cts-1.0.0 into vk-gl-cts/vulkan-cts-1.0.1
[platform/upstream/VK-GL-CTS.git] / framework / platform / CMakeLists.txt
1 # Platform port library
2
3 # Target file may define TCUTIL_PLATFORM_SRCS
4 if (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)
23                 set(TCUTIL_PLATFORM_SRCS
24                         X11/tcuX11.cpp
25                         X11/tcuX11.hpp
26                         X11/tcuX11Platform.hpp
27                         X11/tcuX11Platform.cpp
28                         X11/tcuX11VulkanPlatform.hpp
29                         X11/tcuX11VulkanPlatform.cpp
30                         )
31                 if (DEQP_USE_XCB)
32                         set(TCUTIL_PLATFORM_SRCS
33                                 ${TCUTIL_PLATFORM_SRCS}
34                                 X11/tcuX11Xcb.hpp
35                                 X11/tcuX11Xcb.cpp
36                                 )
37                 endif()
38                 if (DEQP_SUPPORT_EGL)
39                         set(TCUTIL_PLATFORM_SRCS
40                                 ${TCUTIL_PLATFORM_SRCS}
41                                 X11/tcuX11EglPlatform.hpp
42                                 X11/tcuX11EglPlatform.cpp
43                                 )
44                 endif()
45                 if (DEQP_SUPPORT_GLX)
46                         set(TCUTIL_PLATFORM_SRCS
47                                 ${TCUTIL_PLATFORM_SRCS}
48                                 X11/tcuX11GlxPlatform.hpp
49                                 X11/tcuX11GlxPlatform.cpp
50                                 )
51                 endif()
52                 if (NOT (DEQP_SUPPORT_EGL OR DEQP_SUPPORT_GLX))
53                   message(FATAL_ERROR "At least one of EGL and GLX must be enabled for X11")
54                 endif ()
55         elseif (DE_OS_IS_ANDROID)
56                 set(TCUTIL_PLATFORM_SRCS
57                         android/tcuAndroidExecService.cpp
58                         android/tcuAndroidExecService.hpp
59                         )
60
61                 if (DE_ANDROID_API GREATER 8)
62                         # Add NativeActivity code
63                         set(TCUTIL_PLATFORM_SRCS
64                                 ${TCUTIL_PLATFORM_SRCS}
65                                 android/tcuAndroidAssets.cpp
66                                 android/tcuAndroidAssets.hpp
67                                 android/tcuAndroidInternals.cpp
68                                 android/tcuAndroidInternals.hpp
69                                 android/tcuAndroidNativeActivity.cpp
70                                 android/tcuAndroidNativeActivity.hpp
71                                 android/tcuAndroidPlatform.cpp
72                                 android/tcuAndroidPlatform.hpp
73                                 android/tcuAndroidRenderActivity.cpp
74                                 android/tcuAndroidRenderActivity.hpp
75                                 android/tcuAndroidTestActivity.cpp
76                                 android/tcuAndroidTestActivity.hpp
77                                 android/tcuAndroidUtil.cpp
78                                 android/tcuAndroidUtil.hpp
79                                 android/tcuAndroidWindow.cpp
80                                 android/tcuAndroidWindow.hpp
81                                 )
82                 endif ()
83
84         elseif (DE_OS_IS_IOS)
85                 set(TCUTIL_PLATFORM_SRCS
86                         ios/tcuIOSApp.mm
87                         ios/tcuIOSApp.h
88                         ios/tcuIOSPlatform.mm
89                         ios/tcuIOSPlatform.hh
90                         )
91
92         elseif (DE_OS_IS_OSX)
93                 set(TCUTIL_PLATFORM_SRCS
94                         osx/tcuOSXPlatform.cpp
95                         osx/tcuOSXPlatform.hpp
96                         )
97
98         else ()
99                 set(TCUTIL_PLATFORM_SRCS
100                         vanilla/tcuVanillaPlatform.cpp
101                         )
102
103         endif ()
104 endif ()
105
106 add_library(tcutil-platform STATIC ${TCUTIL_PLATFORM_SRCS})
107
108 # Add vkutil to the deps before tcutil so that it picks up the c++11 dependencies
109 target_link_libraries(tcutil-platform vkutil)
110
111 target_link_libraries(tcutil-platform tcutil ${TCUTIL_PLATFORM_LIBS})
112
113 # Always link to glutil as some platforms such as Win32 always support GL
114 target_link_libraries(tcutil-platform glutil)
115
116 # Always link to eglutil
117 target_link_libraries(tcutil-platform eglutil)
118
119 # X11 libraries
120 if (DEQP_USE_X11)
121         find_package(X11 REQUIRED)
122         target_link_libraries(tcutil-platform ${X11_LIBRARIES})
123         if (DEQP_USE_XCB)
124                 find_package(XCB REQUIRED)
125                 target_link_libraries(tcutil-platform ${XCB_LIBRARIES})
126                 add_definitions(-DDEQP_SUPPORT_XCB=1)
127         endif ()
128         if (DEQP_SUPPORT_GLX)
129           # GLX functions don't currently have wrappers, so link directly to libGL.
130           target_link_libraries(tcutil-platform GL)
131         endif ()
132 endif ()