From 28ca22bfde1443cc1b9e6ef8e586b78e2251bf7d Mon Sep 17 00:00:00 2001 From: ivzave Date: Wed, 26 Sep 2012 16:51:41 +0400 Subject: [PATCH 1/2] added lua support for linux platform --- make-all-linux-project.sh | 25 ++ samples/HelloLua/proj.linux/.cproject | 219 +++++++++++++++++ samples/HelloLua/proj.linux/.project | 40 ++++ samples/HelloLua/proj.linux/Makefile | 95 ++++++++ samples/HelloLua/proj.linux/main.cpp | 34 +++ samples/HelloLua/proj.linux/main.h | 7 + samples/TestLua/proj.linux/.cproject | 220 ++++++++++++++++++ samples/TestLua/proj.linux/.project | 40 ++++ samples/TestLua/proj.linux/Makefile | 100 ++++++++ samples/TestLua/proj.linux/main.cpp | 35 +++ samples/TestLua/proj.linux/main.h | 13 ++ .../LuaCocos2d.cpp.REMOVED.git-id | 2 +- scripting/lua/proj.linux/.cproject | 163 +++++++++++++ scripting/lua/proj.linux/.project | 40 ++++ scripting/lua/proj.linux/Makefile | 75 ++++++ tools/tolua++/build.php | 23 +- 16 files changed, 1129 insertions(+), 2 deletions(-) create mode 100644 samples/HelloLua/proj.linux/.cproject create mode 100644 samples/HelloLua/proj.linux/.project create mode 100644 samples/HelloLua/proj.linux/Makefile create mode 100644 samples/HelloLua/proj.linux/main.cpp create mode 100644 samples/HelloLua/proj.linux/main.h create mode 100644 samples/TestLua/proj.linux/.cproject create mode 100644 samples/TestLua/proj.linux/.project create mode 100644 samples/TestLua/proj.linux/Makefile create mode 100644 samples/TestLua/proj.linux/main.cpp create mode 100644 samples/TestLua/proj.linux/main.h create mode 100644 scripting/lua/proj.linux/.cproject create mode 100644 scripting/lua/proj.linux/.project create mode 100644 scripting/lua/proj.linux/Makefile diff --git a/make-all-linux-project.sh b/make-all-linux-project.sh index 678567d8fe..5663b169ae 100755 --- a/make-all-linux-project.sh +++ b/make-all-linux-project.sh @@ -92,6 +92,16 @@ make -C $COCOS2DX20_TRUNK/CocosDenshion/proj.linux release check_make_result cp $COCOS2DX20_TRUNK/CocosDenshion/proj.linux/libcocosdenshion.so $OUTPUT_RELEASE +make -C $COCOS2DX20_TRUNK/scripting/lua/proj.linux clean +make -C $COCOS2DX20_TRUNK/scripting/lua/proj.linux debug +check_make_result +cp $COCOS2DX20_TRUNK/scripting/lua/proj.linux/liblua.so $OUTPUT_DEBUG + +make -C $COCOS2DX20_TRUNK/scripting/lua/proj.linux clean +make -C $COCOS2DX20_TRUNK/scripting/lua/proj.linux release +check_make_result +cp $COCOS2DX20_TRUNK/scripting/lua/proj.linux/liblua.so $OUTPUT_RELEASE + make -C $COCOS2DX20_TRUNK/samples/TestCpp/proj.linux clean make -C $COCOS2DX20_TRUNK/samples/TestCpp/proj.linux debug check_make_result @@ -105,3 +115,18 @@ check_make_result make -C $COCOS2DX20_TRUNK/samples/HelloCpp/proj.linux clean make -C $COCOS2DX20_TRUNK/samples/HelloCpp/proj.linux release check_make_result + +make -C $COCOS2DX20_TRUNK/samples/TestLua/proj.linux clean +make -C $COCOS2DX20_TRUNK/samples/TestLua/proj.linux debug +check_make_result +make -C $COCOS2DX20_TRUNK/samples/TestLua/proj.linux clean +make -C $COCOS2DX20_TRUNK/samples/TestLua/proj.linux release +check_make_result + +make -C $COCOS2DX20_TRUNK/samples/HelloLua/proj.linux clean +make -C $COCOS2DX20_TRUNK/samples/HelloLua/proj.linux debug +check_make_result +make -C $COCOS2DX20_TRUNK/samples/HelloLua/proj.linux clean +make -C $COCOS2DX20_TRUNK/samples/HelloLua/proj.linux release +check_make_result + diff --git a/samples/HelloLua/proj.linux/.cproject b/samples/HelloLua/proj.linux/.cproject new file mode 100644 index 0000000000..fe7110a98e --- /dev/null +++ b/samples/HelloLua/proj.linux/.cproject @@ -0,0 +1,219 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/HelloLua/proj.linux/.project b/samples/HelloLua/proj.linux/.project new file mode 100644 index 0000000000..672ae74815 --- /dev/null +++ b/samples/HelloLua/proj.linux/.project @@ -0,0 +1,40 @@ + + + HelloLua + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + Classes + 2 + PARENT-1-PROJECT_LOC/Classes + + + cocos2dx_support + 2 + PARENT-3-PROJECT_LOC/scripting/lua/cocos2dx_support + + + + diff --git a/samples/HelloLua/proj.linux/Makefile b/samples/HelloLua/proj.linux/Makefile new file mode 100644 index 0000000000..acac34fa72 --- /dev/null +++ b/samples/HelloLua/proj.linux/Makefile @@ -0,0 +1,95 @@ +CC = gcc +CXX = g++ +TARGET = HelloLua +CCFLAGS = -Wall +CXXFLAGS = -Wall +VISIBILITY = + +COCOS2DX_PATH = ../../../cocos2dx +INCLUDES = -I../ \ + -I../Classes \ + -I$(COCOS2DX_PATH) \ + -I$(COCOS2DX_PATH)/platform/third_party/linux \ + -I$(COCOS2DX_PATH)/platform/third_party/linux/libfreetype2 \ + -I$(COCOS2DX_PATH)/cocoa \ + -I$(COCOS2DX_PATH)/include \ + -I$(COCOS2DX_PATH)/platform \ + -I$(COCOS2DX_PATH)/platform/linux \ + -I$(COCOS2DX_PATH)/platform/third_party/linux/glew-1.7.0/glew-1.7.0/include/ \ + -I$(COCOS2DX_PATH)/kazmath/include \ + -I$(COCOS2DX_PATH)/platform/third_party/linux/libxml2 \ + -I$(COCOS2DX_PATH)/platform/third_party/linux/libjpeg \ + -I../../../CocosDenshion/include \ + -I../../../scripting/lua/lua \ + -I../../../scripting/lua/tolua \ + -I../../../scripting/lua/cocos2dx_support + +DEFINES = -DLINUX + +OBJECTS = ./main.o \ + ../Classes/AppDelegate.o \ + ../../../scripting/lua/cocos2dx_support/CCLuaEngine.o \ + ../../../scripting/lua/cocos2dx_support/Cocos2dxLuaLoader.o \ + ../../../scripting/lua/cocos2dx_support/LuaCocos2d.o \ + ../../../scripting/lua/cocos2dx_support/tolua_fix.o + +LBITS := $(shell getconf LONG_BIT) +ifeq ($(LBITS),64) +STATICLIBS_DIR = ../../../cocos2dx/platform/third_party/linux/libraries/lib64 +else +STATICLIBS_DIR = ../../../cocos2dx/platform/third_party/linux/libraries +endif + +STATICLIBS = $(STATICLIBS_DIR)/libfreetype.a \ + $(STATICLIBS_DIR)/libxml2.a \ + $(STATICLIBS_DIR)/libpng.a \ + $(STATICLIBS_DIR)/libjpeg.a \ + $(STATICLIBS_DIR)/libtiff.a \ +# $(STATICLIBS_DIR)/libGLEW.a \ + +SHAREDLIBS += -lglfw -lcurl -llua +SHAREDLIBS += -Wl,-rpath,../../../../../cocos2dx/platform/third_party/linux/glew-1.7.0/glew-1.7.0/lib +SHAREDLIBS += -L../../../cocos2dx/platform/third_party/linux/glew-1.7.0/glew-1.7.0/lib -lGLEW +SHAREDLIBS += -Wl,-rpath,../../../../../lib/linux/Debug + +ifeq ($(LBITS),64) +SHAREDLIBS += -L../../../CocosDenshion/third_party/fmod/lib64/api/lib -lfmodex64 -Wl,-rpath,../../../../../CocosDenshion/third_party/fmod/lib64/api/lib +else +SHAREDLIBS += -L../../../CocosDenshion/third_party/fmod/api/lib -lfmodex -Wl,-rpath,../../../../../CocosDenshion/third_party/fmod/api/lib +endif + +#$(shell ../../build-linux.sh $<) + +BIN_DIR_ROOT=bin +BIN_DIR = $(BIN_DIR_ROOT) + +debug: BIN_DIR = $(BIN_DIR_ROOT)/debug +debug: CCFLAGS += -g3 -O0 +debug: CXXFLAGS += -g3 -O0 +debug: SHAREDLIBS += -L../../../lib/linux/Debug -lcocos2d -lrt -lz -lcocosdenshion +debug: SHAREDLIBS += -Wl,-rpath,../../../../../lib/linux/Debug/ +debug: DEFINES += -DDEBUG +debug: $(TARGET) + +release: BIN_DIR = $(BIN_DIR_ROOT)/release +release: CCFLAGS += -O3 +release: CXXFLAGS += -O3 +release: SHAREDLIBS += -L../../../lib/linux/Release -lcocos2d -lrt -lz -lcocosdenshion +release: SHAREDLIBS += -Wl,-rpath,../../../../../lib/linux/Release/ +release: DEFINES += -DNDEBUG +release: $(TARGET) + +####### Build rules +$(TARGET): $(OBJECTS) + mkdir -p $(BIN_DIR) + $(CXX) $(CXXFLAGS) $(INCLUDES) $(DEFINES) $(OBJECTS) -o $(BIN_DIR)/$(TARGET) $(SHAREDLIBS) $(STATICLIBS) + +####### Compile +%.o: %.cpp + $(CXX) $(CXXFLAGS) $(INCLUDES) $(DEFINES) $(VISIBILITY) -c $< -o $@ + +%.o: %.c + $(CC) $(CCFLAGS) $(INCLUDES) $(DEFINES) $(VISIBILITY) -c $< -o $@ + +clean: + rm -f $(OBJECTS) $(TARGET) core diff --git a/samples/HelloLua/proj.linux/main.cpp b/samples/HelloLua/proj.linux/main.cpp new file mode 100644 index 0000000000..bb6061e8fe --- /dev/null +++ b/samples/HelloLua/proj.linux/main.cpp @@ -0,0 +1,34 @@ +#include "main.h" +#include "../Classes/AppDelegate.h" +#include "cocos2d.h" + + +#include +#include +#include +#include + +USING_NS_CC; + +// 500 is enough? +#define MAXPATHLEN 500 + +int main(int argc, char **argv) +{ + // get application path + int length; + char fullpath[MAXPATHLEN]; + length = readlink("/proc/self/exe", fullpath, sizeof(fullpath)); + fullpath[length] = '\0'; + + std::string resourcePath = fullpath; + resourcePath = resourcePath.substr(0, resourcePath.find_last_of("/")); + resourcePath += "/../../../Resources/"; + + // create the application instance + AppDelegate app; + CCApplication::sharedApplication()->setResourceRootPath(resourcePath.c_str()); + CCEGLView* eglView = CCEGLView::sharedOpenGLView(); + eglView->setFrameSize(960, 640); + return CCApplication::sharedApplication()->run(); +} diff --git a/samples/HelloLua/proj.linux/main.h b/samples/HelloLua/proj.linux/main.h new file mode 100644 index 0000000000..952830d1ac --- /dev/null +++ b/samples/HelloLua/proj.linux/main.h @@ -0,0 +1,7 @@ +#ifndef __MAIN_H__ +#define __MAIN_H__ + +// C RunTime Header Files +#include "CCStdC.h" + +#endif // __MAIN_H__ diff --git a/samples/TestLua/proj.linux/.cproject b/samples/TestLua/proj.linux/.cproject new file mode 100644 index 0000000000..4934a002aa --- /dev/null +++ b/samples/TestLua/proj.linux/.cproject @@ -0,0 +1,220 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/TestLua/proj.linux/.project b/samples/TestLua/proj.linux/.project new file mode 100644 index 0000000000..6634811e8d --- /dev/null +++ b/samples/TestLua/proj.linux/.project @@ -0,0 +1,40 @@ + + + TestLua + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + Classes + 2 + PARENT-1-PROJECT_LOC/Classes + + + cocos2dx_support + 2 + PARENT-3-PROJECT_LOC/scripting/lua/cocos2dx_support + + + + diff --git a/samples/TestLua/proj.linux/Makefile b/samples/TestLua/proj.linux/Makefile new file mode 100644 index 0000000000..2c349b90b2 --- /dev/null +++ b/samples/TestLua/proj.linux/Makefile @@ -0,0 +1,100 @@ +CC = gcc +CXX = g++ +TARGET = TestLua +CCFLAGS = -Wall +CXXFLAGS = -Wall +VISIBILITY = + +COCOS2DX_PATH = ../../../cocos2dx +INCLUDES = -I../ \ + -I../Classes \ + -I$(COCOS2DX_PATH) \ + -I$(COCOS2DX_PATH)/platform/third_party/linux \ + -I$(COCOS2DX_PATH)/platform/third_party/linux/libfreetype2 \ + -I$(COCOS2DX_PATH)/cocoa \ + -I$(COCOS2DX_PATH)/include \ + -I$(COCOS2DX_PATH)/platform \ + -I$(COCOS2DX_PATH)/platform/linux \ + -I$(COCOS2DX_PATH)/platform/third_party/linux/glew-1.7.0/glew-1.7.0/include/ \ + -I$(COCOS2DX_PATH)/kazmath/include \ + -I$(COCOS2DX_PATH)/platform/third_party/linux/libxml2 \ + -I$(COCOS2DX_PATH)/platform/third_party/linux/libjpeg \ + -I../../../CocosDenshion/include \ + -I../../../scripting/lua/lua \ + -I../../../scripting/lua/tolua \ + -I../../../scripting/lua/cocos2dx_support + + +DEFINES = -DLINUX + +OBJECTS = ./main.o \ + ../Classes/AppDelegate.o \ + ../../../scripting/lua/cocos2dx_support/CCLuaEngine.o \ + ../../../scripting/lua/cocos2dx_support/Cocos2dxLuaLoader.o \ + ../../../scripting/lua/cocos2dx_support/LuaCocos2d.o \ + ../../../scripting/lua/cocos2dx_support/tolua_fix.o \ + +LBITS := $(shell getconf LONG_BIT) +ifeq ($(LBITS),64) +STATICLIBS_DIR = ../../../cocos2dx/platform/third_party/linux/libraries/lib64 +else +STATICLIBS_DIR = ../../../cocos2dx/platform/third_party/linux/libraries +endif + +STATICLIBS = $(STATICLIBS_DIR)/libfreetype.a \ + $(STATICLIBS_DIR)/libcurl.a \ + $(STATICLIBS_DIR)/libxml2.a \ + $(STATICLIBS_DIR)/libpng.a \ + $(STATICLIBS_DIR)/libjpeg.a \ + $(STATICLIBS_DIR)/libtiff.a \ +# $(STATICLIBS_DIR)/libGLEW.a \ + ../../../lib/linux/Debug/libbox2d.a \ + ../../../lib/linux/Debug/libchipmunk.a + +SHAREDLIBS += -lglfw -lcurl -llua +SHAREDLIBS += -Wl,-rpath,../../../../../cocos2dx/platform/third_party/linux/glew-1.7.0/glew-1.7.0/lib +SHAREDLIBS += -L../../../cocos2dx/platform/third_party/linux/glew-1.7.0/glew-1.7.0/lib -lGLEW +SHAREDLIBS += -Wl,-rpath,../../../../../lib/linux/Debug + +ifeq ($(LBITS),64) +SHAREDLIBS += -L../../../CocosDenshion/third_party/fmod/lib64/api/lib -lfmodex64 -Wl,-rpath,../../../../../CocosDenshion/third_party/fmod/lib64/api/lib +else +SHAREDLIBS += -L../../../CocosDenshion/third_party/fmod/api/lib -lfmodex -Wl,-rpath,../../../../../CocosDenshion/third_party/fmod/api/lib +endif + +#$(shell ../../build-linux.sh $<) + +BIN_DIR_ROOT=bin +BIN_DIR = $(BIN_DIR_ROOT) + +debug: BIN_DIR = $(BIN_DIR_ROOT)/debug +debug: CCFLAGS += -g3 -O0 +debug: CXXFLAGS += -g3 -O0 +debug: SHAREDLIBS += -L../../../lib/linux/Debug -lcocos2d -lrt -lz -lcocosdenshion +debug: SHAREDLIBS += -Wl,-rpath,../../../../../lib/linux/Debug/ +debug: DEFINES += -DDEBUG +debug: $(TARGET) + +release: BIN_DIR = $(BIN_DIR_ROOT)/release +release: CCFLAGS += -O3 +release: CXXFLAGS += -O3 +release: SHAREDLIBS += -L../../../lib/linux/Release -lcocos2d -lrt -lz -lcocosdenshion +release: SHAREDLIBS += -Wl,-rpath,../../../../../lib/linux/Release/ +release: DEFINES += -DNDEBUG +release: $(TARGET) + +####### Build rules +$(TARGET): $(OBJECTS) + mkdir -p $(BIN_DIR) + cp -R ../../../samples/TestCpp/Resources ../../../samples/TestLua/ + $(CXX) $(CXXFLAGS) $(INCLUDES) $(DEFINES) $(OBJECTS) -o $(BIN_DIR)/$(TARGET) $(SHAREDLIBS) $(STATICLIBS) + +####### Compile +%.o: %.cpp + $(CXX) $(CXXFLAGS) $(INCLUDES) $(DEFINES) $(VISIBILITY) -c $< -o $@ + +%.o: %.c + $(CC) $(CCFLAGS) $(INCLUDES) $(DEFINES) $(VISIBILITY) -c $< -o $@ + +clean: + rm -f $(OBJECTS) $(TARGET) core diff --git a/samples/TestLua/proj.linux/main.cpp b/samples/TestLua/proj.linux/main.cpp new file mode 100644 index 0000000000..71776a9eba --- /dev/null +++ b/samples/TestLua/proj.linux/main.cpp @@ -0,0 +1,35 @@ +#include "main.h" + +#include "../Classes/AppDelegate.h" +#include "cocos2d.h" +#include "CCEGLView.h" + +#include +#include +#include +#include + +USING_NS_CC; + +// 500 is enough? +#define MAXPATHLEN 500 + +int main(int argc, char **argv) +{ + // get application path + int length; + char fullpath[MAXPATHLEN]; + length = readlink("/proc/self/exe", fullpath, sizeof(fullpath)); + fullpath[length] = '\0'; + + std::string resourcePath = fullpath; + resourcePath = resourcePath.substr(0, resourcePath.find_last_of("/")); + resourcePath += "/../../../Resources/"; + + // create the application instance + AppDelegate app; + CCApplication::sharedApplication()->setResourceRootPath(resourcePath.c_str()); + CCEGLView* eglView = CCEGLView::sharedOpenGLView(); + eglView->setFrameSize(480, 320); + return CCApplication::sharedApplication()->run(); +} diff --git a/samples/TestLua/proj.linux/main.h b/samples/TestLua/proj.linux/main.h new file mode 100644 index 0000000000..86022e430a --- /dev/null +++ b/samples/TestLua/proj.linux/main.h @@ -0,0 +1,13 @@ +#ifndef __MAIN_H__ +#define __MAIN_H__ + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + +// Windows Header Files: +//#include +//#include + +// C RunTime Header Files +#include "CCStdC.h" + +#endif // __MAIN_H__ diff --git a/scripting/lua/cocos2dx_support/LuaCocos2d.cpp.REMOVED.git-id b/scripting/lua/cocos2dx_support/LuaCocos2d.cpp.REMOVED.git-id index af907be967..8680cb7a43 100644 --- a/scripting/lua/cocos2dx_support/LuaCocos2d.cpp.REMOVED.git-id +++ b/scripting/lua/cocos2dx_support/LuaCocos2d.cpp.REMOVED.git-id @@ -1 +1 @@ -fb55025330e8a2805460df5913b0a398c9120ed2 \ No newline at end of file +87d2d5f3746fe0c0800a9339f99ae940013066e8 \ No newline at end of file diff --git a/scripting/lua/proj.linux/.cproject b/scripting/lua/proj.linux/.cproject new file mode 100644 index 0000000000..5a09d65ece --- /dev/null +++ b/scripting/lua/proj.linux/.cproject @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/scripting/lua/proj.linux/.project b/scripting/lua/proj.linux/.project new file mode 100644 index 0000000000..ac1d4603ee --- /dev/null +++ b/scripting/lua/proj.linux/.project @@ -0,0 +1,40 @@ + + + liblua + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + lua + 2 + PARENT-1-PROJECT_LOC/lua + + + tolua + 2 + PARENT-1-PROJECT_LOC/tolua + + + + diff --git a/scripting/lua/proj.linux/Makefile b/scripting/lua/proj.linux/Makefile new file mode 100644 index 0000000000..ca4f3f0120 --- /dev/null +++ b/scripting/lua/proj.linux/Makefile @@ -0,0 +1,75 @@ +CC = gcc +CXX = g++ +TARGET = liblua.so +CCFLAGS = -Wall -fPIC +CXXFLAGS = -Wall -fPIC +VISIBILITY = + +LBITS := $(shell getconf LONG_BIT) +INCLUDES = -I../lua \ + -I../tolua \ + +DEFINES = -DLINUX + +OBJECTS = ../lua/lapi.o \ + ../lua/lauxlib.o \ + ../lua/lbaselib.o \ + ../lua/lcode.o \ + ../lua/ldblib.o \ + ../lua/ldebug.o \ + ../lua/ldo.o \ + ../lua/ldump.o \ + ../lua/lfunc.o \ + ../lua/lgc.o \ + ../lua/linit.o \ + ../lua/liolib.o \ + ../lua/llex.o \ + ../lua/lmathlib.o \ + ../lua/lmem.o \ + ../lua/loadlib.o \ + ../lua/lobject.o \ + ../lua/lopcodes.o \ + ../lua/loslib.o \ + ../lua/lparser.o \ + ../lua/lstate.o \ + ../lua/lstring.o \ + ../lua/lstrlib.o \ + ../lua/ltable.o \ + ../lua/ltablib.o \ + ../lua/ltm.o \ + ../lua/lua.o \ + ../lua/lundump.o \ + ../lua/lvm.o \ + ../lua/lzio.o \ + ../lua/print.o \ + ../tolua/tolua_event.o \ + ../tolua/tolua_is.o \ + ../tolua/tolua_map.o \ + ../tolua/tolua_push.o \ + ../tolua/tolua_to.o + +STATICLIBS = + +debug: CCFLAGS += -g3 -O0 +debug: CXXFLAGS += -g3 -O0 +debug: DEFINES += -DDEBUG +debug: $(TARGET) + +release: CCFLAGS += -O3 +release: CXXFLAGS += -O3 +release: DEFINES += -DNDEBUG +release: $(TARGET) + +####### Build rules +$(TARGET): $(OBJECTS) + $(CXX) $(CXXFLAGS) $(INCLUDES) $(DEFINES) $(OBJECTS) -shared -o $(TARGET) $(SHAREDLIBS) $(STATICLIBS) + +####### Compile +%.o: %.cpp + $(CXX) $(CXXFLAGS) $(INCLUDES) $(DEFINES) $(VISIBILITY) -c $< -o $@ + +%.o: %.c + $(CC) $(CCFLAGS) $(INCLUDES) $(DEFINES) $(VISIBILITY) -c $< -o $@ + +clean: + rm -f $(OBJECTS) $(TARGET) core diff --git a/tools/tolua++/build.php b/tools/tolua++/build.php index cd92f45edb..dda9988473 100644 --- a/tools/tolua++/build.php +++ b/tools/tolua++/build.php @@ -12,7 +12,14 @@ defined('DS') or define('DS', DIRECTORY_SEPARATOR); define('SRC_DIR', __DIR__ . DS); define('OUT_DIR', dirname(__DIR__) . '/../scripting/lua/cocos2dx_support/'); -define('TOLUA_BIN', (DS == '\\') ? 'tolua++.exe' : '/usr/local/bin/tolua++'); +if (PHP_OS == 'Linux') +{ + define('TOLUA_BIN', '/usr/bin/tolua++5.1'); +} +else +{ + define('TOLUA_BIN', (DS == '\\') ? 'tolua++.exe' : '/usr/local/bin/tolua++'); +} class Builder { @@ -131,6 +138,11 @@ $replace = ' THE SOFTWARE. ****************************************************************************/ +#ifdef __GNUC__ +#define __VA_COPY(to, from) va_copy((to), (from)) +#else +#define __VA_COPY(to, from) ((to) = (from)) +#endif '; $FIX[$find] = $replace; @@ -250,6 +262,15 @@ EOT; $replace = ''; $FIX[$find] = $replace; +$find = << Date: Thu, 6 Dec 2012 14:57:03 +0800 Subject: [PATCH 2/2] Updated eclipse project configurations for linux --- samples/HelloLua/proj.linux/.cproject | 6 +++++- samples/HelloLua/proj.linux/.project | 4 +++- samples/TestLua/proj.linux/.cproject | 16 ++++++++++------ samples/TestLua/proj.linux/.project | 6 +++++- .../LuaCocos2d.cpp.REMOVED.git-id | 2 +- 5 files changed, 24 insertions(+), 10 deletions(-) diff --git a/samples/HelloLua/proj.linux/.cproject b/samples/HelloLua/proj.linux/.cproject index fe7110a98e..c01d627a23 100644 --- a/samples/HelloLua/proj.linux/.cproject +++ b/samples/HelloLua/proj.linux/.cproject @@ -1,5 +1,7 @@ - + + + @@ -74,6 +76,7 @@ @@ -119,7 +122,7 @@ - @@ -141,7 +144,7 @@ - - diff --git a/samples/TestLua/proj.linux/.project b/samples/TestLua/proj.linux/.project index 6634811e8d..9b6bf99e14 100644 --- a/samples/TestLua/proj.linux/.project +++ b/samples/TestLua/proj.linux/.project @@ -3,6 +3,11 @@ TestLua + libBox2D + libChipmunk + libcocos2d + libCocosDenshion + liblua @@ -37,4 +42,3 @@ - diff --git a/scripting/lua/cocos2dx_support/LuaCocos2d.cpp.REMOVED.git-id b/scripting/lua/cocos2dx_support/LuaCocos2d.cpp.REMOVED.git-id index 97b91736cd..5bd202bfae 100644 --- a/scripting/lua/cocos2dx_support/LuaCocos2d.cpp.REMOVED.git-id +++ b/scripting/lua/cocos2dx_support/LuaCocos2d.cpp.REMOVED.git-id @@ -1 +1 @@ -82c746a075d2fda3f8af4ab4b8f3bfdfe4110252 \ No newline at end of file +4f0d6e6f0679ecaf137538e9de6bdce47bfcabe7 \ No newline at end of file