1# Copyright 2018 The Amber Authors. 2# Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved. 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15 16set(VULKAN_ENGINE_SOURCES 17 blas.cc 18 buffer_descriptor.cc 19 buffer_backed_descriptor.cc 20 command_buffer.cc 21 command_pool.cc 22 compute_pipeline.cc 23 device.cc 24 descriptor.cc 25 engine_vulkan.cc 26 frame_buffer.cc 27 graphics_pipeline.cc 28 image_descriptor.cc 29 index_buffer.cc 30 pipeline.cc 31 push_constant.cc 32 raytracing_pipeline.cc 33 resource.cc 34 sampler.cc 35 sampler_descriptor.cc 36 sbt.cc 37 tlas.cc 38 tlas_descriptor.cc 39 transfer_buffer.cc 40 transfer_image.cc 41 vertex_buffer.cc 42 ${CMAKE_BINARY_DIR}/src/vk-wrappers.inc.fake 43) 44 45add_library(libamberenginevulkan ${VULKAN_ENGINE_SOURCES}) 46amber_default_compile_options(libamberenginevulkan) 47target_include_directories(libamberenginevulkan PRIVATE "${CMAKE_BINARY_DIR}") 48 49# Add the Vulkan include directory to the list of include paths. 50target_include_directories(libamberenginevulkan PUBLIC "${VulkanHeaders_INCLUDE_DIR}") 51 52# When building with dEQP Vulkan CTS the inl files needs to be included and a dependency 53# must be added to the target `deqp-vk-inl` that generates the inl files. 54if (${VULKAN_CTS_HEADER} AND DEFINED AMBER_CTS_INL_DIR) 55 target_include_directories(libamberenginevulkan PRIVATE "${AMBER_CTS_INL_DIR}") 56 add_dependencies(libamberenginevulkan deqp-vk-inl) 57endif() 58 59set_target_properties(libamberenginevulkan PROPERTIES 60 OUTPUT_NAME "amberenginevulkan" 61) 62if (NOT ANDROID) 63 target_link_libraries(libamberenginevulkan) 64endif() 65 66if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") 67 # vulkan/vulkan.h defines VK_NULL_HANDLE as 0u and that also serves as a null pointer. 68 # Disable Clang's warning that will always fire on that. This is required to build 69 # with XCode 10. 70 target_compile_options(libamberenginevulkan PRIVATE -Wno-zero-as-null-pointer-constant) 71endif() 72 73add_custom_command( 74 OUTPUT ${CMAKE_BINARY_DIR}/src/vk-wrappers.inc.fake 75 COMMAND 76 ${Python3_EXECUTABLE} 77 ${PROJECT_SOURCE_DIR}/tools/update_vk_wrappers.py 78 ${CMAKE_BINARY_DIR} 79 ${PROJECT_SOURCE_DIR} 80 WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" 81 COMMENT "Update vk-wrapper files in the build directory" 82) 83