[gecode-users] embedded gecode

Guido Tack tack at gecode.org
Sun Apr 10 14:46:26 CEST 2011


Ruben Zilibowitz wrote:

> 
> On 09/04/2011, at 10:55 AM, Ruben Zilibowitz wrote:
> 
>> 
>> On 09/04/2011, at 7:11 AM, Guido Tack wrote:
>> 
>>> Ruben Zilibowitz wrote:
>>> 
>>>> This is a brilliant idea! Definitely helps to reduce file size.
>>> 
>>> What I was wondering is whether you can use our Makefiles to build Gecode for iOS, or do you have to turn the whole of Gecode into an XCode project?
>> 
>> I believe I first did:
>> ./configure --enable-static --disable-shared --disable-gist --disable-qt
>> in order to generate the config.hpp file
> 
> edit: I also ran make
> 
>> 
>> Then it was just a matter of adding the gecode folder with all the source code to Xcode. Then I removed some files I didn't need and were causing errors. And that was it.

Right, sounds more or less straightforward.  I googled a bit and tried some things, and it's actually quite easy to build Gecode for iOS directly using make.  This might be easier to maintain than always having to re-import Gecode into XCode.  All you have to do is define some environment variables (maybe adapt the paths if your installation is somewhere else):

export CFLAGS="-mno-thumb -arch armv6 -arch armv7 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk"
export CXXFLAGS=$CFLAGS
export CC=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2
export CXX=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++-4.2
/configure --host=arm-apple-darwin --build=i686-apple-darwin --enable-static --disable-shared --disable-qt

When you run make, this will produce the fat static libraries for armv6/armv7.  To build the same for the simulator, you should just have to change the options accordingly.  Unfortunately, it's not that straightforward to pack the device and simulator libraries into one three-platform lib (because lipo doesn't understand static libraries), so you'll have to fix that manually.

We'll probably add a configure option --small-codesize or similar to enable -Os or -Oz and use less aggressive inlining.

Cheers,
	Guido

-- 
Guido Tack, http://people.cs.kuleuven.be/~guido.tack/




More information about the users mailing list