Skip to content

Commit cde8b0d

Browse files
committed
git Add basic github actions build
1 parent 5dd7d77 commit cde8b0d

29 files changed

+277
-35
lines changed

.github/workflows/build.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform.
2+
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml
3+
name: CMake on multiple platforms
4+
5+
on:
6+
push:
7+
branches: master
8+
pull_request:
9+
branches: master
10+
11+
jobs:
12+
build:
13+
runs-on: ${{ matrix.os }}
14+
15+
strategy:
16+
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
17+
fail-fast: false
18+
19+
# Set up a matrix to run the following 3 configurations:
20+
# 1. <Windows, Release, latest MSVC compiler toolchain on the default runner image, default generator>
21+
# 2. <Linux, Release, latest GCC compiler toolchain on the default runner image, default generator>
22+
# 3. <Linux, Release, latest Clang compiler toolchain on the default runner image, default generator>
23+
#
24+
# To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list.
25+
matrix:
26+
os: [ubuntu-latest, windows-latest]
27+
build_type: [Release]
28+
c_compiler: [gcc, clang, cl]
29+
include:
30+
- os: windows-latest
31+
c_compiler: cl
32+
cpp_compiler: cl
33+
- os: ubuntu-latest
34+
c_compiler: gcc
35+
cpp_compiler: g++
36+
- os: ubuntu-latest
37+
c_compiler: clang
38+
cpp_compiler: clang++
39+
exclude:
40+
- os: windows-latest
41+
c_compiler: gcc
42+
- os: windows-latest
43+
c_compiler: clang
44+
- os: ubuntu-latest
45+
c_compiler: cl
46+
47+
steps:
48+
- uses: actions/checkout@v4
49+
50+
- name: Set reusable strings
51+
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
52+
id: strings
53+
shell: bash
54+
run: |
55+
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
56+
57+
- name: Install opengl
58+
run: vcpkg install opengl
59+
60+
- name: Configure CMake
61+
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
62+
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
63+
run: >
64+
cmake -B ${{ steps.strings.outputs.build-output-dir }}
65+
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} -DCMAKE_C_COMPILER=${{
66+
matrix.c_compiler }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -S
67+
${{ github.workspace }}
68+
69+
- name: Build
70+
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
71+
run:
72+
cmake --build ${{ steps.strings.outputs.build-output-dir }} --config
73+
${{ matrix.build_type }}
74+
75+
#- name: Test
76+
# working-directory: ${{ steps.strings.outputs.build-output-dir }}
77+
# Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
78+
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
79+
# run: ctest --build-config ${{ matrix.build_type }}

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.7)
1+
cmake_minimum_required(VERSION 3.10)
22

33
project(chipmunk)
44

README.textile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
11
!http://files.slembcke.net/chipmunk/logo/logo1_med.png!
22

3+
h2. FORK INFO - START HERE
4+
5+
This is a fork of the original "Chipmunk2D":https://github.com/slembcke/Chipmunk2D
6+
7+
The main purpose of this fork is to be a compainion for the Python 2D physics library "Pymunk":https://www.pymunk.org which is built on Chipmunk2D. Given the slow pace of development of Chipmunk2D, and some unique requirements and oppurtunitites of Pymunk this is something that have grown over a long time. What really made me consider to make it more formal was the discussion "here":https://github.com/slembcke/Chipmunk2D/issues/237 with Slembcke, the creator of Chipmunk2D.
8+
9+
I do not forsee that I have the time, motivation or skills to really revive Chipmunk2D. However, I hope to incorporate minor new features, and a bunch of fixes. Any changes are driven by what make sense from the Pymunk use case. However, I do think many of these changes are useful also to users outside of Pymunk, and you are of course free to use the fork for other projects / languages as well.
10+
11+
At the moment I dont have any formal release of this fork, but I plan to make some kind of rename and a release if/when enough changes are accumulated.
12+
13+
h3. Differeces:
14+
15+
* This fork will have ABI breaking changes. For Pymunk it does not matter, a Pymunk verison is always compiled against a specific Chipmunk2D version.
16+
* This fork might have API breaking changes. Since Pymunk wraps Chipmunk2D in a Python friendly API, end users of Pymunk wont be affected.
17+
* Some additional minor features, useful from Pymunk
18+
* Fixes to various issues, mainly those affecting Pymunk
19+
20+
---
21+
322
h2. NEW IN CHIPMUNK 7
423

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

