Skip to content

Commit 3775969

Browse files
authored
CMake documentation added (#409)
1 parent 04ef339 commit 3775969

File tree

1 file changed

+83
-14
lines changed

1 file changed

+83
-14
lines changed

docs/contributing/framework-developer-guide.mdx

Lines changed: 83 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ cd neutralinojs
2929

3030
No need for separate compilers because Linux distributions usually have GNU C/C++ compilers installed already.
3131

32-
Install GTK, WebKit, other libraries with the following command.
32+
Install GTK, WebKit, CMake, Ninja, other libraries with the following command.
3333

3434
##### Debian
3535

3636
```bash
37-
sudo apt install libgtk-3-dev
37+
sudo apt install libgtk-3-dev cmake ninja-build
3838
```
3939

4040
```bash
@@ -54,20 +54,24 @@ sudo dnf install \
5454
libgtk-3-dev \
5555
libwebkit2gtk-4.1-0 \ # or libwebkit2gtk-4.0-37
5656
libglib2.0-dev \
57-
libxrandr-dev
57+
libxrandr-dev \
58+
cmake \
59+
ninja-build
5860
```
5961

6062
##### Arch
6163

6264
```bash
6365
sudo pacman -S \
6466
gtk3 \
65-
webkit2gtk
67+
webkit2gtk \
68+
cmake \
69+
ninja
6670
```
6771

6872
#### Windows
6973

70-
Install the latest Visual Studio IDE with Windows SDK. The Neutralinojs compilation process will use the MSVC C++ compiler (aka `cl.exe`).
74+
Install Visual Studio Build Tools or the Visual Studio IDE with the Windows SDK. The compilation process uses the MSVC C++ compiler (aka `cl.exe`) and requires [CMake](https://cmake.org/download/) (as the build system generator) and [Ninja](https://ninja-build.org/) (as the build executor).
7175

7276
:::info
7377
How to activate Windows 10 SDK: While installing it in the Visual Studio Installer, go to tab Workloads, section "Desktop & Mobile" and select "Desktop development with C++". On the right in "Installation details" > "Desktop development with C++" > "Optional", make sure "Windows 10 SDK" is checked.
@@ -77,28 +81,93 @@ How to activate Windows 10 SDK: While installing it in the Visual Studio Install
7781

7882
Install Xcode Command Line Tools.
7983

84+
CMake and Ninja are also required and can be installed via Homebrew:
85+
86+
```bash
87+
brew install cmake ninja
88+
```
89+
8090
### Compile the Neutralinojs framework.
8191

8292
Run the following script in order to build the framework binaries.
8393

84-
#### Linux or macOS
94+
1. Create a `build/` directory in the main repository.
95+
96+
<Tabs
97+
defaultValue="Linux"
98+
values={[
99+
{label: 'Linux', value: 'Linux'},
100+
{label: 'macOS', value: 'macOS'},
101+
{label: 'Windows', value: 'Windows'},
102+
]}>
103+
<TabItem value="Linux">
85104

86105
```bash
87-
python3 scripts/bz.py
106+
mkdir build
88107
```
89108

90-
#### Windows
109+
</TabItem>
110+
<TabItem value="macOS">
91111

92112
```bash
93-
python scripts/bz.py
113+
mkdir -p build
94114
```
95115

96-
:::info
97-
You need to have the [Python](https://www.python.org/downloads/) interpreter (version 3.x) installed to run this script.
98-
:::
116+
</TabItem>
117+
<TabItem value="Windows">
118+
119+
```bash
120+
mkdir build
121+
```
122+
123+
</TabItem>
124+
</Tabs>
125+
126+
2. Generate Ninja build files.
127+
128+
<Tabs
129+
defaultValue="Linux"
130+
values={[
131+
{label: 'Linux', value: 'Linux'},
132+
{label: 'macOS', value: 'macOS'},
133+
{label: 'Windows', value: 'Windows'},
134+
]}>
135+
<TabItem value="Linux">
136+
137+
```bash
138+
cmake . -G Ninja -B build
139+
140+
# --- Cross compile for ARM64 (optional) ---
141+
cmake . -G Ninja -B build -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/linux-aarch64.cmake
142+
143+
# --- Cross compile for ARM32 (optional) ---
144+
cmake . -G Ninja -B build -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/linux-armhf.cmake
145+
```
146+
147+
</TabItem>
148+
<TabItem value="macOS">
149+
150+
```bash
151+
cmake . -G Ninja -B build
152+
```
153+
154+
</TabItem>
155+
<TabItem value="Windows">
156+
157+
```bash
158+
cmake . -G Ninja -B build
159+
```
160+
161+
</TabItem>
162+
</Tabs>
163+
164+
3. Compile the project.
165+
166+
```bash
167+
ninja -C build
168+
```
99169

100-
Neutralinojs uses BuildZri C++ build automation tool to generate binaries on local development computers and
101-
CI/CD servers. Read the [BuildZri documentation](https://codezri.org/docs/buildzri/intro) to learn more about CLI options and configuration.
170+
This project uses CMake and Ninja to configure and build native binaries for local development and CI/CD environments. Developers can provide custom toolchains or platform-specific configurations to target additional platforms.
102171

103172
## Setup and build the client
104173

0 commit comments

Comments
 (0)