C++ for beginners.
Rivets handles the first 30 minutes of setting up a C++ project so you can focus on writing code, not fighting build scripts. It wraps standard tools like CMake and Clang/GCC in a friendly, modern CLI.
Learning C++ is hard enough. Setting up a project shouldn't be. Beginners often face a wall of frustration before writing a single line of code:
- "Where do I put my files?"
- "How do I link a library?"
- "Why is
CMakeLists.txtsyntax so confusing?" - "It works on my machine but not my friend's."
Rivets is not a build system. It is a manager for your build system.
- Standard by default: We enforce a clean folder structure that scales.
- No magic: We generate standard, readable CMake files. You can stop using Rivets at any time and keep your project.
- Zero config:
riv initsets up everything.riv runjust works.
riv doctor: Automatically checks your system for compilers (Clang/GCC) and tools (CMake, Ninja).riv init: Creates a modern C++ project structure with separated source, include, and test directories.riv build: Scans your project and generates the necessary CMake configuration on the fly, then compiles it.riv run: Builds (if necessary) and executes your binary with argument forwarding.- Dependency Management: (Coming Soon) Simple text-based dependency handling.
If you have Go installed:
go install github.com/rivets-cli/rivets/cmd/riv@latestgit clone https://github.com/rivets-cli/rivets.git
cd rivets
go build -o riv ./cmd/riv
# Move 'riv' to a folder in your PATH(Note: Pre-compiled binaries for Linux, macOS, and Windows are coming soon!)
-
Check your environment:
riv doctor
-
Create a new project:
riv init hello-world cd hello-world -
Run it:
riv run # Output: # Hello from riv! # 2 + 3 = 5
| Command | Description | Example |
|---|---|---|
riv doctor |
Validates toolchain requirements | riv doctor |
riv init <name> |
Creates a new project folder | riv init game_engine |
riv build |
Generates CMake and compiles | riv build -j 4 |
riv run |
Builds and runs the executable | riv run -- --flag |
Rivets enforces a "Convention over Configuration" structure. When you run riv init, you get:
myproject/
├── riv.toml # Simple configuration (Name, Version, Standard)
├── src/
│ └── main.cpp # Your entry point
├── lib/ # Local libraries (automatically linked)
│ └── graphics/
│ ├── include/
│ │ └── graphics/
│ └── src/
└── include/ # Header-only libraries
└── utils/
Why?
src/: Keeps your application logic clean.lib/: Encourages modular code. Any folder inlib/is automatically compiled and linked to your main app.riv.toml: A readable alternative to complex build scripts.
When you run riv build:
- Scan: Rivets looks at your folders (
src,lib,include). - Validate: It ensures you haven't done anything dangerous (like putting
.cppfiles ininclude/). - Generate: It creates a standard
.riv/CMakeLists.txtfile tailored to your files. - Execute: It invokes
cmaketo configure and build your project inside the hidden.riv/folder.
- No Build Scripts in Packages: Security first. Downloading a library shouldn't run arbitrary code on your machine.
- No Lock-in: The artifacts we generate are standard CMake. If you outgrow Rivets, you can take the generated CMake file and move on.
- Fail Loudly: If your project structure is invalid, we tell you exactly why and how to fix it.
- Basic Project Structure
- CMake Generator
- Build & Run
- Dependency Management (The big one!)
- Windows Support (Native)
- macOS Support
- Test Runner Integration
Q: Why not just teach beginners CMake? A: CMake is powerful but has a steep learning curve. Rivets acts as "training wheels," letting users write C++ immediately. They can learn CMake by inspecting the files Rivets generates.
Q: Is this production ready? A: No. Rivets is currently for learning, prototyping, and small hobby projects. For enterprise systems, stick to CMake/Bazel/Conan.
Q: Can I use this with VS Code / CLion?
A: Yes! Since we generate a standard compile_commands.json (via CMake), your IDE's C++ extension will provide full intellisense.
Q: Where is my executable?
A: It's located in .riv/build/<project_name>. We keep the root directory clean.
We love contributions, especially from beginners!
- Check CONTRIBUTING.md for setup instructions.
- Open an issue to discuss your idea.
Distributed under the MIT License. See LICENSE for more information.
- The Go team for an amazing standard library.
- The CMake team for the build system that powers the world.