[SOLVED]Chipmunk on OS X

Member
Posts: 30
Joined: 2010.08
Post: #1
I'm making a pong clone in OpenGL, and to make it a bit more interesting I want to try using chipmunk for physics. But how can I use it on OS X? Most of the Objective-C stuff is all for iPhone. There is target for a static library in the xcode project it gives but that doesn't even compile. Any help?

Thanks.
Quote this message in a reply
⌘-R in Chief
Posts: 1,265
Joined: 2002.05
Post: #2
"It doesn't even compile" is vague. You need to state the problem clearly and thoroughly if you want an answer.
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #3
Chipmunk itself compiles fine on OS X, that's where it's developed.

If you are trying to use the Objective-Chipmunk static library, the one packaged with the Chipmunk distribution is iPhone only. Objective-Chipmunk is closed source, but I can compile an OS X static lib if you want. You are actually the first person that has shown any interest in Objective-Chipmunk on OS X.

Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Quote this message in a reply
⌘-R in Chief
Posts: 1,265
Joined: 2002.05
Post: #4
When I first saw this thread, I went and looked at the website. I thought Objective-Chipmunk worked on both, and the website suggests it does since it says you can use it freely "on Mac OS X and in the iPhone Simulator." It also says that it is very useful "particularly on iPhone games", which implies it's good for Mac OS X games too.

Which we know it certainly would be, if it were available. Wink
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #5
Yes, it's simply a matter of getting the Mac OS X version of the Objective-Chipmunk static lib (which we give away for free). I have an old compiled version sitting around, but nobody ever seemed to want it so I stopped making builds. I can build a more up to date version if you want.

Again, Chipmunk (the C API portion, and not the Objective-C wrapper) should compile fine on any number of systems including OS X. We are selling the Objective-C wrapper for the iPhone to try to fund further Chipmunk development.

Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Quote this message in a reply
Member
Posts: 30
Joined: 2010.08
Post: #6
I tried compiling the xcode project in the macosx directory, which contained an iphone target and demo intel target (I tried building the latter), and it didn't compile, giving many errors about references to things beginning with cp. I just assumed the Objective-chipmunk was what I should use for os x.

So how do I compile the C api and include it in my application?

Thanks.
Quote this message in a reply
⌘-R in Chief
Posts: 1,265
Joined: 2002.05
Post: #7
(Sep 3, 2010 05:03 PM)mk12 Wrote:  So how do I compile the C api

You open up the Xcode project and build the library. You'll need to be more specific about any problems.
Quote this message in a reply
Member
Posts: 30
Joined: 2010.08
Post: #8
Ok, I have a mac static library compiled now, libChipmunk.a, can I just put that in my project's frameworks group and use chipmunk?

Also, my application is packaged as a fat binary with 32-bit and 64-bit intel, does this mean I need to compile 32-bit and 64-bit chipmunk?
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #9
Yes, you can just add the static library and the folder full of Chipmunk's headers to you project. The Xcode project is set to build fat static libraries already. You should be good to go.

Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Quote this message in a reply
Member
Posts: 30
Joined: 2010.08
Post: #10
Ok, thanks.
Quote this message in a reply
Member
Posts: 30
Joined: 2010.08
Post: #11
What about headers? My project won't compile because it can't find chipmunk.h, but it does link to libChipmunk.a fine. I tried "chipmunk.h", "Chipmunk.h", "libChipmunk.h", <Chipmunk/chipmunk.h> etc but nothing worked.


EDIT: I figured it out I just needed to put the chipmunk folder in the include directory of the download into my project.
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #12
#include "chipmunk/chipmunk.h"

It must be quotes, and lower case. The brackets <> means that the header is on a system/compiler defined path.

Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Quote this message in a reply
Moderator
Posts: 916
Joined: 2002.10
Post: #13
Any chance I could get this OS X version of Objective-Chipmunk?
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #14

Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Quote this message in a reply
Moderator
Posts: 916
Joined: 2002.10
Post: #15
Thank you VERY MUCH! I'll let you know how my adventures go.
Quote this message in a reply
Post Reply