.. | ||
campaignd.vcxproj | ||
campaignd.vcxproj.filters | ||
files_with_deactivated_warnings.txt | ||
liblua.vcxproj | ||
liblua.vcxproj.filters | ||
README.md | ||
wesnoth.sln | ||
wesnoth.vcxproj | ||
wesnoth.vcxproj.filters | ||
wesnothd.vcxproj | ||
wesnothd.vcxproj.filters | ||
wesnothlib.vcxproj | ||
wesnothlib.vcxproj.filters | ||
WindowsTimeout.cpp | ||
WindowsTimeout.vcxproj | ||
WML_tests.cmd |
Compiling Wesnoth on Windows using Visual Studio
The current minimum Visual Studio version required for compiling Wesnoth is Visual Studio 2015 (VC14).
Compilation is also supported with Visual Studio 2017 (VC15) and later versions. However, since we keep
the project files in the Git repository targeted at the minimum version, it is recommended you duplicate
the wesnoth/projectfiles/VC14
directory and rename it after the Visual Studio version with which you
wish to build.
Prerequisites
We maintain a handy GitHub repository with all the external libraries (see INSTALL.md) Wesnoth requires. It has various branches corresponding to the Visual Studio version you are building with. Be sure to use the libraries from the appropriate branch!
What to do
-
Clone or download a snapshot of the aforementioned dependency repository. If you do the latter, be sure you've downloaded the snapshot for the correct branch, not
master
! Either way, it should be cloned/unpacked into the same directory as Wesnoth. If you have Wesnoth cloned inDocuments/wesnoth
, for example, the dependency pack should be atDocuments/external
. Note thatexternal
is the name of the resulting directory by default. DO NOT RENAME IT! -
If you cloned the repository, switch to the the version-appropriate branch now.
-
Return to
wesnoth/projectfiles
and duplicate the VC14 folder if applicable, as mentioned above. -
Open
projectfiles/VCXX/wesnoth.sln
in Visual Studio. At this point, it may prompt you to re-target the projectfiles for your current VS and Windows versions. Do so; the build will likely fail if you do not. -
Optional: by default, Wesnoth's WML unit tests are run after each build. This can be quite annoying and/or time-consuming if you build regularly. They can be disabled by heading to the
wesnoth
projectfile's properties, underBuild Events → Post-Build Event
. Delete the value in the "Command Line" field. -
Optional: By default, the Debug configuration is selected. This type of build is only good if you intend to work on the game's engine or wish to get a stacktrace for a bug report. If you're only interested in playing the game, a Release build is faster. You can switch the configurations in the toolbar at the top of the screen.
-
That's it! You can now go ahead and start the build (
Build → Build Solution
). -
Important! After building, copy all the files from
external/dll
into the same directory (wesnoth/
by default) as the newly built executable . The game will not start if you fail to do this.
Manually updating the external dependencies
We do our best to keep the build dependency repository up-to-date with the latest versions of the libraries within, as well as synced with any build requirement changes. If you want to build with a different version of a certain library, however, you can fetch the relevant files at the links below:
-
Boost: Do note that you will need to build the necessary Boost libraries yourself. See the instructions in the dependency repository for details.
-
SDL 2: You'll want the "Visual C++ 32/64-bit" Development Libraries.
-
SDL_Image: Again, you'll want the "Visual C++ 32/64-bit" Development Libraries.
-
SDL_Mixer: Again, you'll want the "Visual C++ 32/64-bit" Development Libraries.
The other libraries require complicated compilation procedures too in-depth to document here.