Coder Social home page Coder Social logo

slembcke / chipmunk2d Goto Github PK

View Code? Open in Web Editor NEW
2.1K 107.0 340.0 6.34 MB

A fast and lightweight 2D game physics library.

Home Page: http://chipmunk2d.net

License: MIT License

CMake 0.65% Makefile 0.58% C 65.26% Ruby 2.43% Shell 0.01% Objective-C 31.06%
c 2d 2d-physics rigid-body

chipmunk2d's Introduction

NEW IN CHIPMUNK 7

Chipmunk 7 is complete and now includes the ARM NEON optimizations, the autogeometry code, and the mulithreaded solver.

The latest programming guide is available.

ABOUT:

Chipmunk2D is a simple, lightweight, fast and portable 2D rigid body physics library written in C. It’s licensed under the unrestrictive, OSI approved MIT license. My aim is to give 2D developers access to the same quality of physics you find in newer 3D games. I hope you enjoy using Chipmunk2D!

FEATURES:

  • Designed specifically for 2D video games.
  • Circle, convex polygon, and beveled line segment collision primitives.
  • Multiple collision primitives can be attached to a single rigid body.
  • Fast broad phase collision detection by using a bounding box tree with great temporal coherence or a spatial hash.
  • Extremely fast impulse solving by utilizing Erin Catto’s contact persistence algorithm.
  • Supports sleeping objects that have come to rest to reduce the CPU load.
  • Support for collision event callbacks based on user definable object types types.
  • Flexible collision filtering system with layers, exclusion groups and callbacks.
    • Can be used to create all sorts of effects like one way platforms or buoyancy areas. (Examples included)
  • Supports nearest point, segment (raycasting), shape and bounding box queries to the collision detection system.
  • Collision impulses amounts can be retrieved for gameplay effects, sound effects, etc.
  • Large variety of joints – easily make vehicles, ragdolls, and more.
  • Joint callbacks.
    • Can be used to easily implement breakable or animated joints. (Examples included)
  • Maintains a contact graph of all colliding objects.
  • Lightweight C99 implementation with no external dependencies outside of the Std. C library.
  • Many language bindings available.
  • Simple, read the documentation and see!
  • Unrestrictive MIT license

CONTRACTING:

Howling Moon Software (my company) is available for contracting if you want to make the physics in your game really stand out. Given our unique experience with the library, we can help you use Chipmunk to its fullest potential. Feel free to contact us through our webpage: http://howlingmoonsoftware.com/

BUILDING:

Mac OS X: There is an included Xcode project file for building the static library and demo application. Alternatively you could use the CMake files or the macstatic.command script inside the xcode/ directory to build a static lib and package up the headers for you.

iPhone: A native Objective-C API is included. The Xcode project can build a static library with all the proper compiler settings. Alternatively, you can just run iphonestatic.command in the xcode/ directory. It will build you a fat library compiled as release for the device and debug for the simulator. After running it, you can simply drop the Chipmunk-iOS directory into your iPhone project!

UNIXes: A forum user was kind enough to make a set of CMake files for Chipmunk. This will require you to have CMake installed. To build run ‘cmake .’ then ‘make’. This should build a dynamic library, a static library, and the demo application. A number of people have had build errors on Ubuntu due to not having GLUT or libxmu installed.

Windows: Visual Studio projects are included in the msvc/ directory. While I try to make sure the MSVC 10 project is up to date, I don’t have MSVC 9 to keep that project updated regularly. It may not work. I’d appreciate a hand fixing it if that’s the case.

GET UP TO DATE:

If you got the source from a point release download, you might want to consider getting the latest source from GitHub. Bugs are fixed and new features are added regularly. Big changes are done in branches and tested before merging them in it’s rare for the point release downloads to be better or more bug free than the latest code.

Head on over to GitHub and experience the future TODAY! (Okay, so maybe it’s not that exciting.)

GETTING STARTED:

First of all, you can find the C API documentation in the doc/ directory.

A good starting point is to take a look at the included Demo application. The demos all just set up a Chipmunk simulation space and the demo app draws the graphics directly out of that. This makes it easy to see how the Chipmunk API works without worrying about the graphics code. You are free to use the demo drawing routines in your own projects, though it is certainly not the recommended way of drawing Chipmunk objects as it pokes around at the undocumented/private APIs of Chipmunk.

SUPPORT:

The best way to get support is to visit the Chipmunk Forums. There are plenty of people around using Chipmunk on the just about every platform I’ve ever heard of. If you are working on a commercial project and want some more direct help, Howling Moon Software is also available for contracting.

chipmunk2d's People

Contributors

adler3d avatar aganm avatar aismann avatar andrewrk avatar andykorth avatar blazewicz avatar crunkle avatar dagagren avatar darkuranium avatar fouronnes avatar hackeranonymousdeepweb avatar jhasse avatar kionx avatar larpon avatar leonid-s-usov avatar mcneja avatar msmshazan avatar niksaak avatar notlion avatar parrieta avatar readmecritic avatar ricardoquesada avatar richyhbm avatar sirlynix avatar slembcke avatar stolk avatar timgates42 avatar timothygu avatar vinay avatar xavierjurado avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chipmunk2d's Issues

Build fail on OSX 10.6.8

Same error using Xcode project or macstatic.command, of course:

xcodebuild -project Chipmunk6.xcodeproj -configuration Release -target ChipmunkStatic
2013-04-11 13:39:40.689 xcodebuild[8340:80b] Unable to load platform at path /Developer/Platforms/iPhoneOS.platform

=== BUILD NATIVE TARGET ChipmunkStatic OF PROJECT Chipmunk6 WITH CONFIGURATION Release ===
Check dependencies
CompileC build/Chipmunk6.build/Release/ChipmunkStatic.build/Objects-normal/x86_64/cpSpaceQuery.o ../src/cpSpaceQuery.c normal x86_64 c com.apple.compilers.llvm.clang.1_0.compiler
cd /Users/grahamwakefield/code/Chipmunk-Physics/xcode
setenv LANG en_US.US-ASCII
/Developer/usr/bin/clang -x c -arch x86_64 -fmessage-length=0 -pipe -fdiagnostics-print-source-range-info -std=c99 -Wno-trigraphs -fpascal-strings -O3 -fasm-blocks -mmacosx-version-min=10.5 -gdwarf-2 -I/Users/grahamwakefield/code/Chipmunk-Physics/xcode/build/Chipmunk6.build/Release/ChipmunkStatic.build/Chipmunk.hmap -Wall -W -Wno-unused-parameter -Werror -Wnewline-eof -pedantic -F/Users/grahamwakefield/code/Chipmunk-Physics/xcode/build/Release -I/Users/grahamwakefield/code/Chipmunk-Physics/xcode/build/Release/include -I../include/chipmunk -I/Users/grahamwakefield/code/Chipmunk-Physics/xcode/build/Chipmunk6.build/Release/ChipmunkStatic.build/DerivedSources/x86_64 -I/Users/grahamwakefield/code/Chipmunk-Physics/xcode/build/Chipmunk6.build/Release/ChipmunkStatic.build/DerivedSources -DCHIPMUNK_FFI -DNDEBUG -ffast-math -c /Users/grahamwakefield/code/Chipmunk-Physics/xcode/../src/cpSpaceQuery.c -o /Users/grahamwakefield/code/Chipmunk-Physics/xcode/build/Chipmunk6.build/Release/ChipmunkStatic.build/Objects-normal/x86_64/cpSpaceQuery.o