VERSION.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
What's new in NEXT:
2+
* API: Now possible to to override cpMessage by defining CP_OVERRIDE_MESSAGE
3+
* API: The maxForce property now have effect on DampedSpring and DampedRotarySpring
4+
* API: Reset velocity and constraint jAcc when body type changes to DYNAMIC
5+
* API: Add transform property to cpSpaceDebugDrawOptions
6+
* API: Use CGFloat as the float type if CP_USE_CGTYPES is set.
7+
* BUG: Fixed total impulse calculation of DampedRotarySpring
8+
* BUG: Fix for compiling cpPolyline with MSVC
9+
* BUG: Fix FFI symbols not exported on windows under mingw
10+
* BUG: Fix a potential divide by zero in ClosestT
11+
* BUG: Fix division by zero in cpPolyShapeSegmentQuery() function.
12+
* BUG: Fix planetmath url (by ccgargantua)
13+
* BUG: Optimized memory allocation of cpPolylineSet (by richardgroves)
14+
* BUG: Fix cast between incompatible function type to reduce warnings (by aganm)
15+
* BUG: Rename body local variable to fix shadow warning (by aganm)
16+
* BUG: Fixes bug in cpSpaceShapeQuery to not miss collisions (by alanmillard)
17+
* BUG: Fix for cpSpaceShapeQuery using cpSegmentShape with null body (by maniek2332)
18+
* MISC: Fix spelling of positive (by skitt)
19+
20+
21+
122
What's new in 7.0.3:
223
* MISC: Replacing GLFW with Sokol in the demo application. No need to push GLFW binaries and has a nice x-platform renderer to build on.
324
* MISC: Fixed some 'const' warnings for MSCV.

demo/ChipmunkDemo.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ ChipmunkDemoDefaultDrawImpl(cpSpace *space)
189189
ColorForShape,
190190
{0.0f, 0.75f, 0.0f, 1.0f}, // Constraint color
191191
{1.0f, 0.0f, 0.0f, 1.0f}, // Collision point color
192+
cpTransformIdentity,
192193
NULL,
193194
};
194195

include/chipmunk/chipmunk_structs.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,12 +239,14 @@ typedef void (*cpConstraintPreStepImpl)(cpConstraint *constraint, cpFloat dt);
239239
typedef void (*cpConstraintApplyCachedImpulseImpl)(cpConstraint *constraint, cpFloat dt_coef);
240240
typedef void (*cpConstraintApplyImpulseImpl)(cpConstraint *constraint, cpFloat dt);
241241
typedef cpFloat (*cpConstraintGetImpulseImpl)(cpConstraint *constraint);
242+
typedef void (*cpConstraintResetAccImpl)(cpConstraint *constraint);
242243

243244
typedef struct cpConstraintClass {
244245
cpConstraintPreStepImpl preStep;
245246
cpConstraintApplyCachedImpulseImpl applyCachedImpulse;
246247
cpConstraintApplyImpulseImpl applyImpulse;
247248
cpConstraintGetImpulseImpl getImpulse;
249+
cpConstraintResetAccImpl resetAcc;
248250
} cpConstraintClass;
249251

250252
struct cpConstraint {

include/chipmunk/cpMarch.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
// Copyright 2013 Howling Moon Software. All rights reserved.
22
// See http://chipmunk2d.net/legal.php for more information.
33

4+
#ifdef __cplusplus
5+
extern "C" {
6+
#endif
7+
48
/// Function type used as a callback from the marching squares algorithm to sample an image function.
59
/// It passes you the point to sample and your context pointer, and you return the density.
610
typedef cpFloat (*cpMarchSampleFunc)(cpVect point, void *data);
@@ -26,3 +30,7 @@ CP_EXPORT void cpMarchHard(
2630
cpMarchSegmentFunc segment, void *segment_data,
2731
cpMarchSampleFunc sample, void *sample_data
2832
);
33+
34+
#ifdef __cplusplus
35+
}
36+
#endif

include/chipmunk/cpPolyline.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
// Copyright 2013 Howling Moon Software. All rights reserved.
22
// See http://chipmunk2d.net/legal.php for more information.
33

4+
#ifdef __cplusplus
5+
extern "C" {
6+
#endif
7+
48
// Polylines are just arrays of vertexes.
59
// They are looped if the first vertex is equal to the last.
610
// cpPolyline structs are intended to be passed by value and destroyed when you are done with them.
@@ -68,3 +72,7 @@ CP_EXPORT void cpPolylineSetCollectSegment(cpVect v0, cpVect v1, cpPolylineSet *
6872
CP_EXPORT cpPolylineSet *cpPolylineConvexDecomposition(cpPolyline *line, cpFloat tol);
6973

7074
#define cpPolylineConvexDecomposition_BETA cpPolylineConvexDecomposition
75+
76+
#ifdef __cplusplus
77+
}
78+
#endif

src/chipmunk.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1818
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1919
* SOFTWARE.
20-
*/
20+
*/
2121

2222
#include <stdio.h>
2323
#include <string.h>
@@ -28,6 +28,7 @@
2828

2929
#include "chipmunk/chipmunk_private.h"
3030

31+
#ifndef CP_OVERRIDE_MESSAGE
3132
void
3233
cpMessage(const char *condition, const char *file, int line, int isError, int isHardError, const char *message, ...)
3334
{
@@ -52,6 +53,8 @@ cpMessage(const char *condition, const char *file, int line, int isError, int is
5253
fprintf(stderr, "\tSource:%s:%d\n", file, line);
5354
#endif
5455
}
56+
#endif
57+
5558

5659
#define STR(s) #s
5760
#define XSTR(s) STR(s)

src/cpBBTree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ cpBBTreeAlloc(void)
544544
return (cpBBTree *)cpcalloc(1, sizeof(cpBBTree));
545545
}
546546

547-
static int
547+
static cpBool
548548
leafSetEql(void *obj, Node *node)
549549
{
550550
return (obj == node->obj);

0 commit comments

Comments
 (0)