1 set(LLVM_OPTIONAL_SOURCES
3 vulkan-runtime-wrappers.cpp
8 if (MLIR_ENABLE_VULKAN_RUNNER)
9 message(STATUS "Building the Vulkan runner")
13 # If Vulkan is not found try a path specified by VULKAN_SDK.
15 if ("$ENV{VULKAN_SDK}" STREQUAL "")
16 message(FATAL_ERROR "Vulkan not found through CMake; please provide "
17 "VULKAN_SDK path as an environment variable")
20 find_library(Vulkan_LIBRARY vulkan HINTS "$ENV{VULKAN_SDK}/lib" REQUIRED)
23 set(Vulkan_INCLUDE_DIR "$ENV{VULKAN_SDK}/include")
24 message(STATUS "Found Vulkan: " ${Vulkan_LIBRARY})
29 message(FATAL_ERROR "Cannot find Vulkan library")
32 add_llvm_library(vulkan-runtime-wrappers SHARED
33 vulkan-runtime-wrappers.cpp
37 target_include_directories(vulkan-runtime-wrappers
42 # *IMPORTANT*: This library cannot depend on LLVM libraries. Otherwise,
43 # it may cause LLVM version conflict when used together with other shared
44 # libraries depending on LLVM. Notably, Mesa, who implements Vulkan
45 # drivers on Linux, depends on the system libLLVM.so.
46 target_link_libraries(vulkan-runtime-wrappers
51 get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS)
56 MLIRBuiltinToLLVMIRTranslation
63 MLIRLLVMCommonConversion
64 MLIRLLVMToLLVMIRTranslation
71 MLIRTargetLLVMIRExport
79 # Manually expand the target library, since our MLIR libraries
80 # aren't plugged into the LLVM dependency tracking. If we don't
81 # do this then we can't insert the CodeGen library after ourselves
82 llvm_expand_pseudo_components(TARGET_LIBS AllTargetsCodeGens)
83 # Prepend LLVM in front of every target, this is how the library
84 # are named with CMake
86 FOREACH(t ${TARGET_LIBS})
87 LIST(APPEND targets_to_link "LLVM${t}")
90 add_mlir_tool(mlir-vulkan-runner
91 mlir-vulkan-runner.cpp
94 vulkan-runtime-wrappers
96 llvm_update_compile_flags(mlir-vulkan-runner)
97 target_link_libraries(mlir-vulkan-runner PRIVATE ${LIBS})