In file included from /Users/grahamwakefield/code/Chipmunk-Physics/xcode/../src/cpSpaceQuery.c:22:
In file included from /Users/grahamwakefield/code/Chipmunk-Physics/xcode/../include/chipmunk/chipmunk_private.h:23:
../include/chipmunk/chipmunk.h:180:48:{180:33-180:48}: error: token is not a valid binary operator in a preprocessor subexpression
#if defined(__has_extension) && __has_extension(blocks)
~~~~~~~~~~~~~~~^
1 error generated.
... etc.

Cmake fails differently:

cd build
cmake ..
-- The C compiler identification is GNU 4.2.1
-- The CXX compiler identification is GNU 4.2.1
-- Checking whether C compiler has -isysroot
-- Checking whether C compiler has -isysroot - yes
-- Checking whether C compiler supports OSX deployment target flag
-- Checking whether C compiler supports OSX deployment target flag - yes
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Checking whether CXX compiler has -isysroot
-- Checking whether CXX compiler has -isysroot - yes
-- Checking whether CXX compiler supports OSX deployment target flag
-- Checking whether CXX compiler supports OSX deployment target flag - yes
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found OpenGL: /System/Library/Frameworks/OpenGL.framework
-- Found GLUT: -framework GLUT
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/grahamwakefield/code/Chipmunk-Physics/build
grrrwaaa:build grahamwakefield$ ls
CMakeCache.txt Demo cmake_install.cmake
CMakeFiles Makefile src
make
Scanning dependencies of target chipmunk
[ 1%] Building C object src/CMakeFiles/chipmunk.dir/chipmunk.c.o
In file included from /Users/grahamwakefield/code/Chipmunk-Physics/include/chipmunk/chipmunk_private.h:23,
from /Users/grahamwakefield/code/Chipmunk-Physics/src/chipmunk.c:26:
/Users/grahamwakefield/code/Chipmunk-Physics/include/chipmunk/chipmunk.h:180:48: error: missing binary operator before token "("
make[2]: *** [src/CMakeFiles/chipmunk.dir/chipmunk.c.o] Error 1
make[1]: *** [src/CMakeFiles/chipmunk.dir/all] Error 2
make: *** [all] Error 2

Incomplete type error when including chipmunk.h in C++

I'm not sure where to ask this, so apologies if this is not the right place.

Including chipmunk.h in a C or Obj-C file works, but when it is included in a C++ file I get this compiler error:

.../Chipmunk2D/include/chipmunk/cpShape.h:85:19: 'cpShapesCollide' has C-linkage specified, but returns incomplete type 'cpContactPointSet' which could be incompatible with C

This is on the current master (5eb7999). Any idea what might be happening?

Warning in CMake Configure step

Configuring Chipmunk Library...
-- The C compiler identification is AppleClang 6.0.0.6000056
-- The CXX compiler identification is AppleClang 6.0.0.6000056
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
Configuring Chipmunk2D version 7.0.0
-- Configuring done
CMake Warning (dev):
Policy CMP0042 is not set: MACOSX_RPATH is enabled by default. Run "cmake
--help-policy CMP0042" for policy details. Use the cmake_policy command to
set the policy and suppress this warning.

MACOSX_RPATH is not specified for the following targets:

chipmunk

This warning is for project developers. Use -Wno-dev to suppress it.

-- Generating done
-- Build files have been written to: /Users/ezavada/work/pdg/build/darwin/chipmunk

The issue is addressed by adding the following line near the top of CMakeLists.txt:

cmake_policy(SET CMP0042 NEW) # use MACOSX_RPATH

CMake min version required (warning)

a command like:

cmake_minimum_required(VERSION 2.6)

should suffice, at the top of src/CMakeLists.txt to silence cmake's warning.

not sure which version of CMake you use and the features therein, but 2.6 is a good bet as I think most everyone has it.

Build warnings on Ubuntu

When building on Ubuntu, I get many warnings like:

/home/singpolyma/src/Chipmunk-Physics/include/chipmunk/cpSpace.h:137:86: warning: ISO C does not allow extra ‘;’ outside of a function [-pedantic]

Ideally, either the code should not generate these warnings (preferred) or the build system should not ask the compiler to generate these warnings.

CMAKE build fails on Ubuntu 14.04


stephen@stephen-Inspiron-N5110:~/Desktop/Chipmunk2D$ make
[  1%] Building C object src/CMakeFiles/chipmunk.dir/cpSpaceDebug.c.o
/home/stephen/Desktop/Chipmunk2D/src/cpSpaceDebug.c:22:39: fatal error: chipmunk/chipmunk_private.h: No such file or directory
 #include "chipmunk/chipmunk_private.h"
                                       ^
compilation terminated.
make[2]: *** [src/CMakeFiles/chipmunk.dir/cpSpaceDebug.c.o] Error 1
make[1]: *** [src/CMakeFiles/chipmunk.dir/all] Error 2
make: *** [all] Error 2

Chipmunk 6.0.3 incompatible with SpaceManager under Mac (CP_USE_CGPOINTS not defined)

In 6.0.2 in chipmunk_types.h the CP_USE_POINTS macro was based on these conditionals:

if (defined TARGET_OS_IPHONE) && (!defined CP_USE_CGPOINTS)

#define CP_USE_CGPOINTS

endif

With 6.0.3 this has changed to this:

if (TARGET_OS_IPHONE == 1) && (!defined CP_USE_CGPOINTS)

#define CP_USE_CGPOINTS 1

endif

For some reason this causes CP_USE_CGPOINTS not to be defined when you're building for the Mac, and that in turn causes incompatibilities with Chipmunk Spacemanager and possibly other code as well, with error messages like these:
error: sending 'cpVect' (aka 'struct cpVect') to parameter of incompatible type 'CGPoint' (aka 'struct CGPoint')
Conflicting parameter types in implementation of 'setPosition:': 'CGPoint' (aka 'struct CGPoint') vs 'cpVect' (aka 'struct cpVect')

My proposed fix is to simply include TARGET_OS_MAC as well, since Mac OS also defines CGPoint:

if (TARGET_OS_IPHONE == 1) || (TARGET_OS_MAC == 1) && (!defined CP_USE_CGPOINTS)

#define CP_USE_CGPOINTS 1

endif

This fix builds successfully for Mac, iOS Device and Simulator and is compatible with SpaceManager in all cases. Tested with Kobold2D (v1.0.2).

Compilation error on Linux if demos are disabled

Cloned from master, ran CMake

cmake . -DBUILD_DEMOS=OFF && make
[  3%] Building C object src/CMakeFiles/chipmunk_static.dir/cpSpaceDebug.c.o
/home/b/Projects/luasdl/lib/Chipmunk2D/src/cpSpaceDebug.c:27:39: error: unknown type name ‘cpSpaceDebugDrawOptions’
 cpSpaceDebugDrawShape(cpShape *shape, cpSpaceDebugDrawOptions *options)
                                       ^
/home/b/Projects/luasdl/lib/Chipmunk2D/src/cpSpaceDebug.c:81:54: error: unknown type name ‘cpSpaceDebugDrawOptions’
 cpSpaceDebugDrawConstraint(cpConstraint *constraint, cpSpaceDebugDrawOptions *options)
                                                      ^
