diff --git a/bldsys/cmake/global_options.cmake b/bldsys/cmake/global_options.cmake index 96c7addbf..750cafdfe 100644 --- a/bldsys/cmake/global_options.cmake +++ b/bldsys/cmake/global_options.cmake @@ -36,6 +36,10 @@ if(APPLE) set(VKB_ENABLE_PORTABILITY ON CACHE BOOL "Enable portability enumeration and subset features in the framework. This is required to be set when running on Apple platforms." FORCE) find_package(Vulkan QUIET OPTIONAL_COMPONENTS MoltenVK) + + message(STATUS "Vulkan library: ${Vulkan_LIBRARY}") + message(STATUS "Vulkan headers: ${Vulkan_INCLUDE_DIR}") + if(USE_MoltenVK OR (IOS AND (NOT Vulkan_MoltenVK_FOUND OR (${CMAKE_OSX_SYSROOT} STREQUAL "iphonesimulator" AND ${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "x86_64")))) # if using MoltenVK, or MoltenVK for iOS was not found, or using iOS Simulator on x86_64, look for MoltenVK in the Vulkan SDK and MoltenVK project locations if(NOT Vulkan_MoltenVK_LIBRARY) @@ -51,6 +55,8 @@ if(APPLE) unset(_saved_cmake_find_framework) endif() + message(STATUS "MoltenVK library: ${Vulkan_MoltenVK_LIBRARY}") + if(Vulkan_MoltenVK_LIBRARY) get_filename_component(MoltenVK_LIBRARY_PATH ${Vulkan_MoltenVK_LIBRARY} DIRECTORY) @@ -77,7 +83,18 @@ if(APPLE) endif() elseif(IOS) # if not using MoltenVK on iOS, set up global Vulkan Library define for iOS Vulkan loader + message(STATUS "Using iOS Vulkan loader") add_compile_definitions(_HPP_VULKAN_LIBRARY="vulkan.framework/vulkan") + elseif(Vulkan_LIBRARY) + # This is a patch for newer macOS versions where the Vulkan Loader is not found in the default search paths + # In the future this can be removed when the Vulkan SDK is updated to install the loader in the default search paths or when the + # VulkanHPP DynamicLoader is updated to search for the loader in the Vulkan SDK install location + string(FIND "${Vulkan_LIBRARY}" "/usr/local/lib" VULKAN_LIBRARY_PREFIX) + if(VULKAN_LIBRARY_PREFIX EQUAL 0) + message(STATUS "Vulkan found in /usr/local/lib. Patching RPATH.") + set(CMAKE_INSTALL_RPATH "/usr/local/lib;${CMAKE_INSTALL_RPATH}") + set(CMAKE_BUILD_WITH_INSTALL_RPATH ON) + endif() endif() if(CMAKE_GENERATOR MATCHES "Xcode")