Skip to content

Commit

Permalink
Simplify DynamicLoader for iOS by using _HPP_VULKAN_LIBRARY define
Browse files Browse the repository at this point in the history
  • Loading branch information
SRSaunders committed Sep 26, 2024
1 parent f14bf34 commit 75a72a1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 12 deletions.
3 changes: 3 additions & 0 deletions bldsys/cmake/global_options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ if(APPLE)
else()
message(FATAL_ERROR "Can't find MoltenVK library. Please install the Vulkan SDK or MoltenVK project and set VULKAN_SDK.")
endif()
elseif(IOS)
# if not using MoltenVK on iOS, set up global Vulkan Library define for iOS Vulkan loader
add_compile_definitions(_HPP_VULKAN_LIBRARY="vulkan.framework/vulkan")
endif()

if(CMAKE_GENERATOR MATCHES "Xcode")
Expand Down
6 changes: 0 additions & 6 deletions framework/vulkan_sample.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@
#include "scene_graph/hpp_scene.h"
#include "scene_graph/scripts/animation.h"

#if defined(PLATFORM__MACOS)
# include <TargetConditionals.h>
#endif

namespace vkb
{
/**
Expand Down Expand Up @@ -1010,8 +1006,6 @@ inline bool VulkanSample<bindingType>::prepare(const ApplicationOptions &options
// initialize C++-Bindings default dispatcher, first step
#if defined(_HPP_VULKAN_LIBRARY)
static vk::DynamicLoader dl(_HPP_VULKAN_LIBRARY);
#elif TARGET_OS_IPHONE
static vk::DynamicLoader dl("vulkan.framework/vulkan");
#else
static vk::DynamicLoader dl;
#endif
Expand Down
6 changes: 0 additions & 6 deletions samples/api/hpp_hello_triangle/hpp_hello_triangle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@
#include <hpp_glsl_compiler.h>
#include <platform/window.h>

#if defined(PLATFORM__MACOS)
# include <TargetConditionals.h>
#endif

// Note: the default dispatcher is instantiated in hpp_api_vulkan_sample.cpp.
// Even though, that file is not part of this sample, it's part of the sample-project!

Expand Down Expand Up @@ -427,8 +423,6 @@ vk::Instance HPPHelloTriangle::create_instance(std::vector<const char *> const &
{
#if defined(_HPP_VULKAN_LIBRARY)
static vk::DynamicLoader dl(_HPP_VULKAN_LIBRARY);
#elif TARGET_OS_IPHONE
static vk::DynamicLoader dl("vulkan.framework/vulkan");
#else
static vk::DynamicLoader dl;
#endif
Expand Down

0 comments on commit 75a72a1

Please sign in to comment.