Installation
This page shows how to install Rix in a Vix.cpp project.
Rix is installed through the Vix Registry and declared in your project manifest.
You do not install Rix with a separate Rix CLI.
You use the normal Vix workflow:
vix registry sync
vix add rix/rix
vix installThen you declare the dependency in vix.app:
deps = [
"rix/rix",
]Requirements
Before using Rix, make sure you have a Vix.cpp project.
A simple application project can be created with:
vix new hello --app
cd helloA reusable library project can be created with:
vix new mylib --lib
cd mylibRix can be used in both.
Use it in an application when you want to build a runnable program.
Use it in a library when your reusable C++ package depends on Rix APIs.
Install the unified Rix facade
For normal public usage, install the unified facade package:
vix registry sync
vix add rix/rix
vix installThis gives your project the main Rix header:
#include <rix.hpp>and the public facade object:
rixExample:
#include <rix.hpp>
int main()
{
rix.debug.print("Hello from Rix");
auto auth = rix.auth.memory();
return 0;
}Add Rix to vix.app
If your project uses vix.app, add Rix to the deps array.
deps = [
"rix/rix",
]A minimal application manifest can look like this:
name = "hello"
type = "executable"
standard = "c++20"
output_dir = "bin"
sources = [
"src/main.cpp",
]
include_dirs = [
"include",
"src",
]
deps = [
"rix/rix",
]
packages = [
"vix",
]
links = [
"vix::vix",
]The important part is:
deps = [
"rix/rix",
]deps is for packages installed from the Vix Registry.
packages is for CMake packages resolved with find_package.
links is for CMake targets linked into the application.
Application project example
For an application created with:
vix new hello --appadd Rix to vix.app:
name = "hello"
type = "executable"
standard = "c++20"
output_dir = "bin"
sources = [
"src/main.cpp",
]
include_dirs = [
"include",
"src",
]
deps = [
"rix/rix",
]
packages = [
"vix",
]
links = [
"vix::vix",
]
resources = [
".env=.env",
]Then install dependencies:
vix installBuild:
vix buildRun:
vix runLibrary project example
Rix can also be used inside a reusable C++ library.
For a library created with:
vix new mylib --libadd the dependency to the project metadata with:
vix add rix/rix
vix installIf the library uses a vix.app manifest for examples or small targets, declare Rix in deps:
deps = [
"rix/rix",
]Then include Rix from your library or examples:
#include <rix.hpp>Example:
#include <rix.hpp>
namespace mylib
{
inline void hello()
{
rix.debug.print("Hello from mylib");
}
}Use this when your library intentionally depends on the Rix facade.
If your library only needs one package, prefer the independent package dependency instead.
For example, for Auth only:
deps = [
"rix/auth",
]Installing only Auth
This documentation starts with Auth.
If your project only needs Auth and does not need the full facade package, you can install:
vix add rix/auth
vix installThen declare it in vix.app:
deps = [
"rix/auth",
]However, the public documentation examples use the unified facade:
#include <rix.hpp>and:
rix.authSo for following these docs, prefer:
deps = [
"rix/rix",
]Multiple Rix packages
A project can depend on the facade and independent packages if needed.
Example:
deps = [
"rix/rix",
"rix/auth",
"rix/debug",
]Use this only when the project really needs those packages directly.
For most public examples, start with:
deps = [
"rix/rix",
]Verify the installation
Create or edit src/main.cpp:
#include <rix.hpp>
int main()
{
rix.debug.print("Rix is installed");
auto auth = rix.auth.memory();
auto registered = auth.register_user({"ada@example.com","correct-password"});
if (registered.failed())
{
const auto &error = registered.error();
rix.debug.eprint(
"auth error:",
rix.auth.error.to_string(error),
error.message()
);
return 1;
}
rix.debug.print("registered:", registered.value().email());
return 0;
}Build and run:
vix build
vix runExpected output shape:
Rix is installed
registered: ada@example.comDependency fields
Use the correct field for each kind of dependency.
| Field | Purpose | Example |
|---|---|---|
deps | Vix Registry packages | "rix/rix" |
packages | CMake packages | "vix" |
links | CMake targets | "vix::vix" |
modules | Internal app modules | "auth" |
For Rix packages, use:
deps = [
"rix/rix",
]Do not put Rix Registry packages in packages.
Common mistakes
Forgetting deps
If you include:
#include <rix.hpp>but your vix.app does not contain:
deps = [
"rix/rix",
]the project may fail to build because the generated build does not know that the project depends on Rix.
Confusing deps and packages
Wrong:
packages = [
"rix/rix",
]Correct:
deps = [
"rix/rix",
]deps is for registry packages.
packages is for CMake packages.
Forgetting vix install
After adding a dependency, run:
vix installThis installs the dependency state used by the build.
Using the facade without the facade package
If your code uses:
#include <rix.hpp>install and declare:
deps = [
"rix/rix",
]If your project installs only:
deps = [
"rix/auth",
]then it should use the independent package API instead of assuming the unified facade is available.
What you should remember
Install Rix with Vix:
vix add rix/rix
vix installDeclare Rix in vix.app:
deps = [
"rix/rix",
]Use the public facade:
#include <rix.hpp>Use Auth through:
rix.authBuild and run with Vix:
vix build
vix runNext step
Create your first Rix example.
Next: Quick Start