summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineVulkan
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2020-11-24 00:03:21 +0000
committerassiduous <assiduous@diligentgraphics.com>2020-11-24 00:03:21 +0000
commitea5e784e029aa6ad55cb66ff7eaf11d7082b3edf (patch)
tree83b09be7b5820c18b212e78c5f4ea9d10350342d /Graphics/GraphicsEngineVulkan
parentSet symbol visibility for third-party libraries to hidden (diff)
downloadDiligentCore-ea5e784e029aa6ad55cb66ff7eaf11d7082b3edf.tar.gz
DiligentCore-ea5e784e029aa6ad55cb66ff7eaf11d7082b3edf.zip
Switched to using Volk and dynamic engine libraries on Mac (fixed https://github.com/DiligentGraphics/DiligentCore/issues/151)
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
-rw-r--r--Graphics/GraphicsEngineVulkan/CMakeLists.txt31
1 files changed, 26 insertions, 5 deletions
diff --git a/Graphics/GraphicsEngineVulkan/CMakeLists.txt b/Graphics/GraphicsEngineVulkan/CMakeLists.txt
index 323b4ccf..05c0915b 100644
--- a/Graphics/GraphicsEngineVulkan/CMakeLists.txt
+++ b/Graphics/GraphicsEngineVulkan/CMakeLists.txt
@@ -216,7 +216,29 @@ if(PLATFORM_WIN32)
endif()
endif()
endif()
-endif(PLATFORM_WIN32)
+elseif(PLATFORM_MACOS)
+ if(NOT VULKAN_SDK AND DEFINED ENV{VULKAN_SDK})
+ set(VULKAN_SDK $ENV{VULKAN_SDK})
+ endif()
+
+ if(VULKAN_SDK)
+ if(EXISTS "${VULKAN_SDK}/lib/libvulkan.dylib")
+ set(VULKAN_LIB_PATH ${VULKAN_SDK}/lib CACHE PATH "Vulkan library path" FORCE)
+ elseif(EXISTS "${VULKAN_SDK}/macOS/lib/libvulkan.dylib")
+ set(VULKAN_LIB_PATH ${VULKAN_SDK}/macOS/lib CACHE PATH "Vulkan library path" FORCE)
+ endif()
+
+ if(NOT VULKAN_LIB_PATH)
+ message(WARNING "Unable to find vulkan library at: " ${VULKAN_SDK})
+ endif()
+ endif()
+
+ if (VULKAN_LIB_PATH)
+ message("Using Vulkan library path: " ${VULKAN_LIB_PATH})
+ else()
+ message(WARNING "Vulkan library is not found. Executables may fail to start bcause the library may not be in rpath. Define VULKAN_SDK environment or CMake variable to specify the SDK path.")
+ endif()
+endif()
if(PLATFORM_LINUX)
# VulkanSDK installs dxc to this path
@@ -233,8 +255,7 @@ endif()
if(PLATFORM_WIN32)
# Use Volk
elseif(PLATFORM_MACOS)
- find_library(Vulkan_LIBRARY NAMES vulkan.1 vulkan PATHS "../../ThirdParty/vulkan/libs/macOS")
- list(APPEND PRIVATE_DEPENDENCIES ${Vulkan_LIBRARY})
+ # Use Volk
elseif(PLATFORM_IOS)
set(Vulkan_LIBRARY ${MoltenVK_LIBRARY})
list(APPEND PRIVATE_DEPENDENCIES ${Vulkan_LIBRARY})
@@ -306,9 +327,9 @@ endif()
if(PLATFORM_WIN32)
set(PRIVATE_COMPILE_DEFINITIONS VK_USE_PLATFORM_WIN32_KHR=1 NOMINMAX DILIGENT_USE_VOLK=1)
elseif(PLATFORM_LINUX)
- set(PRIVATE_COMPILE_DEFINITIONS VK_USE_PLATFORM_XCB_KHR=1 VK_USE_PLATFORM_XLIB_KHR=1 DILIGENT_USE_VOLK=1)
+ set(PRIVATE_COMPILE_DEFINITIONS VK_USE_PLATFORM_XCB_KHR=1 VK_USE_PLATFORM_XLIB_KHR=1 DILIGENT_USE_VOLK=1)
elseif(PLATFORM_MACOS)
- set(PRIVATE_COMPILE_DEFINITIONS VK_USE_PLATFORM_MACOS_MVK=1)
+ set(PRIVATE_COMPILE_DEFINITIONS VK_USE_PLATFORM_MACOS_MVK=1 DILIGENT_USE_VOLK=1)
elseif(PLATFORM_IOS)
set(PRIVATE_COMPILE_DEFINITIONS VK_USE_PLATFORM_IOS_MVK=1)
elseif(PLATFORM_ANDROID)