Skip to content

Commit

Permalink
Updated Visual Studio projectfile readme
Browse files Browse the repository at this point in the history
[ci skip]
  • Loading branch information
Vultraz committed Mar 27, 2018
1 parent 139695d commit 8d22446
Showing 1 changed file with 41 additions and 192 deletions.
233 changes: 41 additions & 192 deletions projectfiles/VC14/README.md
@@ -1,210 +1,59 @@
## Compiling Wesnoth on Windows using Visual Studio
# Compiling Wesnoth on Windows using Visual Studio

Please refer to the guide on wiki.wesnoth.org
http://wiki.wesnoth.org/CompilingWesnothOnWindows#Visual_Studio_2010_and_later
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

## Generating a .vcproject file using cmake
We maintain a handy [GitHub repository](https://github.com/aquileia/external) with all the external
libraries (see [INSTALL.md](https://github.com/wesnoth/wesnoth/blob/master/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!

The Visual Studio project is manually updated by its maintainers, which basically
entails appending new source files as they are added to Wesnoth. Previously, it
was regenerated by cmake, for which a legacy script `msvc9-cmake.bat` exists:
## What to do

1. make sure that git (formerly svn) command-line executable is in your %PATH%
2. for wesnoth 1.8 and early pre-1.9 versions: download
ftp://ftp.terraninfo.net/wesnoth/msvc9/external.zip (55mb download) and
unpack it into wesnoth's directory - so, there'll be an 'external'
folder in there.
3. for wesnoth 1.9: download
ftp://ftp.terraninfo.net/wesnoth/msvc9/external_19.zip (59mb download)
and unpack it into wesnoth's directory - so, there'll be an 'external'
folder in there.
4. install cmake http://www.cmake.org/cmake/resources/software.html and
put it into %PATH% (that can be done by the installer)
5. to allow the game to run, put full path to external/dll into %PATH%
6. run external/msvc9-cmake.bat
7. open generated project file in msvc9 and compile. the project should
pick up changes in cmake files automatically. Also, you can re-run the
.bat file to regenerate it.


## Building the prerequisites

We'll assume to have two *General Folders* for libraries and includes to store
most of the prerequisites. (Otherwise each configuration setting for each
project would need to have each and every 'lib' and 'include' folder added.)
`C:\projects\_include`
`C:\projects\_lib`
1. 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 in `Documents/wesnoth`, for
example, the dependency pack should be at `Documents/external`. Note that `external` is the name of the
resulting directory by default. **DO NOT RENAME IT!**

We'll now start downloading and compiling/copying the prerequisites into the necessary
folders, all version numbers are minimal requirements:
2. If you cloned the repository, switch to the the version-appropriate branch now.

3. Return to `wesnoth/projectfiles` and duplicate the VC14 folder if applicable, as mentioned above.

1. zlib-1.2.3 ( http://www.zlib.net/ )

Download the zlib source code
zlib123.zip
and unpack it into the projects folder to get:
`C:\projects\zlib123\`
4. 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.

Open the file zlib.dsw in the folder
`C:\projects\zlib123\projects\visualc6\`
with MSVC and select 'Yes To All' to convert it into a VC9 project.
5. **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, under `Build Events → Post-Build Event`. Delete the value in the "Command Line" field.

Open the properties of the 'zlib' solution and in the
'Configuration Properties' select the 'DLL Release'
'Configuration'. Select 'OK' and then right-click the 'zlib'
project and select 'Build'. After a successful Build, close that
instance of MSVC.
6. That's it! You can now go ahead and start the build (`Build → Build Solution`).

7. **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.

2. libsdl-1.2.10 ( http://www.libsdl.org )
## Manually updating the external dependencies

Download the development library file for Win32 as well as the
source code
SDL-1.2.10.zip
SDL-devel-1.2.10-VC8.zip
and unpack them into the projects folder to get:
`C:\projects\SDL-1.2.10\`
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:

Copy the 'SDL.dll' and the 'SDL.lib' from the 'lib' folder
and the contents of 'include' folder into the corresponding
*General Folder* ( ...\_include\ resp. ...\_lib\ ).
* **Boost:** http://www.boost.org/users/download. Do note that you will need to build the necessary Boost
libraries yourself. See the [instructions](https://github.com/aquileia/external/blob/master/README.md#updating-boost-libraries)
in the dependency repository for details.

Unpack the 'VisualC.zip' and open the 'SDL.sln' file with MSVC.
Follow the instructions to convert the project to VC9.
* **SDL 2:** https://www.libsdl.org/download-2.0.php. You'll want the "Visual C++ 32/64-bit" Development
Libraries.

Right-click the 'SDLmain' project and select 'Build'. After a
successful Build, close that instance of MSVC.
* **SDL_Image:** https://www.libsdl.org/projects/SDL_image. Again, you'll want the "Visual C++ 32/64-bit"
Development Libraries.

Copy 'SDLmain.lib' from
`C:\projects\SDL-1.2.10\VisualC\SDLmain\Debug`
into the 'lib' *General Folder*.
* **SDL_Mixer:** https://www.libsdl.org/projects/SDL_mixer. Again, you'll want the "Visual C++ 32/64-bit"
Development Libraries.


3. libboost-1.50.0 ( http://www.boost.org/ )

Note these instructions are still referring to Boost 1.48.0, and are so
pending possible fixes to make it Boost >= 1.50.0 compliant.

Download Boost and unpack it into the folder
`C:\projects\`

This should give you a folder structure like
`C:\projects\boost_1_48_0\`

Download the pre-built bjam executable
boost-jam-3.1.17-1-ntx86.zip
from the bjam download page on sourceforge
http://sourceforge.net/project/showfiles.php?group_id=7586&package_id=72941
and unpack and move the bjam executable it into the base folder
of boost
`C:\projects\boost_1_48_0\`

Now start the command prompt (CMD.exe) and invoke the following
commands:
```
C:\> set ZLIB_SOURCE=C:\projects\zlib123\
C:\> set ZLIB_LIBPATH=C:\projects\zlib123\projects\visualc6\Win32_DLL_Release
C:\> set ZLIB_BINARY=zlib1.dll
C:\> cd C:\projects\boost_1_48_0
C:\projects\boost_1_48_0> bjam ^
More? --toolset=msvc ^
More? --build-type=complete ^
More? --prefix="C:\projects\Boost\" install
```

If the upper last command doesn't work, replace the last line with:
```
--prefix="C:\projects\Boost" install
```

Now bjam will compile all variants of the boost library binaries
for MSVC 2008 and copies them into the folder
`C:\projects\Boost\lib\`
while all required headers are copied into
`C:\projects\Boost\include\boost-1_38\boost`

Use the time bjam is busy compiling (possibly several hours) as
you wish. (It is possible to continue downloading and copying
the include and lib files since all required compiling is done.)

Once bjam has finished building/copying, you then can delete
the folder
`C:\projects\boost_1_48_0\`
to free up space.


4. sdl-image-1.2 (with PNG support)
( http://www.libsdl.org/projects/SDL_image )

Download the binary file for Win32
SDL_image-devel-1.2.7-VC9.zip
and unpack it into the projects folder to get:
`C:\projects\SDL_image-1.2.7\`

Copy the contents of each the 'lib' and the 'include' folder
into the corresponding *General Folder*.


5. sdl-mixer-1.2.12 (with Vorbis support)
( http://www.libsdl.org/projects/SDL_mixer )

Download the binary file for Win32
SDL_mixer-devel-1.2.12-VC8.zip
and unpack it into the projects folder to get:
`C:\projects\SDL_mixer-1.2.12\`

Copy the contents of each the 'lib' and the 'include' folder
into the corresponding *General Folder*.


6. sdl-ttf-2.0.8 ( http://www.libsdl.org/projects/SDL_ttf )

Download the binary file for Win32
SDL_ttf-devel-2.0.8-VC8.zip
and unpack it into the projects folder to get:
`C:\projects\SDL_ttf-2.0.8\`

Copy the contents of each the 'lib' and the 'include' folder
into the corresponding *General Folder*.


7. libfontconfig-2.4.1
( http://www.gtk.org/download/win32.php )

Download the 'Fontconfig' package 'Binaries' from the
'Third Party Dependencies'
fontconfig-2.4.2-tml-20071015.zip
and unpack it into the projects folder to get:
`C:\projects\fontconfig-2.4.2\`

Copy the 'libfontconfig-1.dll' from the 'bin' folder into the
'lib' *General Folder*.


8. pangocairo-1.24.4 ( http://www.gtk.org/download-windows.html )

Download the following 'Binaryies' and 'Dev' packages from the
'GTK+ individual packages'
cairo_1.8.6-1_win32.zip
cairo-dev_1.8.6-1_win32.zip
glib_2.20.0-1_win32.zip
glib-dev_2.20.0-1_win32.zip
pango_1.24.0-1_win32.zip
pango-dev_1.24.0-1_win32.zip
and unpack them into the projects folder to get:
`C:\projects\pangocairo\`

Copy all dll's from the 'bin' folder into the '_lib'
*General Folder*.
Copy the contents (but not the subfolders) of the 'lib' folder
into the corresponding *General Folder*.
Copy the 'glibconfig.h' file from
`C:\projects\pangocairo\lib\glib-2.0\include` into the '_include'
*General Folder*.
Copy the contens (including subfolders) of the following folders
into the '_include' *General Folder*:
`C:\projects\pangocairo\include\cairo`
`C:\projects\pangocairo\include\glib-2.0`
`C:\projects\pangocairo\include\pango-1.0`
The other libraries require complicated compilation procedures too in-depth to document here.

0 comments on commit 8d22446

Please sign in to comment.