Squash project setup refactor
This commit is contained in:
committed by
Georg Hagen
parent
6a1a76f4d1
commit
071ced8cb0
30
cmake/functions/SetupVulkan.cmake
Normal file
30
cmake/functions/SetupVulkan.cmake
Normal file
@@ -0,0 +1,30 @@
|
||||
function(SetupVulkan TARGET)
|
||||
if (APPLE)
|
||||
find_package(MoltenVK REQUIRED)
|
||||
target_link_libraries(${TARGET} PRIVATE ${MoltenVK_LIBRARIES})
|
||||
else ()
|
||||
find_package(Vulkan REQUIRED)
|
||||
target_link_libraries(${TARGET} PRIVATE Vulkan::Vulkan)
|
||||
if (NO_SHADERC)
|
||||
message("Disable shaderc linking")
|
||||
else()
|
||||
find_package(Vulkan OPTIONAL_COMPONENTS shaderc_combined)
|
||||
if (Vulkan_shaderc_combined_FOUND)
|
||||
target_link_libraries(${TARGET} PRIVATE Vulkan::shaderc_combined)
|
||||
target_compile_definitions(${TARGET} PRIVATE HAS_SHADERC)
|
||||
endif ()
|
||||
endif ()
|
||||
endif ()
|
||||
target_include_directories(${TARGET} PUBLIC ${Vulkan_INCLUDE_DIR})
|
||||
|
||||
if (ANDROID)
|
||||
add_definitions(-DVK_USE_PLATFORM_ANDROID_KHR)
|
||||
elseif (WIN32)
|
||||
add_definitions(-DVK_USE_PLATFORM_WIN32_KHR)
|
||||
elseif (LINUX)
|
||||
add_definitions(-DVK_USE_PLATFORM_XCB_KHR)
|
||||
find_package(XCB REQUIRED)
|
||||
target_link_libraries(${TARGET} PRIVATE ${XCB_LIBRARIES})
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
Reference in New Issue
Block a user