/home/b/Projects/luasdl/lib/Chipmunk2D/src/cpSpaceDebug.c:156:34: error: unknown type name ‘cpSpaceDebugDrawOptions’
 cpSpaceDebugDraw(cpSpace *space, cpSpaceDebugDrawOptions *options)
                                  ^
make[2]: *** [src/CMakeFiles/chipmunk_static.dir/cpSpaceDebug.c.o] Error 1
make[1]: *** [src/CMakeFiles/chipmunk_static.dir/all] Error 2
make: *** [all] Error 2

Now i tried

cmake . -DBUILD_DEMOS=OFF -DCMAKE_C_FLAGS="-DCP_SPACE_DISABLE_DEBUG_API" && make

Result was a slightly longer error message, see here https://gist.github.com/Syrws/a700269e4a82f6b50ddd
I'm using gcc (Ubuntu/Linaro 4.8.2-14ubuntu2) 4.8.2, but clang fails in a very similar manner.

Bring back cpRemoveCollisionHandler

It looks like cpRemoveCollisionHandler was removed in Chipmunk 7.
I request you bring it back.

As far as I can tell, you can't use NULL to unset a function. Doing so will cause a crash within the engine. The only way to reset it is to have the original default function pointer addresses which are private internals of the engine and not accessible publicly. Also, it looks like recalling cpAddCollisionHandler doesn't reset previous set callbacks.

I use Chipmunk with language bindings so there is a potential issue that the callback functions can go away during runtime. Being able to reset the default functions is useful to prevent it from calling dead functions.

Incidentally, I also miss having a function to set the functions as in Chipmunk 6. The new struct technique is harder for language bindings and the persistence of setting things in a returned struct is not obvious, nor memory management/life-cycle issues that come with it.

Visual Studio Error: _USE_MATH_DEFINES redefinition

Currently some build configurations in Visual Studio 2012 and 2013 are failing to compile due to _USE_MATH_DEFINES being redefined. The cause of this is due to chipmunk.h defining it for Visual Studio compilers on line 26 and certain configurations having it also set in the Project Setting's: Property > C/C++ > Preprocessor > Preprocessor Definitions

Right now I'm going through fixing the redefinition error, but I'd like some feedback on how you prefer this fix to be made. Would you prefer the code to handle defining _USE_MATH_DEFINES or would you prefer Visual Studio's project settings to do so?

Somewhat worrying casting of function pointers

Hi,

While porting the latest version of Chipmunk to D, I've been hitting segfaults. The bottom-line issue was that a function taking one parameter was being casted to one taking two parameters:

cpBodyActivate(cpBody *body);
cpSpaceEachBody(space, (cpSpaceBodyIteratorFunc)cpBodyActivate, NULL);

cpSpaceEachBody ends up calling cpBodyActivate with:

cpBodyActivate(body, NULL);

Because of the C calling convention body ends up being pushed on the stack last (after NULL), and hence cpBodyActivate has no problem working with this. Also, the caller (not the callee) cleans up the stack, so there's no stack corruption.

But when I've ported this code over to D, which uses its own calling convention, cpBodyActivate would receive NULL rather than the value of body. This would then lead to a crash when body was accessed.

Anyway, I'm just wondering whether this is something you're aware of and are just taking advantage of the way the C calling convention works, or if it's an oversight and would maybe prefer to use safer code as a workaround?

Cheers.

alloca.h: No such file or directory

Compiling with MinGW produces the error:

alloca.h: No such file or directory

chipmunk.h:32 reads:

#ifdef _WIN32
    // For alloca().
    #include <malloc.h>
#else
    #include <alloca.h>
#endif

But it should read:

#if defined(WIN32) || defined(__WIN32) || defined(__WIN32__)
    // For alloca().
    #include <malloc.h>
#else
    #include <alloca.h>
#endif

I didn't submit a pull request since the change is small.

Build failure on VS due to missing files (Master branch)

file: 'C:\Libraries\Chipmunk2D-master\src\cpVect.c': No such file or directory
1> cpShape.c
1>c:\libraries\chipmunk2d-master\src\cpshape.c(23): fatal error C1083: Cannot open include file: 'chipmunk_unsafe.h': No such file or directory
1> cpPolyShape.c
1>c:\libraries\chipmunk2d-master\src\cppolyshape.c(23): fatal error C1083: Cannot open include file: 'chipmunk_unsafe.h': No such file or directory
1> cpBB.c
1>c1xx : fatal error C1083: Cannot open source file: 'C:\Libraries\Chipmunk2D-master\src\cpBB.c': No such file or directory
1> cpSlideJoint.c
1>c1xx : fatal error C1083: Cannot open source file: 'C:\Libraries\Chipmunk2D-master\src\constraints\cpSlideJoint.c': No such file or directory
1> cpSimpleMotor.c
1>c1xx : fatal error C1083: Cannot open source file: 'C:\Libraries\Chipmunk2D-master\src\constraints\cpSimpleMotor.c': No such file or directory
1> cpRotaryLimitJoint.c
1>c1xx : fatal error C1083: Cannot open source file: 'C:\Libraries\Chipmunk2D-master\src\constraints\cpRotaryLimitJoint.c': No such file or directory
1> cpRatchetJoint.c
1>c1xx : fatal error C1083: Cannot open source file: 'C:\Libraries\Chipmunk2D-master\src\constraints\cpRatchetJoint.c': No such file or directory
1> cpPivotJoint.c
1>c1xx : fatal error C1083: Cannot open source file: 'C:\Libraries\Chipmunk2D-master\src\constraints\cpPivotJoint.c': No such file or directory
1> cpPinJoint.c
1>c1xx : fatal error C1083: Cannot open source file: 'C:\Libraries\Chipmunk2D-master\src\constraints\cpPinJoint.c': No such file or directory
1> cpGrooveJoint.c
1>c1xx : fatal error C1083: Cannot open source file: 'C:\Libraries\Chipmunk2D-master\src\constraints\cpGrooveJoint.c': No such file or directory
1> cpGearJoint.c
1>c1xx : fatal error C1083: Cannot open source file: 'C:\Libraries\Chipmunk2D-master\src\constraints\cpGearJoint.c': No such file or directory
1> cpDampedSpring.c
1>c1xx : fatal error C1083: Cannot open source file: 'C:\Libraries\Chipmunk2D-master\src\constraints\cpDampedSpring.c': No such file or directory
1> cpDampedRotarySpring.c
1>c1xx : fatal error C1083: Cannot open source file: 'C:\Libraries\Chipmunk2D-master\src\constraints\cpDampedRotarySpring.c': No such file or directory
1> cpConstraint.c
1>c1xx : fatal error C1083: Cannot open source file: 'C:\Libraries\Chipmunk2D-master\src\constraints\cpConstraint.c': No such file or directory
1> chipmunk.c
1>c:\libraries\chipmunk2d-master\src\chipmunk.c(318): fatal error C1083: Cannot open include file: 'chipmunk_ffi.h': No such file or directory
1> Generating Code...
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.55
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I noticed that \src\cpVect.c is no longer in the master branch directories

Version tagging

Since there's no changelog file, It'd be useful to have the versions tagged in the Git repo so people can more easily see the changes between versions.

