CompilingWesnothOnWindows
From Wesnoth
Compiling Wesnoth
- on Linux or Unix
- on Linux PDA
- on Mac OS X
- on MS Windows
- on SuSE
- cross-compiling
Tools
Contents |
Compiling Wesnoth on Windows
The most up to date guide I know of is at the moment in this forum topic. Since it tends to change rather often with new mingw relases/wesnoth dependencies and I tend to forget to update the wiki I suggest visiting abovementioned topic for waltrough, some insight, shortcuts and other feedback.
On 10-04-2008 there are two guides there- setting up gcc 3.4.5 toolchain in first post, and setting up gcc 4.2.1 in the second one. I personaly suggest the latter since that enviroment works faster and produces faster code and I do not maintain 3.4.5 version anymore (though it doesn't mean it's not maintained at all, there still are devs using it and they update project files once every while)
Mist
Post Scriptum : It may also happen that I forget to update wesnoth.dev after source files are added/removed. In that case instead of wesnoth.exe you'll get awful lot of errors in this format <name1>::<name2>::<function>. Try to find a file in the /src directory (and subfolders) thats not included in the project and add it, or you might wait a bit. I recompile wesnoth quite often and will post patched wesnoth.dev on the forum thread.
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 then 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 reported having built using Visual Studio 7.1 (.Net 2003) 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_animation.cpp unit_display.cpp unit_types.cpp upload_log.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.
Or see here for another attempt: http://www.wesnoth.org/wiki/CompilingWesnoth/CrossCompiling
