Separate dependency installation from Luanti compilation
VS C++ includes vcpkg and CMake as well
This commit is contained in:
parent
49e5f1ae3f
commit
01048ee3ca
@ -2,10 +2,10 @@
|
||||
|
||||
## Requirements
|
||||
|
||||
- [Visual Studio 2015 or newer](https://visualstudio.microsoft.com)
|
||||
- [CMake](https://cmake.org/download/)
|
||||
- [vcpkg](https://github.com/Microsoft/vcpkg)
|
||||
> [vcpkg installation guide](https://learn.microsoft.com/en-us/vcpkg/get_started/get-started#1---set-up-vcpkg)
|
||||
- [Visual Studio (VS) 2015 or newer](https://visualstudio.microsoft.com)
|
||||
> with C++ build tools for desktop (todo add image)
|
||||
- [CMake](https://cmake.org/download/) (comes with VS C++ build tools)
|
||||
- [vcpkg](https://github.com/Microsoft/vcpkg) (comes with VS C++ build tools)
|
||||
- [Git](https://git-scm.com/downloads)
|
||||
|
||||
## Compiling and installing the dependencies
|
||||
@ -13,16 +13,17 @@
|
||||
It is highly recommended to use vcpkg to manage dependencies, installed at a path without spaces in it for compatibility with the Luanti build configuration.
|
||||
|
||||
```
|
||||
"C:\Program Filesvcpkg\vcpkg.exe" # bad, may have issues
|
||||
"C:\Program Files\vcpkg\vcpkg.exe" # bad, may have issues
|
||||
"C:\vcpkg\vcpkg.exe" # good, no spaces means fewer problems
|
||||
```
|
||||
|
||||
If spaces are present, you may see errors like:
|
||||
If spaces are present, when trying to compile Luanti, you may see errors like:
|
||||
|
||||
```
|
||||
libtool: error: 'Files/vcpkg/buildtrees/libiconv/x64-windows-dbg/lib/libcharset.la' is not a directory
|
||||
```
|
||||
|
||||
<!-- todo check if this is necessary
|
||||
After you successfully built vcpkg you can easily install the required libraries:
|
||||
```powershell
|
||||
vcpkg install zlib zstd curl[winssl] openal-soft libvorbis libogg libjpeg-turbo sqlite3 freetype luajit gmp jsoncpp gettext[tools] sdl2 --triplet x64-windows
|
||||
@ -39,40 +40,44 @@ This command takes about 10-30 minutes to complete, depending on your device.
|
||||
There are other optional libraries, but we don't test if they can build and link correctly.
|
||||
|
||||
Use `--triplet` to specify the target triplet, e.g. `x64-windows` or `x86-windows`.
|
||||
-->
|
||||
|
||||
## Compile Luanti
|
||||
|
||||
There are two ways to compile Luanti: CMake GUI and CLI
|
||||
|
||||
### a) CMake GUI
|
||||
### Setup CMake
|
||||
|
||||
1. Start up the CMake GUI (Win > search "cmake-gui" > open)
|
||||
2. Select **Browse Source...** and select `DIR/minetest` (this is where you've cloned the repo)
|
||||
3. Select **Browse Build...** and select `DIR/minetest/build` (this is a new folder that CMake will prompt to create)
|
||||
2. Select **Browse Source...** and select `path/to/minetest` (where you've cloned the repo)
|
||||
3. Select **Browse Build...** and select `path/to/minetest/build` (a new folder that CMake will prompt to create)
|
||||
4. Select **Configure**
|
||||
5. Choose the right Visual Studio version and target platform. Currently, Luanti uses Visual Studio 16 2019, but newer VS versions should work as well. The VS version has to match the version of the installed dependencies.
|
||||
6. Choose **Specify toolchain file for cross-compiling**
|
||||
7. Click **Next**
|
||||
8. Select the vcpkg toolchain file e.g. `D:/vcpkg/scripts/buildsystems/vcpkg.cmake`
|
||||
8. Select the vcpkg toolchain file e.g. `C:/vcpkg/scripts/buildsystems/vcpkg.cmake`
|
||||
9. Click Finish
|
||||
10. Wait until CMake generates the cache file (this may take about 10-30 minutes, depending on your device)
|
||||
11. If there are any errors, solve them and hit **Configure**
|
||||
12. Click **Generate**
|
||||
13. Click **Open Project**
|
||||
|
||||
## Compile Luanti
|
||||
|
||||
There are two ways to compile Luanti: via Visual Studio or via CLI.
|
||||
|
||||
### Compile in Visual Studio
|
||||
|
||||
14. Compile Luanti inside Visual Studio.
|
||||
- If you get "Unable to start program '...\x64\Debug\ALL_BUILD'. Access is denied", try compiling via the CLI instead.
|
||||
|
||||
### b) CLI
|
||||
### Compile via CLI
|
||||
|
||||
Run the following script in PowerShell:
|
||||
While in the `path/to/minetest` folder, run the following script in PowerShell:
|
||||
|
||||
```powershell
|
||||
cmake . -G"Visual Studio 16 2019" -DCMAKE_TOOLCHAIN_FILE=D:/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_CURSES=OFF
|
||||
vs="Visual Studio 16 2019" # or "Visual Studio 17 2022", whatever matches your system
|
||||
toolchain_file="C:/vcpkg/scripts/buildsystems/vcpkg.cmake" # ensure this path is correct
|
||||
cmake . -G $vs -DCMAKE_TOOLCHAIN_FILE=$toolchain_file -DCMAKE_BUILD_TYPE=Release -DENABLE_CURSES=OFF
|
||||
cmake --build . --config Release
|
||||
```
|
||||
|
||||
Make sure that the right compiler is selected and the path to the vcpkg toolchain is correct.
|
||||
|
||||
## Windows Installer using WiX Toolset
|
||||
|
||||
Requirements:
|
||||
|
Loading…
Reference in New Issue
Block a user