For example, from 6.0.0->6.0.1 I can only imagine that it's a bugfix release, but what bugs? How critical is it for me to update (where there only fixes to the documentation or to some code path that I'm not even using)? Etc. I'd recommend at least tagging the last few versions (6.0.0 on), but at the very least versions should be tagged from here-on-out. (<-Not really relevant.) With tags, it'd be much easier to see exactly what's changed between versions and not just the short description in VERSION.txt

Why is there no cpBodyApplyImpulse, cpBodyApplyForce in msvc build?

I was building a project that uses chipmunk, cpBodyApplyImpulse and cpBodyApplyForce both give undefined reference, while other cpBody functions work normally. Then I checked in chipmunk's msvc build, in chipmunk.def most of the functions are available except for those 2 (there may be some others that I don't know).
What is wrong? Why don't you include those functions in the export? Or what do I do wrong?

NEON vector optimization does not improve the performance...

The NEON vector optimization do improve the performance if I compile the code without compiler optimization. But if I compile the code with compiler optimization, the performance is just equal to the original code.

In this blog http://howlingmoonsoftware.com/wordpress/chipmunk-pro-goes-neon-19-40-faster/, slembcke said he got a 40% speedup using the NEON vector optimization. This result is similar to the result that I compile code without compiler optimization.

So, I want to know whether slembcke compiled the code using compiler optimization and how he tested the demo.

Demo can not build in HEAD?

