# vk - Vulkan utilites # Split into two libraries - one that depends on spirv/glslang libraries # which have long build times, and one that can build in parallel with those. include(CheckIncludeFileCXX) check_include_file_cxx( ${CMAKE_SOURCE_DIR}/external/renderdoc/src/renderdoc_app.h HAVE_RENDERDOC_APP_H) if(HAVE_RENDERDOC_APP_H) set(VKRENDERDOC_SRC vkRenderDocUtil.cpp) else() set(VKRENDERDOC_SRC vkNoRenderDocUtil.cpp) endif(HAVE_RENDERDOC_APP_H) # Build inl files set(DEQP_VULKAN_INL_GEN_INPUT ${PROJECT_SOURCE_DIR}/external/vulkan-docs/src/xml/vk.xml) set(DEQP_VULKAN_INL_GEN_OUTPUTS_DIR ${PROJECT_BINARY_DIR}/external/vulkancts/framework/vulkan) set(DEQP_VULKAN_INL_GEN_OUTPUTS ${DEQP_VULKAN_INL_GEN_OUTPUTS_DIR}/vkApiExtensionDependencyInfo.inl ${DEQP_VULKAN_INL_GEN_OUTPUTS_DIR}/vkBasicTypes.inl ${DEQP_VULKAN_INL_GEN_OUTPUTS_DIR}/vkConcreteDeviceInterface.inl ${DEQP_VULKAN_INL_GEN_OUTPUTS_DIR}/vkConcreteInstanceInterface.inl ${DEQP_VULKAN_INL_GEN_OUTPUTS_DIR}/vkConcretePlatformInterface.inl ${DEQP_VULKAN_INL_GEN_OUTPUTS_DIR}/vkCoreFunctionalities.inl ${DEQP_VULKAN_INL_GEN_OUTPUTS_DIR}/vkDeviceDriverImpl.inl ${DEQP_VULKAN_INL_GEN_OUTPUTS_DIR}/vkDeviceExtensions.inl ${DEQP_VULKAN_INL_GEN_OUTPUTS_DIR}/vkDeviceFeatures.inl ${DEQP_VULKAN_INL_GEN_OUTPUTS_DIR}/vkDeviceFeatures2.inl ${DEQP_VULKAN_INL_GEN_OUTPUTS_DIR}/vkDeviceFeaturesForContextDecl.inl ${DEQP_VULKAN_INL_GEN_OUTPUTS_DIR}/vkDeviceFeaturesForContextDefs.inl ${DEQP_VULKAN_INL_GEN_OUTPUTS_DIR}/vkDeviceFeaturesForDefaultDeviceDefs.inl ${DEQP_VULKAN_INL_GEN_OUTPUTS_DIR}/vkDeviceFunctionPointers.inl ${DEQP_VULKAN_INL_GEN_OUTPUTS_DIR}/vkDeviceProperties.inl ${DEQP_VULKAN_INL_GEN_OUTPUTS_DIR}/vkDevicePropertiesForContextDecl.inl ${DEQP_VULKAN_INL_GEN_OUTPUTS_DIR}/vkDevicePropertiesForContextDefs.inl ${DEQP_VULKAN_INL_GEN_OUTPUTS_DIR}/vkDevicePropertiesForDefaultDeviceDefs.inl ${DEQP_VULKAN_INL_GEN_OUTPUTS_DIR}/vkExtensionFunctions.inl ${DEQP_VULKAN_INL_GEN_OUTPUTS_DIR}/vkFunctionPointerTypes.inl ${DEQP_VULKAN_INL_GEN_OUTPUTS_DIR}/vkGetStructureTypeImpl.inl ${DEQP_VULKAN_INL_GEN_OUTPUTS_DIR}/vkHandleType.inl ${DEQP_VULKAN_INL_GEN_OUTPUTS_DIR}/vkInitDeviceFunctionPointers.inl ${DEQP_VULKAN_INL_GEN_OUTPUTS_DIR}/vkInitInstanceFunctionPointers.inl ${DEQP_VULKAN_INL_GEN_OUTPUTS_DIR}/vkInitPlatformFunctionPointers.inl ${DEQP_VULKAN_INL_GEN_OUTPUTS_DIR}/vkInstanceDriverImpl.inl ${DEQP_VULKAN_INL_GEN_OUTPUTS_DIR}/vkInstanceExtensions.inl ${DEQP_VULKAN_INL_GEN_OUTPUTS_DIR}/vkInstanceFunctionPointers.inl ${DEQP_VULKAN_INL_GEN_OUTPUTS_DIR}/vkKnownDriverIds.inl ${DEQP_VULKAN_INL_GEN_OUTPUTS_DIR}/vkMandatoryFeatures.inl ${DEQP_VULKAN_INL_GEN_OUTPUTS_DIR}/vkNullDriverImpl.inl ${DEQP_VULKAN_INL_GEN_OUTPUTS_DIR}/vkObjTypeImpl.inl ${DEQP_VULKAN_INL_GEN_OUTPUTS_DIR}/vkPlatformDriverImpl.inl ${DEQP_VULKAN_INL_GEN_OUTPUTS_DIR}/vkPlatformFunctionPointers.inl ${DEQP_VULKAN_INL_GEN_OUTPUTS_DIR}/vkRefUtil.inl ${DEQP_VULKAN_INL_GEN_OUTPUTS_DIR}/vkRefUtilImpl.inl ${DEQP_VULKAN_INL_GEN_OUTPUTS_DIR}/vkStrUtil.inl ${DEQP_VULKAN_INL_GEN_OUTPUTS_DIR}/vkStrUtilImpl.inl ${DEQP_VULKAN_INL_GEN_OUTPUTS_DIR}/vkStructTypes.inl ${DEQP_VULKAN_INL_GEN_OUTPUTS_DIR}/vkSupportedExtensions.inl ${DEQP_VULKAN_INL_GEN_OUTPUTS_DIR}/vkTypeUtil.inl ${DEQP_VULKAN_INL_GEN_OUTPUTS_DIR}/vkVirtualDeviceInterface.inl ${DEQP_VULKAN_INL_GEN_OUTPUTS_DIR}/vkVirtualInstanceInterface.inl ${DEQP_VULKAN_INL_GEN_OUTPUTS_DIR}/vkVirtualPlatformInterface.inl # NOTE: when new file is generated by gen_framework it should be added to this list. ${DEQP_VULKAN_INL_GEN_OUTPUTS_DIR}/vkVulkan_c.inl) add_custom_command( # Remove all outputs to help detect missing outputs. COMMAND cmake -E remove ${DEQP_VULKAN_INL_GEN_OUTPUTS} # Generate all inl files. COMMAND ${PYTHON_EXECUTABLE} ARGS ${PROJECT_SOURCE_DIR}/external/vulkancts/scripts/gen_ext_deps.py ${DEQP_VULKAN_INL_GEN_OUTPUTS_DIR} COMMAND ${PYTHON_EXECUTABLE} ARGS ${PROJECT_SOURCE_DIR}/external/vulkancts/scripts/gen_framework.py ${DEQP_VULKAN_INL_GEN_OUTPUTS_DIR} COMMAND ${PYTHON_EXECUTABLE} ARGS ${PROJECT_SOURCE_DIR}/external/vulkancts/scripts/gen_framework_c.py ${DEQP_VULKAN_INL_GEN_OUTPUTS_DIR} # Check all outputs exist, as CMake does not do this. COMMAND cmake -E md5sum ${DEQP_VULKAN_INL_GEN_OUTPUTS} DEPENDS ${DEQP_VULKAN_INL_GEN_INPUT} OUTPUT ${DEQP_VULKAN_INL_GEN_OUTPUTS}) add_custom_target( deqp-vk-inl ALL DEPENDS ${DEQP_VULKAN_INL_GEN_OUTPUTS}) set(VKUTILNOSHADER_SRCS vkApiVersion.cpp vkApiVersion.hpp vkBuilderUtil.cpp vkBuilderUtil.hpp vkBarrierUtil.cpp vkBarrierUtil.hpp vkCmdUtil.cpp vkCmdUtil.hpp vkDefs.cpp vkDefs.hpp vkRef.cpp vkRef.hpp vkRefUtil.cpp vkRefUtil.hpp vkPlatform.cpp vkPlatform.hpp vkStrUtil.cpp vkStrUtil.hpp vkQueryUtil.cpp vkQueryUtil.hpp vkMemUtil.cpp vkMemUtil.hpp vkDeviceUtil.cpp vkDeviceUtil.hpp vkBinaryRegistry.cpp vkBinaryRegistry.hpp vkNullDriver.cpp vkNullDriver.hpp vkImageUtil.cpp vkImageUtil.hpp vkTypeUtil.cpp vkTypeUtil.hpp vkAllocationCallbackUtil.cpp vkAllocationCallbackUtil.hpp vkWsiPlatform.cpp vkWsiPlatform.hpp vkWsiUtil.cpp vkWsiUtil.hpp vkDebugReportUtil.cpp vkDebugReportUtil.hpp vkBufferWithMemory.cpp vkBufferWithMemory.hpp vkImageWithMemory.cpp vkImageWithMemory.hpp vkImageWithMemory.cpp vkImageWithMemory.hpp vkShaderProgram.cpp vkShaderProgram.hpp vkValidatorOptions.hpp vkYCbCrImageWithMemory.cpp vkYCbCrImageWithMemory.hpp vkObjUtil.cpp vkObjUtil.hpp ${VKRENDERDOC_SRC} vkRenderDocUtil.hpp vkDeviceFeatures.hpp vkDeviceFeatures.cpp vkDeviceProperties.hpp vkDeviceProperties.cpp vkRayTracingUtil.hpp vkRayTracingUtil.cpp ) set(VKUTIL_SRCS vkPrograms.cpp vkPrograms.hpp vkShaderToSpirV.cpp vkShaderToSpirV.hpp vkSpirVAsm.hpp vkSpirVAsm.cpp vkSpirVProgram.hpp vkSpirVProgram.cpp ) set(VKUTILNOSHADER_LIBS glutil tcutil ) set(VKUTIL_LIBS glutil tcutil vkutilnoshader ) include_directories(${GLSLANG_INCLUDE_PATH}) include_directories(${DEQP_VULKAN_INL_GEN_OUTPUTS_DIR}) # \note Code interfacing with glslang needs to include third-party headers # that cause all sorts of warnings to appear. if (DE_COMPILER_IS_GCC OR DE_COMPILER_IS_CLANG) set_source_files_properties( FILES vkShaderToSpirV.cpp PROPERTIES COMPILE_FLAGS "${DE_3RD_PARTY_CXX_FLAGS}") endif () set(VKUTIL_LIBS ${VKUTIL_LIBS} ${GLSLANG_LIBRARIES}) include_directories(${spirv-tools_SOURCE_DIR}/include) include_directories(${spirv-tools_SOURCE_DIR}/external/include) # \note Code interfacing with spirv-opt needs to include third-party headers # that cause all sorts of warnings to appear. if (DE_COMPILER_IS_GCC OR DE_COMPILER_IS_CLANG) set_source_files_properties( FILES vkPrograms.cpp PROPERTIES COMPILE_FLAGS "${DE_3RD_PARTY_CXX_FLAGS}") endif () set(VKUTIL_LIBS ${VKUTIL_LIBS} spirv-tools spirv-tools-opt) if(DEQP_HAVE_RENDERDOC_HEADER) add_definitions(-DDEQP_HAVE_RENDERDOC_HEADER=1) endif() PCH(VKUTILNOSHADER_SRCS ../../modules/vulkan/pch.cpp) PCH(VKUTIL_SRCS ../../modules/vulkan/pch.cpp) add_library(vkutilnoshader STATIC ${VKUTILNOSHADER_SRCS}) target_link_libraries(vkutilnoshader ${VKUTILNOSHADER_LIBS}) add_dependencies(vkutilnoshader deqp-vk-inl) if (DEQP_USE_X11) find_package(X11 REQUIRED) target_link_libraries(vkutilnoshader ${X11_LIBRARIES}) add_definitions(-DDEQP_SUPPORT_X11=1) if (DEQP_USE_XCB) find_package(XCB REQUIRED) target_link_libraries(vkutilnoshader ${XCB_LIBRARIES}) add_definitions(-DDEQP_SUPPORT_XCB=1) endif () endif() add_library(vkutil STATIC ${VKUTIL_SRCS}) target_link_libraries(vkutil ${VKUTIL_LIBS})