diff --git a/CMakeLists.txt b/CMakeLists.txt index 7db3ea143c..894f63bb06 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -229,6 +229,15 @@ add_subdirectory(cocos/audio) # cocos2d library add_subdirectory(cocos) +# network library +add_subdirectory(cocos/network) + +# ui library +add_subdirectory(cocos/ui) + +# sqlite3 library +add_subdirectory(cocos/storage) + if(BUILD_EXTENSIONS) # extensions add_subdirectory(extensions) diff --git a/cocos/CMakeLists.txt b/cocos/CMakeLists.txt index 1479931bc8..d3106bdecf 100644 --- a/cocos/CMakeLists.txt +++ b/cocos/CMakeLists.txt @@ -14,10 +14,7 @@ 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} @@ -28,9 +25,6 @@ add_library(cocos2d STATIC ${COCOS_RENDERER_SRC} ${COCOS_MATH_SRC} ${COCOS_PHYSICS_SRC} - ${COCOS_UI_SRC} - ${COCOS_NETWORK_SRC} - ${COCOS_STORAGE_SRC} ${COCOS_DEPRECATED_SRC} ) @@ -95,8 +89,6 @@ target_link_libraries(cocos2d tinyxml2 unzip xxhash - ${COCOS_STORAGE_LINK} - ${COCOS_NETWORK_LINK} ${COCOS_LINK} ) diff --git a/cocos/network/CMakeLists.txt b/cocos/network/CMakeLists.txt index 5bcf40d79e..597901fdc7 100644 --- a/cocos/network/CMakeLists.txt +++ b/cocos/network/CMakeLists.txt @@ -1,6 +1,6 @@ if(WIN32) set(PLATFORM_SRC - network/WebSocket.cpp + WebSocket.cpp ) set(PLATFORM_LINK @@ -8,7 +8,7 @@ if(WIN32) ) elseif(NOT APPLE) set(PLATFORM_SRC - network/WebSocket.cpp + WebSocket.cpp ) set(PLATFORM_LINK @@ -19,11 +19,15 @@ elseif(NOT APPLE) endif() set(COCOS_NETWORK_SRC - network/HttpClient.cpp - network/SocketIO.cpp + HttpClient.cpp + SocketIO.cpp ${PLATFORM_SRC} ) +add_library(network STATIC + ${COCOS_NETWORK_SRC} +) + IF (WIN32 AND NOT MINGW) set(COCOS_NETWORK_LINK libcurl_imp @@ -35,3 +39,13 @@ ELSE() ${PLATFORM_LINK} ) 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" +) diff --git a/cocos/storage/CMakeLists.txt b/cocos/storage/CMakeLists.txt index 68f06b7a0f..f5cf54d720 100644 --- a/cocos/storage/CMakeLists.txt +++ b/cocos/storage/CMakeLists.txt @@ -1,9 +1,15 @@ set(COCOS_STORAGE_SRC - storage/local-storage/LocalStorage.cpp + local-storage/LocalStorage.cpp ) -set(COCOS_STORAGE_LINK - sqlite3 +add_library(sqlite3 STATIC + ${COCOS_STORAGE_SRC} +) + +set_target_properties(sqlite3 + PROPERTIES + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" ) diff --git a/cocos/ui/CMakeLists.txt b/cocos/ui/CMakeLists.txt index 02829ab86a..baae6f9096 100644 --- a/cocos/ui/CMakeLists.txt +++ b/cocos/ui/CMakeLists.txt @@ -1,27 +1,47 @@ set(COCOS_UI_SRC - ui/CocosGUI.cpp - ui/UIButton.cpp - ui/UICheckBox.cpp - ui/UIHBox.cpp - ui/UIHelper.cpp - ui/UIImageView.cpp - ui/UILayout.cpp - ui/UILayoutParameter.cpp - ui/UILayoutManager.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 - ui/UIDeprecated.cpp - ui/UIScale9Sprite.cpp + CocosGUI.cpp + UIButton.cpp + UICheckBox.cpp + UIHBox.cpp + UIHelper.cpp + UIImageView.cpp + UILayout.cpp + UILayoutParameter.cpp + UILayoutManager.cpp + UIListView.cpp + UILoadingBar.cpp + UIPageView.cpp + UIRelativeBox.cpp + UIRichText.cpp + UIScrollView.cpp + UISlider.cpp + UITextAtlas.cpp + UITextBMFont.cpp + UIText.cpp + UITextField.cpp + UIVBox.cpp + UIWidget.cpp + UIDeprecated.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" ) diff --git a/templates/lua-template-default/frameworks/CMakeLists.txt b/templates/lua-template-default/frameworks/CMakeLists.txt index c55979fd3d..555c36f3c8 100644 --- a/templates/lua-template-default/frameworks/CMakeLists.txt +++ b/templates/lua-template-default/frameworks/CMakeLists.txt @@ -148,11 +148,9 @@ set(FMOD_LIB "fmodex") endif() target_link_libraries(${APP_NAME} - luabinding - spine - cocostudio - cocosbuilder - extensions + luacocos2d + luacocosdenshion + luanetwork audio cocos2d xxtea diff --git a/tests/cpp-tests/CMakeLists.txt b/tests/cpp-tests/CMakeLists.txt index 4fa705d785..51cc2ffe3d 100644 --- a/tests/cpp-tests/CMakeLists.txt +++ b/tests/cpp-tests/CMakeLists.txt @@ -206,6 +206,9 @@ target_link_libraries(${APP_NAME} audio cocos2d box2d + ui + network + sqlite3 ) set(APP_BIN_DIR "${CMAKE_BINARY_DIR}/bin/${APP_NAME}") diff --git a/tests/lua-empty-test/project/CMakeLists.txt b/tests/lua-empty-test/project/CMakeLists.txt index 21766a81df..f4115a1aa1 100644 --- a/tests/lua-empty-test/project/CMakeLists.txt +++ b/tests/lua-empty-test/project/CMakeLists.txt @@ -7,7 +7,7 @@ set(SAMPLE_SRC include_directories( Classes - ../../../cocos/scripting/lua/bindings + ../../../cocos/scripting/lua-bindings ../../../external/lua/lua ../../../external/lua/tolua ) @@ -23,6 +23,7 @@ target_link_libraries(${APP_NAME} luanetwork audio cocos2d + network ) set(APP_BIN_DIR "${CMAKE_BINARY_DIR}/bin/${APP_NAME}") diff --git a/tests/lua-tests/project/CMakeLists.txt b/tests/lua-tests/project/CMakeLists.txt index 868173d26b..b90398a70f 100644 --- a/tests/lua-tests/project/CMakeLists.txt +++ b/tests/lua-tests/project/CMakeLists.txt @@ -33,6 +33,8 @@ target_link_libraries(${APP_NAME} spine cocosbuilder extensions + ui + network ) set(APP_BIN_DIR "${CMAKE_BINARY_DIR}/bin/${APP_NAME}")