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 engine_vulkan_debugger.cc 25 frame_buffer.cc 26 graphics_pipeline.cc 27 image_descriptor.cc 28 index_buffer.cc 29 pipeline.cc 30 push_constant.cc 31 resource.cc 32 sampler.cc 33 sampler_descriptor.cc 34 transfer_buffer.cc 35 transfer_image.cc 36 vertex_buffer.cc 37 ${CMAKE_BINARY_DIR}/src/vk-wrappers.inc.fake 38) 39 40add_library(libamberenginevulkan ${VULKAN_ENGINE_SOURCES}) 41amber_default_compile_options(libamberenginevulkan) 42target_include_directories(libamberenginevulkan PRIVATE "${CMAKE_BINARY_DIR}") 43# Add the Vulkan include directory to the list of include paths. 44target_include_directories(libamberenginevulkan PRIVATE "${VulkanHeaders_INCLUDE_DIR}") 45 46set_target_properties(libamberenginevulkan PROPERTIES 47 OUTPUT_NAME "amberenginevulkan" 48) 49if (NOT ANDROID) 50 target_link_libraries(libamberenginevulkan) 51endif() 52 53if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") 54 # vulkan/vulkan.h defines VK_NULL_HANDLE as 0u and that also serves as a null pointer. 55 # Disable Clang's warning that will alwaays fire on that. This is required to build 56 # with XCode 10. 57 target_compile_options(libamberenginevulkan PRIVATE -Wno-zero-as-null-pointer-constant) 58endif() 59 60if (${AMBER_ENABLE_VK_DEBUGGING}) 61 target_link_libraries(libamberenginevulkan cppdap) 62endif() 63 64add_custom_command( 65 OUTPUT ${CMAKE_BINARY_DIR}/src/vk-wrappers.inc.fake 66 COMMAND 67 ${PYTHON_EXECUTABLE} 68 ${PROJECT_SOURCE_DIR}/tools/update_vk_wrappers.py 69 ${CMAKE_BINARY_DIR} 70 ${PROJECT_SOURCE_DIR} 71 WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" 72 COMMENT "Update vk-wrapper files in the build directory" 73) 74