| title | tipi - 🔮 EXPERIMENTAL - Getting started with tipi CMakeLists generator | |
|---|---|---|
| aliases |
|
Setup your machine:
- Create your account on tipi.build
- Install
tipi:- Tipi Visual Studio Code extension:
Add to Visual Studio Code - Command line utility:
- Tipi Visual Studio Code extension:
# Linux & macOS:
/bin/bash -c \
"$(curl -fsSL https://raw.githubusercontent.com/tipi-build/cli/master/install/install_for_macos_linux.sh)"# Windows 10 / 11 in Powershell
[Net.ServicePointManager]::SecurityProtocol = "Tls, Tls11, Tls12, Ssl3"
. { `
iwr -useb https://raw.githubusercontent.com/tipi-build/cli/master/install/install_for_windows.ps1 `
} | iex
# P.S.: we highly recommend you give a the new Windows Terminal app a try. It truly augments your
# console experience on Windows!- Run
tipi connectand link your installation to your tipi.build account so you can use your tipi subscription - Create an empty folder for the example project on your disk and
cdinto it - Create an
example.cppinside that folder and write a simple hello world:
#include <iostream>
int main(int argc, char** argv) {
std::cout << "tipi is cool!" << std::endl;
return 0;
}You can replace occurrences of
linux-cxx17in the instructions below withwindowsormacos-cxx17when using your subscription or the environment matching your machine's platformOn Linux:
linux-cxx17orlinux-cxx20On macOS:
macos-cxx17ormacos-cxx20On Windows:
windowsorwindows-cxx17orwindows-cxx20orvs-16-2019-cxx17(if you have Build Tools for Visual Studio 2019 installed)When using your tipi subscription to build or run, a cloud node of the corresponding platform is deployed in the tipi cloud.
-
build the example using either:
- your tipi subscription:
tipi -t linux-cxx20 build . - your local machine[^1]:
tipi -t linux-cxx20 .
- your tipi subscription:
-
run the resulting binary using:
- your tipi subscription:
tipi -t linux-cxx20 .run build/linux-cxx20/bin/example - your local machine[^1]:
tipi run build/linux-cxx20/bin/example
- your tipi subscription:
-
Add a dependency from GitHub: we're going to add a JSON manipulation library from: github.com/nlohmann/json
- create a file
.tipi/depswith content
- create a file
{
"nlohmann/json" : {
"@" : "v3.11.2",
"u": false,
"x": [
"benchmarks",
"/tests",
"/docs",
"/tools"
]
}
}
Note: we are pinning the version of the dependency to the tagger release
v3.11.2(list can be found under nlohmann/json/releases ). At time of building tipi will pull the release from the GitHub repository and build it. If you want to live on the edge, you can remove the@pin or write a branch name likemasterin there.
- Edit your
example.cpp:
#include <iostream>
#include <nlohmann/json.hpp> // tipi.build will find it online
int main(int argc, char** argv) {
std::cout << "Wonderful JSON formatter with tipi is cool!" << std::endl;
auto json = nlohmann::json::parse(argv[1]);
std::cout << json.dump(2) << std::endl;
return 0;
}- Compile and run (see #6 and #7 above):
$> tipi -t linux-cxx20 build .
$> tipi -t linux-cxx20 .run ./build/linux-cxx20/bin/example '[4,52,25]'
Wonderful JSON formatter with tipi is cool!
[
4,
52,
25
]