one static library for c++ and another one for lua-binding

This commit is contained in:
minggo 2014-08-24 03:52:51 -07:00
parent f94717de94
commit 030f80a257
25 changed files with 177 additions and 1256 deletions

View File

@ -34,18 +34,6 @@ include(build/BuildHelpers.CMakeLists.txt)
message(${BUILDING_STRING}) 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) if(DEBUG_MODE)
set(CMAKE_BUILD_TYPE DEBUG) set(CMAKE_BUILD_TYPE DEBUG)
else(DEBUG_MODE) else(DEBUG_MODE)
@ -63,7 +51,7 @@ else()
set(CMAKE_C_FLAGS_DEBUG "-g -Wall -DCOCOS2D_DEBUG=1") set(CMAKE_C_FLAGS_DEBUG "-g -Wall -DCOCOS2D_DEBUG=1")
set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG}) set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-exceptions -std=c99") 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) endif(MSVC)
if(WINDOWS) if(WINDOWS)
@ -88,16 +76,6 @@ if(MINGW)
endif() endif()
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 # architecture
if ( CMAKE_SIZEOF_VOID_P EQUAL 8 ) if ( CMAKE_SIZEOF_VOID_P EQUAL 8 )
set(ARCH_DIR "64-bit") set(ARCH_DIR "64-bit")
@ -106,160 +84,35 @@ set(ARCH_DIR "32-bit")
endif() endif()
include_directories( 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
${CMAKE_CURRENT_SOURCE_DIR}/cocos/platform/desktop ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/cocos/platform/${PLATFORM_FOLDER} ${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}/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) link_directories(
include_directories( /usr/local/lib
${CMAKE_CURRENT_SOURCE_DIR}/external/${PLATFORM_FOLDER}-specific/gles/include/OGLES ${CMAKE_CURRENT_SOURCE_DIR}/external/jpeg/prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/external/${PLATFORM_FOLDER}-specific/icon/include ${CMAKE_CURRENT_SOURCE_DIR}/external/tiff/prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/external/${PLATFORM_FOLDER}-specific/zlib/include ${CMAKE_CURRENT_SOURCE_DIR}/external/webp/prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR}
external/curl/include/${PLATFORM_FOLDER} ${CMAKE_CURRENT_SOURCE_DIR}/external/png/prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR}
) ${CMAKE_CURRENT_SOURCE_DIR}/external/freetype2/prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR}
elseif(MACOSX) ${CMAKE_CURRENT_SOURCE_DIR}/external/websockets/prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR}
include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/external/${PLATFORM_FOLDER}-specific/fmod/prebuilt/${ARCH_DIR}
${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()
# libcocos2d.a
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
add_subdirectory(cocos) 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 ## Scripting
if(BUILD_LIBS_LUA)
# lua
add_subdirectory(external/lua/lua)
# tolua
add_subdirectory(external/lua/tolua)
# luabinding
add_subdirectory(cocos/scripting/lua-bindings) add_subdirectory(cocos/scripting/lua-bindings)
# xxtea
add_subdirectory(external/xxtea)
endif(BUILD_LIBS_LUA)
# build tests # build tests
if(BUILD_CppTests)
add_subdirectory(tests/cpp-empty-test) add_subdirectory(tests/cpp-empty-test)
add_subdirectory(tests/cpp-tests) add_subdirectory(tests/cpp-tests)
endif(BUILD_CppTests)
if(BUILD_LuaTests)
add_subdirectory(tests/lua-tests/project) add_subdirectory(tests/lua-tests/project)
add_subdirectory(tests/lua-empty-test/project) add_subdirectory(tests/lua-empty-test/project)
endif(BUILD_LuaTests)

View File

@ -8,8 +8,9 @@ macro(pre_build TARGET_NAME)
COMMENT "${TARGET_NAME}_PRE_BUILD ..." COMMENT "${TARGET_NAME}_PRE_BUILD ..."
) )
add_custom_target( ${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}_PRE_BUILD ${TARGET_NAME}_CORE_PRE_BUILD)
add_dependencies(${TARGET_NAME} ${TARGET_NAME}_PRE_BUILD)
endmacro() endmacro()
#cmake has some strange defaults, this should help us a lot #cmake has some strange defaults, this should help us a lot

View File

@ -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
)

View File

@ -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"
)

View File

