How to compile Wesnoth for iPhone/iPad

Get help with compiling or installing the game, and discuss announcements of new official releases.

Moderator: Forum Moderators

User avatar
fstltna
Posts: 40
Joined: October 2nd, 2010, 10:20 am
Location: South San Francisco, CA
Contact:

How to compile Wesnoth for iPhone/iPad

Post by fstltna »

I downloaded the current version with "Versions" (SVN client for Mac) and tried to compile it for the iPad but I get thousands of errors and warnings.

I don't know what the various targets are and which configuration I should be using: Debug, Valgrind, Release, Distribution, or Beta. And also which targets to use. I am attaching a screen shot of the settings to show you which I mean...
Screen capture 1.png
Please help!

Marisa
--- gameplayer.club port 33333 - The Wesnoth Game Player Club Wesnoth MP server, at the default port
-- https://wesnoth.gameplayer.club - My fan site for the great game Battle for Wesnoth
-- https://wesnoth.gameplayer.club/HostSplash - Get Wesnoth hosting for $14/month & first month free
Boucman
Inactive Developer
Posts: 2119
Joined: March 31st, 2004, 1:04 pm

Re: How to compile Wesnoth for iPhone/iPad

Post by Boucman »

normal version doesn't compile on the ipad/iphone, you need to get the special tree (not sure where it is, though, search for the iphone/ipad threads)
Fight key loggers: write some perl using vim
User avatar
fstltna
Posts: 40
Joined: October 2nd, 2010, 10:20 am
Location: South San Francisco, CA
Contact:

Re: How to compile Wesnoth for iPhone/iPad

Post by fstltna »

That is what I had. The image I posted was what the Xcode IDE has for the Wesnoth build, not my own code...

Marisa
--- gameplayer.club port 33333 - The Wesnoth Game Player Club Wesnoth MP server, at the default port
-- https://wesnoth.gameplayer.club - My fan site for the great game Battle for Wesnoth
-- https://wesnoth.gameplayer.club/HostSplash - Get Wesnoth hosting for $14/month & first month free
dodikk
Posts: 7
Joined: December 9th, 2010, 6:36 pm

Re: How to compile Wesnoth for iPhone/iPad

Post by dodikk »

Same problem for me.

I checked out the following project :
http://wesnoth.repositoryhosting.com/sv ... noth/trunk


This is claimed to be the iPhone and iPad port. Not the desktop version.
User avatar
fstltna
Posts: 40
Joined: October 2nd, 2010, 10:20 am
Location: South San Francisco, CA
Contact:

Re: How to compile Wesnoth for iPhone/iPad

Post by fstltna »

There is a hard-coded path in the iOS/SVN version so that you are not copying hundreds of megabytes each time you do a build. Edit: /Classes/game.mm and change the relevant line:
#if TARGET_IPHONE_SIMULATOR
#ifdef FREE_VERSION
// exe_dir = "/Users/kyle/Desktop/wesnoth FREE/res";
#else
#ifdef __IPAD__
exe_dir = "/Users/fstltna/Documents/wesnoth-ne-hd/res"; // ZZZ
#else
exe_dir = "/Volumes/OSX/Users/kyle/iwesnoth/trunk/res";
#endif
#endif
#endif
--- gameplayer.club port 33333 - The Wesnoth Game Player Club Wesnoth MP server, at the default port
-- https://wesnoth.gameplayer.club - My fan site for the great game Battle for Wesnoth
-- https://wesnoth.gameplayer.club/HostSplash - Get Wesnoth hosting for $14/month & first month free
dodikk
Posts: 7
Joined: December 9th, 2010, 6:36 pm

Re: How to compile Wesnoth for iPhone/iPad

Post by dodikk »

Ok. I'll check this out.
But I also have some problems with the "tcmalloc" library.

The "tcmallocAllocator" template parameter is not recognized in the container classes, such as "AssocVector.h". For example,

