[fpc-devel] First version of FPC for iPhone SDK 2.x available
Jonas Maebe
jonas.maebe at elis.ugent.be
Sun Jan 11 13:46:21 CET 2009
On 11 Jan 2009, at 10:18, dmitry boyarintsev wrote:
>> It is perfectly possible to compile programs without using
>> Objective-C code
>> (the testsuite programs, which are plain command line programs,
>> work fine on
>> the iPhone/iPod Touch -- of course, their output only appears on
>> the console
>> log and not on the screen, because they don't have a GUI).
> What's the correct way to build testsuite programs using fpc and
> XCode? are they Simulator runnable too?
It does not make sense much to run them in the Simulator, because the
Simulator allows full access to the real Mac OS X, so you have no idea
whether you are testing Mac OS X/iPhone-specific code or regular Mac
OS X/i386 code. It's probably safer (and definitely much easier) to
run them under plain Mac OS X/i386 in that case.).
That said, I've usually just compiled test programs on the command
line (for ARM), and then copied them over the built binary in an Xcode
project. If you then "run" the program in Xcode, it will code sign and
run the binary that you copied over rather than the original
program :) (just make sure that the binary in Xcode has been compiled
recently so there are no changes that trigger Xcode to relink it).
You can find the binary's location by opening the "products" folder in
the project overview, right-clicking on the .app file and selecting
"Reveal in Finder". The binary's location is then in program.app/
Contents/MacOS. Just overwrite whatever file is there with the program
you compiled.
To compile on the command line (replace "iphone2.1" with the directory
in which you installed the SDK):
ppcarm -FD/iphone2.1/Platforms/iPhoneOS.platform/Developer/usr/bin -XR/
iphone2.1/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk tt2
To compile for the simulator, replace "ppcarm" with "/usr/local/lib/
fpc/2.3.1/ppc386", and the -XR parameter with the path to a simulator
SDK. And in case you created an alternate fpc.cfg that uses a
different unit search path than /usr/local/lib/fpc/2.3.1/units/*, also
add -Fu/usr/local/lib/fpc/2.3.1/units/*
You can also directly compile from Xcode, if you want: just create a
new project based on the template, remove all files except for the
*Prefix.pch, Info.plist, Framewoeks and Products from the project, and
then add the test program file (Project->Add to Project...). Finally,
double click on the project icon at the top left in the file list, go
to the Build tab, and change the FPC_MAIN_FILE setting to the name of
the test program you added (for all configurations). Then you can
build it.
To see the console output of the test programs, press cmd-shift-r (or
select Run->Console)
Jonas
More information about the fpc-devel
mailing list