I have got this result (after modified some changed interface, but I really don't know how to solve the cpShape->group, it was gone and I found a cpShapeFilter which has group):

D:\Work\Sources\Chipmunk2D\build>ninja
[4/5] Building C object Demo/CMakeFile...chipmunk_demos.dir/ContactPoints.c.obj
FAILED: D:\MinGW\bin\gcc.exe   -std=gnu99 -O3 -DNDEBUG -ffast-math -I../include
-I../include/chipmunk -ID:/MinGW/include -MMD -MT Demo/CMakeFiles/chipmunk_demos
.dir/ContactPoints.c.obj -MF "Demo/CMakeFiles/chipmunk_demos.dir/ContactPoints.c
.obj.d" -o Demo/CMakeFiles/chipmunk_demos.dir/ContactPoints.c.obj   -c ../Demo/C
ontactPoints.c
../Demo/ContactPoints.c: In function 'init':
../Demo/ContactPoints.c:50:2: warning: implicit declaration of function 'cpSpace
SetDefaultCollisionHandler' [-Wimplicit-function-declaration]
  cpSpaceSetDefaultCollisionHandler(space, NeverCollide, NULL, NULL, NULL, NULL)
;
  ^
../Demo/ContactPoints.c:57:3: error: too few arguments to function 'cpMomentForS
egment'
   cpBody *body = cpSpaceAddBody(space, cpBodyNew(mass, cpMomentForSegment(mass,
 a, b)));
   ^
In file included from ../include/chipmunk/chipmunk_private.h:28:0,
                 from ../Demo/ContactPoints.c:27:
../include/chipmunk/chipmunk.h:156:9: note: declared here
 cpFloat cpMomentForSegment(cpFloat m, cpVect a, cpVect b, cpFloat radius);
         ^
../Demo/ContactPoints.c:58:3: warning: implicit declaration of function 'cpBodyS
etPos' [-Wimplicit-function-declaration]
   cpBodySetPos(body, cpv(-160.0f, -80.0f));
   ^
../Demo/ContactPoints.c:68:3: error: too few arguments to function 'cpMomentForS
egment'
   cpBody *body = cpSpaceAddBody(space, cpBodyNew(mass, cpMomentForSegment(mass,
 a, b)));
   ^
In file included from ../include/chipmunk/chipmunk_private.h:28:0,
                 from ../Demo/ContactPoints.c:27:
../include/chipmunk/chipmunk.h:156:9: note: declared here
 cpFloat cpMomentForSegment(cpFloat m, cpVect a, cpVect b, cpFloat radius);
         ^
../Demo/ContactPoints.c:84:3: error: too few arguments to function 'cpMomentForP
oly'
   cpBody *body = cpSpaceAddBody(space, cpBodyNew(mass, cpMomentForPoly(mass, NU
M_VERTS, verts, cpvzero)));
   ^
In file included from ../include/chipmunk/chipmunk_private.h:28:0,
                 from ../Demo/ContactPoints.c:27:
../include/chipmunk/chipmunk.h:162:9: note: declared here
 cpFloat cpMomentForPoly(cpFloat m, int count, const cpVect *verts, cpVect offse
t, cpFloat radius);
         ^
../Demo/ContactPoints.c:87:3: error: incompatible type for argument 4 of 'cpPoly
ShapeNew'
   cpSpaceAddShape(space, cpPolyShapeNew(body, NUM_VERTS, verts, cpvzero));
   ^
In file included from ../include/chipmunk/chipmunk.h:132:0,
                 from ../include/chipmunk/chipmunk_private.h:28,
                 from ../Demo/ContactPoints.c:27:
../include/chipmunk/cpPolyShape.h:33:10: note: expected 'cpTransform' but argume
nt is of type 'cpVect'
 cpShape* cpPolyShapeNew(cpBody *body, int count, const cpVect *verts, cpTransfo
rm transform, cpFloat radius);
          ^
../Demo/ContactPoints.c:87:3: error: too few arguments to function 'cpPolyShapeN
ew'
   cpSpaceAddShape(space, cpPolyShapeNew(body, NUM_VERTS, verts, cpvzero));
   ^
In file included from ../include/chipmunk/chipmunk.h:132:0,
                 from ../include/chipmunk/chipmunk_private.h:28,
                 from ../Demo/ContactPoints.c:27:
../include/chipmunk/cpPolyShape.h:33:10: note: declared here
 cpShape* cpPolyShapeNew(cpBody *body, int count, const cpVect *verts, cpTransfo
rm transform, cpFloat radius);
          ^
../Demo/ContactPoints.c:100:3: error: too few arguments to function 'cpMomentFor
Poly'
   cpBody *body = cpSpaceAddBody(space, cpBodyNew(mass, cpMomentForPoly(mass, NU
M_VERTS, verts, cpvzero)));
   ^
In file included from ../include/chipmunk/chipmunk_private.h:28:0,
                 from ../Demo/ContactPoints.c:27:
../include/chipmunk/chipmunk.h:162:9: note: declared here
 cpFloat cpMomentForPoly(cpFloat m, int count, const cpVect *verts, cpVect offse
t, cpFloat radius);
         ^
../Demo/ContactPoints.c:103:3: error: incompatible type for argument 4 of 'cpPol
yShapeNew'
   cpSpaceAddShape(space, cpPolyShapeNew(body, NUM_VERTS, verts, cpvzero));
   ^
In file included from ../include/chipmunk/chipmunk.h:132:0,
                 from ../include/chipmunk/chipmunk_private.h:28,
                 from ../Demo/ContactPoints.c:27:
../include/chipmunk/cpPolyShape.h:33:10: note: expected 'cpTransform' but argume
nt is of type 'cpVect'
 cpShape* cpPolyShapeNew(cpBody *body, int count, const cpVect *verts, cpTransfo
rm transform, cpFloat radius);
          ^
../Demo/ContactPoints.c:103:3: error: too few arguments to function 'cpPolyShape
New'
   cpSpaceAddShape(space, cpPolyShapeNew(body, NUM_VERTS, verts, cpvzero));
   ^
In file included from ../include/chipmunk/chipmunk.h:132:0,
                 from ../include/chipmunk/chipmunk_private.h:28,
                 from ../Demo/ContactPoints.c:27:
../include/chipmunk/cpPolyShape.h:33:10: note: declared here
 cpShape* cpPolyShapeNew(cpBody *body, int count, const cpVect *verts, cpTransfo
rm transform, cpFloat radius);
          ^
../Demo/ContactPoints.c: At top level:
../Demo/ContactPoints.c:140:2: warning: initialization from incompatible pointer
 type [enabled by default]
  update,
  ^
../Demo/ContactPoints.c:140:2: warning: (near initialization for 'ContactPoints.
updateFunc') [enabled by default]
[4/5] Building C object Demo/CMakeFiles/chipmunk_demos.dir/GJK.c.obj
FAILED: D:\MinGW\bin\gcc.exe   -std=gnu99 -O3 -DNDEBUG -ffast-math -I../include
-I../include/chipmunk -ID:/MinGW/include -MMD -MT Demo/CMakeFiles/chipmunk_demos
.dir/GJK.c.obj -MF "Demo/CMakeFiles/chipmunk_demos.dir/GJK.c.obj.d" -o Demo/CMak
eFiles/chipmunk_demos.dir/GJK.c.obj   -c ../Demo/GJK.c
../Demo/GJK.c: In function 'init':
../Demo/GJK.c:64:9: error: 'cpShape' has no member named 'group'
   shape1->group = 1;
         ^
../Demo/GJK.c:73:9: error: 'cpShape' has no member named 'group'
   shape2->group = 1;
         ^
[4/5] Building C object Demo/CMakeFile.../chipmunk_demos.dir/ChipmunkDemo.c.obj
FAILED: D:\MinGW\bin\gcc.exe   -std=gnu99 -O3 -DNDEBUG -ffast-math -I../include
-I../include/chipmunk -ID:/MinGW/include -MMD -MT Demo/CMakeFiles/chipmunk_demos
.dir/ChipmunkDemo.c.obj -MF "Demo/CMakeFiles/chipmunk_demos.dir/ChipmunkDemo.c.o
bj.d" -o Demo/CMakeFiles/chipmunk_demos.dir/ChipmunkDemo.c.obj   -c ../Demo/Chip
munkDemo.c
../Demo/ChipmunkDemo.c: In function 'Display':
../Demo/ChipmunkDemo.c:357:2: error: too few arguments to function 'glfwSwapBuff
ers'
  glfwSwapBuffers();
  ^
In file included from ../Demo/GL/glfw.h:1:0,
                 from ../Demo/ChipmunkDemo.c:40:
d:\mingw\include\glfw\glfw3.h:2445:14: note: declared here
 GLFWAPI void glfwSwapBuffers(GLFWwindow* window);
              ^
../Demo/ChipmunkDemo.c: In function 'RunDemo':
../Demo/ChipmunkDemo.c:406:2: warning: passing argument 1 of 'glfwSetWindowTitle
' from incompatible pointer type [enabled by default]
  glfwSetWindowTitle(DemoTitle(index));
  ^
In file included from ../Demo/GL/glfw.h:1:0,
                 from ../Demo/ChipmunkDemo.c:40:
d:\mingw\include\glfw\glfw3.h:1388:14: note: expected 'struct GLFWwindow *' but
argument is of type 'char *'
 GLFWAPI void glfwSetWindowTitle(GLFWwindow* window, const char* title);
              ^
../Demo/ChipmunkDemo.c:406:2: error: too few arguments to function 'glfwSetWindo
wTitle'
  glfwSetWindowTitle(DemoTitle(index));
  ^
In file included from ../Demo/GL/glfw.h:1:0,
                 from ../Demo/ChipmunkDemo.c:40:
d:\mingw\include\glfw\glfw3.h:1388:14: note: declared here
 GLFWAPI void glfwSetWindowTitle(GLFWwindow* window, const char* title);
              ^
../Demo/ChipmunkDemo.c: In function 'MouseToSpace':
../Demo/ChipmunkDemo.c:465:2: warning: passing argument 1 of 'glfwGetWindowSize'
 from incompatible pointer type [enabled by default]
  glfwGetWindowSize(&ww, &wh);
  ^
In file included from ../Demo/GL/glfw.h:1:0,
                 from ../Demo/ChipmunkDemo.c:40:
d:\mingw\include\glfw\glfw3.h:1455:14: note: expected 'struct GLFWwindow *' but
argument is of type 'int *'
 GLFWAPI void glfwGetWindowSize(GLFWwindow* window, int* width, int* height);
              ^
../Demo/ChipmunkDemo.c:465:2: error: too few arguments to function 'glfwGetWindo
wSize'
  glfwGetWindowSize(&ww, &wh);
  ^
In file included from ../Demo/GL/glfw.h:1:0,
                 from ../Demo/ChipmunkDemo.c:40:
d:\mingw\include\glfw\glfw3.h:1455:14: note: declared here
 GLFWAPI void glfwGetWindowSize(GLFWwindow* window, int* width, int* height);
              ^
../Demo/ChipmunkDemo.c: In function 'SetupGLFW':
../Demo/ChipmunkDemo.c:559:2: warning: implicit declaration of function 'glfwOpe
nWindow' [-Wimplicit-function-declaration]
  cpAssertHard(glfwOpenWindow(640, 480, 8, 8, 8, 8, 0, 0, GLFW_WINDOW), "Error o
pening GLFW window.");
  ^
In file included from ../include/chipmunk/chipmunk_private.h:28:0,
                 from ../Demo/ChipmunkDemo.c:42:
../Demo/ChipmunkDemo.c:559:58: error: 'GLFW_WINDOW' undeclared (first use in thi
s function)
  cpAssertHard(glfwOpenWindow(640, 480, 8, 8, 8, 8, 0, 0, GLFW_WINDOW), "Error o
pening GLFW window.");
                                                          ^
../include/chipmunk/chipmunk.h:68:47: note: in definition of macro 'cpAssertHard
'
 #define cpAssertHard(__condition__, ...) if(!(__condition__)){cpMessage(#__cond
ition__, __FILE__, __LINE__, 1, 1, __VA_ARGS__); abort();}
                                               ^
../Demo/ChipmunkDemo.c:559:58: note: each undeclared identifier is reported only
 once for each function it appears in
  cpAssertHard(glfwOpenWindow(640, 480, 8, 8, 8, 8, 0, 0, GLFW_WINDOW), "Error o
pening GLFW window.");
                                                          ^
../include/chipmunk/chipmunk.h:68:47: note: in definition of macro 'cpAssertHard
'
 #define cpAssertHard(__condition__, ...) if(!(__condition__)){cpMessage(#__cond
ition__, __FILE__, __LINE__, 1, 1, __VA_ARGS__); abort();}
                                               ^
../Demo/ChipmunkDemo.c:560:2: warning: passing argument 1 of 'glfwSetWindowTitle
' from incompatible pointer type [enabled by default]
  glfwSetWindowTitle(DemoTitle(demo_index));
  ^
In file included from ../Demo/GL/glfw.h:1:0,
                 from ../Demo/ChipmunkDemo.c:40:
d:\mingw\include\glfw\glfw3.h:1388:14: note: expected 'struct GLFWwindow *' but
argument is of type 'char *'
 GLFWAPI void glfwSetWindowTitle(GLFWwindow* window, const char* title);
              ^
../Demo/ChipmunkDemo.c:560:2: error: too few arguments to function 'glfwSetWindo
wTitle'
  glfwSetWindowTitle(DemoTitle(demo_index));
  ^
In file included from ../Demo/GL/glfw.h:1:0,
                 from ../Demo/ChipmunkDemo.c:40:
d:\mingw\include\glfw\glfw3.h:1388:14: note: declared here
 GLFWAPI void glfwSetWindowTitle(GLFWwindow* window, const char* title);
              ^
../Demo/ChipmunkDemo.c:565:2: warning: passing argument 1 of 'glfwSetWindowSizeC
allback' from incompatible pointer type [enabled by default]
  glfwSetWindowSizeCallback(Reshape);
  ^
In file included from ../Demo/GL/glfw.h:1:0,
                 from ../Demo/ChipmunkDemo.c:40:
d:\mingw\include\glfw\glfw3.h:1690:27: note: expected 'struct GLFWwindow *' but
argument is of type 'void (*)(int,  int)'
 GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwin
dowsizefun cbfun);
                           ^