@ -1,46 +1,112 @@
if(WINDOWS) #/****************************************************************************
ADD_DEFINITIONS(-DUNICODE -D_UNICODE) # Copyright (c) 2013 cocos2d-x.org
endif() # 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) # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
include(platform/CMakeLists.txt) # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
include(physics/CMakeLists.txt) # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
include(math/CMakeLists.txt) # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
include(renderer/CMakeLists.txt) # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
include(base/CMakeLists.txt) # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
include(deprecated/CMakeLists.txt) # THE SOFTWARE.
# ****************************************************************************/
add_library(cocos2d STATIC # this CMakeLists is to generate libcocos2d.a
${COCOS_SRC}
${COCOS_2D_SRC} include_directories(
${COCOS_PLATFORM_SRC} ${CMAKE_CURRENT_SOURCE_DIR}/platform/desktop
${COCOS_BASE_SRC} ${CMAKE_CURRENT_SOURCE_DIR}/audio/include
${COCOS_RENDERER_SRC} ${CMAKE_CURRENT_SOURCE_DIR}/editor-support
${COCOS_MATH_SRC} ${CMAKE_CURRENT_SOURCE_DIR}/../external
${COCOS_PHYSICS_SRC} ${CMAKE_CURRENT_SOURCE_DIR}/../external/tinyxml2
${COCOS_DEPRECATED_SRC} ${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 # cocos2d source files and header files
chipmunk_static file(GLOB core_source_files
tinyxml2 "${CMAKE_CURRENT_SOURCE_DIR}/cocos2d.cpp"
unzip "${CMAKE_CURRENT_SOURCE_DIR}/base/ccFPSImages.c"
xxhash "${CMAKE_CURRENT_SOURCE_DIR}/2d/*.cpp"
${COCOS_LINK} "${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 set_target_properties(cocos2d
PROPERTIES PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
) )

View File

@ -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"
)

View File

@ -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
)

View File

@ -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
)

View File

@ -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"
)

View File

@ -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"
)

View File

@ -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"
)

View File

@ -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
)

View File

@ -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}
)

View File

@ -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
)

View File

@ -1,229 +1,51 @@
#luacocos2d set(cocos_root ${CMAKE_CURRENT_SOURCE_DIR}/../../..)
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
)
include_directories( include_directories(
auto ${cocos_root}/external/lua/tolua/
manual ${cocos_root}/external/lua/lua
manual/cocos2d ${cocos_root}/external/xxtea
manual/extension ${cocos_root}/external
manual/cocostudio ${cocos_root}/cocos
manual/ui ${cocos_root}/cocos/base
../../2d ${cocos_root}/cocos/physics
../../3d ${cocos_root}/cocos/audio/include
../../../extensions ${cocos_root}/cocos/2d
../../../external/lua/lua ${cocos_root}/cocos/3d
../../../external/lua/tolua ${cocos_root}/cocos/editor-support/spine
../../../external/xxtea ${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
) )
file(GLOB lua_cocos2d_source_files
add_library(luacocos2d STATIC "${cocos_root}/external/lua/lua/*.c"
${LIBLUACOCOS2D_SRC} "${cocos_root}/external/lua/tolua/*.c"
) "${CMAKE_CURRENT_SOURCE_DIR}/auto/*.cpp"
"${cocos_root}/external/xxtea/xxtea.cpp"
target_link_libraries(luacocos2d )
tolua file(GLOB_RECURSE lua_binding_manual_files "${CMAKE_CURRENT_SOURCE_DIR}/manual/*.cpp")
lua set(lua_cocos2d_source_files ${lua_cocos2d_source_files} ${lua_binding_manual_files})
xxtea # 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 set_target_properties(luacocos2d
PROPERTIES PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
LIBRARY_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"
)

View File

@ -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"
)

View File

@ -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"
)

View File

@ -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"
)

View File

@ -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"
)

View File

@ -1,12 +1,10 @@
cmake_minimum_required(VERSION 2.6) cmake_minimum_required(VERSION 2.8)
set(APP_NAME MyGame) set(APP_NAME MyGame)
project (${APP_NAME}) project (${APP_NAME})
include(cocos2d/build/BuildHelpers.CMakeLists.txt) 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) option(DEBUG_MODE "Debug or release?" ON)
if(DEBUG_MODE) 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_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99") 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() 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 # architecture
if ( CMAKE_SIZEOF_VOID_P EQUAL 8 ) if ( CMAKE_SIZEOF_VOID_P EQUAL 8 )
set(ARCH_DIR "64-bit") set(ARCH_DIR "64-bit")
@ -150,6 +132,8 @@ include_directories(
${COCOS2D_ROOT}/external/xxhash ${COCOS2D_ROOT}/external/xxhash
) )
ADD_DEFINITIONS(-DLINUX)
link_directories( link_directories(
/usr/local/lib /usr/local/lib
${COCOS2D_ROOT}/external/jpeg/prebuilt/linux/${ARCH_DIR} ${COCOS2D_ROOT}/external/jpeg/prebuilt/linux/${ARCH_DIR}
@ -162,81 +146,13 @@ link_directories(
) )
endif() endif()
if(USE_CHIPMUNK) # libcocos2d
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
add_subdirectory(${COCOS2D_ROOT}/cocos) add_subdirectory(${COCOS2D_ROOT}/cocos)
# cocos3d library
add_subdirectory(${COCOS2D_ROOT}/cocos/3d)
# network library add_executable(${APP_NAME} ${GAME_SRC})
add_subdirectory(${COCOS2D_ROOT}/cocos/network)
# ui library target_link_libraries(${APP_NAME} cocos2d)
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
)
set(APP_BIN_DIR "${CMAKE_BINARY_DIR}/bin") set(APP_BIN_DIR "${CMAKE_BINARY_DIR}/bin")

