diff --git a/CHANGELOG.md b/CHANGELOG.md index d66560d..769da94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,52 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 --- ## [Unreleased] +## [v2.3.0] + +### Features + +- feat(run): ultra-fast direct C++ execution + Introduces a new execution mode that compiles and runs single C++ files instantly without CMake. + +- feat(run): smart CMake fallback + Automatically falls back to CMake when the script requires complex dependencies or project structure. + +- feat(run,check): add --local-cache for script mode + Enables local caching for faster repeated executions and unified cache behavior. + +- feat(run,build): add SQLite/MySQL flags + Adds support for database flags directly in run/build workflows. + +### Improvements + +- improve(run): global cache for script builds + Script builds are now cached globally and keyed by absolute file path for better reuse. + +- improve(run): better executable detection + Resolves executables from actual build directories (`bin/`, scanned targets) instead of assuming project names. + +- improve(run): reorganized execution pipeline + Cleaner and more robust run flow with improved process handling. + +- improve(config): enhance configuration system + Improved config structure and handling in core module. + +### Fixes + +- fix(run): detect Vix runtime scripts correctly in fallback mode + Prevents incorrect fallback behavior when running Vix-based scripts. + +- fix(build): improve CMake error detection + Fixes misleading build errors and improves project root handling. + +- fix(utils): clean up configuration template + Removes redundant content in `vix_utilsConfig.cmake`. + +### Examples + +- update(examples): improve run examples + Updated examples for blocking, background, and dynamic port usage. + ## [v2.2.0] ### Features diff --git a/README.md b/README.md index 84e8069..e775527 100644 --- a/README.md +++ b/README.md @@ -13,19 +13,17 @@

-

- A modern C++ runtime for real-world systems. -

+

Remove the friction from C++.

- Build HTTP, WebSocket, and peer-to-peer applications with - predictable performance and offline-first reliability. + A modern runtime for building C++ applications.

- 🌍 Website · - 📘 Docs · - ⬇️ Download + Website · + Docs · + Install · + Download

