Tools to make compiling C/C++ projects easy
Project description
compiletools
C/C++ build tools that requires almost no configuration.
- NOTE:
The repository-level README.rst is a symlink to this file, so they are the same canonical document.
- Author:
- Date:
2025-12-17
- Version:
7.0.2
- Manual section:
1
- Manual group:
developers
SYNOPSIS
ct-* [compilation args] [filename.cpp] [–variant=<VARIANT>]
DESCRIPTION
compiletools provides C/C++ build automation with minimal configuration. The tools automatically determine source files, dependencies, and build requirements by analyzing your code.
To build a C or C++ project, simply type:
ct-cake
This automatically determines source files, builds executables, and runs tests. See ct-cake(1) for details.
QUICK START
Try compiletools without installing using uvx:
uvx --from compiletools ct-cake
uvx --from compiletools ct-compilation-database
This runs tools directly without affecting your system. All ct-* tools work with uvx (e.g., uvx --from compiletools ct-config).
INSTALLATION
uv pip install compiletools
Or for development:
git clone https://github.com/DrGeoff/compiletools
cd compiletools
uv pip install -e ".[dev]"
KEY FEATURES
- Magic Comments
Embed build requirements directly in source files using special comments like //#LDFLAGS=-lpthread or //#PKG-CONFIG=zlib. See ct-magicflags(1).
- Automatic Dependency Detection
Traces #include statements to determine what to compile and link. No manual dependency lists needed.
- Build Variants
Support for debug, release, and custom build configurations. Use --variant=release to select. See ct-config(1).
- Shared Object Cache
Multi-user/multi-host object file caching with filesystem-aware locking for faster builds in team environments. Enable with shared-objects = true.
- Minimal Configuration
Works out-of-the-box with sensible defaults. Configuration only needed for customization.
CORE TOOLS
- ct-cake
Main build tool. Auto-detects targets, builds executables, runs tests.
- ct-compilation-database
Generate compile_commands.json for IDE integration. Auto-detects targets.
- ct-config
Inspect configuration resolution and available compilation variants.
- ct-magicflags
Show magic flags extracted from source files.
- ct-headertree
Visualize include dependency structure.
- ct-filelist
Generate file lists for packaging and distribution.
- ct-cleanup-locks
Clean stale locks in shared object caches.
- Shell Wrappers
Convenience scripts in scripts/: ct-build, ct-build-static-library, ct-build-dynamic-library, ct-watch-build, ct-lock-helper, ct-release.
CONFIGURATION
Options are parsed using ConfigArgParse, allowing configuration via command line, environment variables, or config files.
Configuration hierarchy (lowest to highest priority):
Executable directory (ct/ct.conf.d alongside the ct-* executable)
System config (/etc/xdg/ct/)
Python virtual environment (${python-site-packages}/ct/ct.conf.d)
Package bundled config (<installed-package>/ct.conf.d)
User config (~/.config/ct/)
Project config (<gitroot>/ct.conf.d/)
Git repository root directory
Current working directory
Environment variables (capitalized, e.g., VARIANT=release)
Command-line arguments
Build variants (debug, release, etc.) are config profiles specifying compiler and flags. Common variants include blank (default debug), blank.release, gcc.debug, gcc.release, clang.debug, clang.release.
Common usage:
ct-cake --variant=release
ct-cake --append-CXXFLAGS="-march=native"
For details on configuration hierarchy, file format, and variant system, see ct-config(1).
ATTRIBUTION
This project is derived from the original compiletools developed at Zomojo Pty Ltd (between 2011-2019). Zomojo ceased operations in February 2020. This repository continues the development and maintenance of the compiletools project.
SEE ALSO
ct-build
ct-build-dynamic-library
ct-build-static-library
ct-cake
ct-cleanup-locks
ct-compilation-database
ct-config
ct-cppdeps
ct-create-makefile
ct-filelist
ct-findtargets
ct-git-sha-report
ct-gitroot
ct-headertree
ct-jobs
ct-list-variants
ct-lock-helper
ct-magicflags
ct-release
ct-watch-build
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file compiletools-7.0.2.tar.gz.
File metadata
- Download URL: compiletools-7.0.2.tar.gz
- Upload date:
- Size: 292.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"43","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c3c5a9161788ef4c62029c3281b266fbae3775cc5d5a82dc6211e7bc50ce74f
|
|
| MD5 |
109b909d5a478ea8d63597d016ea38c0
|
|
| BLAKE2b-256 |
9158049fc35669ef605df69680236c4b90bb49e9c4966dee8f61b24a9cd7a320
|
File details
Details for the file compiletools-7.0.2-py3-none-any.whl.
File metadata
- Download URL: compiletools-7.0.2-py3-none-any.whl
- Upload date:
- Size: 422.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"43","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b2eaf48507f69154a0057a47f550a30fa5f350a8fb161291997ee72ec64b6df
|
|
| MD5 |
10e46578d75de0937cf75e6fa2424504
|
|
| BLAKE2b-256 |
60742d03f627a8ee05b98071d5e09a48de4a3d7017a468f6b86f1aca7bcf587e
|