Download for iPhone?

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Download for iPhone?

Postby brianhammond » Mon Jul 14, 2008 3:28 pm

Julio - I have a game that I wrote using Newton and it runs on Mac OS X. I really want to port the same game to the iPhone. The iPhone is not based on Intel however, but ARM. There is no static library download for 32-bit ARM processors.

Could you please create one? You can cross-compile for arm-apple-darwin using GCC on Linux.

I would be eternally grateful for your efforts! :D
User avatar
brianhammond
 
Posts: 14
Joined: Thu Sep 06, 2007 7:59 pm

Re: Download for iPhone?

Postby Julio Jerez » Mon Jul 14, 2008 4:19 pm

It is funny you mention that, I was reading about the Iphone SDK and the CPU
http://www.ipodhacks.com/article.php?sid=2289
It seems very powerful for that device even with simd intrusions :) .
I also saw the keynotes when they introduction it and I saw the some companies are making 3d game for the iphone
I make a library for I definitely made a library for it if there is interest.
do I need and actual IPhone device to build an library or do the emulator let me compile in emulation mode?

also if made the library I will make for 2.0, are you using newton 2.0?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Download for iPhone?

Postby Julio Jerez » Mon Jul 14, 2008 4:23 pm

brianhammond wrote: You can cross-compile for arm-apple-darwin using GCC on Linux.

do you mean that if I take teh linux make file and I set the flags to use arm-apple-darwin, badabim badbum the library is done fo rteh Iphone? It can not be that eassy? tell me more I am listenning?
what do I need to do to make that cross comipilation
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Download for iPhone?

Postby brianhammond » Mon Jul 14, 2008 4:53 pm

Yes, once you setup a toolchain for cross-compiling, you set some flags and out pops a static library for the ARM processor. If you distribute that file and the Newton.h, you have a wonderful, easy to use physics library for iPhone. What distribution of Linux do you have access to? I'm not 100% sure how to set this toolchain up to be honest.

I have not used Newton 2.0 -- Is there a download available that I can check out?

Regarding the iPhone simulator: you personally would not need an iPhone nor the iPhone SDK (which includes the simulator). You just need to cross-compile for the ARM processor and distribute a static library and include file(s). However, those that do want to use the simulator would have to link against the Intel version of the static library when running their application in the simulator, and link against the ARM version of the static library when testing their application on the iPhone (or iPod touch) device.

You could also -- if you have access to an Intel Mac running 10.5 Leopard -- download the iPhone SDK and cross-compile using the same toolchain that XCode uses when compiling applications written for the iPhone device.

I'm not sure what's in your Makefile for Mac OS X. These are the settings you'd use if you chose this route:

EDIT -- see Makefile posted in message below.
Last edited by brianhammond on Tue Jul 29, 2008 2:16 pm, edited 1 time in total.
User avatar
brianhammond
 
Posts: 14
Joined: Thu Sep 06, 2007 7:59 pm

Re: Download for iPhone?

Postby Julio Jerez » Mon Jul 14, 2008 6:02 pm

brianhammond wrote:You could also -- if you have access to an Intel Mac running 10.5 Leopard -- download the iPhone SDK and cross-compile using the same toolchain that XCode uses when compiling applications written for the iPhone device.

I'm not sure what's in your Makefile for Mac OS X. These are the settings you'd use if you chose this route:


That sounds quite awesome.
I have an Intel Mad pro now with Leopard and xcode 3, and the Newton 2.0 SDK runs on it as well as is Power PC IMac G3/4/5.
so I guess the easiest thing will be for me to download the Iphone SDK.

let us do this, You send me a PM, and I send you the Newton Archemedia SDK so that you upgrade your APP to the New SDK.
I will download the Iphone SDK and compile the engine, then you a library.
then you can test it in the Iphone since you already have a lot done and and you can save me teh debug phase.
if you agree and this work I may even buy an iphone to see newton working in the first non PC platform.
Send me a PM for a link to the SDK download .
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Download for iPhone?

