CompilingWesnothOnWindows

From The Battle for Wesnoth Wiki
Revision as of 17:39, 3 January 2006 by Xan (talk | contribs) ([Xan's guide to Compiling the Battle for Wesnoth on Windows])

Compiling Wesnoth on Windows

On 2005-03-27, baro wrote:

 Just to let you know, it is no problem to compile wesnoth
 for windows using free tools. I used "devcpp" and "msys",
 downloaded all needed libraries via the devcpp package
 downloader, compiled freetype2 and than wesnoth with msys..
 using linux like ./configure and make

The source code includes a project file for VC++ 6 which is kept up to date since Dave uses that environment. Yes, he is aware that it is very old.

Azlan tried to compile using mingw32 using the Dev-C++ IDE, but was having problems linking.

Wintifax <a href="http://www.wesnoth.org/forum/viewtopic.php?t=5589">reported having built using Visual Studio 7.1 (.Net 2003)</a> and posted instructions.

Enzo successfully built using mingw32 and included instructions and a link to the downloadable installer. Some of the postings in this thread discuss issues with this build, but it does seem reasonable.

SL also reported building successfully, giving quite a lot of detail.

[Xan's guide to Compiling the Battle for Wesnoth on Windows]

1. Acquire tools

a. Dev-C++ from http://www.bloodshed.net/devcpp.html

b. MSYS from http://www.mingw.org/

c. FT Jam from http://sourceforge.net/project/showfiles.php?group_id=3157&package_id=19789

d. libintl from Dev-C++ package

e. Freetype2 from http://prdownloads.sourceforge.net/freetype/freetype-2.1.9.tar.bz2?download

f. SDL from Dev-C++ package

g. SDL_image from Dev-C++ package

i. SDL_net from Dev-C++ package

h. SDL_mixer from Dev-C++ package

j. bzip2 from Dev-C++ package

k. zlib from Dev-C++ package

l. libcurl from Dev-C++ package


All the Dev-C++ packages can be downloaded from the Dev-C++ IDE.

2. Setting up libraries

a. Install MSYS. When it asks if you have mingw installed, give it the path to your Dev-C++ directory.

b. Copy the Jam executable to the MSYS /bin directory.

c. Go to the control panel, and open 'System'. Click on the 'Advanced' tab. Click the 'Environment Variables' button. Make a new user variable called 'JAM_TOOLSET' with a value of 'MINGW', and make a new user variable called 'MINGW' where the value is the absolute path to your Dev-C++ install.

d. Run MSYS, go to the freetype2 directory, and type 'jam'. The freetype library should automatically compile. Rename the 'freetype.a' in the 'objs' directory to 'libfreetype.a', and copy it to the Dev-C++ 'lib' directory.

3. Making a jamfile for Wesnoth

Create a file called 'jamfile' in wesnoth/src and copy the lines below to it. Then replace all the $(Path)s, including the '$' with the absolute path to that directory.

# START Jamfile

HDRS = "$(WesnothPath)/src" "$(DevC++Path)/include/SDL" "$(WesnothPath)/src/sdl_ttf" "$(FreeType2Path)/include" ;

ALLLINKLIBS += -lmingw32 ;

LINK = g++ ; CC = g++ ; C++ = g++ ;

ALLLINKLIBS += -lSDLmain -lSDL -lSDL_image -lSDL_net -lSDL_mixer -lbz2 -lz -lcurl -lwsock32 -lws2_32 -lwinmm -lfreetype -lintl -mwindows ;

LINKLIBS on Wesnoth$(SUFEXE) = $(ALLLINKLIBS) ;

Main Wesnoth : about.cpp actions.cpp ai.cpp ai_dfool.cpp ai_attack.cpp ai_move.cpp ai_python.cpp animated.cpp astarnode.cpp builder.cpp cavegen.cpp checksum.cpp clipboard.cpp color_range.cpp config.cpp config_adapter.cpp cursor.cpp dialogs.cpp display.cpp events.cpp filechooser.cpp filesystem.cpp font.cpp game.cpp game_config.cpp game_events.cpp gamestatus.cpp gettext.cpp halo.cpp help.cpp hotkeys.cpp image.cpp intro.cpp key.cpp language.cpp leader_list.cpp log.cpp map.cpp map_create.cpp map_label.cpp mapgen.cpp mapgen_dialog.cpp marked-up_text.cpp menu_events.cpp minimap.cpp mouse.cpp mouse_events.cpp multiplayer.cpp multiplayer_ui.cpp multiplayer_wait.cpp multiplayer_connect.cpp multiplayer_create.cpp multiplayer_lobby.cpp network.cpp network_worker.cpp pathfind.cpp pathutils.cpp playcampaign.cpp playlevel.cpp playturn.cpp preferences.cpp preferences_display.cpp publish_campaign.cpp race.cpp random.cpp replay.cpp replay_controller.cpp reports.cpp sdl_utils.cpp show_dialog.cpp sound.cpp statistics.cpp team.cpp terrain.cpp theme.cpp thread.cpp titlescreen.cpp tooltips.cpp tstring.cpp unit.cpp unit_display.cpp unit_types.cpp util.cpp variable.cpp video.cpp wassert.cpp serialization/binary_or_text.cpp serialization/binary_wml.cpp serialization/preprocessor.cpp serialization/parser.cpp serialization/string_utils.cpp serialization/tokenizer.cpp widgets/button.cpp widgets/combo.cpp widgets/file_chooser.cpp widgets/image_button.cpp widgets/label.cpp widgets/menu.cpp widgets/progressbar.cpp widgets/scrollarea.cpp widgets/scrollbar.cpp widgets/scrollpane.cpp widgets/slider.cpp widgets/textbox.cpp widgets/widget.cpp sdl_ttf/SDL_ttf.c zipios++/xcoll.cpp ;

# END Jamfile

Note that the above list of source files may need to be edited depending on the version of Wesnoth you are compiling.

4. Compiling Wesnoth

a. Run MSYS and go to the wesnoth/src directory.

b. Type 'jam'

c. Wesnoth should now compile!

Cross compiling for Windows

Forcemstr has cross compiled for Windows using the free mingw32 tools, running under Linux.


See Also