Enable easy swithing between Box2D and chipmunk in linux and nacl

The ENABLE_BOX2D/ENABLE_CHIPMUNK defines were previously
hardcoded in the Makefiles.  Now you get chipmunk by default
on both platforms and can enble Box2D by setting USE_BOX2D in
your environment.

Also remove erroneous -D__CC_PLATFORM_FILEUTILS_CPP__ and
-D__CC_PLATFORM_IMAGE_CPP__ from linux Makefiles.  These should
never be defined globally like this.
This commit is contained in:
Sam Clegg 2013-03-20 11:47:24 -07:00
parent 57d34bf161
commit ffb7360e46
8 changed files with 19 additions and 24 deletions

View File

@ -9,9 +9,6 @@ INCLUDES += \
-I../../external/chipmunk/include/chipmunk \
-I../../extensions/network \
DEFINES += -D__CC_PLATFORM_FILEUTILS_CPP__
DEFINES += -DCC_ENABLE_CHIPMUNK_INTEGRATION
SOURCES = ../actions/CCAction.cpp \
../actions/CCActionCamera.cpp \
../actions/CCActionEase.cpp \

View File

@ -8,6 +8,12 @@ ARFLAGS = cr
DEFINES += -DLINUX
ifdef USE_BOX2D
DEFINES += -DCC_ENABLE_BOX2D_INTEGRATION
else
DEFINES += -DCC_ENABLE_CHIPMUNK_INTEGRATION
endif
THIS_MAKEFILE := $(CURDIR)/$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
ifndef COCOS_ROOT
COCOS_ROOT := $(realpath $(dir $(THIS_MAKEFILE))/../..)

View File

@ -137,8 +137,6 @@ CXXFLAGS += -Wno-sequence-point
TARGET = $(LIB_DIR)/libcocos2d.a
DEFINES += -DCC_ENABLE_CHIPMUNK_INTEGRATION
all: $(TARGET)
$(TARGET): $(OBJECTS) $(CORE_MAKEFILE_LIST)

View File

@ -18,13 +18,15 @@ THIS_MAKEFILE := $(CURDIR)/$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
# The top level of the cocos2dx-x source tree. The parent Makefile will
# often define this, but in case is doesn't we can find it relative to
# THIS_MAKEFILE
COCOS_ROOT ?= $(realpath $(dir $(THIS_MAKEFILE))/../..)
COCOS_SRC = $(COCOS_ROOT)/cocos2dx
ifndef COCOS_ROOT
COCOS_ROOT := $(realpath $(dir $(THIS_MAKEFILE))/../..)
endif
COCOS_SRC := $(COCOS_ROOT)/cocos2dx
ifeq ($(NACL_ARCH), i686)
ARCH_DIR=$(NACL_LIBC)_x86_32
ARCH_DIR := $(NACL_LIBC)_x86_32
else
ARCH_DIR=$(NACL_LIBC)_$(NACL_ARCH)
ARCH_DIR := $(NACL_LIBC)_$(NACL_ARCH)
endif
NACLPORTS_ROOT ?= $(NACL_SDK_ROOT)/ports
@ -33,6 +35,12 @@ OUT_DIR ?= obj
OBJ_DIR ?= $(OUT_DIR)/$(NACL_ARCH)
LIB_DIR ?= $(COCOS_ROOT)/lib/nacl/$(ARCH_DIR)
ifdef USE_BOX2D
DEFINES += -DCC_ENABLE_BOX2D_INTEGRATION
else
DEFINES += -DCC_ENABLE_CHIPMUNK_INTEGRATION
endif
INCLUDES += -I$(COCOS_SRC) \
-I$(COCOS_SRC)/cocoa \
-I$(COCOS_SRC)/include \

View File

@ -42,16 +42,9 @@
#include "network/HttpClient.h"
// Physics integration
#if CC_ENABLE_CHIPMUNK_INTEGRATION
#if CC_ENABLE_CHIPMUNK_INTEGRATION || CC_ENABLE_BOX2D_INTEGRATION
#include "physics_nodes/CCPhysicsDebugNode.h"
#include "physics_nodes/CCPhysicsSprite.h"
#endif
#if CC_ENABLE_BOX2D_INTEGRATION
#include "physics_nodes/CCPhysicsDebugNode.h"
#include "physics_nodes/CCPhysicsSprite.h"
#endif
#endif /* __COCOS2D_EXT_H__ */

View File

@ -10,9 +10,6 @@ INCLUDES = -I$(COCOS_ROOT)/external \
-I../GUI/CCControlExtension \
-I../network
DEFINES += -DCC_ENABLE_CHIPMUNK_INTEGRATION=1
DEFINES += -D__CC_PLATFORM_IMAGE_CPP__
SOURCES = ../CCBReader/CCBFileLoader.cpp \
../CCBReader/CCMenuItemImageLoader.cpp \
../CCBReader/CCBReader.cpp \

View File

@ -110,8 +110,6 @@ STATICLIBS += \
$(LIB_DIR)/libbox2d.a \
$(LIB_DIR)/libchipmunk.a
DEFINES += -DCC_ENABLE_CHIPMUNK_INTEGRATION=1
####### Build rules
$(TARGET): $(OBJECTS) $(STATICLIBS) $(COCOS_LIBS) $(CORE_MAKEFILE_LIST)
@mkdir -p $(@D)

View File

@ -1,5 +1,3 @@
DEFINES += -DCC_ENABLE_BOX2D_INTEGRATION
COCOS_ROOT = ../../../..
COCOS2DX_PATH = $(COCOS_ROOT)/cocos2dx