Postby brianhammond » Mon Jul 14, 2008 7:12 pm

Whee! Sending you a PM now...
User avatar
brianhammond
 
Posts: 14
Joined: Thu Sep 06, 2007 7:59 pm

Re: Download for iPhone?

Postby Julio Jerez » Wed Jul 16, 2008 11:12 am

does anyone know what do I nee d to do to get teh SDK
I am a mac regiterd develeoper, but each time a try to downlod teh SDK I get the message

Thank you

Thank you for registering as an iPhone Developer. You will receive an email to complete your registration. Simply click the link within the email to access the Free SDK.

If you would like us to resend you this email or send it to a different email address, please click here.

the thing is that I never get the teh email, an dthsi has been for more few month, actaully since they realeased and I saw teh keynotes.
my impression was that I dod nto get a respond because I need a real Iphone, but peopel say this is not need it.
I do not know how to continue for that point.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Download for iPhone?

Postby Julio Jerez » Thu Jul 17, 2008 11:17 am

Ok I am downloadi SDK now.
wow it is 1+ gbyte, it will take soem time.
So let us see how is goes.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Download for iPhone?

Postby brianhammond » Fri Jul 18, 2008 1:08 am

Great! Yeah, the SDK is huge. Let me know if I can help with anything.
User avatar
brianhammond
 
Posts: 14
Joined: Thu Sep 06, 2007 7:59 pm

Re: Download for iPhone?

Postby Julio Jerez » Mon Jul 21, 2008 1:02 pm

Ok the new beta fo r teh Mac is on the site.
I include G3, Intel
in 32 an d64 bit versions.

I also include the Inewton library for I phone
I only build the emulation library, and I do nto test yet, just compiler teh library terefore I will be very surpice if it works.

I found extrnage tha teh library did not nee any Iphone framework like the mac version do.

any way see fi tehse works since you are far more into teh ihon ethat I am.
Next weekend I will try making a small Iphode demo app.

and how know if thsi works I might buy and Iphone,

hey this is the first non PC post of the Engine. I hear tha the Iphone CPU is actually quite good, so good the people can make 3d games on it.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Download for iPhone?

Postby Julio Jerez » Wed Jul 23, 2008 2:15 am

Uhoo I buidl the tow library for teh I phone (device and emulation)
I even made a small open Gl ES templat app, now I onel need to add teh Netwon demo and see what happens.
I will only make the very basic physiocs dmeo an dlet teh peopel interested take for there.

teh Iphone lokking very good so far :mrgreen: :mrgreen:
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Download for iPhone?

Postby Julio Jerez » Thu Jul 24, 2008 12:21 am

Ok INetwon is up an running.
I build a very small test class that create and destroy the Netwon world, and it also creates Netwons body.
The test application launch and runs fine.

I did not add the graphics represention because I do not know well how to use the Mac API and objective C
But the class is sufficeent for anyone who used Netwon in the Mac can use it in with the IPhone.
The project contain the Emulation library and the Device library.
The device library is no tested since I do not own an iPHone device.

This will be included with the next Beta, but anyone waiting for it can just PM me or let me know here.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Download for iPhone?

Postby brianhammond » Tue Jul 29, 2008 1:13 pm

Julio -- The libinewton.a static library in the beta download is not compiled for ARM. It is compiled for i386.

Can you please compile a version for ARM?

Code: Select all
$ ar -x libinewton.a

$ file *.o
Newton.o:                          Mach-O object i386
NewtonAproximateConvexPartition.o: Mach-O object i386
NewtonClass.o:                     Mach-O object i386
NewtonHeightFieldCollision.o:      Mach-O object i386
NewtonMeshEffect.o:                Mach-O object i386
NewtonStdAfx.o:                    Mach-O object i386
dg.o:                              Mach-O object i386
...
User avatar
brianhammond
 
Posts: 14
Joined: Thu Sep 06, 2007 7:59 pm