../Demo/ChipmunkDemo.c:565:2: error: too few arguments to function 'glfwSetWindo
wSizeCallback'
  glfwSetWindowSizeCallback(Reshape);
  ^
In file included from ../Demo/GL/glfw.h:1:0,
                 from ../Demo/ChipmunkDemo.c:40:
d:\mingw\include\glfw\glfw3.h:1690:27: note: declared here
 GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwin
dowsizefun cbfun);
                           ^
../Demo/ChipmunkDemo.c:566:2: warning: passing argument 1 of 'glfwSetWindowClose
Callback' from incompatible pointer type [enabled by default]
  glfwSetWindowCloseCallback(WindowClose);
  ^
In file included from ../Demo/GL/glfw.h:1:0,
                 from ../Demo/ChipmunkDemo.c:40:
d:\mingw\include\glfw\glfw3.h:1719:28: note: expected 'struct GLFWwindow *' but
argument is of type 'int (*)()'
 GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* window, GLFWw
indowclosefun cbfun);
                            ^
../Demo/ChipmunkDemo.c:566:2: error: too few arguments to function 'glfwSetWindo
wCloseCallback'
  glfwSetWindowCloseCallback(WindowClose);
  ^
In file included from ../Demo/GL/glfw.h:1:0,
                 from ../Demo/ChipmunkDemo.c:40:
d:\mingw\include\glfw\glfw3.h:1719:28: note: declared here
 GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* window, GLFWw
indowclosefun cbfun);
                            ^
../Demo/ChipmunkDemo.c:568:2: warning: passing argument 1 of 'glfwSetCharCallbac
k' from incompatible pointer type [enabled by default]
  glfwSetCharCallback(Keyboard);
  ^
In file included from ../Demo/GL/glfw.h:1:0,
                 from ../Demo/ChipmunkDemo.c:40:
d:\mingw\include\glfw\glfw3.h:2142:21: note: expected 'struct GLFWwindow *' but
argument is of type 'void (*)(int,  int)'
 GLFWAPI GLFWcharfun glfwSetCharCallback(GLFWwindow* window, GLFWcharfun cbfun);

                     ^
../Demo/ChipmunkDemo.c:568:2: error: too few arguments to function 'glfwSetCharC
allback'
  glfwSetCharCallback(Keyboard);
  ^
In file included from ../Demo/GL/glfw.h:1:0,
                 from ../Demo/ChipmunkDemo.c:40:
d:\mingw\include\glfw\glfw3.h:2142:21: note: declared here
 GLFWAPI GLFWcharfun glfwSetCharCallback(GLFWwindow* window, GLFWcharfun cbfun);

                     ^
../Demo/ChipmunkDemo.c:569:2: warning: passing argument 1 of 'glfwSetKeyCallback
' from incompatible pointer type [enabled by default]
  glfwSetKeyCallback(SpecialKeyboard);
  ^
In file included from ../Demo/GL/glfw.h:1:0,
                 from ../Demo/ChipmunkDemo.c:40:
d:\mingw\include\glfw\glfw3.h:2121:20: note: expected 'struct GLFWwindow *' but
argument is of type 'void (*)(int,  int)'
 GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun cbfun);
                    ^
../Demo/ChipmunkDemo.c:569:2: error: too few arguments to function 'glfwSetKeyCa
llback'
  glfwSetKeyCallback(SpecialKeyboard);
  ^
In file included from ../Demo/GL/glfw.h:1:0,
                 from ../Demo/ChipmunkDemo.c:40:
d:\mingw\include\glfw\glfw3.h:2121:20: note: declared here
 GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun cbfun);
                    ^
../Demo/ChipmunkDemo.c:571:2: warning: implicit declaration of function 'glfwSet
MousePosCallback' [-Wimplicit-function-declaration]
  glfwSetMousePosCallback(Mouse);
  ^
../Demo/ChipmunkDemo.c:572:2: warning: passing argument 1 of 'glfwSetMouseButton
Callback' from incompatible pointer type [enabled by default]
  glfwSetMouseButtonCallback(Click);
  ^
In file included from ../Demo/GL/glfw.h:1:0,
                 from ../Demo/ChipmunkDemo.c:40:
d:\mingw\include\glfw\glfw3.h:2165:28: note: expected 'struct GLFWwindow *' but
argument is of type 'void (*)(int,  int)'
 GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* window, GLFWm
ousebuttonfun cbfun);
                            ^
../Demo/ChipmunkDemo.c:572:2: error: too few arguments to function 'glfwSetMouse
ButtonCallback'
  glfwSetMouseButtonCallback(Click);
  ^
In file included from ../Demo/GL/glfw.h:1:0,
                 from ../Demo/ChipmunkDemo.c:40:
d:\mingw\include\glfw\glfw3.h:2165:28: note: declared here
 GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* window, GLFWm
ousebuttonfun cbfun);
                            ^
[4/5] Building C object Demo/CMakeFiles/chipmunk_demos.dir/Smooth.c.obj
FAILED: D:\MinGW\bin\gcc.exe   -std=gnu99 -O3 -DNDEBUG -ffast-math -I../include
-I../include/chipmunk -ID:/MinGW/include -MMD -MT Demo/CMakeFiles/chipmunk_demos
.dir/Smooth.c.obj -MF "Demo/CMakeFiles/chipmunk_demos.dir/Smooth.c.obj.d" -o Dem
o/CMakeFiles/chipmunk_demos.dir/Smooth.c.obj   -c ../Demo/Smooth.c
../Demo/Smooth.c: In function 'DrawContacts':
../Demo/Smooth.c:34:27: error: 'struct <anonymous>' has no member named 'point'
   cpVect p = set.points[i].point;
                           ^
../Demo/Smooth.c:36:62: error: 'struct <anonymous>' has no member named 'normal'

   ChipmunkDebugDrawSegment(p, cpvadd(p, cpvmult(set.points[i].normal, 10.0)), R
GBAColor(1, 0, 0, 1));
                                                              ^
../Demo/Smooth.c: In function 'init':
../Demo/Smooth.c:64:2: warning: implicit declaration of function 'cpSpaceSetDefa
ultCollisionHandler' [-Wimplicit-function-declaration]
  cpSpaceSetDefaultCollisionHandler(space, NULL, DrawContacts, NULL, NULL, NULL)
;
  ^
