Merge pull request #6539 from ricardoquesada/cmake_improvements

linux cmake improvements
This commit is contained in:
Ricardo Quesada 2014-05-01 13:02:50 -07:00
commit aa51fbd8db
14 changed files with 307 additions and 392 deletions

View File

@ -38,9 +38,6 @@ option(USE_CHIPMUNK "Use chipmunk for physics library" ON)
option(USE_BOX2D "Use box2d for physics library" OFF)
option(DEBUG_MODE "Debug or release?" ON)
option(BUILD_LIBS_LUA "Build lua libraries" OFF)
option(BUILD_GUI "Build GUI library" ON)
option(BUILD_NETWORK "Build network library" ON)
option(BUILD_STORAGE "Build storage library" ON)
option(BUILD_EXTENSIONS "Build extension library" ON)
option(BUILD_EDITOR_SPINE "Build editor support for spine" ON)
option(BUILD_EDITOR_COCOSTUDIO "Build editor support for cocostudio" ON)
@ -54,9 +51,6 @@ option(USE_CHIPMUNK "Use chipmunk for physics library" ON)
option(USE_BOX2D "Use box2d for physics library" OFF)
option(DEBUG_MODE "Debug or release?" ON)
option(BUILD_LIBS_LUA "Build lua libraries" ON)
option(BUILD_GUI "Build GUI library" ON)
option(BUILD_NETWORK "Build network library" ON)
option(BUILD_STORAGE "Build storage library" ON)
option(BUILD_EXTENSIONS "Build extension library" ON)
option(BUILD_EDITOR_SPINE "Build editor support for spine" ON)
option(BUILD_EDITOR_COCOSTUDIO "Build editor support for cocostudio" ON)
@ -136,6 +130,7 @@ endif()
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/cocos
${CMAKE_CURRENT_SOURCE_DIR}/cocos/audio/include
${CMAKE_CURRENT_SOURCE_DIR}/cocos/editor-support
${CMAKE_CURRENT_SOURCE_DIR}/cocos/scripting/lua-bindings/auto
${CMAKE_CURRENT_SOURCE_DIR}/cocos/scripting/lua-bindings/manual
@ -227,32 +222,8 @@ add_subdirectory(external/xxhash)
# audio
add_subdirectory(cocos/audio)
# cocos renderer library
add_subdirectory(cocos/renderer)
# cocos math library
add_subdirectory(cocos/math)
# cocos2d library
add_subdirectory(cocos/2d)
# cocos base library
add_subdirectory(cocos/base)
if(BUILD_STORAGE)
# cocos storage
add_subdirectory(cocos/storage)
endif(BUILD_STORAGE)
if(BUILD_GUI)
# ui
add_subdirectory(cocos/ui)
endif(BUILD_GUI)
if(BUILD_NETWORK)
# network
add_subdirectory(cocos/network)
endif(BUILD_NETWORK)
add_subdirectory(cocos)
if(BUILD_EXTENSIONS)
# extensions

View File

