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