Code: Select all

    template
    <
        class K,
        class V,
        class C = std::less<K>,
        //class A = std::allocator< std::pair<K, V> >
		class A = STL_Allocator< std::pair<K, V>, tcmallocAllocator>
    >
class AssocVector 
Am I missing any library dependencies which are not included in the repository?
Any suggestions?

P.S. I can attach the build logs in case you need them.
User avatar
fstltna
Posts: 40
Joined: October 2nd, 2010, 10:20 am
Location: South San Francisco, CA
Contact:

Re: How to compile Wesnoth for iPhone/iPad

Post by fstltna »

dodikk wrote:Ok. I'll check this out.
But I also have some problems with the "tcmalloc" library.

The "tcmallocAllocator" template parameter is not recognized in the container classes, such as "AssocVector.h". For example,
I seem to remember that I had the same problem, but I can't remember for sure what I did to fix it. I think you can remove the references, or maybe it was just changing the tcmalloc to malloc. Here is what my contact had to say about it - I think I did what he said and uncommented the malloc lines:
You can try removing the tcmalloc folder from the project, and changing the lines with the errors to the original code that is commented out just above or below. Tcmalloc is a different memory manager, but this isn't needed for iPad as there is plenty of memory...
--- gameplayer.club port 33333 - The Wesnoth Game Player Club Wesnoth MP server, at the default port
-- https://wesnoth.gameplayer.club - My fan site for the great game Battle for Wesnoth
-- https://wesnoth.gameplayer.club/HostSplash - Get Wesnoth hosting for $14/month & first month free
User avatar
fstltna
Posts: 40
Joined: October 2nd, 2010, 10:20 am
Location: South San Francisco, CA
Contact:

Re: How to compile Wesnoth for iPhone/iPad

Post by fstltna »

One thing I forgot, since you may not know this, is that the version that you get from SVN does not work properly on iPad, just on the smaller screens of iPhone & iPod Touch. On the iPad the intro & menu works OK in full-size but the game itself the screen is in a mish-mash of 480x320 & 1024x768. I am willing to pay to get this fixed, as iPad is what I want to target before adding the ipod4 & iphone4 as well at the iPad, and have someone working on this among other things. I could use the help if you get this fixed before I do. :) I have a SVN at sourceforge if you want to check out my version which does build and starts up, with the mentioned graphics issue...

Marisa
--- gameplayer.club port 33333 - The Wesnoth Game Player Club Wesnoth MP server, at the default port
-- https://wesnoth.gameplayer.club - My fan site for the great game Battle for Wesnoth
-- https://wesnoth.gameplayer.club/HostSplash - Get Wesnoth hosting for $14/month & first month free
dodikk
Posts: 7
Joined: December 9th, 2010, 6:36 pm

Re: How to compile Wesnoth for iPhone/iPad

Post by dodikk »

Seems like some sources are missing within the "Trunk" branch:

Sources/OpenFeint/api/Invite
Sources/OpenFeint/api/OFRequestHandle.[h/mm]
Sources/OpenFeint/api/sample_delegates
Resources/FULL/IPad
REsources/HTTT
REsources/TSG

and some more...

Any suggestions?
dodikk
Posts: 7
Joined: December 9th, 2010, 6:36 pm

Re: How to compile Wesnoth for iPhone/iPad

Post by dodikk »

I have a SVN at sourceforge if you want to check out my version which does build and starts up, with the mentioned graphics issue...
Since I'm unable to build the "official" version, I'd like to try your one.
Please do me a favor by giving the link to your repo.
User avatar
KylePoole
iOS Port Maintainer
Posts: 135
Joined: July 5th, 2009, 3:36 am

Re: How to compile Wesnoth for iPhone/iPad

Post by KylePoole »

Please post any specific errors you have and I'll see if I can help

Resources for the iPad version are mostly just the same as iPhone with some wml copied from the PC (1024x768 resolution support) plus new fullscreen images for loading and whatnot. It is not included in svn because it is another several hundred megabytes that is the same as you can get elsewhere

