Skip to content

pybamm-team/sundials-vcpkg-registry

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 

Repository files navigation

A vcpkg registry providing a portfile for the sundials library with a feature to enable compilation against SuiteSparse's KLU algorithm.

See

Why a separate registry?

sundials is available through vcpkg, but is compiled without KLU support. To enable this, the portfile (among other things) must be modified to enable KLU support (i.e. setting KLU_ENABLE to TRUE) but also find the SuiteSparse library.

Installing sundials from this registry

You need to tell you vcpkg installation to look for sundials port here, instead of the main vcpkg registry. This is achieved using vcpkg-configuration.json file at the root of you vcpkg installation (or project if you're using vcpkg in manifest mode):

{
  "registries": [
    {
      "kind": "git",
      "repository": "https://github.com/pybamm-team/sundials-vcpkg-registry.git",
      "packages": [ "sundials" ]
    }
  ]
}

Next, you can install sundials with KLU support with

vcpkg install sundials[klu] --feature-flags=registries

this will installed sundials with KLU support, along with the required dependencies (e.g. SuiteSparse).

Summary of changes

The two main changes compared are:

  • A klu feature that depends on SuiteSparse

    # ports/sundials/vcpkg.json
    {
      "name": "sundials",
      # ...
      "features": {
          "klu": {
              "description": "KLU support for SUNDIALS",
              "dependencies": ["suitesparse"]
              }
        }
    }
    # ports/sundials/portfile.cmake
    #...
    if ("klu" IN_LIST FEATURES)
        set(ENABLE_KLU ON)
    else()
        set(CMAKE_DISABLE_FIND_PACKAGE_SUITESPARSE ON)
    endif()
    # ...
  • A find-klu.patch patch that makes sure CMake finds vcpkg's SuiteSparse when compiling sundials.

    # ports/sundials/portfile.cmake
    vcpkg_from_github(
      OUT_SOURCE_PATH SOURCE_PATH
      REPO LLNL/sundials
      # ...
      PATCHES "find-klu.patch"
      # ...
    )

    See the vcpkg docs at Patching Example: Patching libpng to work for x64-uwp.