@@ -44,23 +42,6 @@ ## Install -#### Linux - -```bash -sudo apt update -sudo apt install -y \ - build-essential cmake ninja-build pkg-config git curl unzip zip \ - libssl-dev libsqlite3-dev zlib1g-dev libbrotli-dev \ - nlohmann-json3-dev \ - libspdlog-dev libfmt-dev -``` - -## macOS Dependencies (example) - -```bash -brew install cmake ninja pkg-config openssl@3 spdlog fmt nlohmann-json brotli -``` - ## Shell (Linux, macOS) ```bash @@ -73,40 +54,33 @@ curl -fsSL https://vixcpp.com/install.sh | bash irm https://vixcpp.com/install.ps1 | iex ``` -Verify installation: +## Run C++ instantly -```bash -vix --version +```cpp +#include + +int main(){ + std::cout << "Hello, world!" << std::endl; +} ``` -## Build from source ```bash -git clone --recurse-submodules https://github.com/vixcpp/vix.git -cd vix - -cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -cmake --build build -j - -# Install for current user (recommended) -cmake --install build --prefix "$HOME/.local" - -# Ensure PATH contains ~/.local/bin then restart your terminal -vix --version -vix doctor +vix run main.cpp ``` -## Your first Vix.cpp program +Done. -Create a file called `server.cpp`: +## Build a server ```cpp #include + using namespace vix; -int main() { +int main(){ App app; - app.get("/", [](Request&, Response& res) { + app.get("/", [](Request&, Response& res){ res.send("Hello, world!"); }); @@ -114,50 +88,84 @@ int main() { } ``` -Run it: - ```bash vix run server.cpp ``` -Open http://localhost:8080 -That’s it. +→ http://localhost:8080 -## Script mode (no project setup) +--- -Run C++ like a script: +## Install a framework in 1 command ```bash -vix run main.cpp +vix install -g cnerium/app ``` -## Shell completion +```cpp +#include +using namespace cnerium::app; + +int main(){ + App app; + + app.get("/", [](AppContext &ctx){ + ctx.text("Hello from Cnerium"); + }); -Enable tab completion for Vix commands. + app.listen("127.0.0.1", 8080); +} +``` ```bash -source <(vix completion bash) +vix run main.cpp ``` -Make it permanent: +## WebSocket -```bash -vix completion bash > ~/.vix-completion.bash -echo 'source ~/.vix-completion.bash' >> ~/.bashrc +```cpp +#include +#include +#include + +int main(){ + auto exec = std::make_shared(); + + vix::websocket::App app{"config/config.json", exec}; + auto &ws = app.server(); + + ws.on_typed_message([](auto &, + const std::string &type, + const vix::json::kvs &payload) + { + if (type == "chat.message") + return payload; + }); + + app.run_blocking(); +} ``` -Learn more: https://vixcpp.com/docs/modules/cli/completion +## What Vix.cpp gives you + +- Run a single `.cpp` file instantly +- No CMake required for simple apps +- Native C++ performance +- HTTP, WebSocket, P2P ready +- Offline-first architecture support +- Deterministic execution -## Why Vix.cpp -Most systems assume perfect conditions. -Vix is built for when things are not. +## Why Vix exists -- predictable under load -- no GC pauses -- offline-first by design -- deterministic execution -- minimal setup +C++ is powerful. + +But: +- too much setup +- too much friction +- too slow to start + +Vix removes that. ## Performance @@ -169,14 +177,6 @@ Stable under sustained load. | Avg Latency | ~13–20 ms | | P99 Latency | ~17–50 ms | -## Core principles - -- Local-first execution -- Network is optional -- Deterministic behavior -- Failure-tolerant -- Built for unreliable environments - ## Learn more - Docs: https://vixcpp.com/docs diff --git a/examples/01_run_blocking.cpp b/examples/01_run_blocking.cpp index c94ec14..8252454 100644 --- a/examples/01_run_blocking.cpp +++ b/examples/01_run_blocking.cpp @@ -9,6 +9,5 @@ int main() app.get("/", [](Request &, Response &res) { res.text("Hello Vix"); }); - // Bloque le thread courant app.run(8080); } diff --git a/examples/02_listen_background.cpp b/examples/02_listen_background.cpp index 2489734..fdbe392 100644 --- a/examples/02_listen_background.cpp +++ b/examples/02_listen_background.cpp @@ -10,10 +10,8 @@ int main() app.get("/health", [](Request &, Response &res) { res.json({"ok", true}); }); - // Lance le serveur en background app.listen(8080, []() - { std::cout << "Server is ready and accepting connections\n"; }); + { console.log("Server is ready and accepting connections"); }); - // Attente propre app.wait(); } diff --git a/examples/03_listen_port_dynamic.cpp b/examples/03_listen_port_dynamic.cpp index 83b4cdb..bedac4d 100644 --- a/examples/03_listen_port_dynamic.cpp +++ b/examples/03_listen_port_dynamic.cpp @@ -9,7 +9,6 @@ int main() app.get("/", [](Request &, Response &res) { res.text("Dynamic port example"); }); - // Port 0 → choisi par l’OS app.listen_port(0, [](int port) { console.log("Listening on http://localhost:", port); }); diff --git a/modules/cli b/modules/cli index d583290..23fae62 160000 --- a/modules/cli +++ b/modules/cli @@ -1 +1 @@ -Subproject commit d5832909d2308e76b4eef16162495f2af67524fe +Subproject commit 23fae623f71ad97be39e84f9618af6ca745d277e diff --git a/modules/core b/modules/core index 457de6d..2fbabf4 160000 --- a/modules/core +++ b/modules/core @@ -1 +1 @@ -Subproject commit 457de6d822f00d10289686ce6657e95673597c08 +Subproject commit 2fbabf4c06b6e11ab7cfd4af64ef95516f54bd40 diff --git a/modules/utils b/modules/utils index 9ea64be..7a69f06 160000 --- a/modules/utils +++ b/modules/utils @@ -1 +1 @@ -Subproject commit 9ea64be553511aaafd27b49f99a636d8d32ba21c +Subproject commit 7a69f06f5f8118441e8e36317112a65fa59114cd