aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Ramos <juan@lunarg.com>2023-11-16 19:04:12 -0700
committerJuan Ramos <114601453+juan-lunarg@users.noreply.github.com>2023-11-16 19:09:43 -0700
commitae2a2dc99bc01417d2c80e81078a5672e9d31d0b (patch)
tree84a3f98c263b18a753123148ac2fd92306279db1
parent62c4f8f7c546662aa5d43ca185e7d478d1224fb1 (diff)
downloadusermoji-ae2a2dc99bc01417d2c80e81078a5672e9d31d0b.tar.xz
cube: Fix layers on Apple
Otherwise layers won't work on Apple
-rw-r--r--CMakeLists.txt1
-rw-r--r--cube/cube.cpp14
-rw-r--r--cube/macOS/cube/CMakeLists.txt5
-rw-r--r--cube/macOS/cubepp/CMakeLists.txt5
-rw-r--r--scripts/known_good.json3
5 files changed, 4 insertions, 24 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d1ce0175..56137d07 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -51,6 +51,7 @@ endif()
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
find_package(VulkanHeaders QUIET CONFIG)
+find_package(VulkanLoader QUIET CONFIG)
find_package(volk QUIET CONFIG)
include(GNUInstallDirs)
diff --git a/cube/cube.cpp b/cube/cube.cpp
index 1d594b32..a0ed023e 100644
--- a/cube/cube.cpp
+++ b/cube/cube.cpp
@@ -43,9 +43,6 @@
#define VULKAN_HPP_TYPESAFE_CONVERSION
#include <vulkan/vulkan.hpp>
-#define VOLK_IMPLEMENTATION
-#include "volk.h"
-
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE
#include "linmath.h"
@@ -1120,16 +1117,7 @@ VKAPI_ATTR VkBool32 VKAPI_CALL Demo::debug_messenger_callback(VkDebugUtilsMessag
}
void Demo::init_vk() {
- // Vulkan-hpp doesn't load moltenkVK, so we use volk to do that for us, then pass vkGetInstanceProcAddr along
- VkResult err = volkInitialize();
- if (err != VK_SUCCESS) {
- ERR_EXIT(
- "Unable to find the Vulkan runtime on the system.\n\n"
- "This likely indicates that no Vulkan capable drivers are installed.",
- "Installation Failure");
- }
-
- VULKAN_HPP_DEFAULT_DISPATCHER.init(vkGetInstanceProcAddr);
+ VULKAN_HPP_DEFAULT_DISPATCHER.init();
std::vector<char const *> instance_validation_layers = {"VK_LAYER_KHRONOS_validation"};
diff --git a/cube/macOS/cube/CMakeLists.txt b/cube/macOS/cube/CMakeLists.txt
index 4d1de169..c638243b 100644
--- a/cube/macOS/cube/CMakeLists.txt
+++ b/cube/macOS/cube/CMakeLists.txt
@@ -59,10 +59,7 @@ add_dependencies(vkcube MoltenVK_icd-staging-json)
target_include_directories(vkcube PRIVATE . ${MOLTENVK_DIR}/MoltenVK/include)
# We do this so vkcube is linked to an individual library and NOT a framework.
-target_link_libraries(vkcube volk::volk_headers "-framework Cocoa -framework QuartzCore")
-
-# Link to MoltenVK directly, so the RPATH is setup
-target_link_libraries(vkcube ${MOLTENVK_DIR}/MoltenVK/dylib/macOS/libMoltenVK.dylib)
+target_link_libraries(vkcube Vulkan::Loader volk::volk_headers "-framework Cocoa -framework QuartzCore")
# Disable warnings about sprintf
target_compile_options(vkcube PRIVATE -Wno-deprecated-declarations)
diff --git a/cube/macOS/cubepp/CMakeLists.txt b/cube/macOS/cubepp/CMakeLists.txt
index 29e5e787..6277d438 100644
--- a/cube/macOS/cubepp/CMakeLists.txt
+++ b/cube/macOS/cubepp/CMakeLists.txt
@@ -59,10 +59,7 @@ add_dependencies(vkcubepp MoltenVK_icd-staging-json)
target_include_directories(vkcubepp PRIVATE ${CMAKE_CURRENT_LIST_DIR} ${MOLTENVK_DIR}/MoltenVK/include)
# We do this so vkcubepp is linked to an individual library and NOT a framework.
-target_link_libraries(vkcubepp volk::volk_headers "-framework Cocoa -framework QuartzCore")
-
-# Link to MoltenVK directly, so the RPATH is setup
-target_link_libraries(vkcubepp ${MOLTENVK_DIR}/MoltenVK/dylib/macOS/libMoltenVK.dylib)
+target_link_libraries(vkcubepp Vulkan::Loader volk::volk_headers "-framework Cocoa -framework QuartzCore")
set_target_properties(vkcubepp PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_LIST_DIR}/Info.plist)
diff --git a/scripts/known_good.json b/scripts/known_good.json
index 47a1f32d..cfa99d40 100644
--- a/scripts/known_good.json
+++ b/scripts/known_good.json
@@ -85,9 +85,6 @@
"var_name": "VULKAN_HEADERS_INSTALL_DIR",
"repo_name": "Vulkan-Headers"
}
- ],
- "optional": [
- "tests"
]
}
],