diff options
author | Jeremy Kniager <jeremyk@lunarg.com> | 2018-06-25 11:56:55 -0600 |
---|---|---|
committer | jeremyk-lunarg <jeremyk@lunarg.com> | 2018-06-28 08:10:33 -0600 |
commit | fb5d4829fa1daddb36bc55084e26d8253cd92552 (patch) | |
tree | 391c9b173c2e6162be81d2efb7856e487a971c3a | |
parent | 08c8e54e8c1cb6f502650f984cca7606a429b9d7 (diff) | |
download | Vulkan-Tools-fb5d4829fa1daddb36bc55084e26d8253cd92552.tar.gz Vulkan-Tools-fb5d4829fa1daddb36bc55084e26d8253cd92552.tar.bz2 Vulkan-Tools-fb5d4829fa1daddb36bc55084e26d8253cd92552.zip |
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
-rw-r--r-- | CMakeLists.txt | 15 |
1 files changed, 15 insertions, 0 deletions
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) |