Skip to content

Commit b89bd2b

Browse files
authored
Revised: Update iOS build to support future standarization of FindVulkan.cmake (#1516)
* Update iOS build to support future standarization of FindVulkan.cmake * Update to Vulkan SDK 1.4.341.1 for iOS CI builds to match project
1 parent 77a6d63 commit b89bd2b

4 files changed

Lines changed: 17 additions & 11 deletions

File tree

.github/workflows/build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,9 @@ jobs:
187187
- name: retrieve VulkanSDK
188188
if: steps.VulkanSDK.outputs.cache-hit != 'true'
189189
run: |
190-
wget https://sdk.lunarg.com/sdk/download/1.4.304.1/mac/vulkansdk-macos-1.4.304.1.zip
191-
unzip vulkansdk-macos-1.4.304.1.zip
192-
sudo InstallVulkan-1.4.304.1.app/Contents/MacOS/InstallVulkan-1.4.304.1 --root ~/VulkanSDK --accept-licenses --default-answer --confirm-command install com.lunarg.vulkan.ios
190+
wget https://sdk.lunarg.com/sdk/download/1.4.341.1/mac/vulkansdk-macos-1.4.341.1.zip
191+
unzip vulkansdk-macos-1.4.341.1.zip
192+
sudo vulkansdk-macOS-1.4.341.1.app/Contents/MacOS/vulkansdk-macOS-1.4.341.1 --root ~/VulkanSDK --accept-licenses --default-answer --confirm-command install com.lunarg.vulkan.ios
193193
194194
- name: build_ios
195195
run: |

CMakeLists.txt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Copyright (c) 2020-2025, Arm Limited and Contributors
2-
# Copyright (c) 2024-2025, Mobica Limited
3-
# Copyright (c) 2024-2025, Sascha Willems
1+
# Copyright (c) 2020-2026, Arm Limited and Contributors
2+
# Copyright (c) 2024-2026, Mobica Limited
3+
# Copyright (c) 2024-2026, Sascha Willems
44
#
55
# SPDX-License-Identifier: Apache-2.0
66
#
@@ -40,6 +40,11 @@ project(vulkan_samples)
4040
if(VKB_GENERATE_ANTORA_SITE)
4141
add_subdirectory(antora)
4242
else ()
43+
# On IOS we define CMAKE_FIND_ROOT_PATH to allow find_package(Vulkan) to locate the Vulkan frameworks for iOS
44+
if(IOS)
45+
set(CMAKE_FIND_ROOT_PATH "$ENV{VULKAN_SDK}")
46+
endif()
47+
4348
# search for Vulkan SDK
4449
find_package(Vulkan)
4550

app/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ if(IOS)
139139
endif ()
140140
# Vulkan cache variables already defined by main project CMakeLists and updated on Apple platforms by global_options.cmake
141141
if(Vulkan_LIBRARY AND ${Vulkan_VERSION} VERSION_GREATER_EQUAL 1.3.278)
142+
get_filename_component(Vulkan_Target_SDK "$ENV{VULKAN_SDK}/.." REALPATH)
142143
target_sources(${PROJECT_NAME} PRIVATE
143144
${Vulkan_Target_SDK}/iOS/share/vulkan
144145
)

bldsys/cmake/global_options.cmake

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#[[
2-
Copyright (c) 2019-2025, Arm Limited and Contributors
2+
Copyright (c) 2019-2026, Arm Limited and Contributors
33
44
SPDX-License-Identifier: Apache-2.0
55
@@ -78,10 +78,10 @@ if(APPLE)
7878
else()
7979
message(FATAL_ERROR "Can't find MoltenVK library. Please install the Vulkan SDK or MoltenVK project and set VULKAN_SDK.")
8080
endif()
81-
#elseif(OTHER_VULKAN_DRIVER)
82-
# handle any special processing here for other Vulkan driver (e.g. KosmicKrisp) for standalone usage on macOS or deployment to iOS
83-
# would likely require extensions to CMake find_package() OPTIONAL_COMPONENTS and library variables to identify & use other driver
84-
#else()
81+
elseif(IOS AND NOT Vulkan_Layer_VALIDATION)
82+
# if building for iOS devices (not iOS Simulator as above) and Vulkan_Layer_VALIDATION is not defined or found, search in the Vulkan SDK
83+
find_library(Vulkan_Layer_VALIDATION NAMES VkLayer_khronos_validation HINTS "$ENV{VULKAN_SDK}/lib")
84+
else()
8585
# if not using standalone driver, retain find_package() results for Vulkan driver, Vulkan loader, and Validation Layer library variables
8686
# no need to override with _HPP_VULKAN_LIBRARY in this case since Vulkan DynamicLoader will find/load Vulkan library on macOS & iOS
8787
endif()

0 commit comments

Comments
 (0)