From 030f80a2570fcadd7149e307bd463e08c4e35b94 Mon Sep 17 00:00:00 2001 From: minggo Date: Sun, 24 Aug 2014 03:52:51 -0700 Subject: [PATCH] one static library for c++ and another one for lua-binding --- CMakeLists.txt | 179 ++---------- build/BuildHelpers.CMakeLists.txt | 5 +- cocos/2d/CMakeLists.txt | 72 ----- cocos/3d/CMakeLists.txt | 37 --- cocos/CMakeLists.txt | 134 ++++++--- cocos/audio/CMakeLists.txt | 52 ---- cocos/base/CMakeLists.txt | 49 ---- cocos/deprecated/CMakeLists.txt | 9 - .../cocosbuilder/CMakeLists.txt | 34 --- .../editor-support/cocostudio/CMakeLists.txt | 69 ----- cocos/network/CMakeLists.txt | 37 --- cocos/physics/CMakeLists.txt | 13 - cocos/platform/CMakeLists.txt | 43 --- cocos/renderer/CMakeLists.txt | 22 -- cocos/scripting/lua-bindings/CMakeLists.txt | 258 +++--------------- cocos/storage/CMakeLists.txt | 13 - cocos/ui/CMakeLists.txt | 46 ---- external/Box2D/CMakeLists.txt | 62 ----- external/chipmunk/src/CMakeLists.txt | 57 ---- templates/cpp-template-default/CMakeLists.txt | 98 +------ .../frameworks/CMakeLists.txt | 100 +------ tests/cpp-empty-test/CMakeLists.txt | 3 +- tests/cpp-tests/CMakeLists.txt | 10 - tests/lua-empty-test/project/CMakeLists.txt | 15 +- tests/lua-tests/project/CMakeLists.txt | 16 -- 25 files changed, 177 insertions(+), 1256 deletions(-) delete mode 100644 cocos/2d/CMakeLists.txt delete mode 100644 cocos/3d/CMakeLists.txt delete mode 100644 cocos/audio/CMakeLists.txt delete mode 100644 cocos/base/CMakeLists.txt delete mode 100644 cocos/deprecated/CMakeLists.txt delete mode 100644 cocos/editor-support/cocosbuilder/CMakeLists.txt delete mode 100644 cocos/editor-support/cocostudio/CMakeLists.txt delete mode 100644 cocos/network/CMakeLists.txt delete mode 100644 cocos/physics/CMakeLists.txt delete mode 100644 cocos/platform/CMakeLists.txt delete mode 100644 cocos/renderer/CMakeLists.txt delete mode 100644 cocos/storage/CMakeLists.txt delete mode 100644 cocos/ui/CMakeLists.txt delete mode 100644 external/Box2D/CMakeLists.txt delete mode 100644 external/chipmunk/src/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index bd59e4b987..4e12df4e49 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,18 +34,6 @@ include(build/BuildHelpers.CMakeLists.txt) message(${BUILDING_STRING}) -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_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) -option(BUILD_EDITOR_COCOSBUILDER "Build editor support for cocosbuilder" ON) -option(BUILD_EXTERN_LIBS "Build Box2d, Chipmunk, Tinyxml2 from source" ON) -option(BUILD_CppTests "Build TestCpp samples" ON) -option(BUILD_LIBS_LUA "Build lua libraries" ON) -option(BUILD_LuaTests "Build TestLua samples" ON) - if(DEBUG_MODE) set(CMAKE_BUILD_TYPE DEBUG) else(DEBUG_MODE) @@ -63,7 +51,7 @@ else() set(CMAKE_C_FLAGS_DEBUG "-g -Wall -DCOCOS2D_DEBUG=1") set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG}) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-exceptions -std=c99") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -std=c++11") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -std=c++11 -Wno-deprecated-declarations -Wno-reorder") endif(MSVC) if(WINDOWS) @@ -88,16 +76,6 @@ if(MINGW) endif() endif() -if(USE_CHIPMUNK) - message("Using chipmunk ...") - add_definitions(-DCC_ENABLE_CHIPMUNK_INTEGRATION=1) -elseif(USE_BOX2D) - message("Using box2d ...") - add_definitions(-DCC_ENABLE_BOX2D_INTEGRATION=1) -else(USE_CHIPMUNK) - message(FATAL_ERROR "Must choose a physics library.") -endif(USE_CHIPMUNK) - # architecture if ( CMAKE_SIZEOF_VOID_P EQUAL 8 ) set(ARCH_DIR "64-bit") @@ -106,160 +84,35 @@ set(ARCH_DIR "32-bit") endif() include_directories( - ${CMAKE_CURRENT_SOURCE_DIR} + /usr/include + /usr/include/GLFW + /usr/local/include/GLFW ${CMAKE_CURRENT_SOURCE_DIR}/cocos - ${CMAKE_CURRENT_SOURCE_DIR}/cocos/platform/desktop + ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/cocos/platform/${PLATFORM_FOLDER} - ${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 ${CMAKE_CURRENT_SOURCE_DIR}/extensions - ${CMAKE_CURRENT_SOURCE_DIR}/external - ${CMAKE_CURRENT_SOURCE_DIR}/external/tinyxml2 - ${CMAKE_CURRENT_SOURCE_DIR}/external/unzip - ${CMAKE_CURRENT_SOURCE_DIR}/external/edtaa3func - ${CMAKE_CURRENT_SOURCE_DIR}/external/chipmunk/include/chipmunk - ${CMAKE_CURRENT_SOURCE_DIR}/external/jpeg/include/${PLATFORM_FOLDER} - ${CMAKE_CURRENT_SOURCE_DIR}/external/png/include/${PLATFORM_FOLDER} - ${CMAKE_CURRENT_SOURCE_DIR}/external/tiff/include/${PLATFORM_FOLDER} - ${CMAKE_CURRENT_SOURCE_DIR}/external/webp/include/${PLATFORM_FOLDER} - ${CMAKE_CURRENT_SOURCE_DIR}/external/glfw3/include/${PLATFORM_FOLDER} - ${CMAKE_CURRENT_SOURCE_DIR}/external/freetype2/include/${PLATFORM_FOLDER} - ${CMAKE_CURRENT_SOURCE_DIR}/external/websockets/include/${PLATFORM_FOLDER} - ${CMAKE_CURRENT_SOURCE_DIR}/external/xxhash - ${CMAKE_CURRENT_SOURCE_DIR}/external/xxtea ) -if(MSVC) - include_directories( - ${CMAKE_CURRENT_SOURCE_DIR}/external/${PLATFORM_FOLDER}-specific/gles/include/OGLES - ${CMAKE_CURRENT_SOURCE_DIR}/external/${PLATFORM_FOLDER}-specific/icon/include - ${CMAKE_CURRENT_SOURCE_DIR}/external/${PLATFORM_FOLDER}-specific/zlib/include - external/curl/include/${PLATFORM_FOLDER} - ) -elseif(MACOSX) - include_directories( - ${CMAKE_CURRENT_SOURCE_DIR}/external/curl/include/${PLATFORM_FOLDER} - ) -elseif(LINUX) - include_directories( - /usr/include - /usr/include/GLFW - /usr/local/include/GLFW - ${CMAKE_CURRENT_SOURCE_DIR}/external/${PLATFORM_FOLDER}-specific/fmod/include/${ARCH_DIR} - ) -endif() +link_directories( + /usr/local/lib + ${CMAKE_CURRENT_SOURCE_DIR}/external/jpeg/prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/external/tiff/prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/external/webp/prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/external/png/prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/external/freetype2/prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/external/websockets/prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/external/${PLATFORM_FOLDER}-specific/fmod/prebuilt/${ARCH_DIR} +) - -if(MSVC) - - link_directories( - ${CMAKE_CURRENT_SOURCE_DIR}/external/jpeg/prebuilt/${PLATFORM_FOLDER} - ${CMAKE_CURRENT_SOURCE_DIR}/external/tiff/prebuilt/${PLATFORM_FOLDER} - ${CMAKE_CURRENT_SOURCE_DIR}/external/png/prebuilt/${PLATFORM_FOLDER} - ${CMAKE_CURRENT_SOURCE_DIR}/external/freetype2/prebuilt/${PLATFORM_FOLDER} - ${CMAKE_CURRENT_SOURCE_DIR}/external/curl/prebuilt/${PLATFORM_FOLDER} - ${CMAKE_CURRENT_SOURCE_DIR}/external/${PLATFORM_FOLDER}-specific/icon/prebuilt - ${CMAKE_CURRENT_SOURCE_DIR}/external/${PLATFORM_FOLDER}-specific/zlib/prebuilt - ) - -elseif(LINUX) - - link_directories( - /usr/local/lib - ${CMAKE_CURRENT_SOURCE_DIR}/external/jpeg/prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/external/tiff/prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/external/webp/prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/external/png/prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/external/freetype2/prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/external/websockets/prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/external/${PLATFORM_FOLDER}-specific/fmod/prebuilt/${ARCH_DIR} - ) - -endif() - -if(BUILD_EXTERN_LIBS) -# chipmunk library -add_subdirectory(external/chipmunk/src) - -# box2d library -add_subdirectory(external/Box2D) -endif() - -# unzip library -add_subdirectory(external/unzip) - -if(BUILD_EXTERN_LIBS) -# tinyxml2 library -add_subdirectory(external/tinyxml2) -endif() - -# xxhash library -add_subdirectory(external/xxhash) - -# audio -add_subdirectory(cocos/audio) - -# cocos2d library +# libcocos2d.a add_subdirectory(cocos) -# cocos3d library -add_subdirectory(cocos/3d) - -# 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) -endif(BUILD_EXTENSIONS) - -## Editor Support - -if(BUILD_EDITOR_SPINE) -# spine -add_subdirectory(cocos/editor-support/spine) -endif(BUILD_EDITOR_SPINE) - -if(BUILD_EDITOR_COCOSBUILDER) -# cocosbuilder -add_subdirectory(cocos/editor-support/cocosbuilder) -endif(BUILD_EDITOR_COCOSBUILDER) - -if(BUILD_EDITOR_COCOSTUDIO) -# cocostudio -add_subdirectory(cocos/editor-support/cocostudio) -endif(BUILD_EDITOR_COCOSTUDIO) - ## Scripting -if(BUILD_LIBS_LUA) -# lua -add_subdirectory(external/lua/lua) - -# tolua -add_subdirectory(external/lua/tolua) - -# luabinding add_subdirectory(cocos/scripting/lua-bindings) -# xxtea -add_subdirectory(external/xxtea) -endif(BUILD_LIBS_LUA) - # build tests -if(BUILD_CppTests) add_subdirectory(tests/cpp-empty-test) add_subdirectory(tests/cpp-tests) -endif(BUILD_CppTests) -if(BUILD_LuaTests) add_subdirectory(tests/lua-tests/project) add_subdirectory(tests/lua-empty-test/project) -endif(BUILD_LuaTests) diff --git a/build/BuildHelpers.CMakeLists.txt b/build/BuildHelpers.CMakeLists.txt index 225e3c7ed7..1ebcb2fc6e 100644 --- a/build/BuildHelpers.CMakeLists.txt +++ b/build/BuildHelpers.CMakeLists.txt @@ -8,8 +8,9 @@ macro(pre_build TARGET_NAME) COMMENT "${TARGET_NAME}_PRE_BUILD ..." ) - add_custom_target( ${TARGET_NAME}_CORE_PRE_BUILD ) - add_dependencies( ${TARGET_NAME}_PRE_BUILD ${TARGET_NAME}_CORE_PRE_BUILD ) + add_custom_target(${TARGET_NAME}_CORE_PRE_BUILD) + add_dependencies(${TARGET_NAME}_PRE_BUILD ${TARGET_NAME}_CORE_PRE_BUILD) + add_dependencies(${TARGET_NAME} ${TARGET_NAME}_PRE_BUILD) endmacro() #cmake has some strange defaults, this should help us a lot diff --git a/cocos/2d/CMakeLists.txt b/cocos/2d/CMakeLists.txt deleted file mode 100644 index dbe25302c9..0000000000 --- a/cocos/2d/CMakeLists.txt +++ /dev/null @@ -1,72 +0,0 @@ -include_directories( - ../external/ConvertUTF -) - -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/CCClippingNode.cpp - 2d/CCComponentContainer.cpp - 2d/CCComponent.cpp - 2d/CCDrawingPrimitives.cpp - 2d/CCDrawNode.cpp - 2d/CCFastTMXLayer.cpp - 2d/CCFastTMXTiledMap.cpp - 2d/CCFontAtlasCache.cpp - 2d/CCFontAtlas.cpp - 2d/CCFontCharMap.cpp - 2d/CCFont.cpp - 2d/CCFontFNT.cpp - 2d/CCFontFreeType.cpp - 2d/CCGLBufferedNode.cpp - 2d/CCGrabber.cpp - 2d/CCGrid.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/CCProtectedNode.cpp - 2d/CCRenderTexture.cpp - 2d/CCScene.cpp - 2d/CCSpriteBatchNode.cpp - 2d/CCSprite.cpp - 2d/CCSpriteFrameCache.cpp - 2d/CCSpriteFrame.cpp - 2d/CCTextFieldTTF.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 -) diff --git a/cocos/3d/CMakeLists.txt b/cocos/3d/CMakeLists.txt deleted file mode 100644 index 28e0ac6970..0000000000 --- a/cocos/3d/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -set(COCOS_3D_SRC -CCRay.cpp -CCAABB.cpp -CCOBB.cpp -CCAnimate3D.cpp -CCAnimation3D.cpp -CCAttachNode.cpp -CCBundle3D.cpp -CCBundleReader.cpp -CCMesh.cpp -CCMeshSkin.cpp -CCSprite3DMaterial.cpp -CCObjLoader.cpp -CCSkeleton3D.cpp -CCSprite3D.cpp -CCSubMesh.cpp -CCSubMeshState.cpp -) - - -include_directories( - 3d -) - -add_library(cocos3d STATIC - ${COCOS_3D_SRC} -) - -target_link_libraries(cocos3d - cocos2d -) - -set_target_properties(cocos3d - PROPERTIES - ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" - LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" -) diff --git a/cocos/CMakeLists.txt b/cocos/CMakeLists.txt index bb62406fe1..44ab78f036 100644 --- a/cocos/CMakeLists.txt +++ b/cocos/CMakeLists.txt @@ -1,46 +1,112 @@ -if(WINDOWS) - ADD_DEFINITIONS(-DUNICODE -D_UNICODE) -endif() +#/**************************************************************************** +# Copyright (c) 2013 cocos2d-x.org +# Copyright (c) 2014 martell malone +# +# http://www.cocos2d-x.org +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: -set(COCOS_SRC cocos2d.cpp) +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. -include(2d/CMakeLists.txt) -include(platform/CMakeLists.txt) -include(physics/CMakeLists.txt) -include(math/CMakeLists.txt) -include(renderer/CMakeLists.txt) -include(base/CMakeLists.txt) -include(deprecated/CMakeLists.txt) +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# ****************************************************************************/ -add_library(cocos2d STATIC - ${COCOS_SRC} - ${COCOS_2D_SRC} - ${COCOS_PLATFORM_SRC} - ${COCOS_BASE_SRC} - ${COCOS_RENDERER_SRC} - ${COCOS_MATH_SRC} - ${COCOS_PHYSICS_SRC} - ${COCOS_DEPRECATED_SRC} +# this CMakeLists is to generate libcocos2d.a + +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR}/platform/desktop + ${CMAKE_CURRENT_SOURCE_DIR}/audio/include + ${CMAKE_CURRENT_SOURCE_DIR}/editor-support + ${CMAKE_CURRENT_SOURCE_DIR}/../external + ${CMAKE_CURRENT_SOURCE_DIR}/../external/tinyxml2 + ${CMAKE_CURRENT_SOURCE_DIR}/../external/unzip + ${CMAKE_CURRENT_SOURCE_DIR}/../external/edtaa3func + ${CMAKE_CURRENT_SOURCE_DIR}/../external/chipmunk/include/chipmunk + ${CMAKE_CURRENT_SOURCE_DIR}/../external/jpeg/include/${PLATFORM_FOLDER} + ${CMAKE_CURRENT_SOURCE_DIR}/../external/png/include/${PLATFORM_FOLDER} + ${CMAKE_CURRENT_SOURCE_DIR}/../external/tiff/include/${PLATFORM_FOLDER} + ${CMAKE_CURRENT_SOURCE_DIR}/../external/webp/include/${PLATFORM_FOLDER} + ${CMAKE_CURRENT_SOURCE_DIR}/../external/glfw3/include/${PLATFORM_FOLDER} + ${CMAKE_CURRENT_SOURCE_DIR}/../external/freetype2/include/${PLATFORM_FOLDER} + ${CMAKE_CURRENT_SOURCE_DIR}/../external/websockets/include/${PLATFORM_FOLDER} + ${CMAKE_CURRENT_SOURCE_DIR}/../external/xxhash + ${CMAKE_CURRENT_SOURCE_DIR}/../external/ConvertUTF + ${CMAKE_CURRENT_SOURCE_DIR}/../external/linux-specific/fmod/include/${ARCH_DIR} ) -if(MINGW) - set(COCOS_LINK z jpeg png webp tiff glfw3 glew32 opengl32 iconv freetype bz2) -elseif(WINDOWS) - set(COCOS_LINK libjpeg libpng libwebp libtiff freetype250 glfw3 glew32 opengl32 libiconv libzlib) -elseif(LINUX) - 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_LINK} -) +# cocos2d source files and header files +file(GLOB core_source_files + "${CMAKE_CURRENT_SOURCE_DIR}/cocos2d.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/base/ccFPSImages.c" + "${CMAKE_CURRENT_SOURCE_DIR}/2d/*.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/3d/*.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/audio/linux/*.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/base/*.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/deprecated/*.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/editor-support/cocosbuilder/*.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/editor-support/spine/*.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/math/*.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/network/*.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/physics/*.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/physics/chipmunk/*.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/platform/*.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/platform/linux/*.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/platform/desktop/*.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/renderer/*.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/storage/local-storage/*.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/ui/*.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/../external/tinyxml2/*.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/../external/xxhash/*.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../external/unzip/*.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/../external/chipmunk/src/*.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../external/chipmunk/src/constraints/*.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../external/edtaa3func/*.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/../external/ConvertUTF/*.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/../external/ConvertUTF/*.c" + ) +file(GLOB_RECURSE cocostudio_source_files "${CMAKE_CURRENT_SOURCE_DIR}/editor-support/cocostudio/*.cpp") +file(GLOB_RECURSE extensions_source_files "${CMAKE_CURRENT_SOURCE_DIR}/../extensions/*.cpp") +file(GLOB_RECURSE box2d_source_files "${CMAKE_CURRENT_SOURCE_DIR}/../external/Box2D/*.cpp") +set(cocos2d_source_files ${chipmunk_source_files} ${box2d_source_files} ${core_source_files} ${cocostudio_source_files} ${extensions_source_files}) +# exclude files specific for other platforms +list(REMOVE_ITEM cocos2d_source_files + "${CMAKE_CURRENT_SOURCE_DIR}/base/CCController-android.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/base/CCUserDefaultAndroid.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/ui/UIVideoPlayerAndroid.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/storage/local-storage/LocalStorageAndroid.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/base/CCEventController.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/base/CCEventListenerController.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/../extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/../extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/../extensions/GUI/CCEditBox/CCEditBoxImplWp8.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/editor-support/cocostudio/proj.wp8/pch.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/../extensions/proj.wp8/pch.cpp") + +add_library(cocos2d STATIC ${cocos2d_source_files}) + +if ( CMAKE_SIZEOF_VOID_P EQUAL 8 ) + set(FMOD_LIB "fmodex64") +else() + set(FMOD_LIB "fmodex") +endif() +target_link_libraries(cocos2d jpeg webp tiff freetype fontconfig png pthread glfw GLEW GL X11 rt z ${FMOD_LIB} curl) set_target_properties(cocos2d PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" ) + diff --git a/cocos/audio/CMakeLists.txt b/cocos/audio/CMakeLists.txt deleted file mode 100644 index c2e15dfaa8..0000000000 --- a/cocos/audio/CMakeLists.txt +++ /dev/null @@ -1,52 +0,0 @@ -# architecture -#if ( CMAKE_SIZEOF_VOID_P EQUAL 8 ) -#set(ARCH_DIR "64-bit") -#else() -#set(ARCH_DIR "32-bit") -#endif() - -if(WINDOWS) - set(AUDIO_SRC - win32/SimpleAudioEngine.cpp - win32/MciPlayer.cpp - win32/MciPlayer.h - ) - -elseif(LINUX) - set(AUDIO_SRC - linux/SimpleAudioEngineFMOD.cpp - linux/FmodAudioPlayer.cpp - linux/FmodAudioPlayer.h - linux/AudioPlayer.h - ) - - include_directories( ../../external/linux-specific/fmod/include/${ARCH_DIR} ) - -endif() - -add_library(audio STATIC - ${AUDIO_SRC} - include/Export.h - include/SimpleAudioEngine.h -) - -if(LINUX) - - if ( CMAKE_SIZEOF_VOID_P EQUAL 8 ) - set(FMOD_LIB "fmodex64") - else() - set(FMOD_LIB "fmodex") - endif() - - target_link_libraries(audio ${FMOD_LIB}) -elseif(WINDOWS) - target_link_libraries(audio Winmm) -endif() - -set_target_properties(audio - PROPERTIES - ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" - LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" -) - - diff --git a/cocos/base/CMakeLists.txt b/cocos/base/CMakeLists.txt deleted file mode 100644 index dc46fc23cd..0000000000 --- a/cocos/base/CMakeLists.txt +++ /dev/null @@ -1,49 +0,0 @@ -set(COCOS_BASE_SRC - base/CCAutoreleasePool.cpp - base/CCCamera.cpp - base/CCConfiguration.cpp - base/CCConsole.cpp - base/CCData.cpp - base/CCDataVisitor.cpp - base/CCDirector.cpp - base/CCEvent.cpp - base/CCEventAcceleration.cpp - base/CCEventCustom.cpp - base/CCEventDispatcher.cpp - base/CCEventFocus.cpp - base/CCEventKeyboard.cpp - base/CCEventListener.cpp - base/CCEventListenerAcceleration.cpp - base/CCEventListenerCustom.cpp - base/CCEventListenerFocus.cpp - base/CCEventListenerKeyboard.cpp - base/CCEventListenerMouse.cpp - base/CCEventListenerTouch.cpp - base/CCEventMouse.cpp - base/CCEventTouch.cpp - base/CCIMEDispatcher.cpp - base/CCModuleManager.cpp - base/CCNS.cpp - base/CCProfiling.cpp - base/ccRandom.cpp - base/CCRef.cpp - base/CCScheduler.cpp - base/CCScriptSupport.cpp - base/CCTouch.cpp - base/CCUserDefault.cpp - base/CCUserDefaultAndroid.cpp - base/CCValue.cpp - base/TGAlib.cpp - base/ZipUtils.cpp - base/atitc.cpp - base/base64.cpp - base/ccCArray.cpp - base/ccFPSImages.c - base/ccTypes.cpp - base/ccUTF8.cpp - base/ccUtils.cpp - base/etc1.cpp - base/pvr.cpp - base/s3tc.cpp - base/ObjectFactory.cpp -) diff --git a/cocos/deprecated/CMakeLists.txt b/cocos/deprecated/CMakeLists.txt deleted file mode 100644 index ef1ae7a2b5..0000000000 --- a/cocos/deprecated/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -set(COCOS_DEPRECATED_SRC - deprecated/CCArray.cpp - deprecated/CCDeprecated.cpp - deprecated/CCDictionary.cpp - deprecated/CCNotificationCenter.cpp - deprecated/CCSet.cpp - deprecated/CCString.cpp -) - diff --git a/cocos/editor-support/cocosbuilder/CMakeLists.txt b/cocos/editor-support/cocosbuilder/CMakeLists.txt deleted file mode 100644 index 607c85be8e..0000000000 --- a/cocos/editor-support/cocosbuilder/CMakeLists.txt +++ /dev/null @@ -1,34 +0,0 @@ -set(CCB_SRC - CCBFileLoader.cpp - CCMenuItemImageLoader.cpp - CCBReader.cpp - CCMenuItemLoader.cpp - CCControlButtonLoader.cpp - CCNodeLoader.cpp - CCControlLoader.cpp - CCNodeLoaderLibrary.cpp - CCLabelBMFontLoader.cpp - CCParticleSystemQuadLoader.cpp - CCLabelTTFLoader.cpp - CCScale9SpriteLoader.cpp - CCLayerColorLoader.cpp - CCScrollViewLoader.cpp - CCLayerGradientLoader.cpp - CCSpriteLoader.cpp - CCLayerLoader.cpp - CCBAnimationManager.cpp - CCBKeyframe.cpp - CCBSequence.cpp - CCBSequenceProperty.cpp - CCNode+CCBRelativePositioning.cpp -) - -include_directories( .. ) - -add_library(cocosbuilder STATIC ${CCB_SRC}) - -set_target_properties(cocosbuilder - PROPERTIES - ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" - LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" -) diff --git a/cocos/editor-support/cocostudio/CMakeLists.txt b/cocos/editor-support/cocostudio/CMakeLists.txt deleted file mode 100644 index fc722a7c7b..0000000000 --- a/cocos/editor-support/cocostudio/CMakeLists.txt +++ /dev/null @@ -1,69 +0,0 @@ -set(CS_SRC - CCActionFrame.cpp - CCActionFrameEasing.cpp - CCActionManagerEx.cpp - CCActionNode.cpp - CCActionObject.cpp - CCArmature.cpp - CCBone.cpp - CCArmatureAnimation.cpp - CCProcessBase.cpp - CCTween.cpp - CCDatas.cpp - CCBatchNode.cpp - CCDecorativeDisplay.cpp - CCDisplayFactory.cpp - CCDisplayManager.cpp - CCSkin.cpp - CCColliderDetector.cpp - CCArmatureDataManager.cpp - CCArmatureDefine.cpp - CCDataReaderHelper.cpp - CCSpriteFrameCacheHelper.cpp - CCTransformHelp.cpp - CCUtilMath.cpp - CCComAttribute.cpp - CCComAudio.cpp - CCComController.cpp - CCComRender.cpp - CCInputDelegate.cpp - DictionaryHelper.cpp - CCSGUIReader.cpp - CCSSceneReader.cpp - TriggerBase.cpp - TriggerMng.cpp - TriggerObj.cpp - CocoLoader.cpp - WidgetReader/WidgetReader.cpp - WidgetReader/ButtonReader/ButtonReader.cpp - WidgetReader/CheckBoxReader/CheckBoxReader.cpp - WidgetReader/ImageViewReader/ImageViewReader.cpp - WidgetReader/LayoutReader/LayoutReader.cpp - WidgetReader/ListViewReader/ListViewReader.cpp - WidgetReader/LoadingBarReader/LoadingBarReader.cpp - WidgetReader/PageViewReader/PageViewReader.cpp - WidgetReader/ScrollViewReader/ScrollViewReader.cpp - WidgetReader/SliderReader/SliderReader.cpp - WidgetReader/TextAtlasReader/TextAtlasReader.cpp - WidgetReader/TextBMFontReader/TextBMFontReader.cpp - WidgetReader/TextFieldReader/TextFieldReader.cpp - WidgetReader/TextReader/TextReader.cpp - ActionTimeline/CCActionTimeline.cpp - ActionTimeline/CCActionTimelineCache.cpp - ActionTimeline/CCFrame.cpp - ActionTimeline/CCNodeReader.cpp - ActionTimeline/CCTimeLine.cpp -) - -include_directories( .. ) - -add_library(cocostudio STATIC ${CS_SRC} ) - -target_link_libraries(cocostudio) - -set_target_properties(cocostudio - PROPERTIES - ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" - LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" -) - diff --git a/cocos/network/CMakeLists.txt b/cocos/network/CMakeLists.txt deleted file mode 100644 index 1ea26015b8..0000000000 --- a/cocos/network/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -if(WINDOWS) - set(PLATFORM_LINK websockets) -elseif(LINUX) - set(PLATFORM_LINK websockets ssl crypto) -endif() - -set(COCOS_NETWORK_SRC - HttpClient.cpp - SocketIO.cpp - WebSocket.cpp -) - -add_library(network STATIC - ${COCOS_NETWORK_SRC} -) - -if(MSVC) - set(COCOS_NETWORK_LINK - libcurl_imp - ${PLATFORM_LINK} - ) -else() - set(COCOS_NETWORK_LINK - curl - ${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/physics/CMakeLists.txt b/cocos/physics/CMakeLists.txt deleted file mode 100644 index f30d0d2320..0000000000 --- a/cocos/physics/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -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 -) - diff --git a/cocos/platform/CMakeLists.txt b/cocos/platform/CMakeLists.txt deleted file mode 100644 index 28200922fd..0000000000 --- a/cocos/platform/CMakeLists.txt +++ /dev/null @@ -1,43 +0,0 @@ -if(WIN32) - -ADD_DEFINITIONS(-DUNICODE -D_UNICODE) - -set(COCOS_PLATFORM_SPECIFIC_SRC - platform/win32/CCStdC.cpp - platform/win32/CCFileUtilsWin32.cpp - platform/win32/CCCommon.cpp - platform/win32/CCApplication.cpp - platform/win32/CCDevice.cpp -) - -elseif(APPLE) - -else() - -set(COCOS_PLATFORM_SPECIFIC_SRC - platform/linux/CCStdC.cpp - platform/linux/CCFileUtilsLinux.cpp - platform/linux/CCCommon.cpp - platform/linux/CCApplication.cpp - platform/linux/CCDevice.cpp -) - -endif() - -include_directories( - ../external/ConvertUTF -) - -set(COCOS_PLATFORM_SRC - platform/CCSAXParser.cpp - platform/CCThread.cpp - platform/CCGLView.cpp - platform/CCFileUtils.cpp - platform/CCImage.cpp - platform/desktop/CCGLViewImpl.cpp - ../external/edtaa3func/edtaa3func.cpp - ../external/ConvertUTF/ConvertUTFWrapper.cpp - ../external/ConvertUTF/ConvertUTF.c - ${COCOS_PLATFORM_SPECIFIC_SRC} -) - diff --git a/cocos/renderer/CMakeLists.txt b/cocos/renderer/CMakeLists.txt deleted file mode 100644 index 4e02154825..0000000000 --- a/cocos/renderer/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -set(COCOS_RENDERER_SRC - renderer/CCBatchCommand.cpp - renderer/CCCustomCommand.cpp - renderer/CCMeshCommand.cpp - renderer/CCGLProgramCache.cpp - renderer/CCGLProgram.cpp - renderer/CCGLProgramStateCache.cpp - renderer/CCGLProgramState.cpp - renderer/ccGLStateCache.cpp - renderer/CCGroupCommand.cpp - renderer/CCQuadCommand.cpp - renderer/CCRenderCommand.cpp - renderer/CCRenderer.cpp - renderer/ccShaders.cpp - renderer/CCTexture2D.cpp - renderer/CCTextureAtlas.cpp - renderer/CCTextureCache.cpp - renderer/CCVertexIndexBuffer.cpp - renderer/CCVertexIndexData.cpp - renderer/CCPrimitive.cpp - renderer/CCPrimitiveCommand.cpp -) diff --git a/cocos/scripting/lua-bindings/CMakeLists.txt b/cocos/scripting/lua-bindings/CMakeLists.txt index 7da34f7b45..79ac5ed3fe 100644 --- a/cocos/scripting/lua-bindings/CMakeLists.txt +++ b/cocos/scripting/lua-bindings/CMakeLists.txt @@ -1,229 +1,51 @@ -#luacocos2d -set(LIBLUACOCOS2D_SRC - auto/lua_cocos2dx_auto.cpp - auto/lua_cocos2dx_physics_auto.cpp - auto/lua_cocos2dx_experimental_auto.cpp - manual/tolua_fix.cpp - manual/CCLuaBridge.cpp - manual/CCLuaEngine.cpp - manual/CCLuaStack.cpp - manual/CCLuaValue.cpp - manual/Cocos2dxLuaLoader.cpp - manual/LuaBasicConversions.cpp - manual/cocos2d/lua_cocos2dx_deprecated.cpp - manual/cocos2d/lua_cocos2dx_experimental_manual.cpp - manual/cocos2d/lua_cocos2dx_manual.cpp - manual/cocos2d/lua_cocos2dx_physics_manual.cpp - manual/cocos2d/LuaOpengl.cpp - manual/cocos2d/LuaScriptHandlerMgr.cpp -) +set(cocos_root ${CMAKE_CURRENT_SOURCE_DIR}/../../..) include_directories( - auto - manual - manual/cocos2d - manual/extension - manual/cocostudio - manual/ui - ../../2d - ../../3d - ../../../extensions - ../../../external/lua/lua - ../../../external/lua/tolua - ../../../external/xxtea + ${cocos_root}/external/lua/tolua/ + ${cocos_root}/external/lua/lua + ${cocos_root}/external/xxtea + ${cocos_root}/external + ${cocos_root}/cocos + ${cocos_root}/cocos/base + ${cocos_root}/cocos/physics + ${cocos_root}/cocos/audio/include + ${cocos_root}/cocos/2d + ${cocos_root}/cocos/3d + ${cocos_root}/cocos/editor-support/spine + ${cocos_root}/cocos/editor-support/cocostudio + ${cocos_root}/cocos/editor-support/cocosbuilder + ${cocos_root}/cocos/ui + ${cocos_root}/cocos/network + ${cocos_root}/cocos/storage + ${cocos_root}/cocos/editor-support + ${cocos_root}/cocos/platform + ${CMAKE_CURRENT_SOURCE_DIR}/manual + ${CMAKE_CURRENT_SOURCE_DIR}/manual/extension + ${CMAKE_CURRENT_SOURCE_DIR}/manual/cocostudio + ${CMAKE_CURRENT_SOURCE_DIR}/manual/ui + ${CMAKE_CURRENT_SOURCE_DIR}/ui + ${CMAKE_CURRENT_SOURCE_DIR}/manual/cocos2d + ${CMAKE_CURRENT_SOURCE_DIR}/auto ) - -add_library(luacocos2d STATIC - ${LIBLUACOCOS2D_SRC} -) - -target_link_libraries(luacocos2d - tolua - lua - xxtea +file(GLOB lua_cocos2d_source_files + "${cocos_root}/external/lua/lua/*.c" + "${cocos_root}/external/lua/tolua/*.c" + "${CMAKE_CURRENT_SOURCE_DIR}/auto/*.cpp" + "${cocos_root}/external/xxtea/xxtea.cpp" + ) +file(GLOB_RECURSE lua_binding_manual_files "${CMAKE_CURRENT_SOURCE_DIR}/manual/*.cpp") +set(lua_cocos2d_source_files ${lua_cocos2d_source_files} ${lua_binding_manual_files}) +# exclude files for other platforms +list(REMOVE_ITEM lua_cocos2d_source_files + "${CMAKE_CURRENT_SOURCE_DIR}/manual/platform/android/CCLuaJavaBridge.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/manual/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxLuaJavaBridge.cpp" ) +add_library(luacocos2d STATIC ${lua_cocos2d_source_files}) +target_link_libraries(luacocos2d cocos2d) set_target_properties(luacocos2d PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" ) - - -#luacocosdenshion -set(LIBLUACOCOSDENSHION_SRC - auto/lua_cocos2dx_cocosdenshion_auto.cpp - manual/cocosdenshion/lua_cocos2dx_cocosdenshion_manual.cpp -) - -include_directories( - auto - manual/cocosdenshion - ../../audio/include -) - -add_library(luacocosdenshion STATIC - ${LIBLUACOCOSDENSHION_SRC} -) - -set_target_properties(luacocosdenshion - PROPERTIES - ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" - LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" -) - -#luanetwork -set(LIBLUANETWORK_SRC - manual/network/lua_cocos2dx_network_manual.cpp - manual/network/lua_xml_http_request.cpp -) - -include_directories( - manual/network - ../../network -) - -add_library(luanetwork STATIC - ${LIBLUANETWORK_SRC} -) - -set_target_properties(luanetwork - PROPERTIES - ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" - LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" -) - -#luacocosbuilder -set(LIBLUACOCOSBUILDER_SRC - auto/lua_cocos2dx_cocosbuilder_auto.cpp - manual/cocosbuilder/lua_cocos2dx_cocosbuilder_manual.cpp - manual/cocosbuilder/CCBProxy.cpp -) - -include_directories( - auto - manual/cocosbuilder - ../../editor-support/cocosbuilder -) - -add_library(luacocosbuilder STATIC - ${LIBLUACOCOSBUILDER_SRC} -) - -set_target_properties(luacocosbuilder - PROPERTIES - ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" - LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" -) - -#luacocostudio -set(LIBLUACOCOSTUDIO_SRC - auto/lua_cocos2dx_studio_auto.cpp - manual/cocostudio/lua_cocos2dx_coco_studio_manual.cpp -) - -include_directories( - auto - manual/cocostudio - ../../editor-support/cocostudio -) - -add_library(luacocostudio STATIC - ${LIBLUACOCOSTUDIO_SRC} -) - -set_target_properties(luacocostudio - PROPERTIES - ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" - LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" -) - -#luaspine -set(LIBLUASPINE_SRC - auto/lua_cocos2dx_spine_auto.cpp - manual/spine/LuaSkeletonAnimation.cpp - manual/spine/lua_cocos2dx_spine_manual.cpp -) - -include_directories( - auto - manual/spine - ../../editor-support/spine -) - -add_library(luaspine STATIC - ${LIBLUASPINE_SRC} -) - -set_target_properties(luaspine - PROPERTIES - ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" - LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" -) - -#luaextension -set(LIBLUAEXTENSION_SRC - auto/lua_cocos2dx_extension_auto.cpp - manual/extension/lua_cocos2dx_extension_manual.cpp -) - -include_directories( - auto - manual/extension - ../../../extensions -) - -add_library(luaextension STATIC - ${LIBLUAEXTENSION_SRC} -) - -set_target_properties(luaextension - PROPERTIES - ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" - LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" -) - -#luaui -set(LIBLUAUI_SRC - auto/lua_cocos2dx_ui_auto.cpp - manual/ui/lua_cocos2dx_ui_manual.cpp -) - -include_directories( - auto - manual/ui - ../../ui -) - -add_library(luaui STATIC - ${LIBLUAUI_SRC} -) - -set_target_properties(luaui - PROPERTIES - ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" - LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" -) - -#luacocos3d -set(LIBLUA3D_SRC - auto/lua_cocos2dx_3d_auto.cpp - manual/3d/lua_cocos2dx_3d_manual.cpp -) - -include_directories( - auto - manual/3d - ../../../3d -) - -add_library(luacocos3d STATIC - ${LIBLUA3D_SRC} -) - -set_target_properties(luacocos3d - 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 deleted file mode 100644 index 1ddd93f957..0000000000 --- a/cocos/storage/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -set(COCOS_STORAGE_SRC - local-storage/LocalStorage.cpp -) - -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 deleted file mode 100644 index 3ccdf27b25..0000000000 --- a/cocos/ui/CMakeLists.txt +++ /dev/null @@ -1,46 +0,0 @@ -set(COCOS_UI_SRC - 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/external/Box2D/CMakeLists.txt b/external/Box2D/CMakeLists.txt deleted file mode 100644 index eff3db22eb..0000000000 --- a/external/Box2D/CMakeLists.txt +++ /dev/null @@ -1,62 +0,0 @@ -set(BOX2D_SRC - Collision/Shapes/b2ChainShape.cpp - Collision/Shapes/b2CircleShape.cpp - Collision/Shapes/b2EdgeShape.cpp - Collision/Shapes/b2PolygonShape.cpp - Collision/b2BroadPhase.cpp - Collision/b2CollideCircle.cpp - Collision/b2CollideEdge.cpp - Collision/b2CollidePolygon.cpp - Collision/b2Collision.cpp - Collision/b2Distance.cpp - Collision/b2DynamicTree.cpp - Collision/b2TimeOfImpact.cpp - Common/b2BlockAllocator.cpp - Common/b2Draw.cpp - Common/b2Math.cpp - Common/b2Settings.cpp - Common/b2StackAllocator.cpp - Common/b2Timer.cpp - Dynamics/Contacts/b2ChainAndCircleContact.cpp - Dynamics/Contacts/b2ChainAndPolygonContact.cpp - Dynamics/Contacts/b2CircleContact.cpp - Dynamics/Contacts/b2Contact.cpp - Dynamics/Contacts/b2ContactSolver.cpp - Dynamics/Contacts/b2EdgeAndCircleContact.cpp - Dynamics/Contacts/b2EdgeAndPolygonContact.cpp - Dynamics/Contacts/b2PolygonAndCircleContact.cpp - Dynamics/Contacts/b2PolygonContact.cpp - Dynamics/Joints/b2DistanceJoint.cpp - Dynamics/Joints/b2FrictionJoint.cpp - Dynamics/Joints/b2GearJoint.cpp - Dynamics/Joints/b2Joint.cpp - Dynamics/Joints/b2MouseJoint.cpp - Dynamics/Joints/b2MotorJoint.cpp - Dynamics/Joints/b2PrismaticJoint.cpp - Dynamics/Joints/b2PulleyJoint.cpp - Dynamics/Joints/b2RevoluteJoint.cpp - Dynamics/Joints/b2RopeJoint.cpp - Dynamics/Joints/b2WeldJoint.cpp - Dynamics/Joints/b2WheelJoint.cpp - Dynamics/b2Body.cpp - Dynamics/b2ContactManager.cpp - Dynamics/b2Fixture.cpp - Dynamics/b2Island.cpp - Dynamics/b2World.cpp - Dynamics/b2WorldCallbacks.cpp - Rope/b2Rope.cpp -) - -include_directories( - .. -) - -add_library(box2d STATIC - ${BOX2D_SRC} -) - -set_target_properties(box2d - PROPERTIES - ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" - LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" -) diff --git a/external/chipmunk/src/CMakeLists.txt b/external/chipmunk/src/CMakeLists.txt deleted file mode 100644 index 4005c750f4..0000000000 --- a/external/chipmunk/src/CMakeLists.txt +++ /dev/null @@ -1,57 +0,0 @@ -set(BUILD_STATIC 1) - -file(GLOB chipmunk_source_files "*.c" "constraints/*.c") -file(GLOB chipmunk_public_header "${chipmunk_SOURCE_DIR}/include/chipmunk/*.h") -file(GLOB chipmunk_constraint_header "${chipmunk_SOURCE_DIR}/include/chipmunk/constraints/*.h") - -include_directories(${chipmunk_SOURCE_DIR}/include/chipmunk) - -if(BUILD_SHARED) - add_library(chipmunk SHARED - ${chipmunk_source_files} - ) - # Tell MSVC to compile the code as C++. - if(MSVC) - set_source_files_properties(${chipmunk_source_files} PROPERTIES LANGUAGE CXX) - set_target_properties(chipmunk PROPERTIES LINKER_LANGUAGE CXX) - endif(MSVC) - # set the lib's version number - # But avoid on Android because symlinks to version numbered .so's don't work with Android's Java-side loadLibrary. - if(NOT ANDROID) - set_target_properties(chipmunk PROPERTIES VERSION 6.2.1) - endif(NOT ANDROID) - if(ANDROID) - # need to explicitly link to the math library because the CMake/Android toolchains may not do it automatically - target_link_libraries(chipmunk m) - endif(ANDROID) - install(TARGETS chipmunk RUNTIME DESTINATION lib LIBRARY DESTINATION lib) -endif(BUILD_SHARED) - -if(BUILD_STATIC) - add_library(chipmunk_static STATIC - ${chipmunk_source_files} - ) - # Tell MSVC to compile the code as C++. - if(MSVC) - set_source_files_properties(${chipmunk_source_files} PROPERTIES LANGUAGE CXX) - set_target_properties(chipmunk_static PROPERTIES LINKER_LANGUAGE CXX) - endif(MSVC) - # Sets chipmunk_static to output "libchipmunk.a" not "libchipmunk_static.a" - set_target_properties(chipmunk_static PROPERTIES OUTPUT_NAME chipmunk) - if(INSTALL_STATIC) - install(TARGETS chipmunk_static ARCHIVE DESTINATION lib) - endif(INSTALL_STATIC) -endif(BUILD_STATIC) - -if(BUILD_SHARED OR INSTALL_STATIC) - # FIXME: change to PUBLIC_HEADER to allow building frameworks - install(FILES ${chipmunk_public_header} DESTINATION include/chipmunk) - install(FILES ${chipmunk_constraint_header} DESTINATION include/chipmunk/constraints) -endif(BUILD_SHARED OR INSTALL_STATIC) - -set_target_properties(chipmunk_static - PROPERTIES - ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" - LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" -) - diff --git a/templates/cpp-template-default/CMakeLists.txt b/templates/cpp-template-default/CMakeLists.txt index 1f709e0d8f..b4d1086daa 100644 --- a/templates/cpp-template-default/CMakeLists.txt +++ b/templates/cpp-template-default/CMakeLists.txt @@ -1,12 +1,10 @@ -cmake_minimum_required(VERSION 2.6) +cmake_minimum_required(VERSION 2.8) set(APP_NAME MyGame) project (${APP_NAME}) include(cocos2d/build/BuildHelpers.CMakeLists.txt) -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) if(DEBUG_MODE) @@ -27,26 +25,10 @@ elseif (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG}) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-deprecated-declarations -Wno-reorder") endif() -if(USE_CHIPMUNK) - message("Using chipmunk ...") - add_definitions(-DCC_ENABLE_CHIPMUNK_INTEGRATION=1) - if(UNIX) # assuming linux - add_definitions(-DLINUX ) - endif() -elseif(USE_BOX2D) - message("Using box2d ...") - add_definitions(-DCC_ENABLE_BOX2D_INTEGRATION=1) - if(UNIX) # assuming linux - add_definitions(-DLINUX ) - endif() -else(USE_CHIPMUNK) - message(FATAL_ERROR "Must choose a physics library.") -endif(USE_CHIPMUNK) - # architecture if ( CMAKE_SIZEOF_VOID_P EQUAL 8 ) set(ARCH_DIR "64-bit") @@ -150,6 +132,8 @@ include_directories( ${COCOS2D_ROOT}/external/xxhash ) +ADD_DEFINITIONS(-DLINUX) + link_directories( /usr/local/lib ${COCOS2D_ROOT}/external/jpeg/prebuilt/linux/${ARCH_DIR} @@ -162,81 +146,13 @@ link_directories( ) endif() -if(USE_CHIPMUNK) - - include_directories(${COCOS2D_ROOT}/external/chipmunk/include/chipmunk) - # chipmunk library - add_subdirectory(${COCOS2D_ROOT}/external/chipmunk/src) -endif() - -if(USE_BOX2D) - # box2d library - add_subdirectory(${COCOS2D_ROOT}/external/Box2D) -endif() - -# unzip library -add_subdirectory(${COCOS2D_ROOT}/external/unzip) - -# tinyxml2 library -add_subdirectory(${COCOS2D_ROOT}/external/tinyxml2) - -# audio -add_subdirectory(${COCOS2D_ROOT}/cocos/audio) - -# xxhash library -add_subdirectory(${COCOS2D_ROOT}/external/xxhash) - -# cocos2d +# libcocos2d add_subdirectory(${COCOS2D_ROOT}/cocos) -# cocos3d library -add_subdirectory(${COCOS2D_ROOT}/cocos/3d) -# network library -add_subdirectory(${COCOS2D_ROOT}/cocos/network) +add_executable(${APP_NAME} ${GAME_SRC}) -# ui library -add_subdirectory(${COCOS2D_ROOT}/cocos/ui) - -# sqlite3 library -add_subdirectory(${COCOS2D_ROOT}/cocos/storage) - -# extensions -add_subdirectory(${COCOS2D_ROOT}/extensions) - -## Editor Support - -# spine -add_subdirectory(${COCOS2D_ROOT}/cocos/editor-support/spine) - -# cocosbuilder -add_subdirectory(${COCOS2D_ROOT}/cocos/editor-support/cocosbuilder) - -# cocostudio -add_subdirectory(${COCOS2D_ROOT}/cocos/editor-support/cocostudio) - -if ( WIN32 ) - # add the executable - add_executable(${APP_NAME} - WIN32 - ${GAME_SRC} - ) -else() - # add the executable - add_executable(${APP_NAME} - ${GAME_SRC} - ) -endif() - -if ( CMAKE_SIZEOF_VOID_P EQUAL 8 ) -set(FMOD_LIB "fmodex64") -else() -set(FMOD_LIB "fmodex") -endif() - -target_link_libraries(${APP_NAME} - cocos2d - ) +target_link_libraries(${APP_NAME} cocos2d) set(APP_BIN_DIR "${CMAKE_BINARY_DIR}/bin") diff --git a/templates/lua-template-default/frameworks/CMakeLists.txt b/templates/lua-template-default/frameworks/CMakeLists.txt index 90b1390537..4d49259356 100644 --- a/templates/lua-template-default/frameworks/CMakeLists.txt +++ b/templates/lua-template-default/frameworks/CMakeLists.txt @@ -1,12 +1,10 @@ -cmake_minimum_required(VERSION 2.6) +cmake_minimum_required(VERSION 2.8) set(APP_NAME HelloLua) project (${APP_NAME}) include(cocos2d-x/build/BuildHelpers.CMakeLists.txt) -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) if(DEBUG_MODE) @@ -19,17 +17,8 @@ set(CMAKE_C_FLAGS_DEBUG "-g -Wall -DCOCOS2D_DEBUG=1") set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG}) set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} "-std=c99") -set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-std=c++11") - -if(USE_CHIPMUNK) - message("Using chipmunk ...") - add_definitions(-DLINUX -DCC_ENABLE_CHIPMUNK_INTEGRATION=1) -elseif(USE_BOX2D) - message("Using box2d ...") - add_definitions(-DLINUX -DCC_ENABLE_BOX2D_INTEGRATION=1) -else(USE_CHIPMUNK) - message(FATAL_ERROR "Must choose a physics library.") -endif(USE_CHIPMUNK) +set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-std=c++11 -Wno-deprecated-declarations -Wno-reorder") +ADD_DEFINITIONS(-DLINUX) # architecture if ( CMAKE_SIZEOF_VOID_P EQUAL 8 ) @@ -88,70 +77,14 @@ link_directories( ${COCOS2D_ROOT}/external/linux-specific/fmod/prebuilt/${ARCH_DIR} ) -# chipmunk library -add_subdirectory(${COCOS2D_ROOT}/external/chipmunk/src) - -# box2d library -add_subdirectory(${COCOS2D_ROOT}/external/Box2D) - -# unzip library -add_subdirectory(${COCOS2D_ROOT}/external/unzip) - -# tinyxml2 library -add_subdirectory(${COCOS2D_ROOT}/external/tinyxml2) - -# audio -add_subdirectory(${COCOS2D_ROOT}/cocos/audio) - -# xxhash library -add_subdirectory(${COCOS2D_ROOT}/external/xxhash) - -# cocos 2d library +# libcocos2d add_subdirectory(${COCOS2D_ROOT}/cocos) -# cocos 3d library -add_subdirectory(${COCOS2D_ROOT}/cocos/3d) - -# network library -add_subdirectory(${COCOS2D_ROOT}/cocos/network) - -# ui library -add_subdirectory(${COCOS2D_ROOT}/cocos/ui) - -# sqlite3 library -add_subdirectory(${COCOS2D_ROOT}/cocos/storage) - -# extensions -add_subdirectory(${COCOS2D_ROOT}/extensions) - -# xxtea library -add_subdirectory(${COCOS2D_ROOT}/external/xxtea) - -## Editor Support - -# spine -add_subdirectory(${COCOS2D_ROOT}/cocos/editor-support/spine) - -# cocosbuilder -add_subdirectory(${COCOS2D_ROOT}/cocos/editor-support/cocosbuilder) - -# cocostudio -add_subdirectory(${COCOS2D_ROOT}/cocos/editor-support/cocostudio) - -## Scripting -# lua -add_subdirectory(${COCOS2D_ROOT}/external/lua/lua) - -# tolua -add_subdirectory(${COCOS2D_ROOT}/external/lua/tolua) - -# luabinding +# libluacocos2d add_subdirectory(${COCOS2D_ROOT}/cocos/scripting/lua-bindings) # add the executable -add_executable(${APP_NAME} - ${GAME_SRC} -) +add_executable(${APP_NAME} ${GAME_SRC}) if ( CMAKE_SIZEOF_VOID_P EQUAL 8 ) set(FMOD_LIB "fmodex64") @@ -159,26 +92,7 @@ else() set(FMOD_LIB "fmodex") endif() -target_link_libraries(${APP_NAME} - luacocos2d - luacocos3d - luacocosdenshion - luanetwork - luacocosbuilder - luacocostudio - luaspine - luaextension - luaui - cocos2d - cocos3d - audio - cocostudio - spine - cocosbuilder - extensions - ui - network - ) +target_link_libraries(${APP_NAME} cocos2d luacocos2d) set(APP_BIN_DIR "${CMAKE_BINARY_DIR}/bin") diff --git a/tests/cpp-empty-test/CMakeLists.txt b/tests/cpp-empty-test/CMakeLists.txt index 8221cc32c1..e0fe6dc2cb 100644 --- a/tests/cpp-empty-test/CMakeLists.txt +++ b/tests/cpp-empty-test/CMakeLists.txt @@ -72,11 +72,10 @@ else() set_target_properties(${APP_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${APP_BIN_DIR}") - pre_build(${APP_NAME} COMMAND ${CMAKE_COMMAND} -E remove_directory ${APP_BIN_DIR}/Resources COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/Resources ${APP_BIN_DIR}/Resources ) endif() -target_link_libraries(${APP_NAME} audio cocos2d) +target_link_libraries(${APP_NAME} cocos2d) diff --git a/tests/cpp-tests/CMakeLists.txt b/tests/cpp-tests/CMakeLists.txt index 5dcfe748c8..1307f086c1 100644 --- a/tests/cpp-tests/CMakeLists.txt +++ b/tests/cpp-tests/CMakeLists.txt @@ -201,17 +201,7 @@ add_executable(${APP_NAME} ) target_link_libraries(${APP_NAME} - spine - cocostudio - cocosbuilder - extensions - audio cocos2d - cocos3d - 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 2b2db4e968..c1996afea1 100644 --- a/tests/lua-empty-test/project/CMakeLists.txt +++ b/tests/lua-empty-test/project/CMakeLists.txt @@ -7,24 +7,15 @@ set(SAMPLE_SRC include_directories( Classes - ../../../cocos/scripting/lua-bindings + ../../../cocos/scripting/lua-bindings/manual ../../../external/lua/lua ../../../external/lua/tolua ) # add the executable -add_executable(${APP_NAME} - ${SAMPLE_SRC} -) +add_executable(${APP_NAME} ${SAMPLE_SRC}) -target_link_libraries(${APP_NAME} - luacocos2d - luacocosdenshion - luanetwork - audio - cocos2d - network -) +target_link_libraries(${APP_NAME} cocos2d luacocos2d) 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 0130a24fd8..acd3284052 100644 --- a/tests/lua-tests/project/CMakeLists.txt +++ b/tests/lua-tests/project/CMakeLists.txt @@ -20,23 +20,7 @@ add_executable(${APP_NAME} target_link_libraries(${APP_NAME} luacocos2d - luacocosdenshion - luanetwork - luacocosbuilder - luacocostudio - luaspine - luaextension - luaui - luacocos3d cocos2d - cocos3d - audio - cocostudio - spine - cocosbuilder - extensions - ui - network ) set(APP_BIN_DIR "${CMAKE_BINARY_DIR}/bin/${APP_NAME}")