CMakeLists.txt 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. #/****************************************************************************
  2. # Copyright (c) 2015-2017 Chukong Technologies Inc.
  3. #
  4. # http://www.cocos2d-x.org
  5. #
  6. # Permission is hereby granted, free of charge, to any person obtaining a copy
  7. # of this software and associated documentation files (the "Software"), to deal
  8. # in the Software without restriction, including without limitation the rights
  9. # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10. # copies of the Software, and to permit persons to whom the Software is
  11. # furnished to do so, subject to the following conditions:
  12. # The above copyright notice and this permission notice shall be included in
  13. # all copies or substantial portions of the Software.
  14. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20. # THE SOFTWARE.
  21. # ****************************************************************************/
  22. if(WINDOWS)
  23. set(COCOS_PLATFORM_SPECIFIC_HEADER
  24. platform/win32/compat/stdint.h
  25. platform/win32/CCApplication-win32.h
  26. platform/win32/inet_pton_mingw.h
  27. platform/win32/CCGL-win32.h
  28. platform/win32/CCFileUtils-win32.h
  29. platform/win32/CCStdC-win32.h
  30. platform/win32/CCPlatformDefine-win32.h
  31. platform/win32/CCUtils-win32.h
  32. platform/desktop/CCGLViewImpl-desktop.h
  33. )
  34. set(COCOS_PLATFORM_SPECIFIC_SRC
  35. platform/win32/CCStdC-win32.cpp
  36. platform/win32/CCUtils-win32.cpp
  37. platform/win32/CCFileUtils-win32.cpp
  38. platform/win32/CCCommon-win32.cpp
  39. platform/win32/CCApplication-win32.cpp
  40. platform/win32/CCDevice-win32.cpp
  41. platform/win32/inet_pton_mingw.cpp
  42. platform/desktop/CCGLViewImpl-desktop.cpp
  43. )
  44. elseif(APPLE)
  45. set(COCOS_PLATFORM_SPECIFIC_HEADER
  46. platform/apple/CCFileUtils-apple.h
  47. platform/apple/CCLock-apple.h
  48. platform/apple/CCDevice-apple.h
  49. )
  50. set(COCOS_PLATFORM_SPECIFIC_SRC
  51. platform/apple/CCLock-apple.cpp
  52. platform/apple/CCFileUtils-apple.mm
  53. platform/apple/CCThread-apple.mm
  54. platform/apple/CCDevice-apple.mm
  55. )
  56. if(MACOSX)
  57. set(COCOS_PLATFORM_SPECIFIC_HEADER
  58. ${COCOS_PLATFORM_SPECIFIC_HEADER}
  59. platform/mac/CCStdC-mac.h
  60. platform/mac/CCPlatformDefine-mac.h
  61. platform/mac/CCApplication-mac.h
  62. platform/mac/CCGL-mac.h
  63. platform/desktop/CCGLViewImpl-desktop.h
  64. )
  65. set(COCOS_PLATFORM_SPECIFIC_SRC
  66. ${COCOS_PLATFORM_SPECIFIC_SRC}
  67. platform/mac/CCApplication-mac.mm
  68. platform/mac/CCCommon-mac.mm
  69. platform/mac/CCDevice-mac.mm
  70. platform/desktop/CCGLViewImpl-desktop.cpp
  71. )
  72. elseif(IOS)
  73. set(COCOS_PLATFORM_SPECIFIC_HEADER
  74. ${COCOS_PLATFORM_SPECIFIC_HEADER}
  75. platform/ios/CCGL-ios.h
  76. platform/ios/CCApplication-ios.h
  77. platform/ios/CCDirectorCaller-ios.h
  78. platform/ios/CCESRenderer-ios.h
  79. platform/ios/OpenGL_Internal-ios.h
  80. platform/ios/CCPlatformDefine-ios.h
  81. platform/ios/CCStdC-ios.h
  82. platform/ios/CCEAGLView-ios.h
  83. platform/ios/CCGLViewImpl-ios.h
  84. platform/ios/CCES2Renderer-ios.h
  85. )
  86. set(COCOS_PLATFORM_SPECIFIC_SRC
  87. ${COCOS_PLATFORM_SPECIFIC_SRC}
  88. platform/ios/CCApplication-ios.mm
  89. platform/ios/CCCommon-ios.mm
  90. platform/ios/CCDevice-ios.mm
  91. platform/ios/CCDirectorCaller-ios.mm
  92. platform/ios/CCEAGLView-ios.mm
  93. platform/ios/CCES2Renderer-ios.m
  94. platform/ios/CCGLViewImpl-ios.mm
  95. platform/ios/CCImage-ios.mm
  96. )
  97. endif()
  98. elseif(LINUX)
  99. if(NOT CMAKE_CROSSCOMPILING)
  100. include_directories(
  101. /usr/include
  102. /usr/include/GLFW
  103. /usr/local/include/GLFW
  104. )
  105. endif(NOT CMAKE_CROSSCOMPILING)
  106. set(COCOS_PLATFORM_SPECIFIC_HEADER
  107. platform/linux/CCApplication-linux.h
  108. platform/linux/CCGL-linux.h
  109. platform/linux/CCStdC-linux.h
  110. platform/linux/CCFileUtils-linux.h
  111. platform/linux/CCPlatformDefine-linux.h
  112. platform/desktop/CCGLViewImpl-desktop.h
  113. )
  114. set(COCOS_PLATFORM_SPECIFIC_SRC
  115. platform/linux/CCStdC-linux.cpp
  116. platform/linux/CCFileUtils-linux.cpp
  117. platform/linux/CCCommon-linux.cpp
  118. platform/linux/CCApplication-linux.cpp
  119. platform/linux/CCDevice-linux.cpp
  120. platform/desktop/CCGLViewImpl-desktop.cpp
  121. )
  122. elseif(ANDROID)
  123. set(COCOS_PLATFORM_SPECIFIC_HEADER
  124. platform/android/CCApplication-android.h
  125. platform/android/CCStdC-android.h
  126. platform/android/CCFileUtils-android.h
  127. platform/android/CCEnhanceAPI-android.h
  128. platform/android/CCPlatformDefine-android.h
  129. platform/android/CCGLViewImpl-android.h
  130. platform/android/jni/ProcessCpuTracker.h
  131. platform/android/jni/JniHelper.h
  132. platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxBitmap.h
  133. platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.h
  134. platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxEngineDataManager.h
  135. platform/android/CCGL-android.h
  136. )
  137. # need move to COCOS2DX_ANDROID_SRC?
  138. # need refactor
  139. set(COCOS_PLATFORM_SPECIFIC_SRC
  140. platform/android/CCApplication-android.cpp
  141. platform/android/CCCommon-android.cpp
  142. platform/android/CCGLViewImpl-android.cpp
  143. platform/android/CCFileUtils-android.cpp
  144. platform/android/CCEnhanceAPI-android.cpp
  145. platform/android/jni/JniHelper.cpp
  146. )
  147. set(COCOS2DX_ANDROID_SRC
  148. platform/android/CCDevice-android.cpp
  149. platform/android/javaactivity-android.cpp
  150. platform/android/jni/TouchesJni.cpp
  151. platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxAccelerometer.cpp
  152. platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxBitmap.cpp
  153. platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.cpp
  154. platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxRenderer.cpp
  155. platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxEngineDataManager.cpp
  156. )
  157. add_library(cocos2d_android STATIC ${COCOS2DX_ANDROID_SRC})
  158. set_property(TARGET cocos2d_android PROPERTY POSITION_INDEPENDENT_CODE TRUE)
  159. set_target_properties(cocos2d_android
  160. PROPERTIES
  161. ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
  162. LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
  163. VERSION "${COCOS2D_X_VERSION}"
  164. )
  165. endif()
  166. #leave andatory external stuff here also
  167. include_directories(
  168. ../external
  169. ../external/ConvertUTF
  170. ../external/edtaa3func
  171. ../external/poly2tri
  172. ../external/poly2tri/common
  173. ../external/poly2tri/sweep
  174. )
  175. set(COCOS_PLATFORM_HEADER
  176. ${COCOS_PLATFORM_SPECIFIC_HEADER}
  177. platform/CCApplication.h
  178. platform/CCApplicationProtocol.h
  179. platform/CCCommon.h
  180. platform/CCDevice.h
  181. platform/CCFileUtils.h
  182. platform/CCGL.h
  183. platform/CCGLView.h
  184. platform/CCImage.h
  185. platform/CCPlatformConfig.h
  186. platform/CCPlatformDefine.h
  187. platform/CCPlatformMacros.h
  188. platform/CCSAXParser.h
  189. platform/CCStdC.h
  190. platform/CCThread.h
  191. )
  192. set(COCOS_PLATFORM_SRC
  193. ${COCOS_PLATFORM_SPECIFIC_SRC}
  194. platform/CCSAXParser.cpp
  195. platform/CCThread.cpp
  196. platform/CCGLView.cpp
  197. platform/CCFileUtils.cpp
  198. platform/CCImage.cpp
  199. ../external/edtaa3func/edtaa3func.cpp
  200. ../external/ConvertUTF/ConvertUTFWrapper.cpp
  201. ../external/ConvertUTF/ConvertUTF.c
  202. ../external/md5/md5.c
  203. ../external/poly2tri/common/shapes.cc
  204. ../external/poly2tri/sweep/advancing_front.cc
  205. ../external/poly2tri/sweep/cdt.cc
  206. ../external/poly2tri/sweep/sweep_context.cc
  207. ../external/poly2tri/sweep/sweep.cc
  208. )