Skip to content

Fixed datatype size + Bake defines#50

Open
SleepProgger wants to merge 1 commit into
kivy:masterfrom
SleepProgger:bake_defines
Open

Fixed datatype size + Bake defines#50
SleepProgger wants to merge 1 commit into
kivy:masterfrom
SleepProgger:bake_defines

Conversation

@SleepProgger

Copy link
Copy Markdown

This PR adds changes to the setup.py script to "bake" the defines used at compile time by generating a config.h file which is included in chipmunk.h.
This allows to change the types used for cpFloat (except for apple devices) plus the sizes of cpGroup, cpLayer and so on.

Additionally it exposes these types as the biggest possible types (uint64_t / double) on the cython side.
Currently cymunk.pxd exposes cpFloat as float while chipmunk uses by default doubles.
While cython will internally use the type defined in the .h file (double), the type defined in cython will be used to convert to/from python. Thus a number too big for a float will be returned to the python side as INFINITE. Too large integers will raise an OverflowError.

I also removed the duplicate include folder.

+Fixed problem with type sizes
@Berserker66

Copy link
Copy Markdown

Doesn't work on Python 3, due to line 52 in setup.py - you use dict.iter_items, which in python 3 is dict.items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants