Updated Makefiles for linux port.

This commit is contained in:
James Chen 2012-08-27 16:43:02 +08:00
parent 6681cf74ef
commit dd26a2fcd8
7 changed files with 45 additions and 22 deletions

View File

@ -84,7 +84,8 @@ const char* CCFileUtils::fullPathFromRelativePath(const char *pszRelativePath)
} }
const char *CCFileUtils::fullPathFromRelativeFile(const char *pszFilename, const char *pszRelativeFile) { const char *CCFileUtils::fullPathFromRelativeFile(const char *pszFilename, const char *pszRelativeFile)
{
std::string relativeFile = pszRelativeFile; std::string relativeFile = pszRelativeFile;
CCString *pRet = new CCString(); CCString *pRet = new CCString();
pRet->autorelease(); pRet->autorelease();
@ -93,15 +94,21 @@ const char *CCFileUtils::fullPathFromRelativeFile(const char *pszFilename, const
return pRet->m_sString.c_str(); return pRet->m_sString.c_str();
} }
unsigned char* CCFileUtils::getFileData(const char* pszFileName, const char* pszMode, unsigned long * pSize) { unsigned char* CCFileUtils::getFileData(const char* pszFileName, const char* pszMode, unsigned long * pSize)
{
string fullPath = pszFileName; string fullPath = pszFileName;
unsigned char * pData = 0; unsigned char * pData = 0;
if (!pszFileName || !pszMode)
{
return 0;
}
do do
{ {
fullPath = fullPathFromRelativePath(fullPath.c_str());
// read rrom other path than user set it // read rrom other path than user set it
FILE *fp = fopen(pszFileName, pszMode); FILE *fp = fopen(fullPath.c_str(), pszMode);
CC_BREAK_IF(!fp); CC_BREAK_IF(!fp);
fseek(fp,0,SEEK_END); fseek(fp,0,SEEK_END);
@ -123,7 +130,8 @@ unsigned char* CCFileUtils::getFileData(const char* pszFileName, const char* psz
} }
string CCFileUtils::getWriteablePath() { string CCFileUtils::getWriteablePath()
{
//return current resource path //return current resource path
return CCApplication::sharedApplication()->getResourceRootPath(); return CCApplication::sharedApplication()->getResourceRootPath();
} }

View File

@ -42,15 +42,19 @@ STATICLIBS = $(STATICLIBS_DIR)/libfreetype.a \
# $(STATICLIBS_DIR)/libGLEW.a \ # $(STATICLIBS_DIR)/libGLEW.a \
SHAREDLIBS = -L../../../lib/linux/Debug -lcocos2d -lrt -lz -lcocosdenshion -Wl,-rpath,../../../lib/linux/Debug/ SHAREDLIBS = -L../../../lib/linux/Debug -lcocos2d -lrt -lz -lcocosdenshion -Wl,-rpath,../../../../lib/linux/Debug/
SHAREDLIBS += -lglfw -lcurl SHAREDLIBS += -lglfw -lcurl
SHAREDLIBS += -Wl,-rpath,../../../cocos2dx/platform/third_party/linux/glew-1.7.0/glew-1.7.0/lib 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 += -L../../../cocos2dx/platform/third_party/linux/glew-1.7.0/glew-1.7.0/lib -lGLEW
#$(shell ../../build-linux.sh $<) #$(shell ../../build-linux.sh $<)
BIN_DIR=bin
####### Build rules ####### Build rules
$(TARGET): $(OBJECTS) $(TARGET): $(OBJECTS)
$(CXX) $(CXXFLAGS) $(INCLUDES) $(DEFINES) $(OBJECTS) -o $(TARGET) $(SHAREDLIBS) $(STATICLIBS) test -d $(BIN_DIR) || mkdir $(BIN_DIR)
$(CXX) $(CXXFLAGS) $(INCLUDES) $(DEFINES) $(OBJECTS) -o $(BIN_DIR)/$(TARGET) $(SHAREDLIBS) $(STATICLIBS)
####### Compile ####### Compile
%.o: %.cpp %.o: %.cpp
@ -61,3 +65,4 @@ $(TARGET): $(OBJECTS)
clean: clean:
rm -f $(OBJECTS) $(TARGET) core rm -f $(OBJECTS) $(TARGET) core
rm -r $(BIN_DIR)

View File

@ -24,7 +24,7 @@ int main(int argc, char **argv)
std::string resourcePath = fullpath; std::string resourcePath = fullpath;
resourcePath = resourcePath.substr(0, resourcePath.find_last_of("/")); resourcePath = resourcePath.substr(0, resourcePath.find_last_of("/"));
resourcePath += "/../Resources/"; resourcePath += "/../../Resources/";
// create the application instance // create the application instance
AppDelegate app; AppDelegate app;

View File

@ -147,19 +147,22 @@ endif
SHAREDLIBS += -lglfw -lGL SHAREDLIBS += -lglfw -lGL
#SHAREDLIBS += -lGLEW #SHAREDLIBS += -lGLEW
SHAREDLIBS += -L../../../lib/linux/Debug -lcocos2d -lrt -lz -lcocosdenshion -Wl,-rpath,../../../lib/linux/Debug/ SHAREDLIBS += -L../../../lib/linux/Debug -lcocos2d -lrt -lz -lcocosdenshion -Wl,-rpath,../../../../lib/linux/Debug/
SHAREDLIBS += -Wl,-rpath,$(SHAREDLIBS_DIR) SHAREDLIBS += -Wl,-rpath,../$(SHAREDLIBS_DIR)
SHAREDLIBS += -Wl,-rpath,../../../cocos2dx/platform/third_party/linux/glew-1.7.0/glew-1.7.0/lib 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 += -L../../../cocos2dx/platform/third_party/linux/glew-1.7.0/glew-1.7.0/lib -lGLEW
SHAREDLIBS += -Wl,-rpath,$(STATICLIBS_DIR) SHAREDLIBS += -Wl,-rpath,../$(STATICLIBS_DIR)
SHAREDLIBS += -lcurl SHAREDLIBS += -lcurl
BIN_DIR=bin
####### Build rules ####### Build rules
$(TARGET): $(OBJECTS) $(TARGET): $(OBJECTS)
$(CXX) $(CXXFLAGS) $(INCLUDES) $(DEFINES) $(OBJECTS) -o $(TARGET) $(SHAREDLIBS) $(STATICLIBS) $(LIBS) test -d $(BIN_DIR) || mkdir $(BIN_DIR)
$(CXX) $(CXXFLAGS) $(INCLUDES) $(DEFINES) $(OBJECTS) -o $(BIN_DIR)/$(TARGET) $(SHAREDLIBS) $(STATICLIBS) $(LIBS)
####### Compile ####### Compile
%.o: %.cpp %.o: %.cpp
$(CXX) $(CXXFLAGS) $(INCLUDES) $(DEFINES) $(VISIBILITY) -c $< -o $@ $(CXX) $(CXXFLAGS) $(INCLUDES) $(DEFINES) $(VISIBILITY) -c $< -o $@
@ -167,5 +170,7 @@ $(TARGET): $(OBJECTS)
%.o: %.c %.o: %.c
$(CC) $(CCFLAGS) $(INCLUDES) $(DEFINES) $(VISIBILITY) -c $< -o $@ $(CC) $(CCFLAGS) $(INCLUDES) $(DEFINES) $(VISIBILITY) -c $< -o $@
clean: clean:
rm -f $(OBJECTS) $(TARGET) core rm -f $(OBJECTS) $(TARGET) core
rm -r $(BIN_DIR)

View File

@ -24,7 +24,7 @@ int main(int argc, char **argv)
std::string resourcePath = fullpath; std::string resourcePath = fullpath;
resourcePath = resourcePath.substr(0, resourcePath.find_last_of("/")); resourcePath = resourcePath.substr(0, resourcePath.find_last_of("/"));
resourcePath += "/../Resources/"; resourcePath += "/../../Resources/";
// create the application instance // create the application instance
AppDelegate app; AppDelegate app;

View File

@ -55,17 +55,21 @@ SHAREDLIBS_DIR = ../../../CocosDenshion/third_party/fmod/api/lib
SHAREDLIBS = -L$(SHAREDLIBS_DIR) -lfmodex SHAREDLIBS = -L$(SHAREDLIBS_DIR) -lfmodex
endif endif
SHAREDLIBS += -L../../../lib/linux/Debug -lcocos2d -lrt -lz -lcocosdenshion -Wl,-rpath,../../../lib/linux/Debug/ SHAREDLIBS += -L../../../lib/linux/Debug -lcocos2d -lrt -lz -lcocosdenshion -Wl,-rpath,../../../../lib/linux/Debug/
SHAREDLIBS += -lglfw -lcurl SHAREDLIBS += -lglfw -lcurl
#SHAREDLIBS += -lGLEW #SHAREDLIBS += -lGLEW
SHAREDLIBS += -Wl,-rpath,$(SHAREDLIBS_DIR) SHAREDLIBS += -Wl,-rpath,../$(SHAREDLIBS_DIR)
SHAREDLIBS += -Wl,-rpath,../../../cocos2dx/platform/third_party/linux/glew-1.7.0/glew-1.7.0/lib 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 += -L../../../cocos2dx/platform/third_party/linux/glew-1.7.0/glew-1.7.0/lib -lGLEW
#$(shell ../../build-linux.sh $<) #$(shell ../../build-linux.sh $<)
BIN_DIR=bin
####### Build rules ####### Build rules
$(TARGET): $(OBJECTS) $(TARGET): $(OBJECTS)
$(CXX) $(CXXFLAGS) $(INCLUDES) $(DEFINES) $(OBJECTS) -o $(TARGET) $(SHAREDLIBS) $(STATICLIBS) test -d $(BIN_DIR) || mkdir $(BIN_DIR)
$(CXX) $(CXXFLAGS) $(INCLUDES) $(DEFINES) $(OBJECTS) -o $(BIN_DIR)/$(TARGET) $(SHAREDLIBS) $(STATICLIBS)
####### Compile ####### Compile
%.o: %.cpp %.o: %.cpp
@ -76,3 +80,4 @@ $(TARGET): $(OBJECTS)
clean: clean:
rm -f $(OBJECTS) $(TARGET) core rm -f $(OBJECTS) $(TARGET) core
rm -r $(BIN_DIR)

View File

@ -24,7 +24,7 @@ int main(int argc, char **argv)
std::string resourcePath = fullpath; std::string resourcePath = fullpath;
resourcePath = resourcePath.substr(0, resourcePath.find_last_of("/")); resourcePath = resourcePath.substr(0, resourcePath.find_last_of("/"));
resourcePath += "/../Resources/"; resourcePath += "/../../Resources/";
// create the application instance // create the application instance
AppDelegate app; AppDelegate app;