Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake support for mac & ios #169

Merged
merged 3 commits into from
Jan 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cmake/Modules/CocosConfigDepend.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@ macro(cocos2dx_depend)
find_library(OPENAL_LIBRARY OpenAL)
find_library(QUARTZCORE_LIBRARY QuartzCore)
find_library(GAMECONTROLLER_LIBRARY GameController)
find_library(METAL_LIBRARY Metal)
set(COCOS_APPLE_LIBS
${OPENAL_LIBRARY}
${AUDIOTOOLBOX_LIBRARY}
${QUARTZCORE_LIBRARY}
${FOUNDATION_LIBRARY}
${ICONV_LIBRARY}
${GAMECONTROLLER_LIBRARY}
${METAL_LIBRARY}
)

if(BUILD_JS_LIBS)
Expand Down
2 changes: 1 addition & 1 deletion cocos/base/ccConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ THE SOFTWARE.

/** Use physics integration API. */
#ifndef CC_USE_PHYSICS
#define CC_USE_PHYSICS 1
#define CC_USE_PHYSICS 0
#endif

/** Use 3d physics integration API. */
Expand Down
17 changes: 8 additions & 9 deletions cocos/platform/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,31 +70,31 @@ elseif(APPLE)
set(COCOS_PLATFORM_SPECIFIC_HEADER
${COCOS_PLATFORM_SPECIFIC_HEADER}
platform/mac/CCStdC-mac.h
platform/mac/CCGLViewImpl-mac.h
platform/mac/CCPlatformDefine-mac.h
platform/mac/CCApplication-mac.h
platform/mac/CCGL-mac.h
platform/desktop/CCGLViewImpl-desktop.h
# platform/desktop/CCGLViewImpl-desktop.h
)
set(COCOS_PLATFORM_SPECIFIC_SRC
${COCOS_PLATFORM_SPECIFIC_SRC}
platform/mac/CCApplication-mac.mm
platform/mac/CCGLViewImpl-mac.mm
platform/mac/CCCommon-mac.mm
platform/mac/CCDevice-mac.mm
platform/desktop/CCGLViewImpl-desktop.cpp
# platform/desktop/CCGLViewImpl-desktop.cpp
)
elseif(IOS)
set(COCOS_PLATFORM_SPECIFIC_HEADER
${COCOS_PLATFORM_SPECIFIC_HEADER}
platform/ios/CCGL-ios.h
platform/ios/CCApplication-ios.h
platform/ios/CCDirectorCaller-ios.h
platform/ios/CCESRenderer-ios.h
platform/ios/OpenGL_Internal-ios.h
platform/ios/CCPlatformDefine-ios.h
platform/ios/CCStdC-ios.h
platform/ios/CCEAGLView-ios.h
platform/ios/CCGL-ios.h
platform/ios/CCGLViewImpl-ios.h
platform/ios/CCES2Renderer-ios.h
platform/ios/CCPlatformDefine-ios.h
platform/ios/CCStdC-ios.h
platform/ios/OpenGL_Internal-ios.h
)
set(COCOS_PLATFORM_SPECIFIC_SRC
${COCOS_PLATFORM_SPECIFIC_SRC}
Expand All @@ -103,7 +103,6 @@ elseif(APPLE)
platform/ios/CCDevice-ios.mm
platform/ios/CCDirectorCaller-ios.mm
platform/ios/CCEAGLView-ios.mm
platform/ios/CCES2Renderer-ios.m
platform/ios/CCGLViewImpl-ios.mm
platform/ios/CCImage-ios.mm
)
Expand Down
28 changes: 28 additions & 0 deletions cocos/renderer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,32 @@ list(APPEND COCOS_RENDERER_SRC
renderer/backend/opengl/TextureGL.cpp
)

else()

list(APPEND COCOS_RENDERER_HEADER
renderer/backend/metal/BlendStateMTL.h
renderer/backend/metal/BufferMTL.h
renderer/backend/metal/BufferManager.h
renderer/backend/metal/CommandBufferMTL.h
renderer/backend/metal/DepthStencilStateMTL.h
renderer/backend/metal/DeviceMTL.h
renderer/backend/metal/RenderPipelineMTL.h
renderer/backend/metal/ShaderModuleMTL.h
renderer/backend/metal/TextureMTL.h
renderer/backend/metal/Utils.h
)

list(APPEND COCOS_RENDERER_SRC
renderer/backend/metal/BlendStateMTL.mm
renderer/backend/metal/BufferMTL.mm
renderer/backend/metal/BufferManager.mm
renderer/backend/metal/CommandBufferMTL.mm
renderer/backend/metal/DepthStencilStateMTL.mm
renderer/backend/metal/DeviceMTL.mm
renderer/backend/metal/RenderPipelineMTL.mm
renderer/backend/metal/ShaderModuleMTL.mm
renderer/backend/metal/TextureMTL.mm
renderer/backend/metal/Utils.mm
)

