Easy (I think) minetest compilation in windows

Post Reply
Posts: 22
Joined: Thu Feb 06, 2020 10:21
GitHub: anlismon
In-game: Liso
Location: Valencia - Spain.

Easy (I think) minetest compilation in windows

by Liso » Post

Hi, this is my first contribution to the forum and I'm not sure if this belongs here.

I only develop on Linux, but for certain reasons I have to work on windows now.

So I've decided to compile minetest on windows. Specifically with the vs2019 community edition. And the truth is that it's a nightmare xD.

Here is a little howto on how to compile minetest without too much effort, just in case it can help someone.

1. VisualStudio with the English Language Pack installed.
2. cmake and git installed.
This can be done easily in user space with "scoop" (https://scoop.sh/), "scoop install cmake git"

Once you get this installed, we can get started.

We should have a directory where we'll work. For simplicity "C:\dev"

Open cmd.exe
ps> cd \
ps> mkdir dev
ps> cd dev
ps> git clone https://github.com/Microsoft/vcpkg.git
ps> cd vcpkg
ps> bootstrap-vcpkg.bat -disableMetrics

After that vcpkg will be ready to use. If you want to enable vcpkg user-wide , you can do it with: "vcpkg integrate install"

Now we can use vcpkg to download and compile dependencies and it will also download and compile the project dependencies.

By default vcpkg uses the x86-windows triplet, if you want to use the 64 bits version you have to use the x64-windows triplet.

So, let's install minetest's dependencies:

# at c:\dev\vcpkg directory
ps> vcpkg.exe install curl:x64-windows
ps> vcpkg.exe install freetype:x64-windows
ps> vcpkg.exe install irrlicht:x64-windows
ps> vcpkg.exe install libogg:x64-windows
ps> vcpkg.exe install libvorbis:x64-windows
ps> vcpkg.exe install openal-soft:x64-windows
ps> vcpkg.exe install luajit:x64-windows
ps> vcpkg.exe install sqlite3:x64-windows
ps> vcpkg.exe install gettext:x64-windows

Now we can download the minetest code, from git or zip or whatever you want:

ps> cd c:\dev
ps> git clone https://github.com/minetest/minetest
ps> cd minetest

we have to create a directory for the solution

ps> mkdir build_win
ps> cd build_win

and now we will create the solution for visual studio, to see other generators, run "cmake -G"

By running cmake with the parameter "-DCMAKE_TOOLCHAIN_FILE=YOUR_VCPKG_DIR\scripts\buildsystems\vcpkg.cmake" cmake will find all the libraries we have downloaded and compiled.

ps> cmake -DCMAKE_TOOLCHAIN_FILE=C:\dev\vcpkg\scripts\buildsystems\vcpkg.cmake ..

And voila, here we have our fancy VS solution.

Now we just open the solution and we'll be able to compile, debug and contribute.

Btw, the executable will be generated in bin directory.

Hope this helps someone.
Liso. - My twitter -

User avatar
Posts: 6431
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: United Kingdom

Re: Easy (I think) minetest compilation in windows

by rubenwardy » Post

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest