Hi,
Thanks for writing ChipMunk, I think it's awesome!
As a token of my appreciation I've added support for native build files creation with cmake (http://www.cmake.org/HTML/Features.html)
This is how it works on GNU/Linux.
*First install cmake if it's not already part of your distribution
*cd to the build directory and type cmake ..
*make
Now the library is in build/source and chipmunk_demos is in build.
The nice part of this is that the makefiles our created out of the
source tree so you can easily do a rm -rf * in directory build and
start over.
Keep up the great work!
Kind regards,
W.P. van Paassen
cmake native build files creation
-
- Posts: 16
- Joined: Tue Aug 21, 2007 3:53 am
- Contact:
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: cmake native build files creation
I've added the CMake files to the repository with some slight changes. Seems to work pretty good.
Some questions though:
Some questions though:
- It says that it supports creating MSVC projects. Would this be helpful? It seems there wouldn't be that much work to create a new project from scratch given how little Chipmunk actually has. Though if it could be automated, all the better.
- How do you get it to install headers?
- I added a static library target, but it recompiles all the C files to do so. How do you make them share between the targets. Not that it takes that long, just nitpicking.
- Not sure if I botched my cmake configuration or if I broke your build files when moving them to the new project structure, it tries to install in /usr/local/usr/local/lib.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
-
- Posts: 16
- Joined: Tue Aug 21, 2007 3:53 am
- Contact:
Re: cmake native build files creation
Yes, this is helpful, I've tried this on win32 and it automatically creates a MSVC project when using cmake on win32. I believe cmake is even able to generate xcode projects for osx. This would mean that you only need to distribute the CMakeList.txt files and use cmake to create the build files for a specific target.slembcke wrote:
- It says that it supports creating MSVC projects. Would this be helpful? It seems there wouldn't be that much work to create a new project from scratch given how little Chipmunk actually has. Though if it could be automated, all the better.
You can't, only the shared library version needs the -fPIC flag for gcc to create position independent code.slembcke wrote:
- I added a static library target, but it recompiles all the C files to do so. How do you make them share between the targets. Not that it takes that long, just nitpicking.
You can check this by using make VERBOSE=1
Replace the INSTALL_TARGETS line in the CMakeLists.txt file in directory src withslembcke wrote:
- How do you get it to install headers?
- Not sure if I botched my cmake configuration or if I broke your build files when moving them to the new project structure, it tries to install in /usr/local/usr/local/lib.
INSTALL(TARGETS chipmunk chipmunk_static
LIBRARY DESTINATION /usr/local/lib/chipmunk
ARCHIVE DESTINATION /usr/local/lib/chipmunk
)
INSTALL(FILES
chipmunk.h cpArray.h cpBody.h cpHashSet.h cpPolyShape.h cpSpace.h cpVect.h
cpArbiter.h cpBB.h cpCollision.h cpJoint.h cpShape.h cpSpaceHash.h prime.h
DESTINATION /usr/local/include/chipmunk
)
cheers,
W.P.
-
- Posts: 11
- Joined: Tue Sep 18, 2007 7:11 pm
- Location: Portsmouth, UK
- Contact:
Re: cmake native build files creation
This works very well actually. In our team there's me working on Linux, using CMake to create the gnu make files and our other developer working with Visual Studio and uses CMake to create the VS project files whenever there's a change to the CMakeLists.txt.W.P. van Paassen wrote:Yes, this is helpful, I've tried this on win32 and it automatically creates a MSVC project when using cmake on win32. I believe cmake is even able to generate xcode projects for osx. This would mean that you only need to distribute the CMakeList.txt files and use cmake to create the build files for a specific target.
I've also written a small patch for the CMakeLists.txt file in the src directory. Firstly it installs the header files (in a similar way to that which W.P. van Paassen described). It also installs the library with the correct command, allowing everything to be installed to a custom location (by passing -DCMAKE_INSTALL_PREFIX=<path> to 'cmake'). Finally, it creates a versioned library in the way that many Unix libraries do it. It should apply just fine against svn revision 149.
p.s. Sorry that the patch is packaged in a tar.gz, but the forum wouldn't let me add an attachment with a .diff, .patch or .txt extension.
-
- Posts: 16
- Joined: Tue Aug 21, 2007 3:53 am
- Contact:
Re: cmake native build files creation
Hi milliams,
thanks for improving on the cmakelist.txt file. I was wondering though why you kept the installation of the static library out of your patch
INSTALL(TARGETS chipmunk chipmunk_static
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
Personally I don't want to dynamically link to a physics engine, because after carefully tweaking the physics (and maybe some of it quirks too) the installation of a new shared lib can ruin the game because of fixed (but anticipated for in game) bugs/quirks.
cheers,
W.P.
thanks for improving on the cmakelist.txt file. I was wondering though why you kept the installation of the static library out of your patch
INSTALL(TARGETS chipmunk chipmunk_static
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
Personally I don't want to dynamically link to a physics engine, because after carefully tweaking the physics (and maybe some of it quirks too) the installation of a new shared lib can ruin the game because of fixed (but anticipated for in game) bugs/quirks.
cheers,
W.P.
-
- Posts: 11
- Joined: Tue Sep 18, 2007 7:11 pm
- Location: Portsmouth, UK
- Contact:
Re: cmake native build files creation
I only left it out because in the version in svn, it wasn't being installed. I agree that it probably should be installed for those who wish to statically link.
I've attached an updated patch which installs the static library as libchipmunk.a.
I've attached an updated patch which installs the static library as libchipmunk.a.
-
- Posts: 206
- Joined: Tue Aug 21, 2007 3:12 pm
- Contact:
Re: cmake native build files creation
I tried to compile chipmunk on windows with cmake on the code found in svn (rev 149), but I got like a million of errors in visual studio.. (well, a couple of hundred before I ctrl-break:ed). I havent tried to fix it, just hoped it would work out of the box
I have VS2005 on WindowsXP.
The commands:

The commands:
Code: Select all
> mkdir build
> cd build
> cmake ..
* open Chipmunk.sln in VS2005 and select compile
http://www.pymunk.org - A python library built on top of Chipmunk to let you easily get cool 2d physics in your python game/app
Who is online
Users browsing this forum: No registered users and 5 guests