Big docs update

This commit is contained in:
Mark Wiemer 2024-12-03 22:12:39 -06:00
parent b88f8f4889
commit 0066b3fcfb
3 changed files with 65 additions and 21 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -2,16 +2,18 @@
If you're just creating mods or games with Luanti, you do not need to compile Luanti. Instead, follow Ruben Wardy's [Luanti Modding Book](https://rubenwardy.gitlab.io/minetest_modding_book) to get started modding. Compiling Luanti is only required if you plan to modify the Luanti engine itself.
## Requirements
In this guide, we use `path/to/minetest` to refer to the repository. Minetest was the old name of Luanti, and as of this writing, the repo has not been renamed.
- [Visual Studio 2015 or newer](https://visualstudio.microsoft.com) including "Desktop development with C++"
- [CMake](https://cmake.org/download/)
- [vcpkg](https://github.com/Microsoft/vcpkg) (included with Visual Studio)
## 1. Machine requirements
Luanti is compiled via Visual Studio and CMake, and version control is managed with Git.
- [Visual Studio 2015 or newer](https://visualstudio.microsoft.com) including "Desktop development with C++" (includes CMake CLI but not CMake GUI)
- [Git](https://git-scm.com/downloads)
### Visual Studio with C++
### 1.1. Visual Studio (VS) with C++
1. Install Visual Studio (VS) from [visualstudio.microsoft.com](https://visualstudio.microsoft.com)
1. Install VS from [visualstudio.microsoft.com](https://visualstudio.microsoft.com)
1. In the VS installer, select "Desktop development with C++":
![VS installer showing desktop development with C++ selected](assets/vs-installer.png)
@ -20,17 +22,35 @@ If you're just creating mods or games with Luanti, you do not need to compile Lu
This will install the C++ compiler used in later steps. VS is also the recommended IDE for Luanti.
You may notice that the C++ tools include CMake, but it should also be installed separately for compatibility with Luanti.
### 1.2. CMake
### CMake
The CMake GUI is a great tool to manage first-time setup of Luanti. It's not required, but recommended for anyone unfamiliar with CMake or its CLI. CMake itself comes bundled with Visual Studio, but the CMake GUI does not, and must be installed separately.
Install from [cmake.org/download](https://cmake.org/download/). Once installed, you should be able to run `cmake-gui` from the start menu:
![cmake-gui in Windows start menu shows app result](./assets/cmake-gui-search.png)
## Install Luanti dependencies
Installing CMake this way also adds it to your PATH environment variable, and you should be able to run `(Get-Command cmake).Path` in PowerShell or `which cmake` in Bash and get a result.
### Optional dependencies
If you don't install CMake manually, and are relying on the version that comes bundled with Visual Studio, you can follow these steps:
1. Find the `/path/to/bin/CMake.exe`. It should be at or around `C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe`.
1. Edit your PATH environment variable to include the `/path/to/bin` (but not `cmake.exe`).
1. Start menu > Search "env" > Edit the system environment variables > Environment Variables... > Path > Edit... > New > Paste the path from step 1
![Path variable with cmake added](./assets/path.png)
![path ends with \bin, not \cmake.exe](./assets/path-bin.png)
1. Restart your terminal
1. Try `(Get-Command cmake).Path` in PowerShell or `which cmake` in Bash to ensure CMake can be executed from the terminal.
## 2. Install Luanti dependencies
Once VS and CMake are ready to use, you can install Luanti's dependencies. Luanti requires several C++ packages to function, which are installed by CMake and compiled by a C++ compiler bundled with VS. CMake uses a tool called vcpkg behind the scenes, which you may see referenced elsewhere in this project.
### 2.1. Optional dependencies
Some optional dependencies are recommended for advanced development. You can add them to `vcpkg.json` to install them along with the required dependencies.
@ -40,7 +60,24 @@ Some optional dependencies are recommended for advanced development. You can add
- `gmp` and `jsoncpp` are optional, otherwise the bundled versions will be compiled
- `gettext` is optional, but required to use translations.
### Install dependencies
### 2.2. Install dependencies
You can install dependencies via CLI or via CMake GUI, whichever your prefer.
To install dependencies via CLI, you can run this program in PowerShell:
```powershell
# Run this while in `path/to/minetest`
$vs="Visual Studio 17 2022" # or "Visual Studio 16 2019", whatever matches your machine
$toolchain_file="C:/Program Files/Microsoft Visual Studio/2022/Community/VC/vcpkg/scripts/buildsystems/vcpkg.cmake" # or wherever you installed vcpkg.cmake manually
cmake build -G "$vs" -DCMAKE_TOOLCHAIN_FILE="$toolchain_file" -DCMAKE_BUILD_TYPE=Release -DENABLE_CURSES=OFF
```
The above steps may take about 10-30 minutes, depending on your device.
You may see several warnings and even errors. For now, you may be able to ignore those and try going to step 3 once the installation completes. If you are struggling, please open an issue on the GitHub repo.
To install dependencies via CMake GUI:
1. Start up the CMake GUI (Win > search "cmake-gui" > open)
1. Select **Browse Source...** and select `path/to/minetest` (where you've cloned the repo)
@ -56,28 +93,35 @@ Some optional dependencies are recommended for advanced development. You can add
1. Click **Generate**
1. Click **Open Project**
## Compile Luanti
You may see several warnings and even errors. For now, you may be able to ignore those and try going to step 3 once the installation completes. If you are struggling, please open an issue on the GitHub repo.
There are two ways to compile Luanti: via Visual Studio or via CLI.
## 3. Compile Luanti
### Compile in Visual Studio
Once the dependencies are installed, there are two ways to compile Luanti: via Visual Studio or via CLI.
14. Compile Luanti inside Visual Studio.
### 3.1. Compile in Visual Studio
14. Compile Luanti inside Visual Studio using the green play button.
- If you get "Unable to start program '...\x64\Debug\ALL_BUILD'. Access is denied", try compiling via the CLI instead.
### Compile via CLI
### 3.2. Compile via CLI
While in the `path/to/minetest` folder, run the following command:
Run the following command:
```
```powershell
# Run this while in `path/to/minetest`
cmake --build build --config Release
```
## Running Luanti
## 4. Running Luanti
You should be able to run `path/to/minetest/bin/Release/luanti.exe` and start up the Development Test game :)
Once Luanti is compiled, you should be able to run `path/to/minetest/bin/Release/luanti.exe` and start up the Development Test game :)
## Windows Installer using WiX Toolset
## 5. Making changes
If you make changes to the C++ code, you can usually just re-compile without re-installing the dependencies. Then you can re-run Luanti to confirm that your changes were applied.
## Appendix: Windows Installer using WiX Toolset
Requirements: