[Cmake-commits] CMake branch, next, updated. v3.6.0-rc1-127-g0b5f585

Brad King brad.king at kitware.com
Wed Jun 8 12:44:30 EDT 2016


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  0b5f5857d3cbf5ce77c78fcaef36c4cd001cd4f0 (commit)
       via  adf4df28caf621569d9d0d62011fc38773710319 (commit)
      from  7160c8c8dea75dda8f016823ed0a0ff2e922fdef (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0b5f5857d3cbf5ce77c78fcaef36c4cd001cd4f0
commit 0b5f5857d3cbf5ce77c78fcaef36c4cd001cd4f0
Merge: 7160c8c adf4df2
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Jun 8 12:44:29 2016 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Jun 8 12:44:29 2016 -0400

    Merge topic 'add-FindVulkan' into next
    
    adf4df28 Add FindVulkan.cmake.


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=adf4df28caf621569d9d0d62011fc38773710319
commit adf4df28caf621569d9d0d62011fc38773710319
Author:     Matthäus G. Chajdas <cmake at anteru.net>
AuthorDate: Sat Jun 4 20:48:23 2016 +0200
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Jun 8 12:44:03 2016 -0400

    Add FindVulkan.cmake.
    
    This adds FindVulkan with corresponding tests.

diff --git a/Help/manual/cmake-modules.7.rst b/Help/manual/cmake-modules.7.rst
index 62910cf..8c9c4be 100644
--- a/Help/manual/cmake-modules.7.rst
+++ b/Help/manual/cmake-modules.7.rst
@@ -209,6 +209,7 @@ All Modules
    /module/FindTIFF
    /module/FindUnixCommands
    /module/FindVTK
+   /module/FindVulkan
    /module/FindWget
    /module/FindWish
    /module/FindwxWidgets
diff --git a/Help/module/FindVulkan.rst b/Help/module/FindVulkan.rst
new file mode 100644
index 0000000..adf824e
--- /dev/null
+++ b/Help/module/FindVulkan.rst
@@ -0,0 +1 @@
+.. cmake-module:: ../../Modules/FindVulkan.cmake
diff --git a/Help/release/dev/FindVulkan.rst b/Help/release/dev/FindVulkan.rst
new file mode 100644
index 0000000..bb5447e
--- /dev/null
+++ b/Help/release/dev/FindVulkan.rst
@@ -0,0 +1,4 @@
+FindVulkan
+----------
+
+* A :module:`FindVulkan` module was added.
diff --git a/Modules/FindVulkan.cmake b/Modules/FindVulkan.cmake
new file mode 100644
index 0000000..b335f5f
--- /dev/null
+++ b/Modules/FindVulkan.cmake
@@ -0,0 +1,85 @@
+#.rst:
+# FindVulkan
+# ----------
+#
+# Try to find Vulkan
+#
+# IMPORTED Targets
+# ^^^^^^^^^^^^^^^^
+#
+# This module defines :prop_tgt:`IMPORTED` target ``Vulkan::Vulkan``, if
+# Vulkan has been found.
+#
+# Result Variables
+# ^^^^^^^^^^^^^^^^
+#
+# This module defines the following variables::
+#
+#   Vulkan_FOUND          - True if Vulkan was found
+#   Vulkan_INCLUDE_DIRS   - include directories for Vulkan
+#   Vulkan_LIBRARIES      - link against this library to use Vulkan
+#
+# The module will also define two cache variables::
+#
+#   Vulkan_INCLUDE_DIR    - the Vulkan include directory
+#   Vulkan_LIBRARY        - the path to the Vulkan library
+#
+
+#=============================================================================
+# Copyright 2016 Matthaeus G. Chajdas
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+#  License text for the above reference.)
+
+if(WIN32)
+  find_path(Vulkan_INCLUDE_DIR
+    NAMES vulkan/vulkan.h
+    PATHS
+      "$ENV{VULKAN_SDK}/Include"
+    )
+
+  if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+    find_library(Vulkan_LIBRARY
+      NAMES vulkan-1
+      PATHS
+        "$ENV{VULKAN_SDK}/Bin")
+  elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
+    find_library(Vulkan_LIBRARY
+      NAMES vulkan-1
+      PATHS
+        "$ENV{VULKAN_SDK}/Bin32")
+  endif()
+else()
+    find_path(Vulkan_INCLUDE_DIR
+      NAMES vulkan/vulkan.h
+      PATHS
+        "$ENV{VULKAN_SDK}/include")
+    find_library(Vulkan_LIBRARY
+      NAMES vulkan
+      PATHS
+        "$ENV{VULKAN_SDK}/lib")
+endif()
+
+set(Vulkan_LIBRARIES ${Vulkan_LIBRARY})
+set(Vulkan_INCLUDE_DIRS ${Vulkan_INCLUDE_DIR})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Vulkan
+  DEFAULT_MSG
+  Vulkan_LIBRARY Vulkan_INCLUDE_DIR)
+
+mark_as_advanced(Vulkan_INCLUDE_DIR Vulkan_LIBRARY)
+
+if(Vulkan_FOUND AND NOT TARGET Vulkan::Vulkan)
+  add_library(Vulkan::Vulkan UNKNOWN IMPORTED)
+  set_target_properties(Vulkan::Vulkan PROPERTIES
+    IMPORTED_LOCATION "${Vulkan_LIBRARIES}"
+    INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_INCLUDE_DIRS}")
+endif()
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index b72ecf5..20f6c35 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1394,6 +1394,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
     add_subdirectory(FindTIFF)
   endif()
 