endif()
8 changes: 4 additions & 4 deletions cocos/ui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ elseif(APPLE)
)
elseif(IOS)
set(COCOS_UI_SPECIFIC_HEADER
ui/UIWebView.h
ui/UIWebView/UIWebView.h
ui/UIVideoPlayer.h
ui/UIWebViewImpl-ios.h
ui/UIWebView/UIWebViewImpl-ios.h
ui/UIEditBox/UIEditBoxImpl-ios.h
ui/UIEditBox/iOS/CCUIEditBoxIOS.h
ui/UIEditBox/iOS/CCUIMultilineTextField.h
Expand All @@ -43,9 +43,9 @@ elseif(APPLE)
ui/UIEditBox/iOS/CCUISingleLineTextField.h
)
set(COCOS_UI_SPECIFIC_SRC
ui/UIWebView.mm
ui/UIWebView/UIWebView.mm
ui/UIVideoPlayer-ios.mm
ui/UIWebViewImpl-ios.mm
ui/UIWebView/UIWebViewImpl-ios.mm
ui/UIEditBox/UIEditBoxImpl-ios.mm
ui/UIEditBox/iOS/CCUIEditBoxIOS.mm
ui/UIEditBox/iOS/CCUIMultilineTextField.mm
Expand Down
2 changes: 1 addition & 1 deletion external/config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "metal-support-2",
"version": "metal-support-3",
"zip_file_size": "146254799",
"repo_name": "cocos2d-x-3rd-party-libs-bin",
"repo_parent": "https://github.com/cocos2d/",
Expand Down
12 changes: 6 additions & 6 deletions tests/cpp-tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@ list(APPEND GAME_HEADER
Classes/NewEventDispatcherTest/NewEventDispatcherTest.h
Classes/ActionsProgressTest/ActionsProgressTest.h
Classes/RotateWorldTest/RotateWorldTest.h
Classes/Camera3DTest/Camera3DTest.h
#Classes/Camera3DTest/Camera3DTest.h
Classes/TextInputTest/TextInputTest.h
Classes/Texture2dTest/Texture2dTest.h
Classes/TerrainTest/TerrainTest.h
#Classes/TerrainTest/TerrainTest.h
Classes/controller.h
Classes/TransitionsTest/TransitionsTest.h
Classes/TextureCacheTest/TextureCacheTest.h
Expand Down Expand Up @@ -236,7 +236,7 @@ list(APPEND GAME_SOURCE
Classes/BugsTest/Bug-15776.cpp
Classes/BugsTest/Bug-Child.cpp
Classes/BugsTest/BugsTest.cpp
Classes/Camera3DTest/Camera3DTest.cpp
#Classes/Camera3DTest/Camera3DTest.cpp
Classes/ClickAndMoveTest/ClickAndMoveTest.cpp
Classes/ClippingNodeTest/ClippingNodeTest.cpp
Classes/CocosDenshionTest/CocosDenshionTest.cpp
Expand Down Expand Up @@ -290,7 +290,7 @@ list(APPEND GAME_SOURCE
Classes/Sprite3DTest/Sprite3DTest.cpp
Classes/SpritePolygonTest/SpritePolygonTest.cpp
Classes/SpriteTest/SpriteTest.cpp
Classes/TerrainTest/TerrainTest.cpp
# Classes/TerrainTest/TerrainTest.cpp
Classes/TextInputTest/TextInputTest.cpp
Classes/Texture2dTest/Texture2dTest.cpp
Classes/TextureCacheTest/TextureCacheTest.cpp
Expand Down Expand Up @@ -445,8 +445,8 @@ if(USE_CHIPMUNK)
Classes/ChipmunkTest/ChipmunkTest.h
)
list(APPEND GAME_SOURCE
Classes/PhysicsTest/PhysicsTest.cpp
Classes/ChipmunkTest/ChipmunkTest.cpp
# Classes/PhysicsTest/PhysicsTest.cpp
# Classes/ChipmunkTest/ChipmunkTest.cpp
)
endif()

Expand Down
2 changes: 1 addition & 1 deletion tests/cpp-tests/Classes/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class RootTests : public TestList
addTest("Node: Particles", [](){return new ParticleTests(); });
// addTest("Node: Particle3D (PU)", [](){return new Particle3DTests(); });
#if CC_USE_PHYSICS
addTest("Node: Physics", []() { return new PhysicsTests(); });
// addTest("Node: Physics", []() { return new PhysicsTests(); });
#endif
// addTest("Node: Physics3D", []() { return new Physics3DTests(); } );
addTest("Node: RenderTexture", [](){return new RenderTextureTests(); });
Expand Down