View File

@ -1,12 +1,10 @@
cmake_minimum_required(VERSION 2.6) cmake_minimum_required(VERSION 2.8)
set(APP_NAME HelloLua) set(APP_NAME HelloLua)
project (${APP_NAME}) project (${APP_NAME})
include(cocos2d-x/build/BuildHelpers.CMakeLists.txt) 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) option(DEBUG_MODE "Debug or release?" ON)
if(DEBUG_MODE) 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_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} "-std=c99") 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")
ADD_DEFINITIONS(-DLINUX)
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)
# architecture # architecture
if ( CMAKE_SIZEOF_VOID_P EQUAL 8 ) if ( CMAKE_SIZEOF_VOID_P EQUAL 8 )
@ -88,70 +77,14 @@ link_directories(
${COCOS2D_ROOT}/external/linux-specific/fmod/prebuilt/${ARCH_DIR} ${COCOS2D_ROOT}/external/linux-specific/fmod/prebuilt/${ARCH_DIR}
) )
# chipmunk library # libcocos2d
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
add_subdirectory(${COCOS2D_ROOT}/cocos) add_subdirectory(${COCOS2D_ROOT}/cocos)
# cocos 3d library # libluacocos2d
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
add_subdirectory(${COCOS2D_ROOT}/cocos/scripting/lua-bindings) add_subdirectory(${COCOS2D_ROOT}/cocos/scripting/lua-bindings)
# add the executable # add the executable
add_executable(${APP_NAME} add_executable(${APP_NAME} ${GAME_SRC})
${GAME_SRC}
)
if ( CMAKE_SIZEOF_VOID_P EQUAL 8 ) if ( CMAKE_SIZEOF_VOID_P EQUAL 8 )
set(FMOD_LIB "fmodex64") set(FMOD_LIB "fmodex64")
@ -159,26 +92,7 @@ else()
set(FMOD_LIB "fmodex") set(FMOD_LIB "fmodex")
endif() endif()
target_link_libraries(${APP_NAME} target_link_libraries(${APP_NAME} cocos2d luacocos2d)
luacocos2d
luacocos3d
luacocosdenshion
luanetwork
luacocosbuilder
luacocostudio
luaspine
luaextension
luaui
cocos2d
cocos3d
audio
cocostudio
spine
cocosbuilder
extensions
ui
network
)
set(APP_BIN_DIR "${CMAKE_BINARY_DIR}/bin") set(APP_BIN_DIR "${CMAKE_BINARY_DIR}/bin")

View File

@ -72,11 +72,10 @@ else()
set_target_properties(${APP_NAME} PROPERTIES set_target_properties(${APP_NAME} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${APP_BIN_DIR}") RUNTIME_OUTPUT_DIRECTORY "${APP_BIN_DIR}")
pre_build(${APP_NAME} pre_build(${APP_NAME}
COMMAND ${CMAKE_COMMAND} -E remove_directory ${APP_BIN_DIR}/Resources 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 COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/Resources ${APP_BIN_DIR}/Resources
) )
endif() endif()
target_link_libraries(${APP_NAME} audio cocos2d) target_link_libraries(${APP_NAME} cocos2d)

View File

@ -201,17 +201,7 @@ add_executable(${APP_NAME}
) )
target_link_libraries(${APP_NAME} target_link_libraries(${APP_NAME}
spine
cocostudio
cocosbuilder
extensions
audio
cocos2d cocos2d
cocos3d
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,24 +7,15 @@ set(SAMPLE_SRC
include_directories( include_directories(
Classes Classes
../../../cocos/scripting/lua-bindings ../../../cocos/scripting/lua-bindings/manual
../../../external/lua/lua ../../../external/lua/lua
../../../external/lua/tolua ../../../external/lua/tolua
) )
# add the executable # add the executable
add_executable(${APP_NAME} add_executable(${APP_NAME} ${SAMPLE_SRC})
${SAMPLE_SRC}
)
target_link_libraries(${APP_NAME} target_link_libraries(${APP_NAME} cocos2d luacocos2d)
luacocos2d
luacocosdenshion
luanetwork
audio
cocos2d
network
)
set(APP_BIN_DIR "${CMAKE_BINARY_DIR}/bin/${APP_NAME}") set(APP_BIN_DIR "${CMAKE_BINARY_DIR}/bin/${APP_NAME}")

View File

@ -20,23 +20,7 @@ add_executable(${APP_NAME}
target_link_libraries(${APP_NAME} target_link_libraries(${APP_NAME}
luacocos2d luacocos2d
luacocosdenshion
luanetwork
luacocosbuilder
luacocostudio
luaspine
luaextension
luaui
luacocos3d
cocos2d cocos2d
cocos3d
audio
cocostudio
spine
cocosbuilder
extensions
ui
network
) )
set(APP_BIN_DIR "${CMAKE_BINARY_DIR}/bin/${APP_NAME}") set(APP_BIN_DIR "${CMAKE_BINARY_DIR}/bin/${APP_NAME}")