+  if(CMake_TEST_FindVulkan)
+    add_subdirectory(FindVulkan)
+  endif()
+
   if(CMake_TEST_FindXalanC)
     add_subdirectory(FindXalanC)
   endif()
diff --git a/Tests/FindVulkan/CMakeLists.txt b/Tests/FindVulkan/CMakeLists.txt
new file mode 100644
index 0000000..46ce1c6
--- /dev/null
+++ b/Tests/FindVulkan/CMakeLists.txt
@@ -0,0 +1,10 @@
+add_test(NAME FindVulkan.Test COMMAND
+  ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+  --build-and-test
+  "${CMake_SOURCE_DIR}/Tests/FindVulkan/Test"
+  "${CMake_BINARY_DIR}/Tests/FindVulkan/Test"
+  ${build_generator_args}
+  --build-project TestFindVulkan
+  --build-options ${build_options}
+  --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+  )
diff --git a/Tests/FindVulkan/Test/CMakeLists.txt b/Tests/FindVulkan/Test/CMakeLists.txt
new file mode 100644
index 0000000..0b13d53
--- /dev/null
+++ b/Tests/FindVulkan/Test/CMakeLists.txt
@@ -0,0 +1,15 @@
+cmake_minimum_required(VERSION 3.4)
+project(TestFindVulkan C)
+include(CTest)
+
+SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../../)
+find_package(Vulkan REQUIRED)
+
+add_executable(test_tgt main.c)
+target_link_libraries(test_tgt Vulkan::Vulkan)
+add_test(NAME test_tgt COMMAND test_tgt)
+
+add_executable(test_var main.c)
+target_include_directories(test_var PRIVATE ${Vulkan_INCLUDE_DIRS})
+target_link_libraries(test_var PRIVATE ${Vulkan_LIBRARIES})
+add_test(NAME test_var COMMAND test_var)
diff --git a/Tests/FindVulkan/Test/main.c b/Tests/FindVulkan/Test/main.c
new file mode 100644
index 0000000..78dcb65
--- /dev/null
+++ b/Tests/FindVulkan/Test/main.c
@@ -0,0 +1,29 @@
+#include <vulkan/vulkan.h>
+
+int main()
+{
+  VkInstanceCreateInfo instanceCreateInfo = {};
+  instanceCreateInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
+
+  VkApplicationInfo applicationInfo = {};
+  applicationInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
+  applicationInfo.apiVersion = VK_API_VERSION_1_0;
+  applicationInfo.applicationVersion = VK_MAKE_VERSION(1, 0, 0);
+  applicationInfo.engineVersion = VK_MAKE_VERSION(1, 0, 0);
+  applicationInfo.pApplicationName = "CMake Test application";
+  applicationInfo.pEngineName = "CMake Test Engine";
+
+  instanceCreateInfo.pApplicationInfo = &applicationInfo;
+
+  VkInstance instance = VK_NULL_HANDLE;
+  vkCreateInstance(&instanceCreateInfo, NULL, &instance);
+
+  // We can't assert here because in general vkCreateInstance will return an
+  // error if no driver is found - but if we get here, FindVulkan is working
+
+  if (instance != VK_NULL_HANDLE) {
+      vkDestroyInstance (instance, NULL);
+  }
+
+  return 0;
+}

-----------------------------------------------------------------------

Summary of changes:


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list