../Demo/Smooth.c:71:3: error: too few arguments to function 'cpMomentForSegment'

   cpBody *body = cpSpaceAddBody(space, cpBodyNew(mass, cpMomentForSegment(mass,
 a, b)));
   ^
In file included from ../include/chipmunk/chipmunk_private.h:28:0,
                 from ../Demo/Smooth.c:27:
../include/chipmunk/chipmunk.h:156:9: note: declared here
 cpFloat cpMomentForSegment(cpFloat m, cpVect a, cpVect b, cpFloat radius);
         ^
../Demo/Smooth.c:72:3: warning: implicit declaration of function 'cpBodySetPos'
[-Wimplicit-function-declaration]
   cpBodySetPos(body, cpv(-160.0f, 80.0f));
   ^
../Demo/Smooth.c:87:3: error: too few arguments to function 'cpMomentForPoly'
   cpBody *body = cpSpaceAddBody(space, cpBodyNew(mass, cpMomentForPoly(mass, NU
M_VERTS, verts, cpvzero)));
   ^
In file included from ../include/chipmunk/chipmunk_private.h:28:0,
                 from ../Demo/Smooth.c:27:
../include/chipmunk/chipmunk.h:162:9: note: declared here
 cpFloat cpMomentForPoly(cpFloat m, int count, const cpVect *verts, cpVect offse
t, cpFloat radius);
         ^
../Demo/Smooth.c:90:3: error: incompatible type for argument 4 of 'cpPolyShapeNe
w'
   cpSpaceAddShape(space, cpPolyShapeNew(body, NUM_VERTS, verts, cpvzero));
   ^
In file included from ../include/chipmunk/chipmunk.h:132:0,
                 from ../include/chipmunk/chipmunk_private.h:28,
                 from ../Demo/Smooth.c:27:
../include/chipmunk/cpPolyShape.h:33:10: note: expected 'cpTransform' but argume
nt is of type 'cpVect'
 cpShape* cpPolyShapeNew(cpBody *body, int count, const cpVect *verts, cpTransfo
rm transform, cpFloat radius);
          ^
../Demo/Smooth.c:90:3: error: too few arguments to function 'cpPolyShapeNew'
   cpSpaceAddShape(space, cpPolyShapeNew(body, NUM_VERTS, verts, cpvzero));
   ^
In file included from ../include/chipmunk/chipmunk.h:132:0,
                 from ../include/chipmunk/chipmunk_private.h:28,
                 from ../Demo/Smooth.c:27:
../include/chipmunk/cpPolyShape.h:33:10: note: declared here
 cpShape* cpPolyShapeNew(cpBody *body, int count, const cpVect *verts, cpTransfo
rm transform, cpFloat radius);
          ^
../Demo/Smooth.c: At top level:
../Demo/Smooth.c:138:2: warning: initialization from incompatible pointer type [
enabled by default]
  update,
  ^
../Demo/Smooth.c:138:2: warning: (near initialization for 'Smooth.updateFunc') [
enabled by default]
ninja: build stopped: subcommand failed.

D:\Work\Sources\Chipmunk2D\build>

this is what I modified:

diff --git a/Demo/ContactGraph.c b/Demo/ContactGraph.c
index 41854d0..48acfe3 100644
--- a/Demo/ContactGraph.c
+++ b/Demo/ContactGraph.c
@@ -42,7 +42,7 @@ static cpBody *ballBody;
 static void
 ScaleIterator(cpBody *body, cpArbiter *arb, cpVect *sum)
 {
-       (*sum) = cpvadd(*sum, cpArbiterTotalImpulseWithFriction(arb));
+       (*sum) = cpvadd(*sum, cpArbiterTotalImpulse(arb));
 }

 static void
@@ -64,7 +64,7 @@ struct CrushingContext {
 static void
 EstimateCrushing(cpBody *body, cpArbiter *arb, struct CrushingContext *context)

 {
-       cpVect j = cpArbiterTotalImpulseWithFriction(arb);
+       cpVect j = cpArbiterTotalImpulse(arb);
        context->magnitudeSum += cpvlength(j);
        context->vectorSum = cpvadd(context->vectorSum, j);
 }
diff --git a/Demo/GJK.c b/Demo/GJK.c
index a79fcbc..8b5a526 100644
--- a/Demo/GJK.c
+++ b/Demo/GJK.c
@@ -42,7 +42,7 @@ draw(cpSpace *space)
        ChipmunkDemoDefaultDrawImpl(space);
        struct cpContact arr[CP_MAX_CONTACTS_PER_ARBITER];
 //     cpCollideShapes(shape1, shape2, (cpCollisionID[]){0}, arr);
-       cpCollisionInfo info = cpCollideShapes(shape2, shape1, 0x00000000, arr);

+       struct cpCollisionInfo info = cpCollide(shape2, shape1, 0x00000000, arr)
;
 }

another incomplete sentence in documentation

here is another incomplete sentence in the documentation:

cpBool cpArbiterIsFirstContact(const cpArbiter *arb)

Returns true if this is the first step the two shapes started touching. Can be used

No tag for Chipmunk 7

I can't find a tag or branch for Chipmunk 7.

Btw: Does a migration guide for 6 to 7 exist somewhere?

No cpSpaceFreeChildren() function

The manual mentions a function named cpSpaceFreeChildren() that will "free all of the shapes, bodies and joints that have been added to space." However, it is nowhere in the header or source files, and searching the download files, I can only find a reference to it in index.html

Compilation error on Ubuntu

master ~/src/Chipmunk2D> cmake .
-- The C compiler identification is GNU 4.8.1
-- The CXX compiler identification is GNU 4.8.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Found X11: /usr/lib/x86_64-linux-gnu/libX11.so
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libGL.so  
-- Configuring done
-- Generating done
-- Build files have been written to: /home/david/src/Chipmunk2D
?master ~/src/Chipmunk2D> make
Scanning dependencies of target chipmunk
[  1%] Building C object src/CMakeFiles/chipmunk.dir/cpSpaceDebug.c.o
/home/david/src/Chipmunk2D/src/cpSpaceDebug.c:22:39: fatal error: chipmunk/chipmunk_private.h: No such file or directory
 #include "chipmunk/chipmunk_private.h"
                                       ^
compilation terminated.
make[2]: *** [src/CMakeFiles/chipmunk.dir/cpSpaceDebug.c.o] Error 1
make[1]: *** [src/CMakeFiles/chipmunk.dir/all] Error 2
make: *** [all] Error 2
exit 2
?master ~/src/Chipmunk2D> 

I ran the commands in the README file - cmake .;make; but I got a quite strange error. Any ideas?

a sentence in manual is incomplete

There is a sentence starting like this under Overview:

  • Spaces: Spaces are containers for simulating objects in Chipmunk. You add bodies, shapes and joints to a space and then update the space as a whole. They control how all the rigid bodies, shapes, and

That's the whole line.

Error In cpBody.c

Same expression on both sides of '=='.
Finding the same expression on both sides of an operator is suspicious and might indicate a cut and paste or logic error. Please examine this code carefully to determine if it is correct.

static void cpv_assert_nan(cpVect v, char *message){cpAssertSoft(v.x == v.x && v.y == v.y, message);}  // v.x == v.x ???