Re: Download for iPhone?

Postby Julio Jerez » Tue Jul 29, 2008 1:32 pm

aren't there two libraries?
if not I will check it out and post it again

Oh I think I know what happened, I name the two target the same way, I will verify.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Download for iPhone?

Postby brianhammond » Tue Jul 29, 2008 2:23 pm

Julio: Thanks.

If for some reason you cannot build the static library in XCode for the iPhone device (i.e. arm arch), here's a Makefile that allows you to do so from the command line.

Edit the Makefile:

1. Update the SRC variable to contain each of your source files. They can be located anywhere.
2. Update the LIBRARY_NAME to libinewton.a
3. Run 'make'

Ensure that any leading whitespace in the Makefile is a TAB and NOT SPACES. make is picky about that :)

Here's a sample I created. BTW, to anyone else out there, this is generic for creating static libraries for the iPhone.

file1.cpp

Code: Select all
int some_function() {
    int i = 42;
    return i;
}


file2.cpp

Code: Select all
int some_other_function() {
    int i = 43;
    return i;
}


Makefile

Code: Select all
###############################################################################
# Makefile for building static library for the iPhone OS 2.0 (arm-based) on Mac
# OS X.  This requires you to have installed the iPhone Developer SDK.  which
# in turn requires you to use Mac OS X 10.5. 
#
# Author: Brian Hammond
# License: Public Domain
###############################################################################

###############################################################################
# Update the library name and list all of your source files.
###############################################################################

LIBRARY_NAME=libDoNothing.a
SRC=file1.cpp \
    file2.cpp

###############################################################################
# You don't need to customize anything after this line.
###############################################################################

OBJ=$(SRC:.cpp=.o)

IPHONE_PLATFORM_HOME=/Developer/Platforms/iPhoneOS.platform/Developer
IPHONE_SDK_HOME=$(IPHONE_PLATFORM_HOME)/SDKs/iPhoneOS2.0.sdk

CC=$(IPHONE_PLATFORM_HOME)/usr/bin/arm-apple-darwin9-gcc-4.0.1
CPP=$(IPHONE_PLATFORM_HOME)/usr/bin/cpp

RANLIB=$(IPHONE_PLATFORM_HOME)/usr/bin/ranlib
AR=$(IPHONE_PLATFORM_HOME)/usr/bin/ar

CFLAGS=-arch armv6 -pipe -O0 -isysroot \
       $(IPHONE_SDK_HOME) -I$(IPHONE_SDK_HOME)/usr/include/gcc/darwin/4.0

LDFLAGS=-L$(IPHONE_SDK_HOME)/usr/lib

default: $(LIBRARY_NAME)

.cpp.o:
   $(CC) $(CFLAGS) -c $< -o $@

$(LIBRARY_NAME): $(OBJ)
   $(AR) -ru $@ $(OBJ)
   $(RANLIB) $@

clean:
   rm -f $(LIBRARY_NAME) $(OBJ)



Usage:

Code: Select all
$ make
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin9-gcc-4.0.1 -arch armv6 -pipe -O0  -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk -I/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk/usr/include/gcc/darwin/4.0 -c file1.cpp -o file1.o
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin9-gcc-4.0.1 -arch armv6 -pipe -O0  -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk -I/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk/usr/include/gcc/darwin/4.0 -c file2.cpp -o file2.o
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ar -ru libDoNothing.a file1.o file2.o
ar: creating archive libDoNothing.a
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib libDoNothing.a

$ file *.o
file1.o: Mach-O object arm
file2.o: Mach-O object arm

$ ar -t libDoNothing.a
__.SYMDEF SORTED
file1.o
file2.o


EDIT: removed -mthumb as that's bad for floating point code
Last edited by brianhammond on Wed Jul 30, 2008 12:15 pm, edited 1 time in total.
User avatar
brianhammond
 
Posts: 14
Joined: Thu Sep 06, 2007 7:59 pm

Next

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 12 guests

cron