How to use Cmake on Windows to build Chipmunk?

Official forum for the Chipmunk2D Physics Library.
Post Reply
xlrustylx
Posts: 4
Joined: Fri Oct 22, 2010 2:39 pm
Contact:

How to use Cmake on Windows to build Chipmunk?

Post by xlrustylx »

Hello,

I use Code::Blocks as my IDE and my compiler (MinGW) just won't compile Chipmunk when I load the .vcproj into Code::Blocks. Way too many errors. I prefer using the console to compile libraries but it seems that Cmake will not build the make files for Chipmunk. Does anyone have any prior experience in this? Or will I just have to buckle and install Visual C++? (Which I want to avoid because I don't like platform specific IDEs)

Thank you
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: How to use Cmake on Windows to build Chipmunk?

Post by slembcke »

What breaks about it? Somebody else contributed the CMake files to Chipmunk, so I'm not exactly an expert. :-\

Is it failing to generate the makefiles or just defaulting to making a .vcproj (on Windows)? You could try cmake -G "Unix Makefiles" if that is the case. It also has a code blocks project generator you could try. cmake -G "CodeBlocks - Unix Makefiles"

Chipmunk should be pretty easy to compile even without a makefile if you are familiar with GCC on the command line. This works for me on OS X to build a static lib:

Code: Select all

gcc -std=gnu99 -ffast-math src/*.c src/constraints/*.c -Iinclude/chipmunk -c
ar rcs chipmunk.a *.o
Add -O3 and -DNDEBUG to make a release build. Then all you need is the static lib and the folder full of headers.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
xlrustylx
Posts: 4
Joined: Fri Oct 22, 2010 2:39 pm
Contact:

Re: How to use Cmake on Windows to build Chipmunk?

Post by xlrustylx »

Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Users\AMD Test Machine>cd c:\chipmunk

c:\chipmunk>cmake -G "MinGW Makefiles"
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: C:/MinGW/bin/gcc.exe
-- Check for working C compiler: C:/MinGW/bin/gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: C:/MinGW/bin/g++.exe
-- Check for working CXX compiler: C:/MinGW/bin/g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
CMake Error: The following variables are used in this project, but they are set
to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake file
s:
GLUT_INCLUDE_DIR (ADVANCED)
used as include directory in directory C:/chipmunk/Demo

-- Configuring incomplete, errors occurred!

c:\chipmunk>



Above is the error I get when trying to compile MinGW make files. I prefer MinGW because I can compile it that way and add it to my MinGW compiler and Code::Blocks. I can remove the variable it speaks of, but mingw32-make ultimately fails when building.
xlrustylx
Posts: 4
Joined: Fri Oct 22, 2010 2:39 pm
Contact:

Re: How to use Cmake on Windows to build Chipmunk?

Post by xlrustylx »

slembcke wrote:What breaks about it? Somebody else contributed the CMake files to Chipmunk, so I'm not exactly an expert. :-\

Is it failing to generate the makefiles or just defaulting to making a .vcproj (on Windows)? You could try cmake -G "Unix Makefiles" if that is the case. It also has a code blocks project generator you could try. cmake -G "CodeBlocks - Unix Makefiles"

Chipmunk should be pretty easy to compile even without a makefile if you are familiar with GCC on the command line. This works for me on OS X to build a static lib:

Code: Select all

gcc -std=gnu99 -ffast-math src/*.c src/constraints/*.c -Iinclude/chipmunk -c
ar rcs chipmunk.a *.o
Add -O3 and -DNDEBUG to make a release build. Then all you need is the static lib and the folder full of headers.
I tried the code and it failed. Failed as hard as the documentation for this software :P
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: How to use Cmake on Windows to build Chipmunk?

Post by slembcke »

You can either install GLUT or disable compiling the demo app.

Code: Select all

cmake -D BUILD_DEMOS=OFF .
xlrustylx wrote:I tried the code and it failed. Failed as hard as the documentation for this software :P
Should I be insulted? What I said was here are some instructions for a completely different system. The point was that it gave you something to work from if you had experience working with GCC. If building software was as easy as a 2 line shell script there wouldn't be so many portable build tools in existence...
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
xlrustylx
Posts: 4
Joined: Fri Oct 22, 2010 2:39 pm
Contact:

Re: How to use Cmake on Windows to build Chipmunk?

Post by xlrustylx »

Haha, no, you shouldn't be offended. I didn't expect the code to work because it was for MacOSX. Yeah, I tried turning the demo build off and then doing it, it worked beautifully. Installed to my program files though? No problem, I put the files where they needed to be and now I can call Chipmunk functions :)

Thank you for your help.

Please don't think I'm ungrateful. I'm just giving you a hard time. I'm learning more and more C++ from actually building games using open source libraries provided by great people like you. Any problems I have are due to my own ignorance rather than the fault of code or another person.
Post Reply

Who is online

Users browsing this forum: No registered users and 29 guests