@ -2,201 +2,117 @@ if(WIN32)
ADD_DEFINITIONS(-DUNICODE -D_UNICODE)
set(PLATFORM_SRC
platform/win32/CCStdC.cpp
platform/win32/CCFileUtilsWin32.cpp
platform/win32/CCCommon.cpp
platform/win32/CCApplication.cpp
platform/desktop/CCGLView.cpp
platform/win32/CCDevice.cpp
set(COCOS_2D_PLATFORM_SRC
2d/platform/win32/CCStdC.cpp
2d/platform/win32/CCFileUtilsWin32.cpp
2d/platform/win32/CCCommon.cpp
2d/platform/win32/CCApplication.cpp
2d/platform/desktop/CCGLView.cpp
2d/platform/win32/CCDevice.cpp
)
elseif(APPLE)
else()
set(PLATFORM_SRC
platform/linux/CCStdC.cpp
platform/linux/CCFileUtilsLinux.cpp
platform/linux/CCCommon.cpp
platform/linux/CCApplication.cpp
platform/desktop/CCGLView.cpp
platform/linux/CCDevice.cpp
set(COCOS_2D_PLATFORM_SRC
2d/platform/linux/CCStdC.cpp
2d/platform/linux/CCFileUtilsLinux.cpp
2d/platform/linux/CCCommon.cpp
2d/platform/linux/CCApplication.cpp
2d/platform/desktop/CCGLView.cpp
2d/platform/linux/CCDevice.cpp
)
endif()
set(COCOS2D_SRC
CCAction.cpp
CCActionCamera.cpp
CCActionCatmullRom.cpp
CCActionEase.cpp
CCActionGrid.cpp
CCActionGrid3D.cpp
CCActionInstant.cpp
CCActionInterval.cpp
CCActionManager.cpp
CCActionPageTurn3D.cpp
CCActionProgressTimer.cpp
CCActionTiledGrid.cpp
CCActionTween.cpp
CCAnimation.cpp
CCAnimationCache.cpp
CCAtlasNode.cpp
CCClippingNode.cpp
CCComponent.cpp
CCComponentContainer.cpp
CCDrawNode.cpp
CCDrawingPrimitives.cpp
CCFont.cpp
CCFontAtlas.cpp
CCFontAtlasCache.cpp
CCFontCharMap.cpp
CCFontFNT.cpp
CCFontFreeType.cpp
CCGLBufferedNode.cpp
CCGLProgram.cpp
CCGrabber.cpp
CCGrid.cpp
CCIMEDispatcher.cpp
CCLabel.cpp
CCLabelAtlas.cpp
CCLabelBMFont.cpp
CCLabelTTF.cpp
CCLabelTextFormatter.cpp
CCLayer.cpp
CCMenu.cpp
CCMenuItem.cpp
CCMotionStreak.cpp
CCNode.cpp
CCNodeGrid.cpp
CCParallaxNode.cpp
CCParticleBatchNode.cpp
CCParticleExamples.cpp
CCParticleSystem.cpp
CCParticleSystemQuad.cpp
CCProgressTimer.cpp
CCRenderTexture.cpp
CCScene.cpp
CCScriptSupport.cpp
CCShaderCache.cpp
CCSprite.cpp
CCSpriteBatchNode.cpp
CCSpriteFrame.cpp
CCSpriteFrameCache.cpp
CCTMXLayer.cpp
CCTMXObjectGroup.cpp
CCTMXTiledMap.cpp
CCTMXXMLParser.cpp
CCTextFieldTTF.cpp
CCTexture2D.cpp
CCTextureAtlas.cpp
CCTextureCache.cpp
CCTileMapAtlas.cpp
CCTransition.cpp
CCTransitionPageTurn.cpp
CCTransitionProgress.cpp
CCTweenFunction.cpp
CCUserDefault.cpp
CCUserDefaultAndroid.cpp
CCVertex.cpp
TGAlib.cpp
ccCArray.cpp
ccGLStateCache.cpp
ccShaders.cpp
ccUTF8.cpp
ccUtils.cpp
ccFPSImages.c
../cocos2d.cpp
platform/CCSAXParser.cpp
platform/CCThread.cpp
platform/CCGLViewProtocol.cpp
platform/CCFileUtils.cpp
platform/CCImage.cpp
../deprecated/CCDeprecated.cpp
../deprecated/CCNotificationCenter.cpp
../../external/edtaa3func/edtaa3func.cpp
)
include(../physics/CMakeLists.txt)
add_library(cocos2d STATIC
${COCOS2D_SRC}
${PLATFORM_SRC}
${COCOS_PHYSICS_SRC}
)
if(WIN32)
if(MINGW)
set(COCOS_LINK
z
jpeg
png
webp
tiff
glfw3
glew32
opengl32
iconv
freetype
bz2
)
else()
set(COCOS_LINK
libjpeg
libpng
libwebp
libtiff
freetype250
glfw3
glew32
opengl32
libiconv
libzlib
)
endif()
elseif(APPLE)
else()
set(COCOS_LINK
jpeg
webp
tiff
freetype
fontconfig
png
pthread
glfw
GLEW
GL
X11
rt
z
)
endif()
target_link_libraries(cocos2d
cocosrenderer
cocosbase
cocosmath
chipmunk_static
tinyxml2
unzip
xxhash
${COCOS_LINK}
)
set_target_properties(cocos2d
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
set(COCOS_2D_SRC
2d/CCActionCamera.cpp
2d/CCActionCatmullRom.cpp
2d/CCAction.cpp
2d/CCActionEase.cpp
2d/CCActionGrid3D.cpp
2d/CCActionGrid.cpp
2d/CCActionInstant.cpp
2d/CCActionInterval.cpp
2d/CCActionManager.cpp
2d/CCActionPageTurn3D.cpp
2d/CCActionProgressTimer.cpp
2d/CCActionTiledGrid.cpp
2d/CCActionTween.cpp
2d/CCAnimationCache.cpp
2d/CCAnimation.cpp
2d/CCAtlasNode.cpp
2d/ccCArray.cpp
2d/CCClippingNode.cpp
2d/CCComponentContainer.cpp
2d/CCComponent.cpp
2d/CCDrawingPrimitives.cpp
2d/CCDrawNode.cpp
2d/CCFontAtlasCache.cpp
2d/CCFontAtlas.cpp
2d/CCFontCharMap.cpp
2d/CCFont.cpp
2d/CCFontFNT.cpp
2d/CCFontFreeType.cpp
2d/CCGLBufferedNode.cpp
2d/CCGLProgram.cpp
2d/ccGLStateCache.cpp
2d/CCGrabber.cpp
2d/CCGrid.cpp
2d/CCIMEDispatcher.cpp
2d/CCLabelAtlas.cpp
2d/CCLabelBMFont.cpp
2d/CCLabel.cpp
2d/CCLabelTextFormatter.cpp
2d/CCLabelTTF.cpp
2d/CCLayer.cpp
2d/CCMenu.cpp
2d/CCMenuItem.cpp
2d/CCMotionStreak.cpp
2d/CCNode.cpp
2d/CCNodeGrid.cpp
2d/CCParallaxNode.cpp
2d/CCParticleBatchNode.cpp
2d/CCParticleExamples.cpp
2d/CCParticleSystem.cpp
2d/CCParticleSystemQuad.cpp
2d/CCProgressTimer.cpp
2d/CCRenderTexture.cpp
2d/CCScene.cpp
2d/CCScriptSupport.cpp
2d/CCShaderCache.cpp
2d/ccShaders.cpp
2d/CCSpriteBatchNode.cpp
2d/CCSprite.cpp
2d/CCSpriteFrameCache.cpp
2d/CCSpriteFrame.cpp
2d/CCTextFieldTTF.cpp
2d/CCTexture2D.cpp
2d/CCTextureAtlas.cpp
2d/CCTextureCache.cpp
2d/CCTileMapAtlas.cpp
2d/CCTMXLayer.cpp
2d/CCTMXObjectGroup.cpp
2d/CCTMXTiledMap.cpp
2d/CCTMXXMLParser.cpp
2d/CCTransition.cpp
2d/CCTransitionPageTurn.cpp
2d/CCTransitionProgress.cpp
2d/CCTweenFunction.cpp
2d/CCUserDefaultAndroid.cpp
2d/CCUserDefault.cpp
2d/ccUTF8.cpp
2d/ccUtils.cpp
2d/CCVertex.cpp
2d/TGAlib.cpp
2d/platform/CCSAXParser.cpp
2d/platform/CCThread.cpp
2d/platform/CCGLViewProtocol.cpp
2d/platform/CCFileUtils.cpp
2d/platform/CCImage.cpp
2d/ccFPSImages.c
../external/edtaa3func/edtaa3func.cpp
)

105
cocos/CMakeLists.txt Normal file
View File

@ -0,0 +1,105 @@
if(WIN32)
ADD_DEFINITIONS(-DUNICODE -D_UNICODE)
endif()
set(COCOS_SRC
cocos2d.cpp
)
include(2d/CMakeLists.txt)
include(physics/CMakeLists.txt)
include(math/CMakeLists.txt)
include(renderer/CMakeLists.txt)
include(base/CMakeLists.txt)
include(ui/CMakeLists.txt)
include(deprecated/CMakeLists.txt)
include(network/CMakeLists.txt)
include(storage/CMakeLists.txt)
add_library(cocos2d STATIC
${COCOS_SRC}
${COCOS_2D_SRC}
${COCOS_2D_PLATFORM_SRC}
${COCOS_BASE_SRC}
${COCOS_RENDERER_SRC}
${COCOS_MATH_SRC}
${COCOS_PHYSICS_SRC}
${COCOS_UI_SRC}
${COCOS_NETWORK_SRC}
${COCOS_STORAGE_SRC}
${COCOS_DEPRECATED_SRC}
)
if(WIN32)
if(MINGW)
set(COCOS_LINK
z
jpeg
png
webp
tiff
glfw3
glew32
opengl32
iconv
freetype
bz2
)
else()
set(COCOS_LINK
libjpeg
libpng
libwebp
libtiff
freetype250
glfw3
glew32
opengl32
libiconv
libzlib
)
endif()
elseif(APPLE)
else()
set(COCOS_LINK
jpeg
webp
tiff
freetype
fontconfig
png
pthread
glfw
GLEW
GL
X11
rt
z
)
endif()
target_link_libraries(cocos2d
chipmunk_static
tinyxml2
unzip
xxhash
${COCOS_STORAGE_LINK}
${COCOS_NETWORK_LINK}
${COCOS_LINK}
)
set_target_properties(cocos2d
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
)

View File

@ -1,62 +1,34 @@
set(COCOS_BASE_SRC
../deprecated/CCSet.cpp
../deprecated/CCArray.cpp
../deprecated/CCDictionary.cpp
../deprecated/CCString.cpp
CCAutoreleasePool.cpp
CCAutoreleasePool.h
CCConfiguration.cpp
CCConfiguration.h
CCConsole.cpp
CCConsole.h
CCData.cpp
CCData.h
CCDataVisitor.cpp
CCDataVisitor.h
CCDirector.cpp
CCDirector.h
CCEvent.cpp
CCEvent.h
CCEventAcceleration.cpp
CCEventAcceleration.h
CCEventCustom.cpp
CCEventDispatcher.cpp
CCEventKeyboard.cpp
CCEventListener.cpp
CCEventListenerAcceleration.cpp
CCEventListenerCustom.cpp
CCEventListenerKeyboard.cpp
CCEventListenerMouse.cpp
CCEventListenerTouch.cpp
CCEventMouse.cpp
CCEventTouch.cpp
CCNS.cpp
CCProfiling.cpp
CCRef.cpp
CCScheduler.cpp
CCTouch.cpp
CCValue.cpp
ZipUtils.cpp
atitc.cpp
base64.cpp
ccTypes.cpp
etc1.cpp
s3tc.cpp
)
add_library(cocosbase STATIC
${COCOS_BASE_SRC}
)
if(WIN32)
target_link_libraries(cocosbase
Ws2_32
)
endif()
set_target_properties(cocosbase
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
base/atitc.cpp
base/base64.cpp
base/CCAutoreleasePool.cpp
base/CCConfiguration.cpp
base/CCConsole.cpp
base/CCData.cpp
base/CCDataVisitor.cpp
base/CCDirector.cpp
base/CCEventAcceleration.cpp
base/CCEvent.cpp
base/CCEventCustom.cpp
base/CCEventDispatcher.cpp
base/CCEventKeyboard.cpp
base/CCEventListenerAcceleration.cpp
base/CCEventListener.cpp
base/CCEventListenerCustom.cpp
base/CCEventListenerKeyboard.cpp
base/CCEventListenerMouse.cpp
base/CCEventListenerTouch.cpp
base/CCEventMouse.cpp
base/CCEventTouch.cpp
base/CCNS.cpp
base/CCProfiling.cpp
base/CCRef.cpp
base/CCScheduler.cpp
base/CCTouch.cpp
base/ccTypes.cpp
base/CCValue.cpp
base/etc1.cpp
base/s3tc.cpp
base/ZipUtils.cpp
)

View File

@ -0,0 +1,9 @@
set(COCOS_DEPRECATED_SRC
deprecated/CCArray.cpp
deprecated/CCDeprecated.cpp
deprecated/CCDictionary.cpp
deprecated/CCNotificationCenter.cpp
deprecated/CCSet.cpp
deprecated/CCString.cpp
)

View File

@ -1,25 +1,12 @@
set(COCOS_MATH_SRC
CCAffineTransform.cpp
CCGeometry.cpp
MathUtil.cpp
Matrix.cpp
Quaternion.cpp
TransformUtils.cpp
Vector2.cpp
Vector3.cpp
Vector4.cpp
math/CCAffineTransform.cpp
math/CCGeometry.cpp
math/MathUtil.cpp
math/Matrix.cpp
math/Quaternion.cpp
math/TransformUtils.cpp
math/Vector2.cpp
math/Vector3.cpp
math/Vector4.cpp
)
add_library(cocosmath STATIC
${COCOS_MATH_SRC}
)
set_target_properties(cocosmath
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
)

View File

@ -1,6 +1,6 @@
if(WIN32)
set(PLATFORM_SRC
WebSocket.cpp
network/WebSocket.cpp
)
set(PLATFORM_LINK
@ -8,7 +8,7 @@ if(WIN32)
)
elseif(NOT APPLE)
set(PLATFORM_SRC
WebSocket.cpp
network/WebSocket.cpp
)
set(PLATFORM_LINK
@ -18,24 +18,13 @@ elseif(NOT APPLE)
)
endif()
set(NETWORK_SRC
HttpClient.cpp
SocketIO.cpp
set(COCOS_NETWORK_SRC
network/HttpClient.cpp
network/SocketIO.cpp
${PLATFORM_SRC}
)
add_library(network STATIC
${NETWORK_SRC}
)
target_link_libraries(network
set(COCOS_NETWORK_LINK
curl
${PLATFORM_LINK}
)
set_target_properties(network
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
)

View File

@ -1,13 +1,13 @@
set(COCOS_PHYSICS_SRC
../physics/chipmunk/CCPhysicsContactInfo_chipmunk.cpp
../physics/chipmunk/CCPhysicsJointInfo_chipmunk.cpp
../physics/chipmunk/CCPhysicsShapeInfo_chipmunk.cpp
../physics/chipmunk/CCPhysicsBodyInfo_chipmunk.cpp
../physics/chipmunk/CCPhysicsWorldInfo_chipmunk.cpp
../physics/CCPhysicsBody.cpp
../physics/CCPhysicsContact.cpp
../physics/CCPhysicsShape.cpp
../physics/CCPhysicsJoint.cpp
../physics/CCPhysicsWorld.cpp
physics/chipmunk/CCPhysicsContactInfo_chipmunk.cpp
physics/chipmunk/CCPhysicsJointInfo_chipmunk.cpp
physics/chipmunk/CCPhysicsShapeInfo_chipmunk.cpp
physics/chipmunk/CCPhysicsBodyInfo_chipmunk.cpp
physics/chipmunk/CCPhysicsWorldInfo_chipmunk.cpp
physics/CCPhysicsBody.cpp
physics/CCPhysicsContact.cpp
physics/CCPhysicsShape.cpp
physics/CCPhysicsJoint.cpp
physics/CCPhysicsWorld.cpp
)

View File

@ -1,19 +1,9 @@
set(COCOS_RENDERER_SRC
CCBatchCommand.cpp
CCCustomCommand.cpp
CCGroupCommand.cpp
CCQuadCommand.cpp
CCRenderCommand.cpp
CCRenderer.cpp
)
add_library(cocosrenderer STATIC
${COCOS_RENDERER_SRC}
)
set_target_properties(cocosrenderer
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
renderer/CCBatchCommand.cpp
renderer/CCCustomCommand.cpp
renderer/CCGroupCommand.cpp
renderer/CCQuadCommand.cpp
renderer/CCRenderCommand.cpp
renderer/CCRenderer.cpp
)

View File

@ -1,18 +1,9 @@
SET(STORAGE_SOURCES
local-storage/LocalStorage.cpp
set(COCOS_STORAGE_SRC
storage/local-storage/LocalStorage.cpp
)
add_library(storage STATIC
${STORAGE_SOURCES}
)
target_link_libraries(storage
set(COCOS_STORAGE_LINK
sqlite3
)
set_target_properties(storage
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
)

View File

@ -1,35 +1,26 @@
set(GUI_SRC
UIWidget.cpp
UILayout.cpp
UILayoutParameter.cpp
UILayoutDefine.cpp
CocosGUI.cpp
UIHelper.cpp
UIListView.cpp
UIPageView.cpp
UIScrollView.cpp
UIButton.cpp
UICheckBox.cpp
UIImageView.cpp
UIText.cpp
UITextAtlas.cpp
UITextBMFont.cpp
UILoadingBar.cpp
UISlider.cpp
UITextField.cpp
UIRichText.cpp
CCProtectedNode.cpp
UIHBox.cpp
UIVBox.cpp
UIRelativeBox.cpp
set(COCOS_UI_SRC
ui/CCProtectedNode.cpp
ui/CocosGUI.cpp
ui/UIButton.cpp
ui/UICheckBox.cpp
ui/UIHBox.cpp
ui/UIHelper.cpp
ui/UIImageView.cpp
ui/UILayout.cpp
ui/UILayoutDefine.cpp
ui/UILayoutParameter.cpp
ui/UIListView.cpp
ui/UILoadingBar.cpp
ui/UIPageView.cpp
ui/UIRelativeBox.cpp
ui/UIRichText.cpp
ui/UIScrollView.cpp
ui/UISlider.cpp
ui/UITextAtlas.cpp
ui/UITextBMFont.cpp
ui/UIText.cpp
ui/UITextField.cpp
ui/UIVBox.cpp
ui/UIWidget.cpp
)
add_library(ui STATIC
${GUI_SRC}
)
set_target_properties(ui
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
)

View File

@ -193,8 +193,6 @@ add_executable(${APP_NAME}
)
target_link_libraries(${APP_NAME}
ui
network
spine
cocostudio
cocosbuilder

View File

@ -19,8 +19,6 @@ add_executable(${APP_NAME}
target_link_libraries(${APP_NAME}
luabinding
ui
network
cocostudio
cocosbuilder
extensions

View File

@ -20,8 +20,6 @@ add_executable(${APP_NAME}
target_link_libraries(${APP_NAME}
luabinding
ui
network
cocostudio
cocosbuilder
extensions