Installation
Integration with CMake is done in the usual ways:
-
Fetch the library.
If you use CPM.cmake, just add the following.
CMakelists.txt CPMAddPackage("gh:neilkichler/cuinterval@0.2.0")FetchContent is built-in to recent CMake. Ensure once at the top of your
CMakelists.txtyou have at least version3.14as a requirement.CMakelists.txt cmake_minimum_required(VERSION 3.14)And you need to include it somewhere.
CMakelists.txt include(FetchContent)Now all dependencies can be added using FetchContent_Declare and FetchContent_MakeAvailable. Here shown for
cuinterval.CMakelists.txt FetchContent_Declare(cuintervalGIT_REPOSITORY git@github.com:neilkichler/cuinterval.gitGIT_TAG main)FetchContent_MakeAvailable(cuinterval)A system-wide install is currently only possible by building from source.
Terminal window git clone https://github.com/neilkichler/cuinterval.gitcd cuintervalcmake --preset releasecmake --build buildcmake --install buildYou also need to add
find_package(cuinterval)before linking to the library.CMakelists.txt find_package(cuinterval)To manage the dependency as Git submodule, you can add it as follows.
Terminal window git submodule add https://github.com/neilkichler/cuinterval.gitNow you just need to add the subdirectory.
CMakelists.txt add_subdirectory(path/to/cuinterval) -
Add the library as a link dependency to your project.
CMakelists.txt target_link_libraries(${PROJECT_NAME} PUBLIC cuinterval) -
Take a look at the example to get started.
You can directly include the header folder into your project.
The latest header-only version is available in the header-only branch:
https://github.com/neilkichler/cuinterval/archive/header-only.zip
Download the latest amalgamated single header version of the library.
curl -o cuinterval.cuh https://raw.githubusercontent.com/neilkichler/cuinterval/refs/heads/single-header/cuinterval.cuh