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../../external/chipmunk/include/chipmunk \
-I../../extensions/network \ -I../../extensions/network \
DEFINES += -D__CC_PLATFORM_FILEUTILS_CPP__
DEFINES += -DCC_ENABLE_CHIPMUNK_INTEGRATION
SOURCES = ../actions/CCAction.cpp \ SOURCES = ../actions/CCAction.cpp \
../actions/CCActionCamera.cpp \ ../actions/CCActionCamera.cpp \
../actions/CCActionEase.cpp \ ../actions/CCActionEase.cpp \

View File

@ -8,6 +8,12 @@ ARFLAGS = cr
DEFINES += -DLINUX 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)) THIS_MAKEFILE := $(CURDIR)/$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
ifndef COCOS_ROOT ifndef COCOS_ROOT
COCOS_ROOT := $(realpath $(dir $(THIS_MAKEFILE))/../..) COCOS_ROOT := $(realpath $(dir $(THIS_MAKEFILE))/../..)

View File

@ -137,8 +137,6 @@ CXXFLAGS += -Wno-sequence-point
TARGET = $(LIB_DIR)/libcocos2d.a TARGET = $(LIB_DIR)/libcocos2d.a
DEFINES += -DCC_ENABLE_CHIPMUNK_INTEGRATION
all: $(TARGET) all: $(TARGET)
$(TARGET): $(OBJECTS) $(CORE_MAKEFILE_LIST) $(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 # 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 # often define this, but in case is doesn't we can find it relative to
# THIS_MAKEFILE # THIS_MAKEFILE
COCOS_ROOT ?= $(realpath $(dir $(THIS_MAKEFILE))/../..) ifndef COCOS_ROOT
COCOS_SRC = $(COCOS_ROOT)/cocos2dx COCOS_ROOT := $(realpath $(dir $(THIS_MAKEFILE))/../..)
endif
COCOS_SRC := $(COCOS_ROOT)/cocos2dx
ifeq ($(NACL_ARCH), i686) ifeq ($(NACL_ARCH), i686)
ARCH_DIR=$(NACL_LIBC)_x86_32 ARCH_DIR := $(NACL_LIBC)_x86_32
else else
ARCH_DIR=$(NACL_LIBC)_$(NACL_ARCH) ARCH_DIR := $(NACL_LIBC)_$(NACL_ARCH)
endif endif
NACLPORTS_ROOT ?= $(NACL_SDK_ROOT)/ports NACLPORTS_ROOT ?= $(NACL_SDK_ROOT)/ports
@ -33,6 +35,12 @@ OUT_DIR ?= obj
OBJ_DIR ?= $(OUT_DIR)/$(NACL_ARCH) OBJ_DIR ?= $(OUT_DIR)/$(NACL_ARCH)
LIB_DIR ?= $(COCOS_ROOT)/lib/nacl/$(ARCH_DIR) 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) \ INCLUDES += -I$(COCOS_SRC) \
-I$(COCOS_SRC)/cocoa \ -I$(COCOS_SRC)/cocoa \
-I$(COCOS_SRC)/include \ -I$(COCOS_SRC)/include \

View File

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

View File

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

View File

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

View File

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