Skip to content

find_vulkan should probably not use include_directories #841

@amaiorano

Description

@amaiorano

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions