Commit a456e409 authored by Michał Chojnowski's avatar Michał Chojnowski
Browse files

vk-bootstrap: 0.7 -> 1.4.335

Motivation: the package is outdated by 3 years.

Things done:
1. Bump the version (to match the current version of Vulkan headers in nixpkgs).
2. Update the catch2 dependency to catch2_3, following upstream.
3. Upstream uses FetchContent to fetch catch2 and glfw for testing.
   Patch CMakeLists.txt so that system packages are used instead.
4. Remove the [out, dev] split. It's pointless because this is a static library.
5. Enable checkPhase. Comment out a test which uses FetchContent.
   Fix CMAKE_PREFIX_PATH in one of the integration tests.
parent 6456e59a
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7ec2d39..f52313d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -129,7 +128,8 @@ if(VK_BOOTSTRAP_TEST)
         endif()
     endif()
 
-    add_subdirectory(ext)
+    find_package(glfw3)
+    find_package(Catch2 3)
     add_subdirectory(tests)
     add_subdirectory(example)
 endif ()
+38 −0
Original line number Diff line number Diff line
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 0b4f2e1..4dd1fe0 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -58,14 +58,16 @@ list(APPEND CMAKE_MODULE_PATH ${Catch2_SOURCE_DIR}/extras)
 include(Catch)
 catch_discover_tests(vk-bootstrap-test)
 
-# Test add_subdirectory support using fetch content vulkan headers
-add_test(NAME integration.add_subdirectory.fetch_content_vulkan_headers
-    COMMAND ${CMAKE_CTEST_COMMAND}
-        --build-and-test ${CMAKE_CURRENT_LIST_DIR}/integration
-                         ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory/fetch_content_vulkan_headers
-        --build-generator ${CMAKE_GENERATOR}
-        --build-options -DADD_SUBDIRECTORY_TESTING=ON -DVULKAN_HEADER_VERSION_GIT_TAG=${VK_BOOTSTRAP_SOURCE_HEADER_VERSION_GIT_TAG}
-)
+# Commented out for nixpkgs due to external dependencies.
+#
+# # Test add_subdirectory support using fetch content vulkan headers
+# add_test(NAME integration.add_subdirectory.fetch_content_vulkan_headers
+#     COMMAND ${CMAKE_CTEST_COMMAND}
+#         --build-and-test ${CMAKE_CURRENT_LIST_DIR}/integration
+#                          ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory/fetch_content_vulkan_headers
+#         --build-generator ${CMAKE_GENERATOR}
+#         --build-options -DADD_SUBDIRECTORY_TESTING=ON -DVULKAN_HEADER_VERSION_GIT_TAG=${VK_BOOTSTRAP_SOURCE_HEADER_VERSION_GIT_TAG}
+# )
 
  get_target_property(vulkan_headers_include_dir Vulkan::Headers INTERFACE_INCLUDE_DIRECTORIES)
 
@@ -105,7 +107,7 @@ if (VulkanHeaders_FOUND)
                 --build-and-test ${CMAKE_CURRENT_LIST_DIR}/integration
                                 ${CMAKE_CURRENT_BINARY_DIR}/find_package/find_package_vulkan_headers
                 --build-generator ${CMAKE_GENERATOR}
-                --build-options -DFIND_PACKAGE_TESTING=ON "-DCMAKE_PREFIX_PATH=${vulkan_headers_install_dir};${test_install_dir}"
+                --build-options -DFIND_PACKAGE_TESTING=ON "-DCMAKE_PREFIX_PATH=${vulkan_headers_install_dir};${test_install_dir};${CMAKE_INSTALL_PREFIX}"
         )
 
         set_tests_properties(integration.find_package.find_package_vulkan_headers PROPERTIES DEPENDS integration.install)
+15 −15
Original line number Diff line number Diff line
@@ -5,40 +5,40 @@
  cmake,
  vulkan-headers,
  glfw,
  catch2,
  catch2_3,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "vk-bootstrap";
  version = "0.7";
  outputs = [
    "out"
    "dev"
  ];
  version = "1.4.335";

  src = fetchFromGitHub {
    owner = "charles-lunarg";
    repo = "vk-bootstrap";
    rev = "v${finalAttrs.version}";
    hash = "sha256-X3ANqfplrCF1R494+H5/plcwMH7rbW6zpLA4MZrYaoE=";
    hash = "sha256-WFROoVAOl4HBNb/a8rx522Zz2LP4m2Zk03jckWxv7w0=";
  };

  postPatch = ''
    # Upstream uses cmake FetchContent to resolve glfw and catch2
    # needed for examples and tests
    sed -i 's=add_subdirectory(ext)==g' CMakeLists.txt
    sed -i 's=Catch2==g' tests/CMakeLists.txt
  '';
  patches = [
    ./0001-disable-fetch-content.patch
    ./0002-fix-install-tests.patch
  ];

  nativeBuildInputs = [ cmake ];

  buildInputs = [
    vulkan-headers
  ];

  checkInputs = [
    glfw
    catch2
    catch2_3
  ];

  doCheck = true;

  cmakeFlags = [
    "-DVK_BOOTSTRAP_VULKAN_HEADER_DIR=${vulkan-headers}/include"
    "-DVK_BOOTSTRAP_INSTALL=1"
  ];

  meta = {