Explore Tipi

Include dependencies from GitHub

Include dependencies from GitHub

To add a Gitub repository as a dependency to your project add it's github radix (the part of the URL containing the Github user - or organisation - and project names) as a key to your .tipi/deps

For example to add the library termcolor made by @ikalnytskyi from Github https://github.com/ikalnytskyi/termcolor

{
  "ikalnytskyi/termcolor": {}
}

And then just use it! Here's a short example colorconsole.cpp:

#include <termcolor/termcolor.hpp>

int main(int /*argc*/, char** /*argv*/)
{
    std::cout << termcolor::red << "Hello, ";                   // 16 colors
    std::cout << termcolor::color<100> << "Colorful ";          // 256 colors
    std::cout << termcolor::color<211, 54, 130> << "World!";    // true colors
    std::cout << std::endl;
    return 0;
}

Compile and run:

$ tipi . -t linux-cxx17
( ... )

$ ./build/linux-cxx17/colorconsole
Hello, Colorful, World!

The full detail about the syntax and options of the deps file can be found in the documentation.

You may want to constrain the dependency to a specific git branch or release by adding the matching branch name / release tag (ex. the tag v2.0.0 of termcolor) to the deps file using an @ section:

{
 "ikalnytskyi/termcolor": { "@": "v2.0.0" }
}

Doing this can be useful to make use of local source caching to improve build speeds as tipi will reuse the stored version

Additionally you can specify this setting by target by providing narrow-named @ sections like @:wasm-cxx17 for the target wasm-cx17

{
  "ikalnytskyi/termcolor": 
  { 
    "@": "v2.0.0", 
    "@:macos-cxx17": "v1.0.0" /* use the v1 release for macOS builds */
  }
}