|
1 | | -# Installation — Vix.cpp |
2 | | - |
3 | | -## 🚀 Getting Started |
4 | | - |
5 | | -## 🧩 Overview |
6 | | - |
7 | | -Vix.cpp is a high-performance C++20 web framework inspired by FastAPI, Vue.js, and React. |
8 | | -It’s modular by design — each component (core, utils, json, orm, cli) can be built independently or together under the umbrella project.pdlog |
9 | | - |
10 | | -## 🧩 Build & Developer Setup |
11 | | - |
12 | | -### 🧱 Prerequisites |
13 | | - |
14 | | -You’ll need the following tools and libraries depending on your platform: |
15 | | - |
16 | | -| **Component** | **Minimum Version** | **Purpose** | |
17 | | -| ------------------- | -------------------------------- | ------------------------ | |
18 | | -| C++ Compiler | GCC 12+ / Clang 16+ / MSVC 2022+ | C++20 support | |
19 | | -| CMake | ≥ 3.20 | Build system | |
20 | | -| Boost | asio, beast | Networking (core module) | |
21 | | -| nlohmann/json | ≥ 3.11 | JSON serialization | |
22 | | -| spdlog | ≥ 1.10 | Logging | |
23 | | -| MySQL Connector/C++ | _optional_ | ORM (database driver) | |
24 | | - |
25 | | -This guide explains how to build and install Vix.cpp on Linux, macOS, and Windows. |
26 | | - |
27 | | ---- |
28 | | - |
29 | | -## 🐧 Linux / Ubuntu |
| 1 | +## Installation |
30 | 2 |
|
31 | 3 | ### Prerequisites |
32 | 4 |
|
| 5 | +Vix.cpp is a **native C++ runtime** and requires a modern toolchain. |
| 6 | + |
| 7 | +#### All platforms |
| 8 | +- **CMake ≥ 3.20** |
| 9 | +- **C++20 compiler** |
| 10 | + - GCC ≥ 11 |
| 11 | + - Clang ≥ 14 |
| 12 | + - MSVC ≥ 19.34 (Visual Studio 2022) |
| 13 | +- **Git** (with submodules) |
| 14 | + |
| 15 | +#### Linux |
| 16 | +- `pkg-config` |
| 17 | +- `ninja` (recommended) |
| 18 | +- system development packages: |
| 19 | + - Boost |
| 20 | + - OpenSSL |
| 21 | + - SQLite |
| 22 | + - zlib / brotli (optional) |
| 23 | + |
| 24 | +**Example (Ubuntu):** |
33 | 25 | ```bash |
34 | 26 | sudo apt update |
35 | | -sudo apt install -y \ g++-12 cmake make git \ # Build tools |
36 | | - libboost-all-dev \ # Boost (includes asio, beast) |
37 | | - nlohmann-json3-dev \ # JSON (nlohmann/json) |
38 | | - libspdlog-dev \ # Logging (spdlog) |
39 | | - libmysqlcppconn-dev # Optional: MySQL Connector/C++ for ORM |
| 27 | +sudo apt install -y \ |
| 28 | + build-essential cmake ninja-build pkg-config \ |
| 29 | + libboost-all-dev libssl-dev libsqlite3-dev |
40 | 30 | ``` |
41 | 31 |
|
42 | | -Optional dependencies: |
| 32 | +#### macOS |
| 33 | +- Xcode Command Line Tools |
| 34 | +- Homebrew |
43 | 35 |
|
44 | 36 | ```bash |
45 | | -sudo apt install -y libmysqlcppconn-dev libsqlite3-dev |
| 37 | +brew install cmake ninja pkg-config boost openssl@3 |
46 | 38 | ``` |
47 | 39 |
|
48 | | -### Build |
49 | | - |
50 | | -```bash |
51 | | -git clone https://github.com/vixcpp/vix.git |
52 | | -cd vix |
53 | | -git submodule update --init --recursive |
54 | | -cmake -S . -B build-rel -DCMAKE_BUILD_TYPE=Release |
55 | | -cmake --build build-rel -j |
56 | | -sudo cmake --install build-rel --prefix /usr/local |
57 | | -``` |
| 40 | +#### Windows |
| 41 | +- **Visual Studio 2022** (Desktop development with C++) |
| 42 | +- **Git** |
| 43 | +- **PowerShell** |
| 44 | +- **vcpkg** (handled automatically by the install script) |
58 | 45 |
|
59 | 46 | --- |
60 | 47 |
|
61 | | -## 🍎 macOS |
62 | | - |
63 | | -### Prerequisites |
| 48 | +### Install Vix.cpp (recommended) |
64 | 49 |
|
65 | | -Install Homebrew first, then: |
| 50 | +Vix provides platform-specific install scripts that: |
| 51 | +- fetch dependencies |
| 52 | +- configure the build |
| 53 | +- produce the `vix` binary |
66 | 54 |
|
| 55 | +#### Linux / macOS |
67 | 56 | ```bash |
68 | | -brew install cmake ninja llvm boost nlohmann-json spdlog fmt mysql sqlite3 |
| 57 | +./install.sh |
69 | 58 | ``` |
70 | 59 |
|
71 | | -### Build |
72 | | - |
| 60 | +You may need: |
73 | 61 | ```bash |
74 | | -cmake -S . -B build-rel -G Ninja -DCMAKE_BUILD_TYPE=Release |
75 | | -cmake --build build-rel -j |
76 | | -sudo cmake --install build-rel |
| 62 | +chmod +x install.sh |
77 | 63 | ``` |
78 | 64 |
|
79 | | ---- |
| 65 | +#### Windows (PowerShell) |
| 66 | +```powershell |
| 67 | +.\install.ps1 |
| 68 | +``` |
80 | 69 |
|
81 | | -## 🪟 Windows |
| 70 | +> On Windows, dependencies such as **Boost** and **SQLite** are installed automatically via **vcpkg**. |
82 | 71 |
|
83 | | -### Requirements |
| 72 | +--- |
84 | 73 |
|
85 | | -- Visual Studio 2022 (with C++ Desktop workload) |
86 | | -- [vcpkg](https://github.com/microsoft/vcpkg) |
87 | | -- Git Bash or PowerShell |
| 74 | +### Verify installation |
88 | 75 |
|
89 | | -### Build |
| 76 | +After installation, verify that `vix` is available: |
90 | 77 |
|
91 | 78 | ```bash |
92 | | -git clone https://github.com/vixcpp/vix.git |
93 | | -cd vix |
94 | | -git submodule update --init --recursive |
95 | | - |
96 | | -cmake -S . -B build-rel -G "Ninja" ^ |
97 | | - -DCMAKE_BUILD_TYPE=Release ^ |
98 | | - -DCMAKE_TOOLCHAIN_FILE=C:/path/to/vcpkg/scripts/buildsystems/vcpkg.cmake |
| 79 | +vix --version |
| 80 | +``` |
99 | 81 |
|
100 | | -cmake --build build-rel -j |
| 82 | +or on Windows: |
| 83 | +```powershell |
| 84 | +vix.exe --version |
101 | 85 | ``` |
102 | 86 |
|
103 | | ---- |
| 87 | +You should see the current release version printed. |
104 | 88 |
|
105 | | -## ⚙️ Verify Installation |
| 89 | +--- |
106 | 90 |
|
107 | | -```bash |
108 | | -vix --version |
109 | | -``` |
| 91 | +### Script mode (no project setup) |
110 | 92 |
|
111 | | -Output example: |
| 93 | +Once installed, you can run C++ files directly: |
112 | 94 |
|
113 | | -``` |
114 | | -Vix.cpp v1.9.0 (C++20, GCC 13, Ubuntu 24.04) |
| 95 | +```bash |
| 96 | +vix run main.cpp |
| 97 | +vix dev main.cpp |
115 | 98 | ``` |
116 | 99 |
|
117 | | -If `vix` is not found, ensure `/usr/local/bin` (or your custom prefix) is in your PATH. |
| 100 | +This compiles, links, and runs your code with the Vix runtime automatically. |
118 | 101 |
|
119 | 102 | --- |
120 | 103 |
|
121 | | -## 🧩 Troubleshooting |
122 | | - |
123 | | -- **Missing headers** — Ensure all dependencies are installed (Boost, fmt, spdlog). |
124 | | -- **CMake errors** — Check `CMAKE_CXX_STANDARD` (must be ≥ 20). |
125 | | -- **Link errors on Linux** — Use `lld` (`-fuse-ld=lld`) for faster and cleaner linking. |
126 | | -- **Permission denied on install** — Add `sudo` to the `cmake --install` command. |
127 | | - |
128 | | ---- |
| 104 | +### Manual build (advanced) |
129 | 105 |
|
130 | | -## ✅ Next Steps |
| 106 | +If you prefer full control, see: |
| 107 | +- **Build & Installation** |
131 | 108 |
|
132 | | -- [Quick Start](./quick-start.md) |
133 | | -- [Build & Packaging](./build.md) _(optional)_ |
134 | | -- [Benchmarks](./benchmarks.md) |
0 commit comments