xref: /aosp_15_r20/external/deqp/CMakeLists.txt (revision 35238bce31c2a825756842865a792f8cf7f89930)
1*35238bceSAndroid Build Coastguard Worker# dEQP cmake file
2*35238bceSAndroid Build Coastguard Worker
3*35238bceSAndroid Build Coastguard Worker# Module FindGit requires cmake >= 2.8.2
4*35238bceSAndroid Build Coastguard Worker# Using AFTER in target_include_directories requires >= 3.20.0
5*35238bceSAndroid Build Coastguard Workercmake_minimum_required(VERSION 3.20.0)
6*35238bceSAndroid Build Coastguard Worker
7*35238bceSAndroid Build Coastguard Workeroption(GLES_ALLOW_DIRECT_LINK "Allow direct linking to GLES libraries" OFF)
8*35238bceSAndroid Build Coastguard Worker
9*35238bceSAndroid Build Coastguard Worker# Target selection:
10*35238bceSAndroid Build Coastguard Worker# SELECTED_BUILD_TARGETS is a CMake option that can be set to a list of targets
11*35238bceSAndroid Build Coastguard Worker# that will be built. If the variable is empty (as is the default), all targets
12*35238bceSAndroid Build Coastguard Worker# will be built normally.
13*35238bceSAndroid Build Coastguard Workerset(SELECTED_BUILD_TARGETS "" CACHE STRING "Select some specific targets to build, separated by spaces")
14*35238bceSAndroid Build Coastguard Worker
15*35238bceSAndroid Build Coastguard Workerset(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/framework/delibs/cmake")
16*35238bceSAndroid Build Coastguard Workerfind_package(Git)
17*35238bceSAndroid Build Coastguard Workerfind_package(PythonInterp 3)
18*35238bceSAndroid Build Coastguard Worker
19*35238bceSAndroid Build Coastguard Worker# dEQP Target.
20*35238bceSAndroid Build Coastguard Workerset(DEQP_TARGET "default" CACHE STRING "dEQP Target (default, android...)")
21*35238bceSAndroid Build Coastguard Worker
22*35238bceSAndroid Build Coastguard Workerif (DEFINED DEQP_TARGET_TOOLCHAIN)
23*35238bceSAndroid Build Coastguard Worker	# \note Toolchain must be included before project() command
24*35238bceSAndroid Build Coastguard Worker	include(targets/${DEQP_TARGET}/${DEQP_TARGET_TOOLCHAIN}.cmake NO_POLICY_SCOPE)
25*35238bceSAndroid Build Coastguard Workerendif ()
26*35238bceSAndroid Build Coastguard Worker
27*35238bceSAndroid Build Coastguard Workerproject(dEQP-Core-${DEQP_TARGET})
28*35238bceSAndroid Build Coastguard Worker
29*35238bceSAndroid Build Coastguard Workerinclude(framework/delibs/cmake/Defs.cmake NO_POLICY_SCOPE)
30*35238bceSAndroid Build Coastguard Workerinclude(framework/delibs/cmake/CFlags.cmake)
31*35238bceSAndroid Build Coastguard Worker
32*35238bceSAndroid Build Coastguard Workeradd_definitions(-DDE_ASSERT_FAILURE_CALLBACK)
33*35238bceSAndroid Build Coastguard Worker
34*35238bceSAndroid Build Coastguard Worker# dEQP-specific configuration. Target file should override these.
35*35238bceSAndroid Build Coastguard Workerset(DEQP_TARGET_NAME		"UNKNOWN")		# Target name
36*35238bceSAndroid Build Coastguard Worker
37*35238bceSAndroid Build Coastguard Workerset(DEQP_GLES2_LIBRARIES	)				# GLESv2 libraries. If empty, run-time linking is used
38*35238bceSAndroid Build Coastguard Workerset(DEQP_GLES3_LIBRARIES	)				# GLESv3 libraries. If empty, run-time linking is used
39*35238bceSAndroid Build Coastguard Workerset(DEQP_EGL_LIBRARIES		)				# EGL libraries
40*35238bceSAndroid Build Coastguard Worker
41*35238bceSAndroid Build Coastguard Worker# Legacy APIs that don't use run-time loading
42*35238bceSAndroid Build Coastguard Workerset(DEQP_SUPPORT_GLES1		OFF)			# Is GLESv1 supported
43*35238bceSAndroid Build Coastguard Workerset(DEQP_GLES1_LIBRARIES	)				# GLESv1 libraries
44*35238bceSAndroid Build Coastguard Workerset(DEQP_SUPPORT_VG			OFF)			# Is OpenVG supported
45*35238bceSAndroid Build Coastguard Workerset(DEQP_VG_LIBRARIES		)				# VG libraries
46*35238bceSAndroid Build Coastguard Worker
47*35238bceSAndroid Build Coastguard Workerset(DEQP_SUPPORT_WGL		OFF)
48*35238bceSAndroid Build Coastguard Workerset(DEQP_SUPPORT_GLX		OFF)			# Is GLX supported \todo [2016-10-12 pyry] X11 specific - move to framework/platform/
49*35238bceSAndroid Build Coastguard Worker
50*35238bceSAndroid Build Coastguard Workerset(DEQP_PLATFORM_LIBRARIES	)				# Other platform libraries
51*35238bceSAndroid Build Coastguard Worker
52*35238bceSAndroid Build Coastguard Workerset(DEQP_PLATFORM_COPY_LIBRARIES	)		# Libraries / binaries that need to be copied to binary directory
53*35238bceSAndroid Build Coastguard Worker
54*35238bceSAndroid Build Coastguard Worker# Delibs include directories
55*35238bceSAndroid Build Coastguard Workerinclude_directories(
56*35238bceSAndroid Build Coastguard Worker	framework/delibs/debase
57*35238bceSAndroid Build Coastguard Worker	framework/delibs/decpp
58*35238bceSAndroid Build Coastguard Worker	framework/delibs/depool
59*35238bceSAndroid Build Coastguard Worker	framework/delibs/dethread
60*35238bceSAndroid Build Coastguard Worker	framework/delibs/deutil
61*35238bceSAndroid Build Coastguard Worker	framework/delibs/destream
62*35238bceSAndroid Build Coastguard Worker	)
63*35238bceSAndroid Build Coastguard Worker
64*35238bceSAndroid Build Coastguard Worker# Include target-specific definitions
65*35238bceSAndroid Build Coastguard Workerinclude(targets/${DEQP_TARGET}/${DEQP_TARGET}.cmake)
66*35238bceSAndroid Build Coastguard Worker
67*35238bceSAndroid Build Coastguard Worker# Handle target selection list.
68*35238bceSAndroid Build Coastguard Workerstring(STRIP "${SELECTED_BUILD_TARGETS}" TARGET_SELECTION_STRIPPED)
69*35238bceSAndroid Build Coastguard Workerif ("${TARGET_SELECTION_STRIPPED}" STREQUAL "" OR (NOT (DE_OS_IS_WIN32 OR DE_OS_IS_UNIX)))
70*35238bceSAndroid Build Coastguard Worker	set(MAYBE_EXCLUDE_FROM_ALL)
71*35238bceSAndroid Build Coastguard Workerelse ()
72*35238bceSAndroid Build Coastguard Worker	# If a non-empty target selection list is provided, exclude all subdirectories by default.
73*35238bceSAndroid Build Coastguard Worker	set(MAYBE_EXCLUDE_FROM_ALL EXCLUDE_FROM_ALL)
74*35238bceSAndroid Build Coastguard Worker
75*35238bceSAndroid Build Coastguard Worker	# Each target in the target selection list will be added as a dependency of a new fake target.
76*35238bceSAndroid Build Coastguard Worker	# The new fake target will be added as a dependency of the default build target.
77*35238bceSAndroid Build Coastguard Worker	string(REGEX REPLACE "[ \t\r\n]+" ";" TARGET_SELECTION_LIST "${TARGET_SELECTION_STRIPPED}")
78*35238bceSAndroid Build Coastguard Worker	add_custom_target(target_selection_list_target ALL)
79*35238bceSAndroid Build Coastguard Worker	add_dependencies(target_selection_list_target ${TARGET_SELECTION_LIST})
80*35238bceSAndroid Build Coastguard Workerendif ()
81*35238bceSAndroid Build Coastguard Worker
82*35238bceSAndroid Build Coastguard Worker# zlib
83*35238bceSAndroid Build Coastguard Workerfind_package(ZLIB)
84*35238bceSAndroid Build Coastguard Worker# dEQP CMake compatibility (as for libpng)
85*35238bceSAndroid Build Coastguard Workerset(ZLIB_INCLUDE_PATH ${ZLIB_INCLUDE_DIRS})
86*35238bceSAndroid Build Coastguard Workerset(ZLIB_LIBRARY ${ZLIB_LIBRARIES})
87*35238bceSAndroid Build Coastguard Worker
88*35238bceSAndroid Build Coastguard Workerif (NOT ZLIB_INCLUDE_PATH OR NOT ZLIB_LIBRARY)
89*35238bceSAndroid Build Coastguard Worker	message(STATUS "System version of zlib not found, using external/zlib")
90*35238bceSAndroid Build Coastguard Worker	add_subdirectory(external/zlib EXCLUDE_FROM_ALL)
91*35238bceSAndroid Build Coastguard Worker	# \note ZLIB_LIBRARY and ZLIB_INCLUDE_PATH are promoted from external/zlib/CMakeLists.txt
92*35238bceSAndroid Build Coastguard Workerendif ()
93*35238bceSAndroid Build Coastguard Worker
94*35238bceSAndroid Build Coastguard Workerif (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/external/renderdoc/src/renderdoc_app.h")
95*35238bceSAndroid Build Coastguard Worker	message(STATUS "Renderdoc header found, integration enabled")
96*35238bceSAndroid Build Coastguard Worker	set(DEQP_HAVE_RENDERDOC_HEADER 1)
97*35238bceSAndroid Build Coastguard Workerelse ()
98*35238bceSAndroid Build Coastguard Worker	message(STATUS "Renderdoc header not found, integration will not work")
99*35238bceSAndroid Build Coastguard Workerendif ()
100*35238bceSAndroid Build Coastguard Worker
101*35238bceSAndroid Build Coastguard Workerinclude_directories(${ZLIB_INCLUDE_PATH})
102*35238bceSAndroid Build Coastguard Worker
103*35238bceSAndroid Build Coastguard Worker# libpng
104*35238bceSAndroid Build Coastguard Worker#
105*35238bceSAndroid Build Coastguard Worker# The FindPNG module defines PNG_INCLUDE_DIRS and PNG_LIBRARIES. But dEQP's
106*35238bceSAndroid Build Coastguard Worker# CMake files expect the non-standard PNG_INCLUDE_PATH and PNG_LIBRARY. Set the
107*35238bceSAndroid Build Coastguard Worker# non-standard variables here to retain compatibility with dEQP's existing
108*35238bceSAndroid Build Coastguard Worker# CMake files.
109*35238bceSAndroid Build Coastguard Workerfind_package(PNG)
110*35238bceSAndroid Build Coastguard Workerset(PNG_INCLUDE_PATH ${PNG_INCLUDE_DIRS})
111*35238bceSAndroid Build Coastguard Workerset(PNG_LIBRARY ${PNG_LIBRARIES})
112*35238bceSAndroid Build Coastguard Worker
113*35238bceSAndroid Build Coastguard Workerif (NOT PNG_INCLUDE_PATH OR NOT PNG_LIBRARY)
114*35238bceSAndroid Build Coastguard Worker	message(STATUS "System version of libpng not found, using external/libpng")
115*35238bceSAndroid Build Coastguard Worker	add_subdirectory(external/libpng EXCLUDE_FROM_ALL)
116*35238bceSAndroid Build Coastguard Worker	# \note PNG_LIBRARY and PNG_INCLUDE_PATH are promoted from external/libpng/CMakeLists.txt
117*35238bceSAndroid Build Coastguard Workerendif ()
118*35238bceSAndroid Build Coastguard Worker
119*35238bceSAndroid Build Coastguard Worker# spirv-tools
120*35238bceSAndroid Build Coastguard Workeradd_subdirectory(external/spirv-tools EXCLUDE_FROM_ALL)
121*35238bceSAndroid Build Coastguard Worker
122*35238bceSAndroid Build Coastguard Worker# glslang
123*35238bceSAndroid Build Coastguard Workeradd_subdirectory(external/glslang EXCLUDE_FROM_ALL)
124*35238bceSAndroid Build Coastguard Worker
125*35238bceSAndroid Build Coastguard Worker# spirv-headers
126*35238bceSAndroid Build Coastguard Workerset(SPIRV_INCLUDE_PATH "${PROJECT_SOURCE_DIR}/external/spirv-headers/src/include")
127*35238bceSAndroid Build Coastguard Workerif (NOT EXISTS ${SPIRV_INCLUDE_PATH})
128*35238bceSAndroid Build Coastguard Worker	message(FATAL_ERROR "SPIR-V headers not found, please run external/fetch_sources.py")
129*35238bceSAndroid Build Coastguard Workerendif()
130*35238bceSAndroid Build Coastguard Workerinclude_directories(${SPIRV_INCLUDE_PATH})
131*35238bceSAndroid Build Coastguard Worker
132*35238bceSAndroid Build Coastguard Worker# Amber
133*35238bceSAndroid Build Coastguard Workeradd_subdirectory(external/amber EXCLUDE_FROM_ALL)
134*35238bceSAndroid Build Coastguard Workerinclude_directories(external/amber)
135*35238bceSAndroid Build Coastguard Worker
136*35238bceSAndroid Build Coastguard Worker# jsoncpp
137*35238bceSAndroid Build Coastguard Workeradd_subdirectory(external/jsoncpp EXCLUDE_FROM_ALL)
138*35238bceSAndroid Build Coastguard Workerinclude_directories(external/jsoncpp/src/include)
139*35238bceSAndroid Build Coastguard Worker
140*35238bceSAndroid Build Coastguard Worker# RenderDoc API
141*35238bceSAndroid Build Coastguard Workerinclude_directories(external/renderdoc/src)
142*35238bceSAndroid Build Coastguard Worker
143*35238bceSAndroid Build Coastguard Worker# Vulkan video support libraries
144*35238bceSAndroid Build Coastguard Workerif (DE_OS_IS_WIN32 OR DE_OS_IS_UNIX)
145*35238bceSAndroid Build Coastguard Worker   # Some of the parsing / codec code is used from here.
146*35238bceSAndroid Build Coastguard Worker   add_subdirectory(external/nvidia-video-samples EXCLUDE_FROM_ALL)
147*35238bceSAndroid Build Coastguard Workerendif()
148*35238bceSAndroid Build Coastguard Worker
149*35238bceSAndroid Build Coastguard Workerinclude_directories(${PNG_INCLUDE_PATH})
150*35238bceSAndroid Build Coastguard Worker
151*35238bceSAndroid Build Coastguard Worker# DRM (Direct Rendering Manager) Headers
152*35238bceSAndroid Build Coastguard Workerfind_path(XF86DRM_H_PATH NAMES xf86drm.h)
153*35238bceSAndroid Build Coastguard Workerfind_path(DRM_H_PATH NAMES drm.h PATH_SUFFIXES libdrm drm)
154*35238bceSAndroid Build Coastguard Worker
155*35238bceSAndroid Build Coastguard Workerif (XF86DRM_H_PATH AND DRM_H_PATH)
156*35238bceSAndroid Build Coastguard Worker	include_directories(${XF86DRM_H_PATH})
157*35238bceSAndroid Build Coastguard Worker	include_directories(${DRM_H_PATH})
158*35238bceSAndroid Build Coastguard Worker	set(DEQP_SUPPORT_DRM ON CACHE BOOL "Build code requiring the Linux/Unix Direct Rendering Manager")
159*35238bceSAndroid Build Coastguard Worker	mark_as_advanced(XF86DRM_H_PATH)
160*35238bceSAndroid Build Coastguard Worker	mark_as_advanced(DRM_H_PATH)
161*35238bceSAndroid Build Coastguard Workerelse ()
162*35238bceSAndroid Build Coastguard Worker	set(DEQP_SUPPORT_DRM OFF CACHE BOOL "Build code requiring the Linux/Unix Direct Rendering Manager")
163*35238bceSAndroid Build Coastguard Workerendif ()
164*35238bceSAndroid Build Coastguard Worker
165*35238bceSAndroid Build Coastguard Workermessage(STATUS "DEQP_TARGET_NAME        = ${DEQP_TARGET_NAME}")
166*35238bceSAndroid Build Coastguard Workermessage(STATUS "DEQP_SUPPORT_GLES1      = ${DEQP_SUPPORT_GLES1}")
167*35238bceSAndroid Build Coastguard Workermessage(STATUS "DEQP_GLES1_LIBRARIES    = ${DEQP_GLES1_LIBRARIES}")
168*35238bceSAndroid Build Coastguard Workermessage(STATUS "DEQP_GLES2_LIBRARIES    = ${DEQP_GLES2_LIBRARIES}")
169*35238bceSAndroid Build Coastguard Workermessage(STATUS "DEQP_GLES3_LIBRARIES    = ${DEQP_GLES3_LIBRARIES}")
170*35238bceSAndroid Build Coastguard Workermessage(STATUS "DEQP_GLES31_LIBRARIES   = ${DEQP_GLES31_LIBRARIES}")
171*35238bceSAndroid Build Coastguard Workermessage(STATUS "DEQP_GLES32_LIBRARIES   = ${DEQP_GLES32_LIBRARIES}")
172*35238bceSAndroid Build Coastguard Workermessage(STATUS "DEQP_SUPPORT_VG         = ${DEQP_SUPPORT_VG}")
173*35238bceSAndroid Build Coastguard Workermessage(STATUS "DEQP_VG_LIBRARIES       = ${DEQP_VG_LIBRARIES}")
174*35238bceSAndroid Build Coastguard Workermessage(STATUS "DEQP_EGL_LIBRARIES      = ${DEQP_EGL_LIBRARIES}")
175*35238bceSAndroid Build Coastguard Workermessage(STATUS "DEQP_PLATFORM_LIBRARIES = ${DEQP_PLATFORM_LIBRARIES}")
176*35238bceSAndroid Build Coastguard Workermessage(STATUS "DEQP_SUPPORT_DRM        = ${DEQP_SUPPORT_DRM}")
177*35238bceSAndroid Build Coastguard Worker
178*35238bceSAndroid Build Coastguard Worker# Defines
179*35238bceSAndroid Build Coastguard Workeradd_definitions(-DDEQP_TARGET_NAME="${DEQP_TARGET_NAME}")
180*35238bceSAndroid Build Coastguard Worker
181*35238bceSAndroid Build Coastguard Worker# Entry points loaded directly by linking to libGL*?
182*35238bceSAndroid Build Coastguard Workerif (DEFINED DEQP_GLES2_LIBRARIES AND GLES_ALLOW_DIRECT_LINK)
183*35238bceSAndroid Build Coastguard Worker	add_definitions(-DDEQP_GLES2_DIRECT_LINK=1)
184*35238bceSAndroid Build Coastguard Workerendif ()
185*35238bceSAndroid Build Coastguard Worker
186*35238bceSAndroid Build Coastguard Workerif (DEFINED DEQP_GLES3_LIBRARIES AND GLES_ALLOW_DIRECT_LINK)
187*35238bceSAndroid Build Coastguard Worker	add_definitions(-DDEQP_GLES3_DIRECT_LINK=1)
188*35238bceSAndroid Build Coastguard Workerendif ()
189*35238bceSAndroid Build Coastguard Worker
190*35238bceSAndroid Build Coastguard Workerif (DEFINED DEQP_GLES31_LIBRARIES AND GLES_ALLOW_DIRECT_LINK)
191*35238bceSAndroid Build Coastguard Worker	add_definitions(-DDEQP_GLES31_DIRECT_LINK=1)
192*35238bceSAndroid Build Coastguard Workerendif ()
193*35238bceSAndroid Build Coastguard Worker
194*35238bceSAndroid Build Coastguard Workerif (DEFINED DEQP_GLES32_LIBRARIES AND GLES_ALLOW_DIRECT_LINK)
195*35238bceSAndroid Build Coastguard Worker	add_definitions(-DDEQP_GLES32_DIRECT_LINK=1)
196*35238bceSAndroid Build Coastguard Workerendif ()
197*35238bceSAndroid Build Coastguard Worker
198*35238bceSAndroid Build Coastguard Workerif (DEFINED DEQP_EGL_LIBRARIES AND GLES_ALLOW_DIRECT_LINK)
199*35238bceSAndroid Build Coastguard Worker	add_definitions(-DDEQP_EGL_DIRECT_LINK=1)
200*35238bceSAndroid Build Coastguard Workerendif ()
201*35238bceSAndroid Build Coastguard Worker
202*35238bceSAndroid Build Coastguard Worker# Legacy APIs that don't support run-time loading
203*35238bceSAndroid Build Coastguard Workerif (DEQP_SUPPORT_GLES1)
204*35238bceSAndroid Build Coastguard Worker	add_definitions(-DDEQP_SUPPORT_GLES1=1)
205*35238bceSAndroid Build Coastguard Worker
206*35238bceSAndroid Build Coastguard Worker	if (NOT DEFINED DEQP_GLES1_LIBRARIES)
207*35238bceSAndroid Build Coastguard Worker		message(FATAL_ERROR "Run-time loading of GLES1 is not supported (DEQP_GLES1_LIBRARIES is not set)")
208*35238bceSAndroid Build Coastguard Worker	endif ()
209*35238bceSAndroid Build Coastguard Workerendif ()
210*35238bceSAndroid Build Coastguard Worker
211*35238bceSAndroid Build Coastguard Workerif (DEQP_SUPPORT_VG)
212*35238bceSAndroid Build Coastguard Worker	add_definitions(-DDEQP_SUPPORT_VG=1)
213*35238bceSAndroid Build Coastguard Worker
214*35238bceSAndroid Build Coastguard Worker	if (NOT DEFINED DEQP_VG_LIBRARIES)
215*35238bceSAndroid Build Coastguard Worker		message(FATAL_ERROR "Run-time loading of VG is not supported (DEQP_VG_LIBRARIES is not set)")
216*35238bceSAndroid Build Coastguard Worker	endif ()
217*35238bceSAndroid Build Coastguard Workerendif ()
218*35238bceSAndroid Build Coastguard Worker
219*35238bceSAndroid Build Coastguard Workerif (DEQP_SUPPORT_DRM)
220*35238bceSAndroid Build Coastguard Worker	add_definitions(-DDEQP_SUPPORT_DRM=1)
221*35238bceSAndroid Build Coastguard Workerelse ()
222*35238bceSAndroid Build Coastguard Worker	add_definitions(-DDEQP_SUPPORT_DRM=0)
223*35238bceSAndroid Build Coastguard Workerendif ()
224*35238bceSAndroid Build Coastguard Worker
225*35238bceSAndroid Build Coastguard Workerif (DE_COMPILER_IS_MSC)
226*35238bceSAndroid Build Coastguard Worker	# Don't nag about std::copy for example
227*35238bceSAndroid Build Coastguard Worker	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_SCL_SECURE_NO_WARNINGS")
228*35238bceSAndroid Build Coastguard Workerendif ()
229*35238bceSAndroid Build Coastguard Worker
230*35238bceSAndroid Build Coastguard Worker# Precompiled header macro. Parameters are source file list and filename for pch cpp file.
231*35238bceSAndroid Build Coastguard Workermacro(PCH SRCS PCHCPP)
232*35238bceSAndroid Build Coastguard Worker  if(MSVC AND CMAKE_GENERATOR MATCHES "^Visual Studio")
233*35238bceSAndroid Build Coastguard Worker    set(PCH_NAME "$(IntDir)\\pch.pch")
234*35238bceSAndroid Build Coastguard Worker    # make source files use/depend on PCH_NAME
235*35238bceSAndroid Build Coastguard Worker    set_source_files_properties(${${SRCS}} PROPERTIES COMPILE_FLAGS "/Yupch.h /FIpch.h /Fp${PCH_NAME}" OBJECT_DEPENDS "${PCH_NAME}")
236*35238bceSAndroid Build Coastguard Worker    # make PCHCPP file compile and generate PCH_NAME
237*35238bceSAndroid Build Coastguard Worker    set_source_files_properties(${PCHCPP} PROPERTIES COMPILE_FLAGS "/Ycpch.h /Fp${PCH_NAME}" OBJECT_OUTPUTS "${PCH_NAME}")
238*35238bceSAndroid Build Coastguard Worker    list(APPEND ${SRCS} "${PCHCPP}")
239*35238bceSAndroid Build Coastguard Worker  endif()
240*35238bceSAndroid Build Coastguard Workerendmacro(PCH)
241*35238bceSAndroid Build Coastguard Worker
242*35238bceSAndroid Build Coastguard Worker# delibs projects
243*35238bceSAndroid Build Coastguard Workeradd_subdirectory(framework/delibs/debase ${MAYBE_EXCLUDE_FROM_ALL})
244*35238bceSAndroid Build Coastguard Workeradd_subdirectory(framework/delibs/depool ${MAYBE_EXCLUDE_FROM_ALL})
245*35238bceSAndroid Build Coastguard Workeradd_subdirectory(framework/delibs/dethread ${MAYBE_EXCLUDE_FROM_ALL})
246*35238bceSAndroid Build Coastguard Workeradd_subdirectory(framework/delibs/destream ${MAYBE_EXCLUDE_FROM_ALL})
247*35238bceSAndroid Build Coastguard Workeradd_subdirectory(framework/delibs/deutil ${MAYBE_EXCLUDE_FROM_ALL})
248*35238bceSAndroid Build Coastguard Workeradd_subdirectory(framework/delibs/decpp ${MAYBE_EXCLUDE_FROM_ALL})
249*35238bceSAndroid Build Coastguard Worker
250*35238bceSAndroid Build Coastguard Worker# ExecServer
251*35238bceSAndroid Build Coastguard Workeradd_subdirectory(execserver ${MAYBE_EXCLUDE_FROM_ALL})
252*35238bceSAndroid Build Coastguard Worker
253*35238bceSAndroid Build Coastguard Worker# Executor framework and tools
254*35238bceSAndroid Build Coastguard Workerif (IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/executor)
255*35238bceSAndroid Build Coastguard Worker	add_subdirectory(executor ${MAYBE_EXCLUDE_FROM_ALL})
256*35238bceSAndroid Build Coastguard Workerendif ()
257*35238bceSAndroid Build Coastguard Worker
258*35238bceSAndroid Build Coastguard Worker# Test framework include directories
259*35238bceSAndroid Build Coastguard Workerinclude_directories(
260*35238bceSAndroid Build Coastguard Worker	framework/common
261*35238bceSAndroid Build Coastguard Worker	framework/qphelper
262*35238bceSAndroid Build Coastguard Worker	framework/opengl
263*35238bceSAndroid Build Coastguard Worker	framework/opengl/wrapper
264*35238bceSAndroid Build Coastguard Worker	framework/referencerenderer
265*35238bceSAndroid Build Coastguard Worker	framework/opengl/simplereference
266*35238bceSAndroid Build Coastguard Worker	framework/randomshaders
267*35238bceSAndroid Build Coastguard Worker	framework/egl
268*35238bceSAndroid Build Coastguard Worker	framework/egl/wrapper
269*35238bceSAndroid Build Coastguard Worker	framework/xexml
270*35238bceSAndroid Build Coastguard Worker	external/vulkancts/framework/vulkan
271*35238bceSAndroid Build Coastguard Worker	)
272*35238bceSAndroid Build Coastguard Worker
273*35238bceSAndroid Build Coastguard Workerif (DE_OS_IS_ANDROID OR DE_OS_IS_IOS)
274*35238bceSAndroid Build Coastguard Worker	# On Android deqp modules are compiled as libraries and linked into final .so
275*35238bceSAndroid Build Coastguard Worker	set(DEQP_MODULE_LIBRARIES )
276*35238bceSAndroid Build Coastguard Worker	set(DEQP_MODULE_ENTRY_POINTS )
277*35238bceSAndroid Build Coastguard Workerendif ()
278*35238bceSAndroid Build Coastguard Worker
279*35238bceSAndroid Build Coastguard Worker# Macro for adding targets for copying binaries (usually target libraries) to the target destination dir
280*35238bceSAndroid Build Coastguard Workermacro (target_copy_files target dep_name files)
281*35238bceSAndroid Build Coastguard Worker	if (NOT "${files}" STREQUAL "")
282*35238bceSAndroid Build Coastguard Worker		set(COPY_TARGETS )
283*35238bceSAndroid Build Coastguard Worker		foreach (SRCNAME ${files})
284*35238bceSAndroid Build Coastguard Worker			get_filename_component(BASENAME ${SRCNAME} NAME)
285*35238bceSAndroid Build Coastguard Worker			set(DSTNAME "${CMAKE_CURRENT_BINARY_DIR}/${BASENAME}")
286*35238bceSAndroid Build Coastguard Worker			add_custom_command(OUTPUT ${DSTNAME}
287*35238bceSAndroid Build Coastguard Worker							   COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SRCNAME} ${DSTNAME})
288*35238bceSAndroid Build Coastguard Worker			set(COPY_TARGETS ${COPY_TARGETS} ${DSTNAME})
289*35238bceSAndroid Build Coastguard Worker		endforeach ()
290*35238bceSAndroid Build Coastguard Worker
291*35238bceSAndroid Build Coastguard Worker		add_custom_target(${dep_name} ALL DEPENDS ${COPY_TARGETS})
292*35238bceSAndroid Build Coastguard Worker		add_dependencies(${target} ${dep_name})
293*35238bceSAndroid Build Coastguard Worker	endif ()
294*35238bceSAndroid Build Coastguard Workerendmacro (target_copy_files)
295*35238bceSAndroid Build Coastguard Worker
296*35238bceSAndroid Build Coastguard Workerset(MODULE_LIB_TARGET_POSTFIX	"-package")
297*35238bceSAndroid Build Coastguard Workerset(MODULE_DATA_TARGET_POSTFIX	"-data")
298*35238bceSAndroid Build Coastguard Worker
299*35238bceSAndroid Build Coastguard Worker# Macro for adding dEQP module
300*35238bceSAndroid Build Coastguard Worker# This adds 3 targets:
301*35238bceSAndroid Build Coastguard Worker#	${MODULE_NAME}-package:		Static library that contains all SRCS and links to LIBS
302*35238bceSAndroid Build Coastguard Worker#	${MODULE_NAME}-data:		Custom target that is used for data file copies
303*35238bceSAndroid Build Coastguard Worker#	${MODULE_NAME}:				Executable binary (if supported by the platform)
304*35238bceSAndroid Build Coastguard Workermacro (add_deqp_module MODULE_NAME SRCS LIBS EXECLIBS ENTRY)
305*35238bceSAndroid Build Coastguard Worker
306*35238bceSAndroid Build Coastguard Worker	# Library target
307*35238bceSAndroid Build Coastguard Worker	add_library("${MODULE_NAME}${MODULE_LIB_TARGET_POSTFIX}" STATIC ${SRCS})
308*35238bceSAndroid Build Coastguard Worker	target_link_libraries("${MODULE_NAME}${MODULE_LIB_TARGET_POSTFIX}" ${LIBS})
309*35238bceSAndroid Build Coastguard Worker
310*35238bceSAndroid Build Coastguard Worker	set(DEQP_MODULE_LIBRARIES		${DEQP_MODULE_LIBRARIES} "${MODULE_NAME}${MODULE_LIB_TARGET_POSTFIX}")
311*35238bceSAndroid Build Coastguard Worker	set(DEQP_MODULE_ENTRY_POINTS	${DEQP_MODULE_ENTRY_POINTS} "${CMAKE_CURRENT_SOURCE_DIR}/${ENTRY}")
312*35238bceSAndroid Build Coastguard Worker
313*35238bceSAndroid Build Coastguard Worker	# Forward to parent scope
314*35238bceSAndroid Build Coastguard Worker	set(DEQP_MODULE_LIBRARIES		${DEQP_MODULE_LIBRARIES} PARENT_SCOPE)
315*35238bceSAndroid Build Coastguard Worker	set(DEQP_MODULE_ENTRY_POINTS	${DEQP_MODULE_ENTRY_POINTS} PARENT_SCOPE)
316*35238bceSAndroid Build Coastguard Worker
317*35238bceSAndroid Build Coastguard Worker	if (NOT DE_OS_IS_ANDROID AND NOT DE_OS_IS_IOS)
318*35238bceSAndroid Build Coastguard Worker		# Executable target
319*35238bceSAndroid Build Coastguard Worker		add_executable(${MODULE_NAME} ${PROJECT_SOURCE_DIR}/framework/platform/tcuMain.cpp ${ENTRY})
320*35238bceSAndroid Build Coastguard Worker		target_link_libraries(${MODULE_NAME} PUBLIC "${EXECLIBS}" "${MODULE_NAME}${MODULE_LIB_TARGET_POSTFIX}")
321*35238bceSAndroid Build Coastguard Worker		target_copy_files(${MODULE_NAME} platform-libs-${MODULE_NAME} "${DEQP_PLATFORM_COPY_LIBRARIES}")
322*35238bceSAndroid Build Coastguard Worker	endif ()
323*35238bceSAndroid Build Coastguard Worker
324*35238bceSAndroid Build Coastguard Worker	# Data file target
325*35238bceSAndroid Build Coastguard Worker	add_custom_target("${MODULE_NAME}${MODULE_DATA_TARGET_POSTFIX}")
326*35238bceSAndroid Build Coastguard Worker	add_dependencies("${MODULE_NAME}${MODULE_LIB_TARGET_POSTFIX}" "${MODULE_NAME}${MODULE_DATA_TARGET_POSTFIX}")
327*35238bceSAndroid Build Coastguard Workerendmacro (add_deqp_module)
328*35238bceSAndroid Build Coastguard Worker
329*35238bceSAndroid Build Coastguard Worker# Macro add_deqp_module_skip_android does not add module to DEQP_MODULE_LIBRARIES, so that it is not created on Android.
330*35238bceSAndroid Build Coastguard Worker# It's a temporary solution to disable Vulkan SC tests on Android, because later defined deqp library
331*35238bceSAndroid Build Coastguard Worker# uses both deqp-vk and deqp-vksc and this means that definitions CTS_USES_VULKAN and CTS_USES_VULKANSC
332*35238bceSAndroid Build Coastguard Worker# exist in deqp library at the same time which causes code to not compile.
333*35238bceSAndroid Build Coastguard Workermacro (add_deqp_module_skip_android MODULE_NAME SRCS LIBS EXECLIBS ENTRY)
334*35238bceSAndroid Build Coastguard Worker
335*35238bceSAndroid Build Coastguard Worker	# Library target
336*35238bceSAndroid Build Coastguard Worker	add_library("${MODULE_NAME}${MODULE_LIB_TARGET_POSTFIX}" STATIC ${SRCS})
337*35238bceSAndroid Build Coastguard Worker	target_link_libraries("${MODULE_NAME}${MODULE_LIB_TARGET_POSTFIX}" ${LIBS})
338*35238bceSAndroid Build Coastguard Worker
339*35238bceSAndroid Build Coastguard Worker	if (NOT DE_OS_IS_ANDROID AND NOT DE_OS_IS_IOS)
340*35238bceSAndroid Build Coastguard Worker		# Executable target
341*35238bceSAndroid Build Coastguard Worker		add_executable(${MODULE_NAME} ${PROJECT_SOURCE_DIR}/framework/platform/tcuMain.cpp ${ENTRY})
342*35238bceSAndroid Build Coastguard Worker		target_link_libraries(${MODULE_NAME} PUBLIC "${EXECLIBS}" "${MODULE_NAME}${MODULE_LIB_TARGET_POSTFIX}")
343*35238bceSAndroid Build Coastguard Worker		target_copy_files(${MODULE_NAME} platform-libs-${MODULE_NAME} "${DEQP_PLATFORM_COPY_LIBRARIES}")
344*35238bceSAndroid Build Coastguard Worker	endif ()
345*35238bceSAndroid Build Coastguard Worker
346*35238bceSAndroid Build Coastguard Worker	# Data file target
347*35238bceSAndroid Build Coastguard Worker	add_custom_target("${MODULE_NAME}${MODULE_DATA_TARGET_POSTFIX}")
348*35238bceSAndroid Build Coastguard Worker	add_dependencies("${MODULE_NAME}${MODULE_LIB_TARGET_POSTFIX}" "${MODULE_NAME}${MODULE_DATA_TARGET_POSTFIX}")
349*35238bceSAndroid Build Coastguard Workerendmacro (add_deqp_module_skip_android)
350*35238bceSAndroid Build Coastguard Worker
351*35238bceSAndroid Build Coastguard Worker# Macro for adding data dirs to module
352*35238bceSAndroid Build Coastguard Workermacro (add_data_dir MODULE_NAME SRC_DIR DST_DIR)
353*35238bceSAndroid Build Coastguard Worker	if (DE_OS_IS_WIN32 OR DE_OS_IS_UNIX OR DE_OS_IS_OSX OR DE_OS_IS_QNX)
354*35238bceSAndroid Build Coastguard Worker		add_custom_command(TARGET "${MODULE_NAME}${MODULE_DATA_TARGET_POSTFIX}" POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/${SRC_DIR} ${CMAKE_CURRENT_BINARY_DIR}/${DST_DIR})
355*35238bceSAndroid Build Coastguard Worker
356*35238bceSAndroid Build Coastguard Worker	elseif (DE_OS_IS_ANDROID)
357*35238bceSAndroid Build Coastguard Worker		add_custom_command(TARGET "${MODULE_NAME}${MODULE_DATA_TARGET_POSTFIX}" POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/${SRC_DIR} ${CMAKE_BINARY_DIR}/assets/${DST_DIR})
358*35238bceSAndroid Build Coastguard Worker
359*35238bceSAndroid Build Coastguard Worker	elseif (DE_OS_IS_IOS)
360*35238bceSAndroid Build Coastguard Worker		add_custom_command(TARGET "${MODULE_NAME}${MODULE_DATA_TARGET_POSTFIX}" POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/${SRC_DIR} ${CMAKE_BINARY_DIR}/\${CONFIGURATION}\${EFFECTIVE_PLATFORM_NAME}/deqp.app/${DST_DIR})
361*35238bceSAndroid Build Coastguard Worker	endif ()
362*35238bceSAndroid Build Coastguard Workerendmacro (add_data_dir)
363*35238bceSAndroid Build Coastguard Worker
364*35238bceSAndroid Build Coastguard Worker# Macro for adding individual data files to module
365*35238bceSAndroid Build Coastguard Workermacro (add_data_file MODULE_NAME SRC_FILE DST_FILE)
366*35238bceSAndroid Build Coastguard Worker	if (DE_OS_IS_WIN32 OR DE_OS_IS_UNIX OR DE_OS_IS_OSX OR DE_OS_IS_QNX)
367*35238bceSAndroid Build Coastguard Worker		add_custom_command(TARGET "${MODULE_NAME}${MODULE_DATA_TARGET_POSTFIX}" POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/${SRC_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${DST_FILE})
368*35238bceSAndroid Build Coastguard Worker
369*35238bceSAndroid Build Coastguard Worker	elseif (DE_OS_IS_ANDROID)
370*35238bceSAndroid Build Coastguard Worker		add_custom_command(TARGET "${MODULE_NAME}${MODULE_DATA_TARGET_POSTFIX}" POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/${SRC_FILE} ${CMAKE_BINARY_DIR}/assets/${DST_FILE})
371*35238bceSAndroid Build Coastguard Worker
372*35238bceSAndroid Build Coastguard Worker	elseif (DE_OS_IS_IOS)
373*35238bceSAndroid Build Coastguard Worker		add_custom_command(TARGET "${MODULE_NAME}${MODULE_DATA_TARGET_POSTFIX}" POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/${SRC_FILE} ${CMAKE_BINARY_DIR}/\${CONFIGURATION}\${EFFECTIVE_PLATFORM_NAME}/deqp.app/${DST_FILE})
374*35238bceSAndroid Build Coastguard Worker	endif ()
375*35238bceSAndroid Build Coastguard Workerendmacro (add_data_file)
376*35238bceSAndroid Build Coastguard Worker
377*35238bceSAndroid Build Coastguard Workeradd_subdirectory(framework ${MAYBE_EXCLUDE_FROM_ALL})
378*35238bceSAndroid Build Coastguard Workeradd_subdirectory(external/vulkancts/framework/vulkan ${MAYBE_EXCLUDE_FROM_ALL})
379*35238bceSAndroid Build Coastguard Worker
380*35238bceSAndroid Build Coastguard Workerif (DE_COMPILER_IS_MSC)
381*35238bceSAndroid Build Coastguard Worker	add_compile_options(/bigobj) # Required by glsBuiltinPrecisionTests.cpp
382*35238bceSAndroid Build Coastguard Workerendif ()
383*35238bceSAndroid Build Coastguard Worker
384*35238bceSAndroid Build Coastguard Workeradd_subdirectory(modules ${MAYBE_EXCLUDE_FROM_ALL})
385*35238bceSAndroid Build Coastguard Workeradd_subdirectory(external/vulkancts/modules/vulkan ${MAYBE_EXCLUDE_FROM_ALL})
386*35238bceSAndroid Build Coastguard Workeradd_subdirectory(external/vulkancts/vkscserver ${MAYBE_EXCLUDE_FROM_ALL})
387*35238bceSAndroid Build Coastguard Workeradd_subdirectory(external/vulkancts/vkscpc ${MAYBE_EXCLUDE_FROM_ALL})
388*35238bceSAndroid Build Coastguard Workeradd_subdirectory(external/openglcts ${MAYBE_EXCLUDE_FROM_ALL})
389*35238bceSAndroid Build Coastguard Worker
390*35238bceSAndroid Build Coastguard Worker# Single-binary targets
391*35238bceSAndroid Build Coastguard Workerif (DE_OS_IS_ANDROID)
392*35238bceSAndroid Build Coastguard Worker	include_directories(executor)
393*35238bceSAndroid Build Coastguard Worker	include_directories(${PROJECT_BINARY_DIR}/external/vulkancts/framework/vulkan)
394*35238bceSAndroid Build Coastguard Worker
395*35238bceSAndroid Build Coastguard Worker	set(DEQP_SRCS
396*35238bceSAndroid Build Coastguard Worker		framework/platform/android/tcuAndroidMain.cpp
397*35238bceSAndroid Build Coastguard Worker		framework/platform/android/tcuAndroidJNI.cpp
398*35238bceSAndroid Build Coastguard Worker		framework/platform/android/tcuAndroidPlatformCapabilityQueryJNI.cpp
399*35238bceSAndroid Build Coastguard Worker		framework/platform/android/tcuTestLogParserJNI.cpp
400*35238bceSAndroid Build Coastguard Worker		${DEQP_MODULE_ENTRY_POINTS}
401*35238bceSAndroid Build Coastguard Worker		)
402*35238bceSAndroid Build Coastguard Worker
403*35238bceSAndroid Build Coastguard Worker	set(DEQP_LIBS
404*35238bceSAndroid Build Coastguard Worker		tcutil-platform
405*35238bceSAndroid Build Coastguard Worker		xecore
406*35238bceSAndroid Build Coastguard Worker		${DEQP_MODULE_LIBRARIES}
407*35238bceSAndroid Build Coastguard Worker		)
408*35238bceSAndroid Build Coastguard Worker
409*35238bceSAndroid Build Coastguard Worker	add_library(deqp SHARED ${DEQP_SRCS})
410*35238bceSAndroid Build Coastguard Worker	target_link_libraries(deqp ${DEQP_LIBS})
411*35238bceSAndroid Build Coastguard Worker
412*35238bceSAndroid Build Coastguard Worker	# Separate out the debug information because it's enormous
413*35238bceSAndroid Build Coastguard Worker	add_custom_command(TARGET deqp POST_BUILD
414*35238bceSAndroid Build Coastguard Worker		COMMAND ${CMAKE_STRIP} --only-keep-debug -o $<TARGET_FILE:deqp>.debug $<TARGET_FILE:deqp>
415*35238bceSAndroid Build Coastguard Worker		COMMAND ${CMAKE_STRIP} -g $<TARGET_FILE:deqp>)
416*35238bceSAndroid Build Coastguard Worker
417*35238bceSAndroid Build Coastguard Worker	# Needed by OpenGL CTS that defines its own activity but depends on
418*35238bceSAndroid Build Coastguard Worker	# common Android support code.
419*35238bceSAndroid Build Coastguard Worker	target_include_directories(deqp PRIVATE framework/platform/android)
420*35238bceSAndroid Build Coastguard Worker
421*35238bceSAndroid Build Coastguard Workerelseif (DE_OS_IS_IOS)
422*35238bceSAndroid Build Coastguard Worker	# Code sign identity
423*35238bceSAndroid Build Coastguard Worker	set(DEQP_IOS_CODE_SIGN_IDENTITY "drawElements" CACHE STRING "Code sign identity for iOS build")
424*35238bceSAndroid Build Coastguard Worker
425*35238bceSAndroid Build Coastguard Worker	set(MACOSX_BUNDLE_PRODUCT_NAME "\${PRODUCT_NAME}")
426*35238bceSAndroid Build Coastguard Worker	set(MACOSX_BUNDLE_GUI_IDENTIFIER "com.drawelements.\${PRODUCT_NAME:identifier}")
427*35238bceSAndroid Build Coastguard Worker
428*35238bceSAndroid Build Coastguard Worker	include_directories(framework/platform/ios)
429*35238bceSAndroid Build Coastguard Worker	set(TESTERCORE_SRC_FILES
430*35238bceSAndroid Build Coastguard Worker		framework/platform/ios/tcuEAGLView.h
431*35238bceSAndroid Build Coastguard Worker		framework/platform/ios/tcuEAGLView.m
432*35238bceSAndroid Build Coastguard Worker		framework/platform/ios/tcuIOSAppDelegate.h
433*35238bceSAndroid Build Coastguard Worker		framework/platform/ios/tcuIOSAppDelegate.m
434*35238bceSAndroid Build Coastguard Worker		framework/platform/ios/tcuIOSViewController.h
435*35238bceSAndroid Build Coastguard Worker		framework/platform/ios/tcuIOSViewController.m
436*35238bceSAndroid Build Coastguard Worker		framework/platform/ios/tcuIOSMain.m
437*35238bceSAndroid Build Coastguard Worker		)
438*35238bceSAndroid Build Coastguard Worker	set_source_files_properties(${TESTERCORE_SRC_FILES} COMPILE_FLAGS "-std=c99")
439*35238bceSAndroid Build Coastguard Worker
440*35238bceSAndroid Build Coastguard Worker	add_executable(deqp MACOSX_BUNDLE ${TESTERCORE_SRC_FILES} ${DEQP_MODULE_ENTRY_POINTS})
441*35238bceSAndroid Build Coastguard Worker	target_link_libraries(deqp tcutil-platform xscore ${DEQP_MODULE_LIBRARIES})
442*35238bceSAndroid Build Coastguard Worker	set_target_properties(deqp PROPERTIES XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2")
443*35238bceSAndroid Build Coastguard Worker	set_target_properties(deqp PROPERTIES XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer: ${DEQP_IOS_CODE_SIGN_IDENTITY}")
444*35238bceSAndroid Build Coastguard Workerendif ()
445*35238bceSAndroid Build Coastguard Worker
446*35238bceSAndroid Build Coastguard Workerif (DE_OS_IS_FUCHSIA)
447*35238bceSAndroid Build Coastguard Worker	# The default Fuchsia stack is small, so the size needs to be increased to at
448*35238bceSAndroid Build Coastguard Worker	# least 2**20 bytes, but 2**24 is chosen for safety.
449*35238bceSAndroid Build Coastguard Worker	set_target_properties(deqp-vk PROPERTIES LINK_FLAGS "-Wl,-z,stack-size=0x1000000")
450*35238bceSAndroid Build Coastguard Workerendif ()
451