chipmunk: update 6.2.2 --> 7.0.2 and use new-style options

replaces and closes #1421
pull/1062/merge
Tony Theodore 6 years ago
parent 6de6c7a9b3
commit 193b97e870

@ -1,59 +0,0 @@
This file is part of MXE. See LICENSE.md for licensing information.
Taken from https://github.com/slembcke/Chipmunk2D/pull/87.
From e3f2b8aa221170988b9349cdce161fe0f109109b Mon Sep 17 00:00:00 2001
From: Timothy Gu <timothygu99@gmail.com>
Date: Thu, 4 Sep 2014 20:23:24 -0700
Subject: [PATCH] build: Make lib and executable install path settable
Also changes DLL install dir to bin/ and install DLL import libs.
---
CMakeLists.txt | 6 ++++++
src/CMakeLists.txt | 6 ++++--
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 863afc0..4c99925 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,6 +15,12 @@ if(NOT CMAKE_BUILD_TYPE)
FORCE)
endif()
+# to manually select install locations of libraries and executables
+# -D LIB_INSTALL_DIR mylib
+# -D BIN_INSTALL_DIR newbin
+set(LIB_INSTALL_DIR lib CACHE STRING "Install location of libraries")
+set(BIN_INSTALL_DIR bin CACHE STRING "Install location of executables")
+
# other options for the build, you can i.e. activate the shared library by passing
# -D BUILD_SHARED=ON
# to cmake. Other options analog
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 2e817ea..633a101 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -22,7 +22,9 @@ if(BUILD_SHARED)
# need to explicitly link to the math library because the CMake/Android toolchains may not do it automatically
target_link_libraries(chipmunk m)
endif(ANDROID)
- install(TARGETS chipmunk RUNTIME DESTINATION lib LIBRARY DESTINATION lib)
+ install(TARGETS chipmunk RUNTIME DESTINATION ${BIN_INSTALL_DIR}
+ LIBRARY DESTINATION ${LIB_INSTALL_DIR}
+ ARCHIVE DESTINATION ${LIB_INSTALL_DIR})
endif(BUILD_SHARED)
if(BUILD_STATIC)
@@ -37,7 +39,7 @@ if(BUILD_STATIC)
# Sets chipmunk_static to output "libchipmunk.a" not "libchipmunk_static.a"
set_target_properties(chipmunk_static PROPERTIES OUTPUT_NAME chipmunk)
if(INSTALL_STATIC)
- install(TARGETS chipmunk_static ARCHIVE DESTINATION lib)
+ install(TARGETS chipmunk_static ARCHIVE DESTINATION ${LIB_INSTALL_DIR})
endif(INSTALL_STATIC)
endif(BUILD_STATIC)
--
1.8.3.2

@ -2,6 +2,7 @@
* This file is part of MXE. See LICENSE.md for licensing information.
*/
// taken from: doc/examples/Hello Chipmunk.html
#include <stdio.h>
#include <chipmunk/chipmunk.h>
@ -15,8 +16,8 @@ int main(void){
// Add a static line segment shape for the ground.
// We'll make it slightly tilted so the ball will roll off.
// We attach it to space->staticBody to tell Chipmunk it shouldn't be movable.
cpShape *ground = cpSegmentShapeNew(space->staticBody, cpv(-20, 5), cpv(20, -5), 0);
// We attach it to a static body to tell Chipmunk it shouldn't be movable.
cpShape *ground = cpSegmentShapeNew(cpSpaceGetStaticBody(space), cpv(-20, 5), cpv(20, -5), 0);
cpShapeSetFriction(ground, 1);
cpSpaceAddShape(space, ground);
@ -35,7 +36,7 @@ int main(void){
// The cpSpaceAdd*() functions return the thing that you are adding.
// It's convenient to create and add an object in one line.
cpBody *ballBody = cpSpaceAddBody(space, cpBodyNew(mass, moment));
cpBodySetPos(ballBody, cpv(0, 15));
cpBodySetPosition(ballBody, cpv(0, 15));
// Now we create the collision shape for the ball.
// You can create multiple collision shapes that point to the same body.
@ -48,11 +49,12 @@ int main(void){
// It is *highly* recommended to use a fixed size time step.
cpFloat timeStep = 1.0/60.0;
for(cpFloat time = 0; time < 2; time += timeStep){
cpVect pos = cpBodyGetPos(ballBody);
cpVect vel = cpBodyGetVel(ballBody);
printf("Time is %5.2f. ballBody is at (%5.2f, %5.2f). "
"It's velocity is (%5.2f, %5.2f)\n",
time, pos.x, pos.y, vel.x, vel.y);
cpVect pos = cpBodyGetPosition(ballBody);
cpVect vel = cpBodyGetVelocity(ballBody);
printf(
"Time is %5.2f. ballBody is at (%5.2f, %5.2f). It's velocity is (%5.2f, %5.2f)\n",
time, pos.x, pos.y, vel.x, vel.y
);
cpSpaceStep(space, timeStep);
}

@ -4,29 +4,18 @@ PKG := chipmunk
$(PKG)_WEBSITE := https://chipmunk-physics.net/
$(PKG)_DESCR := Chipmunk Physics
$(PKG)_IGNORE :=
$(PKG)_VERSION := 6.2.2
$(PKG)_CHECKSUM := c51f0e3a30770f6b940de3228bee40a871aaf7611a1b5ec546a7d2b9e1041f97
$(PKG)_SUBDIR := Chipmunk2D-Chipmunk-$($(PKG)_VERSION)
$(PKG)_FILE := $(PKG)-$($(PKG)_VERSION).tar.gz
$(PKG)_URL := https://github.com/slembcke/Chipmunk2D/archive/Chipmunk-$($(PKG)_VERSION).tar.gz
$(PKG)_VERSION := 7.0.2
$(PKG)_CHECKSUM := 6b6d8d5d910c4442fb9c8c4c46a178126d8c21d075cdb3ce439a7f8d8757b0ca
$(PKG)_GH_CONF := slembcke/Chipmunk2D/tags, Chipmunk-
$(PKG)_DEPS := cc
define $(PKG)_UPDATE
$(WGET) -q -O- 'https://github.com/slembcke/Chipmunk2D/releases' | \
$(SED) -n 's,.*/archive/Chipmunk-\([0-9][^>]*\)\.tar.*,\1,p' | \
head -1
endef
define $(PKG)_BUILD
mkdir '$(1)/build'
cd '$(1)/build' && '$(TARGET)-cmake' .. \
cd '$(BUILD_DIR)' && $(TARGET)-cmake '$(SOURCE_DIR)' \
-DBUILD_DEMOS=OFF \
-DINSTALL_DEMOS=OFF \
$(if $(BUILD_STATIC), \
-DINSTALL_STATIC=ON, \
-DINSTALL_STATIC=OFF)
$(MAKE) -C '$(1)/build' -j '$(JOBS)' install
-DINSTALL_STATIC=$(CMAKE_STATIC_BOOL)
$(MAKE) -C '$(BUILD_DIR)' -j '$(JOBS)'
$(MAKE) -C '$(BUILD_DIR)' -j 1 install
'$(TARGET)-gcc' \
-W -Wall -Werror -ansi -pedantic -std=c99 \

Loading…
Cancel
Save