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