Sign in to follow this  
farmdve

I think I compiled chipmunk-physics engine with MinGW

Recommended Posts

I didn't like it that it used Visual Studio, so I decided to give it ago and made this makefile

CC=gcc
LIBS=
PROGNAME=chipmunk
CFLAGS= -c -std=c99 -I../include/chipmunk -I../include/chipmunk/constraints
SRCS= ../src/chipmunk.c \
../src/cpArbiter.c \
../src/cpArray.c \
../src/cpBB.c \
../src/cpBBTree.c \
../src/cpBody.c \
../src/cpCollision.c \
../src/cpHashSet.c \
../src/cpPolyShape.c \
../src/cpShape.c \
../src/cpSpace.c \
../src/cpSpaceComponent.c \
../src/cpSpaceHash.c \
../src/cpSpaceQuery.c \
../src/cpSpaceStep.c \
../src/cpSpatialIndex.c \
../src/cpSweep1D.c \
../src/cpVect.c \
../src/constraints/cpConstraint.c \
../src/constraints/cpDampedRotarySpring.c \
../src/constraints/cpDampedSpring.c \
../src/constraints/cpGearJoint.c \
../src/constraints/cpGrooveJoint.c \
../src/constraints/cpPinJoint.c \
../src/constraints/cpPivotJoint.c \
../src/constraints/cpRatchetJoint.c \
../src/constraints/cpRotaryLimitJoint.c \
../src/constraints/cpSimpleMotor.c \
../src/constraints/cpSlideJoint.c

OBJS = $(SRCS:.c=.o)

all: $(OBJS)
	$(CC) $^ $(CFLAGS) $(LIBS)
	ar cr lib$(PROGNAME).a $(OBJS)

Place this file in a newly created mingw folder in the root folder of chipmunk-physics-6.1.5(or whichever version is new). It will then create libchipmunk.a, now I am not an expert, but if it compiles I assume it works, I cannot compile the demos as they used GLUT for the Windowing system and that doesn't have a MinGW port, plus I will be using SDL. However, I did compile the demos manually(without ChimpmunkDemo.c) by using libchimpmunk.a and it compiled without warnings and only two with -Wextra and -Wall.

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this