Skip to content

Commit 673b36f

Browse files
PatriceJiangminggo
authored and
minggo
committed
CMake support for mac & ios (cocos2d#169)
* update cmake * fix compile error * update 3rd libs version
1 parent 84b9057 commit 673b36f

File tree

8 files changed

+51
-22
lines changed

8 files changed

+51
-22
lines changed

cmake/Modules/CocosConfigDepend.cmake

+2
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,15 @@ macro(cocos2dx_depend)
3030
find_library(OPENAL_LIBRARY OpenAL)
3131
find_library(QUARTZCORE_LIBRARY QuartzCore)
3232
find_library(GAMECONTROLLER_LIBRARY GameController)
33+
find_library(METAL_LIBRARY Metal)
3334
set(COCOS_APPLE_LIBS
3435
${OPENAL_LIBRARY}
3536
${AUDIOTOOLBOX_LIBRARY}
3637
${QUARTZCORE_LIBRARY}
3738
${FOUNDATION_LIBRARY}
3839
${ICONV_LIBRARY}
3940
${GAMECONTROLLER_LIBRARY}
41+
${METAL_LIBRARY}
4042
)
4143

4244
if(BUILD_JS_LIBS)

cocos/base/ccConfig.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ THE SOFTWARE.
252252

253253
/** Use physics integration API. */
254254
#ifndef CC_USE_PHYSICS
255-
#define CC_USE_PHYSICS 1
255+
#define CC_USE_PHYSICS 0
256256
#endif
257257

258258
/** Use 3d physics integration API. */

cocos/platform/CMakeLists.txt

+8-9
Original file line numberDiff line numberDiff line change
@@ -70,31 +70,31 @@ elseif(APPLE)
7070
set(COCOS_PLATFORM_SPECIFIC_HEADER
7171
${COCOS_PLATFORM_SPECIFIC_HEADER}
7272
platform/mac/CCStdC-mac.h
73+
platform/mac/CCGLViewImpl-mac.h
7374
platform/mac/CCPlatformDefine-mac.h
7475
platform/mac/CCApplication-mac.h
7576
platform/mac/CCGL-mac.h
76-
platform/desktop/CCGLViewImpl-desktop.h
77+
# platform/desktop/CCGLViewImpl-desktop.h
7778
)
7879
set(COCOS_PLATFORM_SPECIFIC_SRC
7980
${COCOS_PLATFORM_SPECIFIC_SRC}
8081
platform/mac/CCApplication-mac.mm
82+
platform/mac/CCGLViewImpl-mac.mm
8183
platform/mac/CCCommon-mac.mm
8284
platform/mac/CCDevice-mac.mm
83-
platform/desktop/CCGLViewImpl-desktop.cpp
85+
# platform/desktop/CCGLViewImpl-desktop.cpp
8486
)
8587
elseif(IOS)
8688
set(COCOS_PLATFORM_SPECIFIC_HEADER
8789
${COCOS_PLATFORM_SPECIFIC_HEADER}
88-
platform/ios/CCGL-ios.h
8990
platform/ios/CCApplication-ios.h
9091
platform/ios/CCDirectorCaller-ios.h
91-
platform/ios/CCESRenderer-ios.h
92-
platform/ios/OpenGL_Internal-ios.h
93-
platform/ios/CCPlatformDefine-ios.h
94-
platform/ios/CCStdC-ios.h
9592
platform/ios/CCEAGLView-ios.h
93+
platform/ios/CCGL-ios.h
9694
platform/ios/CCGLViewImpl-ios.h
97-
platform/ios/CCES2Renderer-ios.h
95+
platform/ios/CCPlatformDefine-ios.h
96+
platform/ios/CCStdC-ios.h
97+
platform/ios/OpenGL_Internal-ios.h
9898
)
9999
set(COCOS_PLATFORM_SPECIFIC_SRC
100100
${COCOS_PLATFORM_SPECIFIC_SRC}
@@ -103,7 +103,6 @@ elseif(APPLE)
103103
platform/ios/CCDevice-ios.mm
104104
platform/ios/CCDirectorCaller-ios.mm
105105
platform/ios/CCEAGLView-ios.mm
106-
platform/ios/CCES2Renderer-ios.m
107106
platform/ios/CCGLViewImpl-ios.mm
108107
platform/ios/CCImage-ios.mm
109108
)

cocos/renderer/CMakeLists.txt

+28
Original file line numberDiff line numberDiff line change
@@ -108,4 +108,32 @@ list(APPEND COCOS_RENDERER_SRC
108108
renderer/backend/opengl/TextureGL.cpp
109109
)
110110

111+
else()
112+
113+
list(APPEND COCOS_RENDERER_HEADER
114+
renderer/backend/metal/BlendStateMTL.h
115+
renderer/backend/metal/BufferMTL.h
116+
renderer/backend/metal/BufferManager.h
117+
renderer/backend/metal/CommandBufferMTL.h
118+
renderer/backend/metal/DepthStencilStateMTL.h
119+
renderer/backend/metal/DeviceMTL.h
120+
renderer/backend/metal/RenderPipelineMTL.h
121+
renderer/backend/metal/ShaderModuleMTL.h
122+
renderer/backend/metal/TextureMTL.h
123+
renderer/backend/metal/Utils.h
124+
)
125+
126+
list(APPEND COCOS_RENDERER_SRC
127+
renderer/backend/metal/BlendStateMTL.mm
128+
renderer/backend/metal/BufferMTL.mm
129+
renderer/backend/metal/BufferManager.mm
130+
renderer/backend/metal/CommandBufferMTL.mm
131+
renderer/backend/metal/DepthStencilStateMTL.mm
132+
renderer/backend/metal/DeviceMTL.mm
133+
renderer/backend/metal/RenderPipelineMTL.mm
134+
renderer/backend/metal/ShaderModuleMTL.mm
135+
renderer/backend/metal/TextureMTL.mm
136+
renderer/backend/metal/Utils.mm
137+
)
138+
111139
endif()

cocos/ui/CMakeLists.txt

+4-4
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ elseif(APPLE)
3131
)
3232
elseif(IOS)
3333
set(COCOS_UI_SPECIFIC_HEADER
34-
ui/UIWebView.h
34+
ui/UIWebView/UIWebView.h
3535
ui/UIVideoPlayer.h
36-
ui/UIWebViewImpl-ios.h
36+
ui/UIWebView/UIWebViewImpl-ios.h
3737
ui/UIEditBox/UIEditBoxImpl-ios.h
3838
ui/UIEditBox/iOS/CCUIEditBoxIOS.h
3939
ui/UIEditBox/iOS/CCUIMultilineTextField.h
@@ -43,9 +43,9 @@ elseif(APPLE)
4343
ui/UIEditBox/iOS/CCUISingleLineTextField.h
4444
)
4545
set(COCOS_UI_SPECIFIC_SRC
46-
ui/UIWebView.mm
46+
ui/UIWebView/UIWebView.mm
4747
ui/UIVideoPlayer-ios.mm
48-
ui/UIWebViewImpl-ios.mm
48+
ui/UIWebView/UIWebViewImpl-ios.mm
4949
ui/UIEditBox/UIEditBoxImpl-ios.mm
5050
ui/UIEditBox/iOS/CCUIEditBoxIOS.mm
5151
ui/UIEditBox/iOS/CCUIMultilineTextField.mm

external/config.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "metal-support-2",
2+
"version": "metal-support-3",
33
"zip_file_size": "146254799",
44
"repo_name": "cocos2d-x-3rd-party-libs-bin",
55
"repo_parent": "https://github.com/cocos2d/",

tests/cpp-tests/CMakeLists.txt

+6-6
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,10 @@ list(APPEND GAME_HEADER
132132
Classes/NewEventDispatcherTest/NewEventDispatcherTest.h
133133
Classes/ActionsProgressTest/ActionsProgressTest.h
134134
Classes/RotateWorldTest/RotateWorldTest.h
135-
Classes/Camera3DTest/Camera3DTest.h
135+
#Classes/Camera3DTest/Camera3DTest.h
136136
Classes/TextInputTest/TextInputTest.h
137137
Classes/Texture2dTest/Texture2dTest.h
138-
Classes/TerrainTest/TerrainTest.h
138+
#Classes/TerrainTest/TerrainTest.h
139139
Classes/controller.h
140140
Classes/TransitionsTest/TransitionsTest.h
141141
Classes/TextureCacheTest/TextureCacheTest.h
@@ -236,7 +236,7 @@ list(APPEND GAME_SOURCE
236236
Classes/BugsTest/Bug-15776.cpp
237237
Classes/BugsTest/Bug-Child.cpp
238238
Classes/BugsTest/BugsTest.cpp
239-
Classes/Camera3DTest/Camera3DTest.cpp
239+
#Classes/Camera3DTest/Camera3DTest.cpp
240240
Classes/ClickAndMoveTest/ClickAndMoveTest.cpp
241241
Classes/ClippingNodeTest/ClippingNodeTest.cpp
242242
Classes/CocosDenshionTest/CocosDenshionTest.cpp
@@ -290,7 +290,7 @@ list(APPEND GAME_SOURCE
290290
Classes/Sprite3DTest/Sprite3DTest.cpp
291291
Classes/SpritePolygonTest/SpritePolygonTest.cpp
292292
Classes/SpriteTest/SpriteTest.cpp
293-
Classes/TerrainTest/TerrainTest.cpp
293+
# Classes/TerrainTest/TerrainTest.cpp
294294
Classes/TextInputTest/TextInputTest.cpp
295295
Classes/Texture2dTest/Texture2dTest.cpp
296296
Classes/TextureCacheTest/TextureCacheTest.cpp
@@ -445,8 +445,8 @@ if(USE_CHIPMUNK)
445445
Classes/ChipmunkTest/ChipmunkTest.h
446446
)
447447
list(APPEND GAME_SOURCE
448-
Classes/PhysicsTest/PhysicsTest.cpp
449-
Classes/ChipmunkTest/ChipmunkTest.cpp
448+
# Classes/PhysicsTest/PhysicsTest.cpp
449+
# Classes/ChipmunkTest/ChipmunkTest.cpp
450450
)
451451
endif()
452452

tests/cpp-tests/Classes/controller.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class RootTests : public TestList
9393
addTest("Node: Particles", [](){return new ParticleTests(); });
9494
// addTest("Node: Particle3D (PU)", [](){return new Particle3DTests(); });
9595
#if CC_USE_PHYSICS
96-
addTest("Node: Physics", []() { return new PhysicsTests(); });
96+
// addTest("Node: Physics", []() { return new PhysicsTests(); });
9797
#endif
9898
// addTest("Node: Physics3D", []() { return new Physics3DTests(); } );
9999
addTest("Node: RenderTexture", [](){return new RenderTextureTests(); });

0 commit comments

Comments
 (0)