Not sure about missing OpenFeint files, but you can download the lateset OpenFeint SDK from their site or disable it with the preprocessor macro something like DISABLE_OPENFEINT
User avatar
fstltna
Posts: 40
Joined: October 2nd, 2010, 10:20 am
Location: South San Francisco, CA
Contact:

Re: How to compile Wesnoth for iPhone/iPad

Post by fstltna »

Hi Kyle - glad to see you back again! I sent this to you a while ago but maybe you never got it or your replies got lost...

Here is what the current version displays when run in iPad mode:
What it looks like on a iPad
What it looks like on a iPad
Hope you can set me right! :)

Marisa
--- gameplayer.club port 33333 - The Wesnoth Game Player Club Wesnoth MP server, at the default port
-- https://wesnoth.gameplayer.club - My fan site for the great game Battle for Wesnoth
-- https://wesnoth.gameplayer.club/HostSplash - Get Wesnoth hosting for $14/month & first month free
User avatar
pauxlo
Posts: 1047
Joined: September 19th, 2006, 8:54 pm

Re: How to compile Wesnoth for iPhone/iPad

Post by pauxlo »

KylePoole wrote:Resources for the iPad version are mostly just the same as iPhone with some wml copied from the PC (1024x768 resolution support) plus new fullscreen images for loading and whatnot. It is not included in svn because it is another several hundred megabytes that is the same as you can get elsewhere
This is what branches are for.
User avatar
KylePoole
iOS Port Maintainer
Posts: 135
Joined: July 5th, 2009, 3:36 am

Re: How to compile Wesnoth for iPhone/iPad

Post by KylePoole »

Thanks for the tip mister fancy pants, but I don't want to deal with svn branches. They are good in theory but never in practice :P

For the wml I was talking about, grab the data/themes/default.cfg from the PC version to get 1024x768 support for iPad
jhkrischel
Posts: 3
Joined: December 20th, 2010, 10:42 am

Re: How to compile Wesnoth for iPhone/iPad

Post by jhkrischel »

