How to compile with Visual Studio 2019 ?

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1264
Joined: 15 Feb 2003 17:32
Location: Villefranche-sur-Saône, France

How to compile with Visual Studio 2019 ?

Post by MagicBuzz »

Hello,

I used to compile OpenTTD myself (to get lastest source code, test my own patches, or try other patches) with Visual Studio 2019.

There were solution and projects files, but they were removed a few ago.

How can I open it now in Visual Studio and compile it ?
User avatar
jfs
Tycoon
Tycoon
Posts: 1251
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: How to compile with Visual Studio 2019 ?

Post by jfs »

Make sure you have the CMake tools support installed, just enable it in the VS installer tool.
Then use File > Open > Open Folder to open your checkout copy.

After that you'll want to find CMakeLists.txt in the folder browser view, right click and open the CMake Settings from there. Maybe add a Release configuration.
Most importantly, you'll probably need to add/change the CMake variable named VCPKG_TARGET_TRIPLET to "x64-windows-static" (or "x86-windows-static" for 32 bit builds) so it can find your installed dependencies.
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1264
Joined: 15 Feb 2003 17:32
Location: Villefranche-sur-Saône, France

Re: How to compile with Visual Studio 2019 ?

Post by MagicBuzz »

Thank you jfs, it worked :bow:

I was trying to build it directly from CMake with no success. Using VS helped me to find the problems :)
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 17 guests