3 cmake_minimum_required(VERSION 2.8)
6 set(DEQP_TARGET "default" CACHE STRING "dEQP Target (default, android...)")
8 if (DEFINED DEQP_TARGET_TOOLCHAIN)
9 # \note Toolchain must be included before project() command
10 include(targets/${DEQP_TARGET}/${DEQP_TARGET_TOOLCHAIN}.cmake NO_POLICY_SCOPE)
13 project(dEQP-Core-${DEQP_TARGET})
15 include(framework/delibs/cmake/Defs.cmake NO_POLICY_SCOPE)
16 include(framework/delibs/cmake/CFlags.cmake)
18 add_definitions(-DDE_ASSERT_FAILURE_CALLBACK)
20 # dEQP-specific configuration. Target file should override these.
21 set(DEQP_TARGET_NAME "UNKNOWN") # Target name
23 set(DEQP_GLES2_LIBRARIES ) # GLESv2 libraries. If empty, run-time linking is used
24 set(DEQP_GLES3_LIBRARIES ) # GLESv3 libraries. If empty, run-time linking is used
25 set(DEQP_EGL_LIBRARIES ) # EGL libraries
27 # Legacy APIs that don't use run-time loading
28 set(DEQP_SUPPORT_GLES1 OFF) # Is GLESv1 supported
29 set(DEQP_GLES1_LIBRARIES ) # GLESv1 libraries
30 set(DEQP_SUPPORT_VG OFF) # Is OpenVG supported
31 set(DEQP_VG_LIBRARIES ) # VG libraries
33 set(DEQP_SUPPORT_WGL OFF)
34 set(DEQP_SUPPORT_GLX OFF) # Is GLX supported \todo [2016-10-12 pyry] X11 specific - move to framework/platform/
36 set(DEQP_PLATFORM_LIBRARIES ) # Other platform libraries
38 set(DEQP_PLATFORM_COPY_LIBRARIES ) # Libraries / binaries that need to be copied to binary directory
40 # Delibs include directories
42 framework/delibs/debase
43 framework/delibs/decpp
44 framework/delibs/depool
45 framework/delibs/dethread
46 framework/delibs/deutil
47 framework/delibs/destream
50 # Include target-specific definitions
51 include(targets/${DEQP_TARGET}/${DEQP_TARGET}.cmake)
54 find_path(ZLIB_INCLUDE_PATH zlib.h)
55 find_library(ZLIB_LIBRARY z)
57 if (NOT ZLIB_INCLUDE_PATH OR NOT ZLIB_LIBRARY)
58 message(STATUS "System version of zlib not found, using external/zlib")
59 add_subdirectory(external/zlib)
60 # \note ZLIB_LIBRARY and ZLIB_INCLUDE_PATH are promoted from external/zlib/CMakeLists.txt
63 include_directories(${ZLIB_INCLUDE_PATH})
67 # The FindPNG module defines PNG_INCLUDE_DIRS and PNG_LIBRARIES. But dEQP's
68 # CMake files expect the non-standard PNG_INCLUDE_PATH and PNG_LIBRARY. Set the
69 # non-standard variables here to retain compatibility with dEQP's existing
72 set(PNG_INCLUDE_PATH ${PNG_INCLUDE_DIRS})
73 set(PNG_LIBRARY ${PNG_LIBRARIES})
75 if (NOT PNG_INCLUDE_PATH OR NOT PNG_LIBRARY)
76 message(STATUS "System version of libpng not found, using external/libpng")
77 add_subdirectory(external/libpng)
78 # \note PNG_LIBRARY and PNG_INCLUDE_PATH are promoted from external/libpng/CMakeLists.txt
82 add_subdirectory(external/glslang)
85 add_subdirectory(external/spirv-tools)
87 include_directories(${PNG_INCLUDE_PATH})
89 message(STATUS "DEQP_TARGET_NAME = ${DEQP_TARGET_NAME}")
90 message(STATUS "DEQP_SUPPORT_GLES1 = ${DEQP_SUPPORT_GLES1}")
91 message(STATUS "DEQP_GLES1_LIBRARIES = ${DEQP_GLES1_LIBRARIES}")
92 message(STATUS "DEQP_GLES2_LIBRARIES = ${DEQP_GLES2_LIBRARIES}")
93 message(STATUS "DEQP_GLES3_LIBRARIES = ${DEQP_GLES3_LIBRARIES}")
94 message(STATUS "DEQP_GLES31_LIBRARIES = ${DEQP_GLES31_LIBRARIES}")
95 message(STATUS "DEQP_GLES32_LIBRARIES = ${DEQP_GLES32_LIBRARIES}")
96 message(STATUS "DEQP_SUPPORT_VG = ${DEQP_SUPPORT_VG}")
97 message(STATUS "DEQP_VG_LIBRARIES = ${DEQP_VG_LIBRARIES}")
98 message(STATUS "DEQP_EGL_LIBRARIES = ${DEQP_EGL_LIBRARIES}")
99 message(STATUS "DEQP_PLATFORM_LIBRARIES = ${DEQP_PLATFORM_LIBRARIES}")
102 add_definitions(-DDEQP_TARGET_NAME="${DEQP_TARGET_NAME}")
104 # Entry points loaded directly by linking to libGL*?
105 if (DEFINED DEQP_GLES2_LIBRARIES)
106 add_definitions(-DDEQP_GLES2_DIRECT_LINK=1)
109 if (DEFINED DEQP_GLES3_LIBRARIES)
110 add_definitions(-DDEQP_GLES3_DIRECT_LINK=1)
113 if (DEFINED DEQP_GLES31_LIBRARIES)
114 add_definitions(-DDEQP_GLES31_DIRECT_LINK=1)
117 if (DEFINED DEQP_GLES32_LIBRARIES)
118 add_definitions(-DDEQP_GLES32_DIRECT_LINK=1)
121 if (DEFINED DEQP_EGL_LIBRARIES)
122 add_definitions(-DDEQP_EGL_DIRECT_LINK=1)
125 # Legacy APIs that don't support run-time loading
126 if (DEQP_SUPPORT_GLES1)
127 add_definitions(-DDEQP_SUPPORT_GLES1=1)
129 if (NOT DEFINED DEQP_GLES1_LIBRARIES)
130 message(FATAL_ERROR "Run-time loading of GLES1 is not supported (DEQP_GLES1_LIBRARIES is not set)")
135 add_definitions(-DDEQP_SUPPORT_VG=1)
137 if (NOT DEFINED DEQP_VG_LIBRARIES)
138 message(FATAL_ERROR "Run-time loading of VG is not supported (DEQP_VG_LIBRARIES is not set)")
142 if (DE_COMPILER_IS_MSC)
143 # Don't nag about std::copy for example
144 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_SCL_SECURE_NO_WARNINGS")
148 add_subdirectory(framework/delibs/debase)
149 add_subdirectory(framework/delibs/depool)
150 add_subdirectory(framework/delibs/dethread)
151 add_subdirectory(framework/delibs/destream)
152 add_subdirectory(framework/delibs/deutil)
153 add_subdirectory(framework/delibs/decpp)
156 add_subdirectory(execserver)
158 # Executor framework and tools
159 if (IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/executor)
160 add_subdirectory(executor)
163 # Test framework include directories
168 framework/opengl/wrapper
169 framework/referencerenderer
170 framework/opengl/simplereference
171 framework/randomshaders
173 framework/egl/wrapper
174 external/vulkancts/framework/vulkan
177 if (DE_OS_IS_ANDROID OR DE_OS_IS_IOS)
178 # On Android deqp modules are compiled as libraries and linked into final .so
179 set(DEQP_MODULE_LIBRARIES )
180 set(DEQP_MODULE_ENTRY_POINTS )
183 # Macro for adding targets for copying binaries (usually target libraries) to the target destination dir
184 macro (target_copy_files target dep_name files)
185 if (NOT "${files}" STREQUAL "")
187 foreach (SRCNAME ${files})
188 get_filename_component(BASENAME ${SRCNAME} NAME)
189 set(DSTNAME "${CMAKE_CURRENT_BINARY_DIR}/${BASENAME}")
190 add_custom_command(OUTPUT ${DSTNAME}
191 COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SRCNAME} ${DSTNAME})
192 set(COPY_TARGETS ${COPY_TARGETS} ${DSTNAME})
195 add_custom_target(${dep_name} ALL DEPENDS ${COPY_TARGETS})
196 add_dependencies(${target} ${dep_name})
198 endmacro (target_copy_files)
200 set(MODULE_LIB_TARGET_POSTFIX "-package")
201 set(MODULE_DATA_TARGET_POSTFIX "-data")
203 # Macro for adding dEQP module
204 # This adds 3 targets:
205 # ${MODULE_NAME}-package: Static library that contains all SRCS and links to LIBS
206 # ${MODULE_NAME}-data: Custom target that is used for data file copies
207 # ${MODULE_NAME}: Executable binary (if supported by the platform)
208 macro (add_deqp_module MODULE_NAME SRCS LIBS ENTRY)
211 add_library("${MODULE_NAME}${MODULE_LIB_TARGET_POSTFIX}" STATIC ${SRCS})
212 target_link_libraries("${MODULE_NAME}${MODULE_LIB_TARGET_POSTFIX}" ${LIBS})
214 set(DEQP_MODULE_LIBRARIES ${DEQP_MODULE_LIBRARIES} "${MODULE_NAME}${MODULE_LIB_TARGET_POSTFIX}")
215 set(DEQP_MODULE_ENTRY_POINTS ${DEQP_MODULE_ENTRY_POINTS} "${CMAKE_CURRENT_SOURCE_DIR}/${ENTRY}")
217 # Forward to parent scope
218 set(DEQP_MODULE_LIBRARIES ${DEQP_MODULE_LIBRARIES} PARENT_SCOPE)
219 set(DEQP_MODULE_ENTRY_POINTS ${DEQP_MODULE_ENTRY_POINTS} PARENT_SCOPE)
221 if (NOT DE_OS_IS_ANDROID AND NOT DE_OS_IS_IOS)
223 add_executable(${MODULE_NAME} ${PROJECT_SOURCE_DIR}/framework/platform/tcuMain.cpp ${ENTRY})
224 target_link_libraries(${MODULE_NAME} tcutil-platform "${MODULE_NAME}${MODULE_LIB_TARGET_POSTFIX}")
225 target_copy_files(${MODULE_NAME} platform-libs-${MODULE_NAME} "${DEQP_PLATFORM_COPY_LIBRARIES}")
229 add_custom_target("${MODULE_NAME}${MODULE_DATA_TARGET_POSTFIX}")
230 add_dependencies("${MODULE_NAME}${MODULE_LIB_TARGET_POSTFIX}" "${MODULE_NAME}${MODULE_DATA_TARGET_POSTFIX}")
231 endmacro (add_deqp_module)
233 # Macro for adding data dirs to module
234 macro (add_data_dir MODULE_NAME SRC_DIR DST_DIR)
235 if (DE_OS_IS_WIN32 OR DE_OS_IS_UNIX OR DE_OS_IS_OSX OR DE_OS_IS_QNX)
236 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})
238 elseif (DE_OS_IS_ANDROID)
239 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})
241 elseif (DE_OS_IS_IOS)
242 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})
244 endmacro (add_data_dir)
246 # Macro for adding individual data files to module
247 macro (add_data_file MODULE_NAME SRC_FILE DST_FILE)
248 if (DE_OS_IS_WIN32 OR DE_OS_IS_UNIX OR DE_OS_IS_OSX OR DE_OS_IS_QNX)
249 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})
251 elseif (DE_OS_IS_ANDROID)
252 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})
254 elseif (DE_OS_IS_IOS)
255 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})
257 endmacro (add_data_file)
259 add_subdirectory(framework)
260 add_subdirectory(external/vulkancts/framework/vulkan)
262 if (DE_COMPILER_IS_MSC)
263 add_compile_options(/bigobj) # Required by glsBuiltinPrecisionTests.cpp
266 add_subdirectory(modules)
267 add_subdirectory(external/vulkancts/modules/vulkan)
268 add_subdirectory(external/openglcts)
270 # Single-binary targets
271 if (DE_OS_IS_ANDROID)
272 include_directories(executor)
275 framework/platform/android/tcuAndroidMain.cpp
276 framework/platform/android/tcuAndroidJNI.cpp
277 framework/platform/android/tcuAndroidPlatformCapabilityQueryJNI.cpp
278 framework/platform/android/tcuTestLogParserJNI.cpp
279 ${DEQP_MODULE_ENTRY_POINTS}
285 ${DEQP_MODULE_LIBRARIES}
288 add_library(deqp SHARED ${DEQP_SRCS})
289 target_link_libraries(deqp ${DEQP_LIBS})
291 # Needed by OpenGL CTS that defines its own activity but depends on
292 # common Android support code.
293 target_include_directories(deqp PRIVATE framework/platform/android)
295 elseif (DE_OS_IS_IOS)
297 set(DEQP_IOS_CODE_SIGN_IDENTITY "drawElements" CACHE STRING "Code sign identity for iOS build")
299 set(MACOSX_BUNDLE_PRODUCT_NAME "\${PRODUCT_NAME}")
300 set(MACOSX_BUNDLE_GUI_IDENTIFIER "com.drawelements.\${PRODUCT_NAME:identifier}")
302 include_directories(framework/platform/ios)
303 set(TESTERCORE_SRC_FILES
304 framework/platform/ios/tcuEAGLView.h
305 framework/platform/ios/tcuEAGLView.m
306 framework/platform/ios/tcuIOSAppDelegate.h
307 framework/platform/ios/tcuIOSAppDelegate.m
308 framework/platform/ios/tcuIOSViewController.h
309 framework/platform/ios/tcuIOSViewController.m
310 framework/platform/ios/tcuIOSMain.m
312 set_source_files_properties(${TESTERCORE_SRC_FILES} COMPILE_FLAGS "-std=c99")
314 add_executable(deqp MACOSX_BUNDLE ${TESTERCORE_SRC_FILES} ${DEQP_MODULE_ENTRY_POINTS})
315 target_link_libraries(deqp tcutil-platform xscore ${DEQP_MODULE_LIBRARIES})
316 set_target_properties(deqp PROPERTIES XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2")
317 set_target_properties(deqp PROPERTIES XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer: ${DEQP_IOS_CODE_SIGN_IDENTITY}")