• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.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		if (DEQP_USE_HEADLESS)
87			add_definitions(-DDEQP_SUPPORT_HEADLESS=1)
88		endif()
89
90	elseif (DE_OS_IS_UNIX AND DEQP_USE_SURFACELESS)
91		set(TCUTIL_PLATFORM_SRCS
92			surfaceless/tcuSurfacelessPlatform.hpp
93			surfaceless/tcuSurfacelessPlatform.cpp
94			)
95
96	elseif (DE_OS_IS_ANDROID)
97		set(TCUTIL_PLATFORM_SRCS
98			android/tcuAndroidExecService.cpp
99			android/tcuAndroidExecService.hpp
100			)
101
102		if (DE_ANDROID_API GREATER 8)
103			# Add NativeActivity code
104			set(TCUTIL_PLATFORM_SRCS
105				${TCUTIL_PLATFORM_SRCS}
106				android/tcuAndroidAssets.cpp
107				android/tcuAndroidAssets.hpp
108				android/tcuAndroidNativeActivity.cpp
109				android/tcuAndroidNativeActivity.hpp
110				android/tcuAndroidPlatform.cpp
111				android/tcuAndroidPlatform.hpp
112				android/tcuAndroidRenderActivity.cpp
113				android/tcuAndroidRenderActivity.hpp
114				android/tcuAndroidTestActivity.cpp
115				android/tcuAndroidTestActivity.hpp
116				android/tcuAndroidUtil.cpp
117				android/tcuAndroidUtil.hpp
118				android/tcuAndroidWindow.cpp
119				android/tcuAndroidWindow.hpp
120				)
121		endif ()
122
123	elseif (DE_OS_IS_IOS)
124		set(TCUTIL_PLATFORM_SRCS
125			ios/tcuIOSApp.mm
126			ios/tcuIOSApp.h
127			ios/tcuIOSPlatform.mm
128			ios/tcuIOSPlatform.hh
129			)
130
131	elseif (DE_OS_IS_OSX)
132		set(TCUTIL_PLATFORM_SRCS
133			osx/tcuOSXPlatform.cpp
134			osx/tcuOSXPlatform.hpp
135			osx/tcuOSXVulkanPlatform.cpp
136			osx/tcuOSXVulkanPlatform.hpp
137			osx/tcuOSXMetalView.mm
138			osx/tcuOSXMetalView.hpp
139			)
140		list(APPEND TCUTIL_PLATFORM_LIBS ${QUARTZCORE_LIBRARY} ${COCOA_LIBRARY})
141
142	else ()
143		set(TCUTIL_PLATFORM_SRCS
144			vanilla/tcuVanillaPlatform.cpp
145			)
146
147	endif ()
148endif ()
149
150include_directories(${PROJECT_BINARY_DIR}/external/vulkancts/framework/vulkan)
151
152add_library(tcutil-platform STATIC ${TCUTIL_PLATFORM_SRCS})
153
154
155# Add vkutil to the deps before tcutil so that it picks up the c++11 dependencies
156target_link_libraries(tcutil-platform vkutil)
157
158target_link_libraries(tcutil-platform tcutil ${TCUTIL_PLATFORM_LIBS})
159
160# Always link to glutil as some platforms such as Win32 always support GL
161target_link_libraries(tcutil-platform glutil)
162
163# Always link to eglutil
164target_link_libraries(tcutil-platform eglutil)
165
166# X11 libraries
167if (DEQP_USE_X11)
168	find_package(X11 REQUIRED)
169	target_link_libraries(tcutil-platform ${X11_LIBRARIES})
170	if (DEQP_USE_XCB)
171		find_package(XCB REQUIRED)
172		target_link_libraries(tcutil-platform ${XCB_LIBRARIES})
173		add_definitions(-DDEQP_SUPPORT_XCB=1)
174	endif ()
175	if (DEQP_SUPPORT_GLX)
176	  # GLX functions don't currently have wrappers, so link directly to libGL.
177	  target_link_libraries(tcutil-platform GL)
178	endif ()
179	if (DEQP_USE_WAYLAND)
180		find_package(Wayland REQUIRED)
181		target_link_libraries(tcutil-platform ${WAYLAND_LIBRARIES})
182		add_definitions(-DDEQP_SUPPORT_WAYLAND=1)
183	endif ()
184endif ()
185
186if (DE_OS_IS_WIN32)
187	target_link_libraries(tcutil-platform "version")
188endif()
189