extract ui,network and storage from cocos2d module and adjust relate CMakeLists.txt

This commit is contained in:
samuele3hu 2014-08-07 13:53:13 +08:00
parent 497847f7e8
commit aa4f407851
9 changed files with 90 additions and 45 deletions

View File

@ -229,6 +229,15 @@ add_subdirectory(cocos/audio)
# cocos2d library # cocos2d library
add_subdirectory(cocos) add_subdirectory(cocos)
# network library
add_subdirectory(cocos/network)
# ui library
add_subdirectory(cocos/ui)
# sqlite3 library
add_subdirectory(cocos/storage)
if(BUILD_EXTENSIONS) if(BUILD_EXTENSIONS)
# extensions # extensions
add_subdirectory(extensions) add_subdirectory(extensions)

View File

@ -14,10 +14,7 @@ include(physics/CMakeLists.txt)
include(math/CMakeLists.txt) include(math/CMakeLists.txt)
include(renderer/CMakeLists.txt) include(renderer/CMakeLists.txt)
include(base/CMakeLists.txt) include(base/CMakeLists.txt)
include(ui/CMakeLists.txt)
include(deprecated/CMakeLists.txt) include(deprecated/CMakeLists.txt)
include(network/CMakeLists.txt)
include(storage/CMakeLists.txt)
add_library(cocos2d STATIC add_library(cocos2d STATIC
${COCOS_SRC} ${COCOS_SRC}
@ -28,9 +25,6 @@ add_library(cocos2d STATIC
${COCOS_RENDERER_SRC} ${COCOS_RENDERER_SRC}
${COCOS_MATH_SRC} ${COCOS_MATH_SRC}
${COCOS_PHYSICS_SRC} ${COCOS_PHYSICS_SRC}
${COCOS_UI_SRC}
${COCOS_NETWORK_SRC}
${COCOS_STORAGE_SRC}
${COCOS_DEPRECATED_SRC} ${COCOS_DEPRECATED_SRC}
) )
@ -95,8 +89,6 @@ target_link_libraries(cocos2d
tinyxml2 tinyxml2
unzip unzip
xxhash xxhash
${COCOS_STORAGE_LINK}
${COCOS_NETWORK_LINK}
${COCOS_LINK} ${COCOS_LINK}
) )

View File

@ -1,6 +1,6 @@
if(WIN32) if(WIN32)
set(PLATFORM_SRC set(PLATFORM_SRC
network/WebSocket.cpp WebSocket.cpp
) )
set(PLATFORM_LINK set(PLATFORM_LINK
@ -8,7 +8,7 @@ if(WIN32)
) )
elseif(NOT APPLE) elseif(NOT APPLE)
set(PLATFORM_SRC set(PLATFORM_SRC
network/WebSocket.cpp WebSocket.cpp
) )
set(PLATFORM_LINK set(PLATFORM_LINK
@ -19,11 +19,15 @@ elseif(NOT APPLE)
endif() endif()
set(COCOS_NETWORK_SRC set(COCOS_NETWORK_SRC
network/HttpClient.cpp HttpClient.cpp
network/SocketIO.cpp SocketIO.cpp
${PLATFORM_SRC} ${PLATFORM_SRC}
) )
add_library(network STATIC
${COCOS_NETWORK_SRC}
)
IF (WIN32 AND NOT MINGW) IF (WIN32 AND NOT MINGW)
set(COCOS_NETWORK_LINK set(COCOS_NETWORK_LINK
libcurl_imp libcurl_imp
@ -35,3 +39,13 @@ ELSE()
${PLATFORM_LINK} ${PLATFORM_LINK}
) )
ENDIF() ENDIF()
target_link_libraries(network
${COCOS_NETWORK_LINK}
)
set_target_properties(network
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
)

View File

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

View File

@ -1,27 +1,47 @@
set(COCOS_UI_SRC set(COCOS_UI_SRC
ui/CocosGUI.cpp CocosGUI.cpp
ui/UIButton.cpp UIButton.cpp
ui/UICheckBox.cpp UICheckBox.cpp
ui/UIHBox.cpp UIHBox.cpp
ui/UIHelper.cpp UIHelper.cpp
ui/UIImageView.cpp UIImageView.cpp
ui/UILayout.cpp UILayout.cpp
ui/UILayoutParameter.cpp UILayoutParameter.cpp
ui/UILayoutManager.cpp UILayoutManager.cpp
ui/UIListView.cpp UIListView.cpp
ui/UILoadingBar.cpp UILoadingBar.cpp
ui/UIPageView.cpp UIPageView.cpp
ui/UIRelativeBox.cpp UIRelativeBox.cpp
ui/UIRichText.cpp UIRichText.cpp
ui/UIScrollView.cpp UIScrollView.cpp
ui/UISlider.cpp UISlider.cpp
ui/UITextAtlas.cpp UITextAtlas.cpp
ui/UITextBMFont.cpp UITextBMFont.cpp
ui/UIText.cpp UIText.cpp
ui/UITextField.cpp UITextField.cpp
ui/UIVBox.cpp UIVBox.cpp
ui/UIWidget.cpp UIWidget.cpp
ui/UIDeprecated.cpp UIDeprecated.cpp
ui/UIScale9Sprite.cpp UIScale9Sprite.cpp
)
include_directories(
ui
../../base
)
add_library(ui STATIC
${COCOS_UI_SRC}
)
target_link_libraries(ui
cocos2d
)
set_target_properties(ui
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
) )

View File

@ -148,11 +148,9 @@ set(FMOD_LIB "fmodex")
endif() endif()
target_link_libraries(${APP_NAME} target_link_libraries(${APP_NAME}
luabinding luacocos2d
spine luacocosdenshion
cocostudio luanetwork
cocosbuilder
extensions
audio audio
cocos2d cocos2d
xxtea xxtea

View File

@ -206,6 +206,9 @@ target_link_libraries(${APP_NAME}
audio audio
cocos2d cocos2d
box2d box2d
ui
network
sqlite3
) )
set(APP_BIN_DIR "${CMAKE_BINARY_DIR}/bin/${APP_NAME}") set(APP_BIN_DIR "${CMAKE_BINARY_DIR}/bin/${APP_NAME}")

View File

@ -7,7 +7,7 @@ set(SAMPLE_SRC
include_directories( include_directories(
Classes Classes
../../../cocos/scripting/lua/bindings ../../../cocos/scripting/lua-bindings
../../../external/lua/lua ../../../external/lua/lua
../../../external/lua/tolua ../../../external/lua/tolua
) )
@ -23,6 +23,7 @@ target_link_libraries(${APP_NAME}
luanetwork luanetwork
audio audio
cocos2d cocos2d
network
) )
set(APP_BIN_DIR "${CMAKE_BINARY_DIR}/bin/${APP_NAME}") set(APP_BIN_DIR "${CMAKE_BINARY_DIR}/bin/${APP_NAME}")

View File

@ -33,6 +33,8 @@ target_link_libraries(${APP_NAME}
spine spine
cocosbuilder cocosbuilder
extensions extensions
ui
network
) )
set(APP_BIN_DIR "${CMAKE_BINARY_DIR}/bin/${APP_NAME}") set(APP_BIN_DIR "${CMAKE_BINARY_DIR}/bin/${APP_NAME}")