π Currently, it is not production ready and thus should be used carefully.οΈ
Feature | Ready? |
---|---|
CLI tool | β |
Global command magnet |
β |
No lock-in | β |
Run Magnet on existing projects | β |
Bootstrap a new C++ project with a single command | β |
Fine tuning after project creation (customize README, LICENSE, .gitignore, etc.) | β |
Edit individual CMakeLists.txt files for full customization | β |
Automatically generate CMakeLists.txt files based on your dependencies and project structure | β |
Pull dependencies from GitHub / GitLab / BitBucket | β |
Switch dependency branch | β |
Remove installed dependencies | β |
macOS support (Xcode / Ninja generator) | β |
Windows support (Visual Studio 17 / Ninja generator) | β |
Linux support (Ninja generator) | β |
See FAQ down below for more information.
Create your brand new C++ project with a single command:
magnet new
Every time your source code changes, simply run:
magnet generate
to regenerate your project files.
π‘ Note: If you use CLion, this is done automatically.
Building your project is as easy as running:
magnet build
Then, launch your project with:
magnet go
π‘ Note: This will only work if your project is an executable. Also, the default configuration is Debug
. To change
that, run magnet config [Debug/Release]
.
To install a dependency, run:
magnet pull <dependency>
where <dependency>
is the GitHub repository of the dependency you want to install.
π‘ Note: Instead of a full GitHub URL, you can also use the shorthand notation username/repository
.
π‘ Note: You can list all installed dependencies by running magnet pull --list
.
π‘ Note: If no argument is provided, Magnet will pull all dependencies for this project. Useful for when cloning a project from GitHub that was created with Magnet.
To remove a dependency, simply run:
magnet remove <dependency>
where <dependency>
is the name of the dependency you want to remove.
Yes, removing a git submodule is that easy.
If you'd like to switch a dependency to a different branch, run:
magnet switch <dependency> <branch>
where <dependency>
is the name of the dependency you want to switch and <branch>
is the branch you want to
switch to.
That's not all. You can explore every possible command by running:
magnet help
Clone repo: git clone https://github.com/futureblur/magnet.git --recursive
Follow the instructions for your system:
- Make sure you have Homebrew installed
- Run the installer:
cd magnet/scripts && chmod +x ./macOSInstaller.sh
:- Xcode:
./macOSInstaller.sh --xcode
- CLion (Ninja):
./macOSInstaller.sh --ninja
- Xcode:
- Install CMake
- Run your desired installer in
magnet/scripts
:- Visual Studio 17: Double-click
WindowsInstaller (Visual Studio 17).bat
- CLion (Ninja): Double-click
WindowsInstaller (Ninja).bat
- Visual Studio 17: Double-click
- Run the installer:
cd magnet/scripts && chmod +x ./LinuxInstaller.sh && ./LinuxInstaller.sh
Magnet is built on top of CMake β the "unofficial" official build system for C++ . It leverages CMake to generate your project files, and git submodules to manage your dependencies.
Think of it like that: Magnet speeds up the process of setting up a new C++ project, creating CMakeLists.txt files, handling dependencies, and more β without you ever writing a single line of CMake code, or executing a single git command.
We are working on a way to make Magnet work on existing projects. Right now, it can only bootstrap new projects due to fundamental differences of project structures.
Magnet generates these on the fly, everytime you run magnet generate
or magnet pull
β hence why any changes will
be overwritten.
However, support for this is planned for the future.
No. Magnet is a dependency manager. It delegates the actual building process to CMake.
No. Magnet is not a lock-in. You can use Magnet to bootstrap your project, and then never use it again (though this defeats the purpose of a dependency manager).
Letβs face it: managing your dependencies in a C++ project is a pain in the butt.
On one hand, you can let existing solutions like Conan or vcpkg handle that, and on the other hand, you could take it on yourself and embrace the countless hours wasted on setting up a new project with your desired dependencies.
But hereβs the problem: when youβre in the middle of creating a project and are searching for a solution, you donβt have the time to learn new tech.
In fact, youβll never have time to learn every new tool that probably isnβt worth dedicating your time to. You want something that can be set up in minutes.
And hereβs where Magnet comes into play.
We take a different approach. We like to simplify things. To a point where itβs not even possible anymore.
Magnet does not lock you in. You are completely in charge of your entire project. At all times.
Magnet is not a new build tool. Nor does it host packages in a dedicated cloud. Instead, we leverage existing, battle-tested technologies to do the heavy lifting.
What you see, is what you get.
Installing Magnet for your system takes 60 seconds. Pulling a dependency, 10 seconds. Scaffolding a new project, 5 seconds.
Imagine what you could do will all of this free time now. Say goodbye to unexpected setup errors: allowing you to focus on coding and innovating great products.
Magnet is licensed under the GNU GPLv3 license.