Okay, here's a walkthrough for compiling and running without OpenFeint or tcmalloc, and one with the latest OpenFeint and without tcmalloc. The actual map screen doesn't work (all kinds of artifacts, the hex tiles just don't seem to get refreshed), but everything else seems to actually work.

Apologies again to Gambit for flooding before, I'll just keep this post edited from now on:

==REMOVING OPENFEINT METHOD==
mkdir ~/Desktop/wesnoth
cd ~/Desktop/wesnoth
svn co http://wesnoth.repositoryhosting.com/sv ... noth/trunk .
rm -rf `find . -type d -name .svn`
rm -Rf OpenFeint
vi Classes/game.mm
#< memory_profiler_start("/Users/kyle/wesnoth");
#> memory_profiler_start("/Users/jere/wesnoth");

#< exe_dir = "/Volumes/OSX2/wesnoth_res/res_iPad";
#> exe_dir = "/Users/jere/Desktop/wesnoth/res_iPad";

#< exe_dir = "/Volumes/OSX/Users/kyle/iwesnoth/trunk/res";
#> exe_dir = "/Users/jere/Desktop/wesnoth/res";

mkdir res_iPad
cd res_iPad
ln -s ../res/* .
rm data
mkdir data
cd data
ln -s ../../res/data/* .
rm themes
mkdir themes
cd themes
ln -s ../../../res/data/themes/* .
rm default.cfg

cd ~/Desktop/wesnoth
#copy wesnoth-1.6.3/data/themes/default.cfg to ~/Desktop/wesnoth/res_iPad/data/themes/default.cfg

open wesnoth.xcodeproj
-delete wesnoth/Sources/OpenFeint

-choose wesnoth project...Command-I
--General...Project Format: Xcode 3.2-compatible
--General...Base SDK for All Configurations: Latest iOS
--Build...iOS Deployment Target: iOS 4.2

-choose Targets...wesnoth-iPad sim...Command-I
--Build...Base SDK: Latest iOS
--Build...iOS Deployment Target: iOS 4.2
--Build...Preprocessor Macros...add "DISABLE_OPENFEINT"

-close project, open project

-Choose Active Target: wesnoth-iPad sim
-Fix paths for wesnoth/Resources/FULL/iPad
--choose item...Command-I...General...Choose...find the directory under wesnoth/res_iPad/
--exception: Default-Landscape.png -> remove the Default.png symlink in wesnoth/res_iPad, make a copy of Default.png and rename it Default-Landscape.png

-Comment out all assert(data_); lines in shared_string.hpp

-fix tcmalloc stuff
--Comment out #include "base/stl_allocator.h" in AssocVector.h, skiplist_map.hpp
--Comment out class A = STL_Allocator< std::pair<K, V>, tcmallocAllocator> in AssocVector.h
--Uncomment class A = std::allocator< std::pair<K, V> > in AssocVector.h
--Comment out template <typename Key, typename Value, typename Compare = std::less<Key>, typename Alloc = STL_Allocator<Value, tcmallocAllocator> > in skiplist_map.hpp
--Uncomment template <typename Key, typename Value, typename Compare = std::less<Key>, typename Alloc = std::allocator<Value> > in skiplist_map.hpp

-Add includes to sync_upload.mm:
#include <vector>
#include "string_utils.hpp"

-fix openFeint stuff
--Comment out extern bool gPauseForOpenFeint; in dialogs.mm, game.mm, sync_login.mm, sync_main.mm, UnitDetails.mm
--Comment out gPauseForOpenFeint = true; in dialogs.mm, game.mm
--Comment out gPauseForOpenFeint = false; in sync_login.mm, sync_main.mm, UnitDetails.mm

-fix pvrtc files
1) grabbed quickpvr from here: http://www.limbicsoftware.com/quickpvr.html

2) edited /Library/QuickLook/quickpvr.qlgenerator/Contents/Info.plist, and added a value "pvrtc" under:

Information Property List...Exported Type UTIs...Item 0...Equivalent Types...public.filename-extension...

3) quickviewd loading?.pvrtc from res/data/core/images/misc/, and took a screenshot with Command-Shift-4 of just the pop-up window

4) trimmed the screenshot to 512x512, then resized it to 1024x1024

5) created new pvrtcs with the following command (replace ? with the number you're really working on):

/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/texturetool -e PVRTC -o loading?.pvrtc loading?.png

6) did the whole create symlinks thing to the ipad-res directory so that they could have different loading?.pvrtc files

cd ~/Desktop/wesnoth/res_iPad/data
rm core
mkdir core
cd core
ln -s ../../../res/data/core/* .
rm images
mkdir images
cd images
ln -s ../../../../res/data/core/images/* .
rm misc
mkdir misc
cd misc
ln -s ../../../../../res/data/core/images/misc/* .
rm loading?.pvrtc

7) copied the new pvrtc files for ipad there

-Command-Shift-K...Clean
-Command-R

==UPDATING OPENFEINT METHOD==
mkdir ~/Desktop/wesnoth
cd ~/Desktop/wesnoth
svn co http://wesnoth.repositoryhosting.com/sv ... noth/trunk .
rm -rf `find . -type d -name .svn`
rm -Rf OpenFeint
vi Classes/game.mm
#< memory_profiler_start("/Users/kyle/wesnoth");
#> memory_profiler_start("/Users/jere/wesnoth");

#< exe_dir = "/Volumes/OSX2/wesnoth_res/res_iPad";
#> exe_dir = "/Users/jere/Desktop/wesnoth/res_iPad";

#< exe_dir = "/Volumes/OSX/Users/kyle/iwesnoth/trunk/res";
#> exe_dir = "/Users/jere/Desktop/wesnoth/res";

mkdir res_iPad
cd res_iPad
ln -s ../res/* .
rm data
mkdir data
cd data
ln -s ../../res/data/* .
rm themes
mkdir themes
cd themes
ln -s ../../../res/data/themes/* .
rm default.cfg

cd ~/Desktop/wesnoth
#copy wesnoth-1.6.3/data/themes/default.cfg to ~/Desktop/wesnoth/res_iPad/data/themes/default.cfg

open wesnoth.xcodeproj
-delete wesnoth/Sources/OpenFeint
-copy OpenFeint.2.7.5/OpenFeint to wesnoth/Sources
--Check "Copy items into destination group's folder
--Add To Targets...Check "wesnoth-iPad sim"...Add

-choose wesnoth project...Command-I
--General...Project Format: Xcode 3.2-compatible
--General...Base SDK for All Configurations: Latest iOS
--Build...iOS Deployment Target: iOS 4.2

-choose Targets...wesnoth-iPad sim...Command-I
--Build...Base SDK: Latest iOS
--Build...iOS Deployment Target: iOS 4.2

-close project, open project

-Choose Active Target: wesnoth-iPad sim
-Fix paths for wesnoth/Resources/FULL/iPad
--choose item...Command-I...General...Choose...find the directory under wesnoth/res_iPad/
--exception: Default-Landscape.png -> remove the Default.png symlink in wesnoth/res_iPad, make a copy of Default.png and rename it Default-Landscape.png

-Comment out all assert(data_); lines in shared_string.hpp

-fix pvrtc files
1) grabbed quickpvr from here: http://www.limbicsoftware.com/quickpvr.html

2) edited /Library/QuickLook/quickpvr.qlgenerator/Contents/Info.plist, and added a value "pvrtc" under:

Information Property List...Exported Type UTIs...Item 0...Equivalent Types...public.filename-extension...

3) quickviewd loading?.pvrtc from res/data/core/images/misc/, and took a screenshot with Command-Shift-4 of just the pop-up window

4) trimmed the screenshot to 512x512, then resized it to 1024x1024

5) created new pvrtcs with the following command (replace ? with the number you're really working on):

/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/texturetool -e PVRTC -o loading?.pvrtc loading?.png

6) did the whole create symlinks thing to the ipad-res directory so that they could have different loading?.pvrtc files

cd ~/Desktop/wesnoth/res_iPad/data
rm core
mkdir core
cd core
ln -s ../../../res/data/core/* .
rm images
mkdir images
cd images
ln -s ../../../../res/data/core/images/* .
rm misc
mkdir misc
cd misc
ln -s ../../../../../res/data/core/images/misc/* .
rm loading?.pvrtc

7) copied the new pvrtc files for ipad there

-fix tcmalloc stuff
--Comment out #include "base/stl_allocator.h" in AssocVector.h, skiplist_map.hpp
--Comment out class A = STL_Allocator< std::pair<K, V>, tcmallocAllocator> in AssocVector.h
--Uncomment class A = std::allocator< std::pair<K, V> > in AssocVector.h
--Comment out template <typename Key, typename Value, typename Compare = std::less<Key>, typename Alloc = STL_Allocator<Value, tcmallocAllocator> > in skiplist_map.hpp
--Uncomment template <typename Key, typename Value, typename Compare = std::less<Key>, typename Alloc = std::allocator<Value> > in skiplist_map.hpp

-fix OpenFeint stuff
--copy OpenFeint.2.7.5/MyOpenFeintSample/SampleDelegates/SampleOFDelegate.h and SampleOFDelegate.mm to wesnoth/Sources/OpenFeint/ (Check "Copy Items")...Add
--add after imports in SampleOFDelegate.mm:

extern bool gPauseForOpenFeint;
bool gPauseForOpenFeint = false;

--in dashboardWillAppear, add: gPauseForOpenFeint = true;
--in dashboardDidDisappear, add: gPauseForOpenFeint = false;

--right-click wesnoth/Frameworks...Add..Existing Frameworks...select AddressBook, AddressBookUI and GameKit...Add

-Command-Shift-K...Clean
-Command-R
Last edited by jhkrischel on December 20th, 2010, 10:15 pm, edited 3 times in total.
Post Reply