A universal C/C++ project manager and build orchestrator with GitHub-integrated package publishing
π Documentation | Configurations | Quick Start
Porters is a modern, production-ready project manager for C/C++ that simplifies dependency management, build orchestration, and package publishing. Inspired by Cargo but designed specifically for C/C++ ecosystems.
β¨ Features
- π Zero-Config Project Init - Automatically detects existing C/C++ projects
- β‘ Direct File Execution -
porters execute file.ccompiles and runs instantly with automatic dependency resolution - π¦ Unified Dependency Management - Git (SSH/HTTPS), path, global/local support, and registry
- π¨ 14 Build System Support - Auto-detect and seamlessly integrate with CMake, XMake, Meson, Make, Ninja, Autotools, SCons, Bazel, Buck2, Premake, QMake, Conan, vcpkg, or custom builds
- π― Smart Project Scaffolding - Interactive project creation with license selection
- π€ Smart Auto-Configuration - Everything works automatically with optional manual overrides
- π Automatic Dependency Resolution - Platform-aware with constraint checking
- π Dependency Graph Visualization - Understand your project dependencies
- π Lockfile Support - Reproducible builds with
porters.lock - π€ GitHub Publishing - Automated package releases with artifacts
- π Package Registry - Search and install packages from the Porters registry
- π Extension System - Create and publish custom extensions to crates.io
- π Global Package Installation - Centralized dependency management in
~/.porters/ - πΎ Global Dependency Cache - Shared cache across all projects in
~/.porters/cache/ - π Isolated Virtual Environments - Project-specific dependencies in
ports/folder - π Smart Sync -
porters syncwith--devand--optionalflags - π οΈ Compiler Detection - Auto-detect GCC, Clang, MSVC, LLVM, MinGW, Emscripten
- π Build Scripts - Pre/post build hooks for custom workflows
- ποΈ Enhanced Configuration - Build flags, include paths, linking options
- π Self-Updating - Built-in update mechanism via GitHub releases
- β Tool Version Requirements - Specify minimum versions for compilers and build tools (like Python's requirements.txt)
- π Hash Verification - SHA-256 checksums for all dependencies
- π Transitive Dependencies - Automatic resolution of dependencies-of-dependencies
- π¨ Custom Commands - Define project-specific CLI commands in config
- π Named Scripts - Quick shortcuts for common tasks
- π Remote Registry Sync - Automatically fetch package index from GitHub
βοΈ Offline Mode - Work without internet using cached dependencies
- π¦ Auto-Install Extensions - Automatically install extensions from porters.toml
- π crates.io Marketplace - Publish and discover extensions on crates.io
- π§ 6 Lifecycle Hooks - pre_build, post_build, pre_install, post_install, pre_sync, post_sync
- π― User-Made Extensions - Anyone can create and publish Porters extensions
- π‘ Template Generator -
porters extension createscaffolds extension projects
- π Cross-Platform - Windows, macOS, Linux support
- π§ Platform-Specific Dependencies - Conditional dependency resolution
- π Library & Application Projects - Proper configuration for both types
- β‘ Parallel Operations - Async dependency downloads
- π¨ Beautiful CLI - Colored output with emoji indicators
- π Build Tool Detection - Automatic checking and installation guidance
β οΈ Enhanced Error Handling - Helpful messages with GitHub issue links- π¨ Version Validation - Pre-build checks for tool version requirements
- π¦ Registry System - Search, discover, and install curated C/C++ packages
- π» Global Configuration - Centralized settings in
~/.porters/config.toml
π Prerequisites
Before installing Porters, ensure you have the following tools installed:
- Rust & Cargo - Required for Porters itself (installation and core functionality)
- Git - Required for dependency management and cloning repositories
Porters auto-detects and supports 14+ build systems. Install the ones you plan to use:
- CMake - Cross-platform build generator
- XMake - Lua-based modern build system
- Meson - Fast, user-friendly build system
- Bazel - Google's scalable build system
- Buck2 - Meta's fast build system
- Make - Makefile-based builds
- Ninja - Fast, lightweight build system
- Autotools - configure/make (GNU Build System)
- SCons - Python-based build tool
- GCC/G++ - GNU Compiler Collection
- Clang/Clang++ - LLVM compiler
- MSVC - Microsoft Visual C++ (Windows)
- MinGW - Minimalist GNU for Windows
Note: You don't need to install all build systems - Porters will auto-detect and use what's available for your projects.
Note: You need to install Rust and Cargo first. See Installation Guide.
cargo install porters
# After installation, add to PATH if needed:
# Windows: [Environment]::SetEnvironmentVariable("Path", $env:Path + ";$env:USERPROFILE\.cargo\bin", "User")
# Linux/macOS: export PATH="$HOME/.cargo/bin:$PATH"Install the latest development version directly from GitHub:
cargo install --git https://github.com/muhammad-fiaz/Porters.git
β οΈ Note: Nightly builds may contain unstable features and bugs. Use stable releases for production.
Windows:
# Clone and run installer
git clone https://github.com/muhammad-fiaz/porters
cd porters
.\install.ps1Linux/macOS:
# Clone and run installer
git clone https://github.com/muhammad-fiaz/porters
cd porters
chmod +x install.sh
./install.shThe installer will:
- β Check Rust installation
- β Install Porters via cargo
- β Automatically add to PATH (with your permission)
- β Verify the installation
git clone https://github.com/muhammad-fiaz/porters
cd porters
cargo build --release
cargo install --path .Download pre-built binaries from GitHub Releases
Note: Porters will automatically check if cargo bin is in your PATH on first run and show setup instructions if needed.
# Interactive project creation
porters create my-awesome-project
# Quick creation with defaults (C++, CMake, Application)
porters create my-project -ycd your-existing-cpp-project
porters init# Execute any C/C++ file - works immediately!
porters execute hello.c
# With arguments
porters execute main.cpp arg1 arg2
# NO porters.toml needed - works anywhere!100% Automatic - Zero Configuration:
- β
Any C/C++ File -
.c,.cpp,.cxx,.cc,.c++,.cp - β Compiler Auto-Detection - Finds gcc/clang/g++/clang++
- β
Dependency Resolution - Reads
porters.tomlif present - β Include/Lib Paths - Automatically injected from dependencies
- β Works Standalone - Execute files even outside a project
See Execute Guide for detailed documentation.
porters create <name> # Create new project
porters init # Initialize existing project
porters add <package> # Add dependency
porters remove <package> # Remove dependency
porters build # Build whole project
porters execute <file> # Execute single C/C++ file (zero config!)
porters run [args] # Run compiled project executable
porters test # Run tests
porters update # Update dependencies
porters clean # Clean build artifacts
porters lock # Generate lockfile
porters vendor # Vendor dependencies
porters graph # Show dependency graph
porters publish # Publish to GitHub
porters upgrade # Update porters itself
porters run-script <name> # Run named script from config
porters <custom-command> # Run custom command from configπ Configuration Structure Example
[project]
name = "my-project"
version = "1.0.0"
description = "My awesome C++ project"
license = "Apache-2.0"
authors = ["Your Name <you@example.com>"]
repository = "https://github.com/username/my-project"
project-type = "application" # or "library"
entry_point = "src/main"
platforms = ["windows", "macos", "linux"]
keywords = ["application", "c", "cpp"]
readme = "README.md"
# Tool version requirements (like Python's requirements.txt)
[requires]
cpp = ">=17" # C++ standard version
cmake = ">=3.20" # CMake version
gcc = ">=9.0" # GCC version
clang = ">=12.0" # Clang version (alternative to gcc)
ninja = ">=1.10" # Ninja build tool version
make = ">=4.0" # Make version
meson = ">=0.60" # Meson version
bazel = ">=5.0" # Bazel version
conan = ">=1.50" # Conan version
vcpkg = "*" # Any version of vcpkg
# Extensions to auto-install from crates.io
extensions = [
"porters-format", # Code formatter extension
"porters-lint", # Linting extension
"porters-doc" # Documentation generator
]
[dependencies]
fmt = { git = "https://github.com/fmtlib/fmt", tag = "10.1.1" }
spdlog = { git = "https://github.com/gabime/spdlog", branch = "v1.x" }
mylib = { path = "../mylib" }
[dev-dependencies]
catch2 = { git = "https://github.com/catchorg/Catch2" }
benchmark = { git = "https://github.com/google/benchmark" }
[optional-dependencies]
zlib = { git = "https://github.com/madler/zlib" }
[build]
system = "cmake"
options = ["-DBUILD_SHARED_LIBS=ON"]
[build.env]
CC = "clang"
CXX = "clang++"
# Build lifecycle scripts
[build.scripts]
pre-build = "echo Building..."
post-build = "strip build/myapp"
pre-install = "echo Installing..."
post-install = "echo Done!"
# Custom CLI commands
[[commands]]
name = "format"
description = "Format source code"
script = "clang-format -i src/**/*.cpp"
[[commands]]
name = "docs"
description = "Generate documentation"
script = "doxygen Doxyfile"
[commands.env]
DOXYGEN_OUTPUT = "docs/html"
# Named script shortcuts
[scripts]
test-all = "cargo build && cargo test"
deploy = "./deploy.sh production"
# Direct file execution configuration (OPTIONAL - works automatically)
[run]
# Extra include directories (beyond automatic dependency includes)
include-dirs = ["./include", "./extra/include"]
# Compiler flags (only if you want warnings, optimizations, etc.)
compiler-flags = ["-Wall", "-O2", "-std=c17"]
# Linker flags (only if you need extra libraries)
linker-flags = ["-lm", "-lpthread"]
# Override compiler (only if you need a specific one)
c-compiler = "clang" # Default: auto-detect
cpp-compiler = "clang++" # Default: auto-detectCreate and use extensions for custom functionality:
# From crates.io
porters extension install porters-format
# From GitHub
porters extension install my-ext --git https://github.com/user/porters-ext-myext
# From local path
porters extension install my-ext --path ./my-extensionporters extension create my-awesome-extensionπ Extension Example
# extension.toml
name = "porters-format"
version = "0.1.0"
description = "Code formatting extension"
[hooks]
post-build = "hooks/format.sh"
[[commands]]
name = "format"
description = "Format code"
script = "scripts/format.sh"See the Extension Guide for details.
π¨ Supported Build Systems (17+)
Porters natively supports and executes the following build systems with auto-detection:
- Make - Makefile-based builds
- Ninja - Fast, lightweight build system
- Autotools - configure/make (GNU Build System)
- Meson - Fast, user-friendly build system
- SCons - Python-based build tool
- Jam - Boost.Build system
- CMake - Cross-platform build generator
- Conan - C/C++ package manager with CMake integration
- vcpkg - Microsoft's C++ library manager
- Hunter - CMake-based package manager
- XMake - Lua-based modern build system
- Bazel - Google's scalable build system
- Buck2 - Meta's fast build system
- Premake - Project file generator (Visual Studio, Makefiles, Xcode)
- QMake - Qt's build system
- Gradle C++ - Gradle build system for C++
- Custom Scripts - Define your own build commands in
porters.toml
- Package managers (Conan, vcpkg, Hunter)
- Modern systems (Bazel, Buck2, CMake, XMake, Meson, Gradle C++)
- Meta build (Premake, QMake)
- Traditional (Ninja, Autotools, SCons, Jam, Make)
- Explicit configuration via
build.systemin porters.toml
porters install fmt --git https://github.com/fmtlib/fmtInstalls to ~/.porters/packages/
porters add fmt --git https://github.com/fmtlib/fmtInstalls to project's ports/ folder
porters sync # Regular dependencies
porters sync --dev # Include dev dependencies
porters sync --optional # Include optional dependenciesporters lock # Generate/update porters.lock- Generates executable
- Entry point:
src/main.cpp - CMake:
add_executable()
- Generates static/shared library
- Proper include setup
- CMake:
add_library()
[dependencies]
winapi = { git = "...", platforms = ["windows"] }
pthread = { version = "*", platforms = ["linux", "macos"] }export GITHUB_TOKEN=ghp_your_token
porters publishCreates GitHub release with:
- Version tag
- Release notes
- Installation table
- CHANGELOG integration
Contributions welcome! See CONTRIBUTING.md
This project is licensed under the Apache License 2.0 - see LICENSE
- π Complete Documentation
- π Getting Started
- π Extension Guide
- π¦ Dependency Management
- π¨ Build Systems
- π οΈ Configuration Reference
if you found any issues please report them at https://github.com/muhammad-fiaz/Porters/issues
Muhammad Fiaz
- Email: contact@muhammadfiaz.com
- GitHub: @muhammad-fiaz