Crates.io | tpot |
lib.rs | tpot |
version | 0.1.4 |
source | src |
created_at | 2023-04-17 19:44:54.312338 |
updated_at | 2024-08-04 20:53:07.567509 |
description | A cargo inspired build tool for C |
homepage | https://github.com/jw2476/teapot |
repository | https://github.com/jw2476/teapot |
max_upload_size | |
id | 841840 |
size | 51,128 |
A cargo inspired C build system with built-in formatting, linting, dependencies, registry (coming soon), and multithreaded building
To install teapot run:
cargo install tpot
There are a few dependencies that teapot relies on. Most of these can be installed with a few commands:
Once teapot and its dependencies are installed you are ready to brew! Create a new leaf (teapot's version of crates) with the command:
tpot new --bin my_first_leaf
If everything went well, there will now be a folder called my_first_leaf containing a tea.toml and a src/main.c file.
To build your leaf run tpot brew
, the artifact will be stored in the target
directory
Or to compile and run with one command, use tpot pour
:
From there it's just more of the same. Teapot will find new C files as you create them, building and linking them at blazingly fast speeds thanks to TCC.
Eventually you'll need to add dependencies to your code. Assuming the dependency supports teapot, it's as simple as downloading the leaf to your computer and running tpot add
. For example, to add raylib:
tpot add raylib --path deps/raylib --features text,shapes
The local folder will be checked for a tea.toml file, built into a static library, and linked into your program.
To format your code, run:
tpot format
If you don't like teapot's default clang-format configuration adjust the .clang-format file located in the same directory as the tea.toml file.
To lint your code, run:
tpot lint
This currently relies on clang-tidy and just uses the default lints, but a system for specifying lints in a similar way to clippy is in development.
To create a library leaf, use the --lib
flag on the tpot new
command. Library leaves have an include directory in addition to the src directory. Any header files within the include directory will be made available for external use.
Features are teapot's way of configuring what's compiled based on operating system, desktop environments, etc.
The available features for a leaf are specified in the tea.toml file at package.features
. In addition to the user-defined features, teapot comes with predefined features such as windows and linux which are defined based on the target operating system.
If a feature is enabled the macro FEATURE_[NAME]
will be defined. For example, if the target OS is Windows the FEATURE_WINDOWS
macro will be defined. In addition to macros, and files ending in .[NAME].c
will only be compiled if the feature is enabled. For example, if the target OS is Linux the file awesome.windows.c
will be ignored and awesome.linux.c
compiled.