cpAssertSoft(body->m == body->m && body->m_inv == body->m_inv, "Body's mass is invalid.");
cpAssertSoft(body->i == body->i && body->i_inv == body->i_inv, "Body's moment is invalid.");
cpAssertSoft(body->a == body->a && cpfabs(body->a) != INFINITY, "Body's angle is invalid.");
cpAssertSoft(body->w == body->w && cpfabs(body->w) != INFINITY, "Body's angular velocity is invalid.");
cpAssertSoft(body->t == body->t && cpfabs(body->t) != INFINITY, "Body's torque is invalid.");

cpAssertSoft(body->v_limit == body->v_limit, "Body's velocity limit is invalid.");
cpAssertSoft(body->w_limit == body->w_limit, "Body's angular velocity limit is invalid.");

chipmunk unsafe

Chipmunk_unsafe.h allows changing the shapes attached to a body but does not expose functions for creating unattached shapes - to the body. Is there a reason for this? One possible scenario this would be useful is changing the collision area of a body during runtime to correlate with that body's animation. Shapes bounding the frames of the animation could be loaded from a file, initialized and attached when needed. Thoughts?

ChipmunkGLRenderBufferSampler not found

I just updated from 6 to 7 and I can't see class
ChipmunkGLRenderBufferSampler *sampler = [[[ChipmunkGLRenderBufferSampler alloc] initWithXSamples:ws.width/downsample ySamples:size.height/downsample] autorelease];

How can I implement autogeometry in new 7 version?

Missing ObjectiveChipmunk OSX target

Right now there is only ObjectiveChipmunk which has the Chipmunk-iPhone as a dependency, that means it's meant for iOS. But the cocos2d osx project uses this same target and it messes up the schemes and generally isn't a very good idea.

I can do the required changes myself if you want to and open a pull request later.
(basically only means creating a new target with the correct dependencies and renaming the old to ObjectiveChipmunk-iPhone).

Contacts for sleeping bodies are leaked.

They don't get freed when the space is deallocated. Need to wake up all the sleeping components before destroying. Fortunately it's only a hundred bytes or so every few seconds.

I could swear I've fixed this before...

Unused function warning when compiling 6.2.1 in Xcode

I recently checked out the Chipmunk-6.2.1 tag in order to use chipmunkpp.

When compiling, Xcode complains that EdgeNew is never used. It's not a huge deal, but it prevents compilation without commenting out the function, or using -Wno-unused-function.

Chipmunk2D/src/cpCollision.c:162:1: error: unused function 'EdgeNew' [-Werror,-Wunused-function]
EdgeNew(cpVect va, cpVect vb, cpHashValue ha, cpHashValue hb, cpFloat r)
^

This was also discussed in a forum a while ago:
https://chipmunk-physics.net/forum/viewtopic.php?f=3&t=3356

Including stdarg.h

It seems #include <stdarg.h> needs to be added to ChipmunkDemo.c, at least for OS X.

Visual Studio .def exports file needs to be updated (or use __declspec)

The exports .def file is extremely out of date. This is needed to correctly build dynamic libraries on Windows.

This is a continuing problem. It would be nice if you started using __declspec hidden behind macros to annotate which APIs are public/exported directly in the header files. This would also have the added benefit of being reusable for gcc/clang which have visibility attributes which restrict which APIs to export (which can shrink the binary and speed up link times).

Chipmunk on Mac in Release mode fails

Chipmunk on Mac 64 bits, when it is compiled in Release mode, it fails.

How to reproduce it:

  • Download Chipmunk 6.1.1.
  • Open the Demo project
  • run "ChipmunkDemo"... It will work ok.
  • change the settings to use "Release".
  • Test it again...
  • Most of the tests will fail... For example, the pyramid fails.

Warnings in headers

-Wdocumentation-unknown-command and -Wreturn-type-c-linkage are triggering on the chipmunk headers. The former might be a clang bug (I don't know enough about documentation tags to say); the latter is definitely a chipmunk bug.

In file included from /Users/keith/Code/Patience/Patience/POOpenGLView.mm:5:
In file included from /Users/keith/Code/Patience/Chipmunk2D/include/chipmunk/chipmunk.h:126:
/Users/keith/Code/Patience/Chipmunk2D/include/chipmunk/cpSpatialIndex.h:57:5: error: unknown command tag name [-Werror,-Wdocumentation-unknown-command]
/// @private
    ^
In file included from /Users/keith/Code/Patience/Patience/POOpenGLView.mm:5:
In file included from /Users/keith/Code/Patience/Chipmunk2D/include/chipmunk/chipmunk.h:129:
/Users/keith/Code/Patience/Chipmunk2D/include/chipmunk/cpShape.h:85:19: error: 'cpShapesCollide' has C-linkage specified, but returns incomplete type 'cpContactPointSet' which could be incompatible with C [-Werror,-Wreturn-type-c-linkage]
cpContactPointSet cpShapesCollide(const cpShape *a, const cpShape *b);

-Wfloat-equal also triggers in many places, but that may not be avoidable.

Please add to CMakeLists.txt option for CHIPMUNK_FFI

I try to adjust Chipmunk-6.2.0 that works proper in FreeBSD.

http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/180061

And to port pymunk which use Chipmunk

http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/170662

I have tried to use -DCHIPMUNK_FFI but see this is only for XCode or OS X.

xcode/Chipmunk6.xcodeproj/project.pbxproj
...
                                OTHER_CFLAGS = (
                                        "-DDEBUG",
                                        "-DCHIPMUNK_FFI",
                                        "-ffast-math",
                                );

The compile should define CHIPMUNK_FFI as

//Build the Chipmunk FFI
BUILD_CHIPMUNK_FFI:BOOL=ON

Now i have in Makefile for Chipmuk

CMAKE_ARGS+=    -DBUILD_CHIPMUNK_FFI:BOOL=ON

and get

CMake Warning:
  Manually-specified variables were not used by the project:

    BUILD_CHIPMUNK_FFI

Build failure in Windows (MinGW-W64) due to missing `<sys/sysctl.h>`

Chipmunk 7.0.0 fails to build in Windows.

The compiler used was MinGW-W64, and the reason appears to be a missing <sys/sysctl.h> include in src/cpHastySpace.c:

[ 20%] Building C object src/CMakeFiles/chipmunk.dir/cpHastySpace.c.obj
C:\Devel\build\Chipmunk-7.0.0\src\cpHastySpace.c:9:24: fatal error: sys/sysctl.h: No such file or directory
 #include <sys/sysctl.h>
                        ^
compilation terminated.
src\CMakeFiles\chipmunk.dir\build.make:342: recipe for target 'src/CMakeFiles/chipmunk.dir/cpHastySpace.c.obj' failed
mingw32-make[2]: *** [src/CMakeFiles/chipmunk.dir/cpHastySpace.c.obj] Error 1
CMakeFiles\Makefile2:76: recipe for target 'src/CMakeFiles/chipmunk.dir/all' failed
mingw32-make[1]: *** [src/CMakeFiles/chipmunk.dir/all] Error 2
makefile:116: recipe for target 'all' failed
mingw32-make: *** [all] Error 2

compiling problem. libm

arch linux 64 bit

Linking C executable chipmunk_demos
/usr/bin/ld: ../src/libchipmunk.a(cpVect.c.o): undefined reference to symbol 'sin@@GLIBC_2.2.5'
/usr/bin/ld: note: 'sin@@GLIBC_2.2.5' is defined in DSO /usr/lib/libm.so.6 so try adding it to the linker command line
/usr/lib/libm.so.6: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status

Looks like its common. but anyway..

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.