From fb5d4829fa1daddb36bc55084e26d8253cd92552 Mon Sep 17 00:00:00 2001 From: Jeremy Kniager Date: Mon, 25 Jun 2018 11:56:55 -0600 Subject: cmake: Update CMake to check env for MoltenVK Updated CMake files to use MOLTENVK_REPO_ROOT as an environment variable if no CMake argument is provided. CMake argument takes priority over environment variable. Change-Id: I661a56f7bc6c8c43fe4d4f7013e26dde87fb41e4 --- CMakeLists.txt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 30be353e..94bb1348 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,11 +42,26 @@ set(TOOLS_TARGET_FOLDER "Helper Targets") # User-supplied CMAKE_PREFIX_PATH containing paths to the header and/or loader install dirs # CMake options VULKAN_HEADERS_INSTALL_DIR and/or VULKAN_LOADER_INSTALL_DIR # Env vars VULKAN_HEADERS_INSTALL_DIR and/or VULKAN_LOADER_INSTALL_DIR +# If on MacOS +# CMake option MOTLENVK_REPO_ROOT +# Env vars MOLTENVK_REPO_ROOT # Fallback to FindVulkan operation using SDK install or system installed components. set(VULKAN_HEADERS_INSTALL_DIR "HEADERS-NOTFOUND" CACHE PATH "Absolute path to a Vulkan-Headers install directory") set(VULKAN_LOADER_INSTALL_DIR "LOADER-NOTFOUND" CACHE PATH "Absolute path to a Vulkan-Loader install directory") set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH};${VULKAN_HEADERS_INSTALL_DIR};${VULKAN_LOADER_INSTALL_DIR}; $ENV{VULKAN_HEADERS_INSTALL_DIR};$ENV{VULKAN_LOADER_INSTALL_DIR}) + +if (APPLE) + set(MOLTENVK_REPO_ROOT "MOLTENVK-NOTFOUND" CACHE PATH "Absolute path to a MoltenVK repo directory") + if (NOT MOLTENVK_REPO_ROOT AND NOT DEFINED ENV{MOLTENVK_REPO_ROOT}) + message(FATAL_ERROR "Must define location of MoltenVK repo -- see BUILD.md") + endif() + + if (NOT MOLTENVK_REPO_ROOT) + set(MOLTENVK_REPO_ROOT $ENV{MOLTENVK_REPO_ROOT}) + endif() + message(STATUS "Using MoltenVK repo location at ${MOLTENVK_REPO_ROOT}") +endif() message(STATUS "Using find_package to locate Vulkan") find_package(Vulkan) find_package(VulkanHeaders) -- cgit v1.2.3