1# dEQP cmake file 2 3cmake_minimum_required(VERSION 2.6) 4 5# dEQP Target. 6set(DEQP_TARGET "default" CACHE STRING "dEQP Target (default, android...)") 7 8project(dEQP-Core-${DEQP_TARGET}) 9 10include(framework/delibs/cmake/Defs.cmake NO_POLICY_SCOPE) 11include(framework/delibs/cmake/CFlags.cmake) 12 13add_definitions(-DDE_ASSERT_FAILURE_CALLBACK) 14 15# dEQP-specific configuration. Target file should override these. 16set(DEQP_TARGET_NAME "UNKNOWN") # Target name 17 18set(DEQP_SUPPORT_GLES1 OFF) # Is GLESv1 supported 19set(DEQP_GLES1_LIBRARIES ) # GLESv1 libraries 20 21set(DEQP_SUPPORT_GLES2 OFF) # Is GLESv2 supported 22set(DEQP_GLES2_LIBRARIES ) # GLESv2 libraries. If empty, run-time linking is used 23 24set(DEQP_SUPPORT_GLES3 OFF) # Is GLESv3 supported 25set(DEQP_GLES3_LIBRARIES ) # GLESv3 libraries. If empty, run-time linking is used 26 27set(DEQP_SUPPORT_VG OFF) # Is VG supported 28set(DEQP_VG_LIBRARIES ) # VG libraries 29 30set(DEQP_SUPPORT_EGL OFF) # Is EGL supported 31set(DEQP_EGL_LIBRARIES ) # EGL libraries 32 33set(DEQP_SUPPORT_GLX OFF) # Is GLX supported 34set(DEQP_SUPPORT_WGL OFF) # Is WGL supported 35 36set(DEQP_PLATFORM_LIBRARIES ) # Other platform libraries 37 38set(DEQP_SUPPORT_OPENGL OFF) # Is OpenGL supported on platform 39 # \note OpenGL is always loaded on run-time 40 41set(DEQP_PLATFORM_COPY_LIBRARIES ) # Libraries / binaries that need to be copied to binary directory 42 43# Delibs include directories 44include_directories( 45 framework/delibs/debase 46 framework/delibs/decpp 47 framework/delibs/depool 48 framework/delibs/dethread 49 framework/delibs/deutil 50 framework/delibs/destream 51 ) 52 53# Include target-specific definitions 54include(targets/${DEQP_TARGET}/${DEQP_TARGET}.cmake) 55 56# zlib 57find_path(ZLIB_INCLUDE_PATH zlib.h) 58find_library(ZLIB_LIBRARY z) 59 60if (NOT ZLIB_INCLUDE_PATH OR NOT ZLIB_LIBRARY) 61 message(STATUS "System version of zlib not found, using external/zlib") 62 add_subdirectory(external/zlib) 63 # \note ZLIB_LIBRARY and ZLIB_INCLUDE_PATH are promoted from external/zlib/CMakeLists.txt 64endif () 65 66include_directories(${ZLIB_INCLUDE_PATH}) 67 68# libpng 69find_path(PNG_INCLUDE_PATH png.h) 70find_library(PNG_LIBRARY png) 71 72if (NOT PNG_INCLUDE_PATH OR NOT PNG_LIBRARY) 73 message(STATUS "System version of libpng not found, using external/libpng") 74 add_subdirectory(external/libpng) 75 # \note PNG_LIBRARY and PNG_INCLUDE_PATH are promoted from external/libpng/CMakeLists.txt 76endif () 77 78# glslang 79add_subdirectory(external/glslang) 80 81# spirv-tools 82add_subdirectory(external/spirv-tools) 83 84include_directories(${PNG_INCLUDE_PATH}) 85 86message(STATUS "DEQP_TARGET_NAME = ${DEQP_TARGET_NAME}") 87message(STATUS "DEQP_SUPPORT_GLES1 = ${DEQP_SUPPORT_GLES1}") 88message(STATUS "DEQP_GLES1_LIBRARIES = ${DEQP_GLES1_LIBRARIES}") 89message(STATUS "DEQP_SUPPORT_GLES2 = ${DEQP_SUPPORT_GLES2}") 90message(STATUS "DEQP_GLES2_LIBRARIES = ${DEQP_GLES2_LIBRARIES}") 91message(STATUS "DEQP_SUPPORT_GLES3 = ${DEQP_SUPPORT_GLES3}") 92message(STATUS "DEQP_GLES3_LIBRARIES = ${DEQP_GLES3_LIBRARIES}") 93message(STATUS "DEQP_SUPPORT_VG = ${DEQP_SUPPORT_VG}") 94message(STATUS "DEQP_VG_LIBRARIES = ${DEQP_VG_LIBRARIES}") 95message(STATUS "DEQP_SUPPORT_EGL = ${DEQP_SUPPORT_EGL}") 96message(STATUS "DEQP_EGL_LIBRARIES = ${DEQP_EGL_LIBRARIES}") 97message(STATUS "DEQP_SUPPORT_OPENGL = ${DEQP_SUPPORT_OPENGL}") 98message(STATUS "DEQP_PLATFORM_LIBRARIES = ${DEQP_PLATFORM_LIBRARIES}") 99message(STATUS "DEQP_SUPPORT_WGL = ${DEQP_SUPPORT_WGL}") 100message(STATUS "DEQP_SUPPORT_GLX = ${DEQP_SUPPORT_GLX}") 101 102# Defines 103add_definitions(-DDEQP_TARGET_NAME="${DEQP_TARGET_NAME}") 104 105if (DEQP_SUPPORT_GLES1) 106 add_definitions(-DDEQP_SUPPORT_GLES1=1) 107endif () 108 109if (DEQP_SUPPORT_GLES2) 110 add_definitions(-DDEQP_SUPPORT_GLES2=1) 111endif () 112 113if (DEQP_SUPPORT_GLES3) 114 add_definitions(-DDEQP_SUPPORT_GLES3=1) 115endif () 116 117if (DEQP_SUPPORT_VG) 118 add_definitions(-DDEQP_SUPPORT_VG=1) 119endif () 120 121if (DEQP_SUPPORT_EGL) 122 add_definitions(-DDEQP_SUPPORT_EGL=1) 123endif () 124 125if (DEQP_SUPPORT_OPENGL) 126 add_definitions(-DDEQP_SUPPORT_OPENGL=1) 127endif () 128 129if (DEQP_SUPPORT_WGL) 130 add_definitions(-DDEQP_SUPPORT_WGL=1) 131endif () 132 133if (DEQP_SUPPORT_GLX) 134 add_definitions(-DDEQP_SUPPORT_GLX=1) 135endif () 136 137# Check runtime linking support 138if (DEQP_SUPPORT_GLES1 AND NOT DEFINED DEQP_GLES1_LIBRARIES) 139 message(FATAL_ERROR "Run-time loading of GLES1 is not supported (DEQP_GLES1_LIBRARIES is not set)") 140endif () 141 142if (DEQP_SUPPORT_GLES2 AND NOT DEFINED DEQP_GLES2_LIBRARIES) 143 add_definitions(-DDEQP_GLES2_RUNTIME_LOAD=1) 144endif () 145 146if (DEQP_SUPPORT_GLES3 AND NOT DEFINED DEQP_GLES3_LIBRARIES) 147 add_definitions(-DDEQP_GLES3_RUNTIME_LOAD=1) 148endif () 149 150if (DEQP_SUPPORT_VG AND NOT DEFINED DEQP_VG_LIBRARIES) 151 message(FATAL_ERROR "Run-time loading of VG is not supported (DEQP_VG_LIBRARIES is not set)") 152endif () 153 154if (DEQP_SUPPORT_EGL AND NOT DEFINED DEQP_EGL_LIBRARIES) 155 add_definitions(-DDEQP_EGL_RUNTIME_LOAD=1) 156endif () 157 158# OpenGL is always loaded on run-time 159if (DEQP_SUPPORT_OPENGL) 160 add_definitions(-DDEQP_OPENGL_RUNTIME_LOAD=1) 161endif () 162 163if (DE_COMPILER_IS_MSC) 164 # Don't nag about std::copy for example 165 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_SCL_SECURE_NO_WARNINGS") 166endif () 167 168# delibs projects 169add_subdirectory(framework/delibs/debase) 170add_subdirectory(framework/delibs/depool) 171add_subdirectory(framework/delibs/dethread) 172add_subdirectory(framework/delibs/destream) 173add_subdirectory(framework/delibs/deutil) 174add_subdirectory(framework/delibs/decpp) 175 176# ExecServer 177add_subdirectory(execserver) 178 179# Executor framework and tools 180if (IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/executor) 181 add_subdirectory(executor) 182endif () 183 184# Test framework include directories 185include_directories( 186 framework/common 187 framework/qphelper 188 framework/opengl 189 framework/opengl/wrapper 190 framework/referencerenderer 191 framework/opengl/simplereference 192 framework/randomshaders 193 framework/egl 194 framework/egl/wrapper 195 external/vulkancts/framework/vulkan 196 ) 197 198if (DE_OS_IS_ANDROID OR DE_OS_IS_IOS) 199 # On Android deqp modules are compiled as libraries and linked into final .so 200 set(DEQP_MODULE_LIBRARIES ) 201 set(DEQP_MODULE_ENTRY_POINTS ) 202endif () 203 204if (DE_OS_IS_WIN32) 205 include_directories(framework/platform/win32) 206endif () 207 208# Macro for adding targets for copying binaries (usually target libraries) to the target destination dir 209macro (target_copy_files target dep_name files) 210 if (NOT "${files}" STREQUAL "") 211 set(COPY_TARGETS ) 212 foreach (SRCNAME ${files}) 213 get_filename_component(BASENAME ${SRCNAME} NAME) 214 set(DSTNAME "${CMAKE_CURRENT_BINARY_DIR}/${BASENAME}") 215 add_custom_command(OUTPUT ${DSTNAME} 216 COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SRCNAME} ${DSTNAME}) 217 set(COPY_TARGETS ${COPY_TARGETS} ${DSTNAME}) 218 endforeach () 219 220 add_custom_target(${dep_name} ALL DEPENDS ${COPY_TARGETS}) 221 add_dependencies(${target} ${dep_name}) 222 endif () 223endmacro (target_copy_files) 224 225# Macro for adding dEQP module 226macro (add_deqp_module MODULE_NAME SRCS LIBS ENTRY) 227 if (DE_OS_IS_ANDROID OR DE_OS_IS_IOS) 228 # Single-binary targets 229 add_library(${MODULE_NAME} STATIC ${SRCS}) 230 target_link_libraries(${MODULE_NAME} ${LIBS}) 231 232 set(DEQP_MODULE_LIBRARIES ${DEQP_MODULE_LIBRARIES} ${MODULE_NAME}) 233 set(DEQP_MODULE_ENTRY_POINTS ${DEQP_MODULE_ENTRY_POINTS} "${CMAKE_CURRENT_SOURCE_DIR}/${ENTRY}") 234 235 # Forward to parent scope 236 set(DEQP_MODULE_LIBRARIES ${DEQP_MODULE_LIBRARIES} PARENT_SCOPE) 237 set(DEQP_MODULE_ENTRY_POINTS ${DEQP_MODULE_ENTRY_POINTS} PARENT_SCOPE) 238 239 else () 240 # Separate binary per target 241 add_executable(${MODULE_NAME} ${CMAKE_SOURCE_DIR}/framework/platform/tcuMain.cpp ${ENTRY} ${SRCS}) 242 target_link_libraries(${MODULE_NAME} tcutil-platform ${LIBS}) 243 target_copy_files(${MODULE_NAME} platform-libs-${MODULE_NAME} "${DEQP_PLATFORM_COPY_LIBRARIES}") 244 endif () 245 246 # Data file target 247 add_custom_target(${MODULE_NAME}-data) 248 add_dependencies(${MODULE_NAME} ${MODULE_NAME}-data) 249endmacro (add_deqp_module) 250 251# Macro for adding data dirs to module 252macro (add_data_dir MODULE_NAME SRC_DIR DST_DIR) 253 if (DE_OS_IS_WIN32 OR DE_OS_IS_UNIX OR DE_OS_IS_OSX) 254 add_custom_command(TARGET ${MODULE_NAME}-data POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/${SRC_DIR} ${CMAKE_CURRENT_BINARY_DIR}/${DST_DIR}) 255 256 elseif (DE_OS_IS_ANDROID) 257 add_custom_command(TARGET ${MODULE_NAME}-data POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/${SRC_DIR} ${CMAKE_BINARY_DIR}/assets/${DST_DIR}) 258 259 elseif (DE_OS_IS_IOS) 260 add_custom_command(TARGET ${MODULE_NAME}-data 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}) 261 endif () 262endmacro (add_data_dir) 263 264# Macro for adding individual data files to module 265macro (add_data_file MODULE_NAME SRC_FILE DST_FILE) 266 if (DE_OS_IS_WIN32 OR DE_OS_IS_UNIX OR DE_OS_IS_OSX) 267 add_custom_command(TARGET ${MODULE_NAME}-data POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/${SRC_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${DST_FILE}) 268 269 elseif (DE_OS_IS_ANDROID) 270 add_custom_command(TARGET ${MODULE_NAME}-data POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/${SRC_FILE} ${CMAKE_BINARY_DIR}/assets/${DST_FILE}) 271 272 elseif (DE_OS_IS_IOS) 273 add_custom_command(TARGET ${MODULE_NAME}-data 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}) 274 endif () 275endmacro (add_data_file) 276 277add_subdirectory(framework) 278add_subdirectory(external/vulkancts/framework/vulkan) 279 280if (DE_COMPILER_IS_MSC) 281 add_compile_options(/bigobj) # Required by glsBuiltinPrecisionTests.cpp 282endif () 283 284add_subdirectory(modules) 285add_subdirectory(external/vulkancts/modules/vulkan) 286 287# Single-binary targets 288if (DE_OS_IS_ANDROID) 289 include_directories(executor) 290 291 add_library(deqp SHARED framework/platform/android/tcuAndroidMain.cpp framework/platform/android/tcuAndroidJNI.cpp framework/platform/android/tcuAndroidPlatformCapabilityQueryJNI.cpp framework/platform/android/tcuTestLogParserJNI.cpp ${DEQP_MODULE_ENTRY_POINTS}) 292 target_link_libraries(deqp tcutil-platform xecore ${DEQP_MODULE_LIBRARIES}) 293 294elseif (DE_OS_IS_IOS) 295 # Code sign identity 296 set(DEQP_IOS_CODE_SIGN_IDENTITY "drawElements" CACHE STRING "Code sign identity for iOS build") 297 298 set(MACOSX_BUNDLE_PRODUCT_NAME "\${PRODUCT_NAME}") 299 set(MACOSX_BUNDLE_GUI_IDENTIFIER "com.drawelements.\${PRODUCT_NAME:identifier}") 300 301 include_directories(framework/platform/ios) 302 set(TESTERCORE_SRC_FILES 303 framework/platform/ios/tcuEAGLView.h 304 framework/platform/ios/tcuEAGLView.m 305 framework/platform/ios/tcuIOSAppDelegate.h 306 framework/platform/ios/tcuIOSAppDelegate.m 307 framework/platform/ios/tcuIOSViewController.h 308 framework/platform/ios/tcuIOSViewController.m 309 framework/platform/ios/tcuIOSMain.m 310 ) 311 set_source_files_properties(${TESTERCORE_SRC_FILES} COMPILE_FLAGS "-std=c99") 312 313 add_executable(deqp MACOSX_BUNDLE ${TESTERCORE_SRC_FILES} ${DEQP_MODULE_ENTRY_POINTS}) 314 target_link_libraries(deqp tcutil-platform xscore ${DEQP_MODULE_LIBRARIES}) 315 set_target_properties(deqp PROPERTIES XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2") 316 set_target_properties(deqp PROPERTIES XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer: ${DEQP_IOS_CODE_SIGN_IDENTITY}") 317endif () 318