2016-05-14 08:49:39 +08:00
|
|
|
set(APP_NAME cpp-tests)
|
2013-11-02 18:07:34 +08:00
|
|
|
|
2014-12-21 21:40:46 +08:00
|
|
|
# Use same method as in cocos library
|
2016-11-18 09:23:44 +08:00
|
|
|
if(LINUX)
|
|
|
|
foreach(_pkg FONTCONFIG GTK3)
|
|
|
|
cocos_find_package(${_pkg} ${_pkg} REQUIRED)
|
|
|
|
endforeach()
|
|
|
|
endif()
|
|
|
|
cocos_find_package(FREETYPE FREETYPE REQUIRED)
|
2014-12-21 21:40:46 +08:00
|
|
|
cocos_find_package(CURL CURL REQUIRED)
|
|
|
|
|
2014-01-09 17:48:37 +08:00
|
|
|
if(WIN32)
|
2014-11-17 06:42:04 +08:00
|
|
|
set(PLATFORM_SRC proj.win32/main.cpp)
|
|
|
|
set(RES_PREFIX "")
|
2014-09-10 03:18:31 +08:00
|
|
|
elseif(MACOSX)
|
2014-11-17 06:42:04 +08:00
|
|
|
set(PLATFORM_SRC proj.mac/main.cpp)
|
2014-11-11 14:49:27 +08:00
|
|
|
|
|
|
|
file(GLOB_RECURSE RES_FILES Resources/*)
|
|
|
|
cocos_mark_resources(FILES ${RES_FILES} BASEDIR Resources)
|
|
|
|
list(APPEND PLATFORM_SRC ${RES_FILES})
|
|
|
|
|
2014-09-10 03:18:31 +08:00
|
|
|
elseif(LINUX)
|
2014-11-17 06:42:04 +08:00
|
|
|
set(PLATFORM_SRC proj.linux/main.cpp)
|
|
|
|
set(RES_PREFIX "/Resources")
|
2016-03-03 08:51:54 +08:00
|
|
|
elseif(ANDROID)
|
|
|
|
set(PLATFORM_SRC
|
|
|
|
Classes/JNITest/JNITest.cpp
|
|
|
|
proj.android/jni/main.cpp)
|
|
|
|
set(RES_PREFIX "/Resources")
|
2014-09-10 03:18:31 +08:00
|
|
|
else()
|
|
|
|
message( FATAL_ERROR "Unsupported platform, CMake will exit" )
|
2014-01-09 17:48:37 +08:00
|
|
|
endif()
|
|
|
|
|
2014-09-10 03:18:31 +08:00
|
|
|
set(TESTS_SRC
|
2013-11-02 18:07:34 +08:00
|
|
|
Classes/ActionManagerTest/ActionManagerTest.cpp
|
|
|
|
Classes/ActionsEaseTest/ActionsEaseTest.cpp
|
|
|
|
Classes/ActionsProgressTest/ActionsProgressTest.cpp
|
|
|
|
Classes/ActionsTest/ActionsTest.cpp
|
2014-12-19 07:10:13 +08:00
|
|
|
Classes/AllocatorTest/AllocatorTest.cpp
|
2015-05-06 04:07:32 +08:00
|
|
|
Classes/AppDelegate.cpp
|
|
|
|
Classes/BaseTest.cpp
|
2014-09-04 16:45:42 +08:00
|
|
|
Classes/BillBoardTest/BillBoardTest.cpp
|
2015-07-07 11:02:00 +08:00
|
|
|
Classes/BugsTest/Bug-CCDrawNode.cpp
|
2013-11-02 18:07:34 +08:00
|
|
|
Classes/BugsTest/Bug-1159.cpp
|
|
|
|
Classes/BugsTest/Bug-1174.cpp
|
|
|
|
Classes/BugsTest/Bug-350.cpp
|
|
|
|
Classes/BugsTest/Bug-422.cpp
|
|
|
|
Classes/BugsTest/Bug-458/Bug-458.cpp
|
|
|
|
Classes/BugsTest/Bug-458/QuestionContainerSprite.cpp
|
|
|
|
Classes/BugsTest/Bug-624.cpp
|
|
|
|
Classes/BugsTest/Bug-886.cpp
|
|
|
|
Classes/BugsTest/Bug-899.cpp
|
|
|
|
Classes/BugsTest/Bug-914.cpp
|
2015-07-22 13:42:10 +08:00
|
|
|
Classes/BugsTest/Bug-12847.cpp
|
2016-05-27 03:02:24 +08:00
|
|
|
Classes/BugsTest/Bug-15594.cpp
|
2016-06-18 07:07:33 +08:00
|
|
|
Classes/BugsTest/Bug-15776.cpp
|
2014-05-13 18:51:02 +08:00
|
|
|
Classes/BugsTest/Bug-Child.cpp
|
2015-05-06 04:07:32 +08:00
|
|
|
Classes/BugsTest/BugsTest.cpp
|
2014-08-07 15:23:31 +08:00
|
|
|
Classes/Camera3DTest/Camera3DTest.cpp
|
2013-11-02 18:07:34 +08:00
|
|
|
Classes/ChipmunkTest/ChipmunkTest.cpp
|
|
|
|
Classes/ClickAndMoveTest/ClickAndMoveTest.cpp
|
|
|
|
Classes/ClippingNodeTest/ClippingNodeTest.cpp
|
|
|
|
Classes/CocosDenshionTest/CocosDenshionTest.cpp
|
2015-05-06 04:07:32 +08:00
|
|
|
Classes/ConfigurationTest/ConfigurationTest.cpp
|
|
|
|
Classes/ConsoleTest/ConsoleTest.cpp
|
2013-11-02 18:07:34 +08:00
|
|
|
Classes/CurlTest/CurlTest.cpp
|
|
|
|
Classes/CurrentLanguageTest/CurrentLanguageTest.cpp
|
2015-05-06 04:07:32 +08:00
|
|
|
Classes/DataVisitorTest/DataVisitorTest.cpp
|
2015-08-13 15:14:10 +08:00
|
|
|
Classes/DownloaderTest/DownloaderTest.cpp
|
2013-11-02 18:07:34 +08:00
|
|
|
Classes/DrawPrimitivesTest/DrawPrimitivesTest.cpp
|
|
|
|
Classes/EffectsAdvancedTest/EffectsAdvancedTest.cpp
|
|
|
|
Classes/EffectsTest/EffectsTest.cpp
|
2014-10-09 18:30:39 +08:00
|
|
|
Classes/ExtensionsTest/AssetsManagerExTest/AssetsManagerExTest.cpp
|
2013-11-02 18:07:34 +08:00
|
|
|
Classes/ExtensionsTest/ExtensionsTest.cpp
|
|
|
|
Classes/ExtensionsTest/NetworkTest/HttpClientTest.cpp
|
2015-05-06 04:07:32 +08:00
|
|
|
Classes/ExtensionsTest/TableViewTest/CustomTableViewCell.cpp
|
|
|
|
Classes/ExtensionsTest/TableViewTest/TableViewTestScene.cpp
|
|
|
|
Classes/FileUtilsTest/FileUtilsTest.cpp
|
2013-11-02 18:07:34 +08:00
|
|
|
Classes/FontTest/FontTest.cpp
|
|
|
|
Classes/InputTest/MouseTest.cpp
|
2015-05-06 04:07:32 +08:00
|
|
|
Classes/IntervalTest/IntervalTest.cpp
|
2013-11-02 18:07:34 +08:00
|
|
|
Classes/LabelTest/LabelTest.cpp
|
|
|
|
Classes/LabelTest/LabelTestNew.cpp
|
|
|
|
Classes/LayerTest/LayerTest.cpp
|
2014-09-26 16:54:01 +08:00
|
|
|
Classes/LightTest/LightTest.cpp
|
2015-05-06 04:07:32 +08:00
|
|
|
Classes/MaterialSystemTest/MaterialSystemTest
|
2013-11-02 18:07:34 +08:00
|
|
|
Classes/MenuTest/MenuTest.cpp
|
|
|
|
Classes/MotionStreakTest/MotionStreakTest.cpp
|
2017-02-23 17:05:08 +08:00
|
|
|
Classes/MultiTouchTest/MultiTouchTest.cpp
|
2015-05-06 04:07:32 +08:00
|
|
|
Classes/NewAudioEngineTest/NewAudioEngineTest.cpp
|
|
|
|
Classes/NewEventDispatcherTest/NewEventDispatcherTest.cpp
|
|
|
|
Classes/NewRendererTest/NewRendererTest.cpp
|
2015-05-29 16:45:33 +08:00
|
|
|
Classes/NavMeshTest/NavMeshTest.cpp
|
2013-11-02 18:07:34 +08:00
|
|
|
Classes/NodeTest/NodeTest.cpp
|
2014-09-22 21:32:20 +08:00
|
|
|
Classes/OpenURLTest/OpenURLTest.cpp
|
2013-11-02 18:07:34 +08:00
|
|
|
Classes/ParallaxTest/ParallaxTest.cpp
|
2015-02-15 13:26:29 +08:00
|
|
|
Classes/Particle3DTest/Particle3DTest.cpp
|
2015-05-06 04:07:32 +08:00
|
|
|
Classes/ParticleTest/ParticleTest.cpp
|
2013-11-02 18:07:34 +08:00
|
|
|
Classes/PhysicsTest/PhysicsTest.cpp
|
2014-01-21 17:47:59 +08:00
|
|
|
Classes/ReleasePoolTest/ReleasePoolTest.cpp
|
2013-11-02 18:07:34 +08:00
|
|
|
Classes/RenderTextureTest/RenderTextureTest.cpp
|
|
|
|
Classes/RotateWorldTest/RotateWorldTest.cpp
|
|
|
|
Classes/SceneTest/SceneTest.cpp
|
|
|
|
Classes/SchedulerTest/SchedulerTest.cpp
|
|
|
|
Classes/ShaderTest/ShaderTest.cpp
|
|
|
|
Classes/ShaderTest/ShaderTest2.cpp
|
2015-05-06 04:07:32 +08:00
|
|
|
Classes/SpineTest/SpineTest.cpp
|
2015-05-14 14:49:48 +08:00
|
|
|
Classes/Scene3DTest/Scene3DTest.cpp
|
2014-08-09 09:27:48 +08:00
|
|
|
Classes/Sprite3DTest/DrawNode3D.cpp
|
2015-05-06 04:07:32 +08:00
|
|
|
Classes/Sprite3DTest/Sprite3DTest.cpp
|
|
|
|
Classes/SpritePolygonTest/SpritePolygonTest.cpp
|
|
|
|
Classes/SpriteTest/SpriteTest.cpp
|
2015-04-02 16:57:38 +08:00
|
|
|
Classes/TerrainTest/TerrainTest.cpp
|
2013-11-02 18:07:34 +08:00
|
|
|
Classes/TextInputTest/TextInputTest.cpp
|
|
|
|
Classes/Texture2dTest/Texture2dTest.cpp
|
|
|
|
Classes/TextureCacheTest/TextureCacheTest.cpp
|
2015-05-06 04:07:32 +08:00
|
|
|
Classes/TexturePackerEncryptionTest/TextureAtlasEncryptionTest.cpp
|
2013-11-02 18:07:34 +08:00
|
|
|
Classes/TileMapTest/TileMapTest.cpp
|
2014-06-13 11:07:21 +08:00
|
|
|
Classes/TileMapTest/TileMapTest2.cpp
|
2013-11-02 18:07:34 +08:00
|
|
|
Classes/TouchesTest/Ball.cpp
|
|
|
|
Classes/TouchesTest/Paddle.cpp
|
|
|
|
Classes/TouchesTest/TouchesTest.cpp
|
|
|
|
Classes/TransitionsTest/TransitionsTest.cpp
|
2015-05-06 04:07:32 +08:00
|
|
|
Classes/UITest/CocoStudioGUITest/CocosGUIScene.cpp
|
|
|
|
Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest.cpp
|
|
|
|
Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest.cpp
|
2015-07-01 14:36:53 +08:00
|
|
|
Classes/UITest/CocoStudioGUITest/UIRadioButtonTest/UIRadioButtonTest.cpp
|
2015-05-06 04:07:32 +08:00
|
|
|
Classes/UITest/CocoStudioGUITest/UIFocusTest/UIFocusTest.cpp
|
|
|
|
Classes/UITest/CocoStudioGUITest/UIImageViewTest/UIImageViewTest.cpp
|
|
|
|
Classes/UITest/CocoStudioGUITest/UILayoutTest/UILayoutTest.cpp
|
|
|
|
Classes/UITest/CocoStudioGUITest/UIListViewTest/UIListViewTest.cpp
|
|
|
|
Classes/UITest/CocoStudioGUITest/UILoadingBarTest/UILoadingBarTest.cpp
|
|
|
|
Classes/UITest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest.cpp
|
|
|
|
Classes/UITest/CocoStudioGUITest/UIRichTextTest/UIRichTextTest.cpp
|
|
|
|
Classes/UITest/CocoStudioGUITest/UIScale9SpriteTest.cpp
|
|
|
|
Classes/UITest/CocoStudioGUITest/UIScene.cpp
|
|
|
|
Classes/UITest/CocoStudioGUITest/UISceneManager.cpp
|
|
|
|
Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest.cpp
|
|
|
|
Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest.cpp
|
|
|
|
Classes/UITest/CocoStudioGUITest/UITextAtlasTest/UITextAtlasTest.cpp
|
|
|
|
Classes/UITest/CocoStudioGUITest/UITextBMFontTest/UITextBMFontTest.cpp
|
|
|
|
Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest.cpp
|
|
|
|
Classes/UITest/CocoStudioGUITest/UITextTest/UITextTest.cpp
|
|
|
|
Classes/UITest/CocoStudioGUITest/UIWidgetAddNodeTest/UIWidgetAddNodeTest.cpp
|
2016-03-03 14:17:48 +08:00
|
|
|
Classes/UITest/CocoStudioGUITest/UITabControlTest/UITabControlTest.cpp
|
2015-05-06 04:07:32 +08:00
|
|
|
Classes/UITest/UITest.cpp
|
2014-04-09 13:29:40 +08:00
|
|
|
Classes/UnitTest/RefPtrTest.cpp
|
2014-01-03 20:21:04 +08:00
|
|
|
Classes/UnitTest/UnitTest.cpp
|
2015-05-06 04:07:32 +08:00
|
|
|
Classes/UserDefaultTest/UserDefaultTest.cpp
|
|
|
|
Classes/VisibleRect.cpp
|
2015-06-25 17:36:57 +08:00
|
|
|
Classes/VibrateTest/VibrateTest.cpp
|
2015-05-06 04:07:32 +08:00
|
|
|
Classes/ZwoptexTest/ZwoptexTest.cpp
|
2016-02-18 01:52:30 +08:00
|
|
|
Classes/SpriteFrameCacheTest/SpriteFrameCacheTest.cpp
|
2013-11-02 18:07:34 +08:00
|
|
|
Classes/controller.cpp
|
2016-06-24 10:03:38 +08:00
|
|
|
Classes/VRTest/VRTest.cpp
|
|
|
|
Classes/VRTest/VRTest.h
|
2014-01-09 17:48:37 +08:00
|
|
|
${PLATFORM_SRC}
|
2013-11-02 18:07:34 +08:00
|
|
|
)
|
|
|
|
|
2016-10-31 14:02:02 +08:00
|
|
|
if(WIN32 OR MACOSX OR LINUX)
|
|
|
|
list(APPEND TESTS_SRC
|
|
|
|
Classes/WindowTest/WindowTest.cpp
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2014-11-16 02:16:01 +08:00
|
|
|
if(USE_CHIPMUNK)
|
|
|
|
include_directories(${CHIPMUNK_INCLUDE_DIRS})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(USE_BOX2D)
|
|
|
|
list(APPEND TESTS_SRC
|
|
|
|
Classes/Box2DTest/Box2dTest.cpp
|
|
|
|
Classes/Box2DTestBed/Box2dView.cpp
|
|
|
|
Classes/Box2DTestBed/GLES-Render.cpp
|
|
|
|
Classes/Box2DTestBed/Test.cpp
|
|
|
|
Classes/Box2DTestBed/TestEntries.cpp
|
|
|
|
)
|
2017-10-31 14:31:23 +08:00
|
|
|
include_directories(${Box2D_INCLUDE_DIRS})
|
2014-11-16 02:16:01 +08:00
|
|
|
endif()
|
|
|
|
|
2015-05-08 15:49:33 +08:00
|
|
|
if(USE_BULLET)
|
|
|
|
list(APPEND TESTS_SRC
|
|
|
|
Classes/Physics3DTest/Physics3DTest.cpp
|
|
|
|
)
|
2017-06-21 13:39:38 +08:00
|
|
|
include_directories(${BULLET_INCLUDE_DIRS})
|
2015-05-08 15:49:33 +08:00
|
|
|
endif()
|
|
|
|
|
2017-01-19 13:55:14 +08:00
|
|
|
set (EXTENDED_TESTS_SRC
|
|
|
|
Classes/ExtensionsTest/NetworkTest/HttpClientTest.cpp
|
|
|
|
Classes/ExtensionsTest/NetworkTest/SocketIOTest.cpp
|
|
|
|
Classes/ExtensionsTest/NetworkTest/WebSocketTest.cpp
|
2014-09-10 03:18:31 +08:00
|
|
|
)
|
|
|
|
|
2017-01-19 13:55:14 +08:00
|
|
|
if(LINUX)
|
|
|
|
|
|
|
|
else()
|
|
|
|
list(APPEND EXTENDED_TESTS_SRC
|
2014-09-10 03:18:31 +08:00
|
|
|
Classes/UITest/CocoStudioGUITest/UIEditBoxTest.cpp
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2013-11-02 18:07:34 +08:00
|
|
|
include_directories(
|
|
|
|
Classes
|
2014-08-25 10:12:36 +08:00
|
|
|
${CMAKE_SOURCE_DIR}/cocos/editor-support
|
2013-11-02 18:07:34 +08:00
|
|
|
)
|
|
|
|
|
2016-03-03 08:51:54 +08:00
|
|
|
if(ANDROID)
|
|
|
|
add_library(${APP_NAME} SHARED ${TESTS_SRC} ${EXTENDED_TESTS_SRC})
|
|
|
|
IF(CMAKE_BUILD_TYPE MATCHES RELEASE)
|
|
|
|
ADD_CUSTOM_COMMAND(TARGET ${APP_NAME} POST_BUILD COMMAND ${CMAKE_STRIP} lib${APP_NAME}.so)
|
|
|
|
ENDIF()
|
|
|
|
else()
|
|
|
|
# add the executable
|
|
|
|
add_executable(${APP_NAME} ${TESTS_SRC} ${EXTENDED_TESTS_SRC})
|
|
|
|
endif()
|
2013-11-02 18:07:34 +08:00
|
|
|
|
2016-03-03 08:51:54 +08:00
|
|
|
target_link_libraries(${APP_NAME} cocos2d)
|
2013-11-02 18:07:34 +08:00
|
|
|
|
2016-11-18 09:23:44 +08:00
|
|
|
if(LINUX)
|
|
|
|
foreach(_pkg FONTCONFIG GTK3)
|
|
|
|
cocos_use_pkg(${APP_NAME} ${_pkg})
|
|
|
|
endforeach()
|
|
|
|
endif()
|
|
|
|
foreach(pkg FREETYPE CURL)
|
|
|
|
cocos_use_pkg(${APP_NAME} ${pkg})
|
|
|
|
endforeach()
|
2014-12-21 21:40:46 +08:00
|
|
|
|
2014-11-11 14:49:27 +08:00
|
|
|
if(MACOSX OR APPLE)
|
|
|
|
set_target_properties(${APP_NAME} PROPERTIES
|
|
|
|
MACOSX_BUNDLE 1
|
|
|
|
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
|
|
|
|
)
|
2016-03-03 08:51:54 +08:00
|
|
|
ELSEIF(ANDROID)
|
|
|
|
set(APP_BIN_DIR "${CMAKE_BINARY_DIR}/bin/${APP_NAME}")
|
|
|
|
set_target_properties(${APP_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${APP_BIN_DIR}")
|
2014-11-11 14:49:27 +08:00
|
|
|
else()
|
|
|
|
set(APP_BIN_DIR "${CMAKE_BINARY_DIR}/bin/${APP_NAME}")
|
|
|
|
set_target_properties(${APP_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${APP_BIN_DIR}")
|
2016-03-03 08:51:54 +08:00
|
|
|
|
2014-11-11 14:49:27 +08:00
|
|
|
pre_build(${APP_NAME}
|
2014-11-17 06:42:04 +08:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/Resources ${APP_BIN_DIR}${RES_PREFIX}
|
2014-11-11 14:49:27 +08:00
|
|
|
)
|
|
|
|
endif()
|
2013-11-02 18:07:34 +08:00
|
|
|
|