google / amber

Amber is a multi-API shader test framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

find_vulkan should probably not use include_directories

amaiorano opened this issue · comments

Currently, Amber includes find_vulkan.cmake to look for a Vulkan installation in various places, and to set up compilation to use it. Part of this is finding VulkanHeaders, and when it's found, it currently uses include_directories(BEFORE...) to add it to the global include directories for all targets defined afterwards:

include_directories(BEFORE "${VulkanHeaders_INCLUDE_DIR}")

The problem with this is that it forces these headers on all targets, including SwiftShader (when enabled), which already has its own vulkan headers that it expects to build against. I made changes to SwiftShader so that it builds correctly, for now, but this may break in the future when you update your headers to a newer version.

Instead of using include_directories, it would be better to create an interface target (add_library(INTERFACE ...) that other targets can use via target_link_libraries. In fact, you already have something like this in place for vulkan headers: https://github.com/google/amber/blob/master/third_party/CMakeLists.txt#L52 so perhaps all you need is to remove the part of find_vulkan that deads with Vulkan headers.

Hello,

Just wanted to let you know that I've landed a change in SwiftShader that (once again) asserts that we're using the specific version of the Vulkan headers that is in our repo. This means that when you decide to update your SwiftShader checkout in amber to this commit or later, you'll need to fix the force include problem detailed above.

Thanks.

Fixed with #850