A command-line tool for the Flux cross-platform native UI framework.
Write your app once in C++ and run it on Windows, Linux, and Android.
Flux is a C++ UI framework inspired by Flutter. You write a single main.cpp using
Flux widgets and the CLI handles building and running it on each platform.
#include <flux/flux.hpp>
class MyApp : public Widget {
public:
WidgetPtr build() override {
return Scaffold(
AppBar("My App"),
Center(Text("Hello World")));
}
};
WidgetPtr createApp(FluxUI *app) {
return FluxApp(
"My App",
std::make_shared<MyApp>(),
AppTheme::light(),
false, 900, 700, false, false);
}- CMake 3.22+
- Git
- curl (built into Windows 10/11, Linux, macOS)
- Visual Studio 2019 or later with Desktop development with C++ workload
- GCC or Clang
sudo apt install build-essential cmake git curl- Download
flux.exefrom Releases - Move it to a folder of your choice, for example:
C:\tools\flux\flux.exe
- Add that folder to your system PATH:
- Open Start → search Environment Variables
- Click Environment Variables
- Under System variables find Path → click Edit
- Click New → paste
C:\tools\flux - Click OK on all dialogs
- Open a new terminal and verify:
fluxcurl -LO https://github.com/HeyItsBablu/flux-cli/releases/latest/download/flux
chmod +x flux
sudo mv flux /usr/local/bin/Verify:
fluxcurl -LO https://github.com/HeyItsBablu/flux-cli/releases/latest/download/flux-macos
chmod +x flux-macos
sudo mv flux-macos /usr/local/bin/fluxVerify:
fluxflux create my_app
cd my_appThis downloads the template from GitHub and generates:
my_app/
├── main.cpp ← only file you need to edit
├── flux.json ← app config, do not edit manually
├── windows/ ← platform build files, do not edit
└── linux/ ← platform build files, do not edit
Open main.cpp in any editor (VS Code recommended) and write your app:
#include <flux/flux.hpp>
class MyApp : public Widget {
public:
WidgetPtr build() override {
return Scaffold(
AppBar("My App"),
Center(
Container(
Center(Text("Hello World")))
->setWidth(300)
->setHeight(200)
->setBackgroundColor(Color::fromRGB(10, 10, 200))
->setBorderRadius(10)));
}
};
WidgetPtr createApp(FluxUI *app) {
return FluxApp(
"My App",
std::make_shared<MyApp>(),
AppTheme::light(),
false, 900, 700, false, false);
}flux run windowsThis will:
- Locate your Visual Studio installation automatically
- Configure the build with CMake
- Build the app in Release mode
- Launch
build/Release/app.exe
Your app folder will look like this after building:
my_app/
├── main.cpp
├── flux.json
├── windows/
├── linux/
└── build/ ← generated, do not commit
└── Release/
└── app.exe
flux run linuxThis will:
- Configure the build with CMake
- Build the app in Release mode
- Launch
build/app
Generated automatically by flux create. Do not edit manually.
{
"name": "my_app",
"package": "com.example.my_app"
}| Field | Description |
|---|---|
name |
App name shown in build output |
package |
Android package identifier (for future Android support) |
my_app/
├── main.cpp
│ └── Your entire app lives here.
│ Implement createApp() to return your root widget.
│
├── flux.json
│ └── App config generated by flux create.
│
├── windows/
│ └── CMakeLists.txt
│ Platform build file for Windows.
│ Pulls flux framework via FetchContent.
│ Compiles main.cpp + flux/src/main_win32.cpp.
│ Do not edit.
│
└── linux/
└── CMakeLists.txt
Platform build file for Linux.
Pulls flux framework via FetchContent.
Compiles main.cpp + flux/src/main_linux.cpp.
Do not edit.
- Downloads a zip of the flux-cli repo from GitHub using curl
- Extracts only the
templates/folder into your app directory - Generates
flux.jsonwith your app name
- Searches common paths to find your Visual Studio installation
- Calls
VsDevCmd.batto set up the MSVC compiler environment - Runs
cmake -S windows -B buildfrom your app root - Runs
cmake --build build --config Release - Launches
build/Release/app.exe
- Runs
cmake -S linux -B buildfrom your app root - Runs
cmake --build build - Launches
build/app
- Make sure
curlis available in your terminal - Make sure you have internet access
- Make sure the
HeyItsBablu/flux-clirepo is public on GitHub
- Make sure Visual Studio is installed with the Desktop development with C++ workload
- Supported versions: VS 2019, VS 2022, VS 2026
- Make sure CMake 3.22+ is installed and in PATH
- Make sure Git is installed and in PATH (needed for FetchContent)
- Make sure build tools are installed:
sudo apt install build-essential cmake git curl- Make sure you are running
flux runfrom your app root directory (whereflux.jsonis)
git clone https://github.com/HeyItsBablu/flux-cli
cd flux-cli
cmake -B build -S .
cmake --build build --config ReleaseBinary will be at:
- Windows:
build/Release/flux.exe - Linux:
build/flux
-
flux create— scaffold a new app -
flux run windows— build and run on Windows -
flux run linux— build and run on Linux -
flux run android— build and run on Android -
flux run ios— build and run on iOS -
flux build— build without running -
flux clean— clean build artifacts - Install script (
curl | sh)
MIT