CMakeLists.txt 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. INCLUDE(PolycodeIncludes)
  2. INCLUDE_DIRECTORIES(
  3. ${LUA_INCLUDE_DIR}
  4. ${Polycode_SOURCE_DIR}/Bindings/Contents/LUA/Include
  5. Include
  6. ../../Core/Contents/PolycodeView/Mac\ OS\ X/
  7. )
  8. SET(CMAKE_DEBUG_POSTFIX "_d")
  9. IF(MSVC)
  10. SET(polycodeplayer_SRCS
  11. ../Build/MSVC/PolycodePlayer/player_icon.ico
  12. ../Build/MSVC/PolycodePlayer/main.cpp
  13. ../Build/MSVC/PolycodePlayer/PolycodePlayerView.cpp
  14. Source/PolycodePlayer.cpp
  15. Source/PolycodeWindowsPlayer.cpp
  16. )
  17. SET(polycodeplayer_HDRS
  18. ../Build/MSVC/PolycodePlayer/resource.h
  19. ../Build/MSVC/PolycodePlayer/PolycodePlayerView.h
  20. Include/PolycodePlayer.h
  21. Include/PolycodeWindowsPlayer.h
  22. )
  23. INCLUDE_DIRECTORIES(../Build/MSVC/PolycodePlayer Include)
  24. # IF(POLYCODE_BUILD_SHARED)
  25. # ADD_EXECUTABLE(PolycodePlayer_dynamic WIN32 ${polycodeplayer_SRCS} ${polycodeplayer_HDRS})
  26. # TARGET_LINK_LIBRARIES(PolycodePlayer Polycore_dynamic PolycodeLua ${LUA_LIBRARY})
  27. # ENDIF(POLYCODE_BUILD_SHARED)
  28. # IF(POLYCODE_BUILD_STATIC)
  29. ADD_EXECUTABLE(PolycodePlayer WIN32 ${polycodeplayer_SRCS} ${polycodeplayer_HDRS})
  30. TARGET_LINK_LIBRARIES(PolycodePlayer
  31. Polycore
  32. PolycodeLua
  33. ${LUA_LIBRARY}
  34. ${OPENGL_LIBRARIES}
  35. ${OPENAL_LIBRARY}
  36. ${PNG_LIBRARIES}
  37. ${FREETYPE_LIBRARIES}
  38. ${PHYSFS_LIBRARY}
  39. ${OGG_LIBRARY}
  40. ${VORBIS_LIBRARY}
  41. ${VORBISFILE_LIBRARY}
  42. )
  43. # ENDIF(POLYCODE_BUILD_STATIC)
  44. ELSEIF(APPLE)
  45. SET(polycodeplayer_SRCS
  46. Source/PolycodePlayer.cpp
  47. Source/PolycodeCocoaPlayer.mm
  48. Platform/Darwin/main.m
  49. Platform/Darwin/MyDocument.mm
  50. Platform/Darwin/PPlayerDocumentController.mm
  51. ../../Core/Contents/PolycodeView/Mac\ OS\ X/PolycodeView.mm
  52. )
  53. SET(polycodeplayer_HDRS
  54. Include/PolycodePlayer.h
  55. Include/PolycodeCocoaPlayer.h
  56. Platform/Darwin/MyDocument.h
  57. Platform/Darwin/PPlayerDocumentController.h
  58. ../../Core/Contents/PolycodeView/Mac\ OS\ X/PolycodeView.h
  59. )
  60. SET(polycodeplayerstandalone_SRCS
  61. Source/PolycodePlayer.cpp
  62. Source/PolycodeCocoaPlayer.mm
  63. Platform/Darwin/Standalone/main.m
  64. Platform/Darwin/Standalone/StandalonePlayerAppDelegate.mm
  65. ../../Core/Contents/PolycodeView/Mac\ OS\ X/PolycodeView.mm
  66. )
  67. SET(polycodeplayerstandalone_HDRS
  68. Include/PolycodePlayer.h
  69. Include/PolycodeCocoaPlayer.h
  70. Platform/Darwin/Standalone/StandalonePlayerAppDelegate.h
  71. ../../Core/Contents/PolycodeView/Mac\ OS\ X/PolycodeView.h
  72. )
  73. INCLUDE_DIRECTORIES(Include)
  74. # IF(POLYCODE_BUILD_SHARED)
  75. # ADD_EXECUTABLE(PolycodePlayer MACOSX_BUNDLE ${polycodeplayer_SRCS} ${polycodeplayer_HDRS})
  76. # TARGET_LINK_LIBRARIES(PolycodePlayer Polycore PolycodeLua ${LUA_LIBRARY})
  77. # ENDIF(POLYCODE_BUILD_SHARED)
  78. find_program(IBTOOL ibtool HINTS "/usr/bin" "${OSX_DEVELOPER_ROOT}/usr/bin")
  79. if (${IBTOOL} STREQUAL "IBTOOL-NOTFOUND")
  80. message(SEND_ERROR "ibtool can not be found and is needed to compile the .xib files. It should have been installed with
  81. the Apple developer tools. The default system paths were searched in addition to ${OSX_DEVELOPER_ROOT}/usr/bin")
  82. endif()
  83. set (PolycodePlayer_XIBS
  84. MainMenu
  85. MyDocument
  86. )
  87. set (PolycodePlayerStandalone_XIBS
  88. MainMenu
  89. )
  90. ADD_EXECUTABLE(PolycodePlayer MACOSX_BUNDLE ${polycodeplayer_SRCS} ${polycodeplayer_HDRS})
  91. set_target_properties( PolycodePlayer PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${Polycode_SOURCE_DIR}/Player/Contents/Platform/Darwin/Info.plist )
  92. ADD_EXECUTABLE(StandalonePlayer MACOSX_BUNDLE ${polycodeplayerstandalone_SRCS} ${polycodeplayerstandalone_HDRS})
  93. set_target_properties( StandalonePlayer PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${Polycode_SOURCE_DIR}/Player/Contents/Platform/Darwin/Standalone/Info.plist )
  94. TARGET_LINK_LIBRARIES(PolycodePlayer
  95. Polycore
  96. PolycodeLua
  97. "-framework Cocoa"
  98. "-framework IOKit"
  99. ${LUA_LIBRARY}
  100. ${OPENGL_LIBRARIES}
  101. ${OPENAL_LIBRARY}
  102. ${PNG_LIBRARIES}
  103. ${FREETYPE_LIBRARIES}
  104. ${PHYSFS_LIBRARY}
  105. ${OGG_LIBRARY}
  106. ${VORBIS_LIBRARY}
  107. ${VORBISFILE_LIBRARY}
  108. )
  109. TARGET_LINK_LIBRARIES(StandalonePlayer
  110. Polycore
  111. PolycodeLua
  112. "-framework Cocoa"
  113. "-framework IOKit"
  114. ${LUA_LIBRARY}
  115. ${OPENGL_LIBRARIES}
  116. ${OPENAL_LIBRARY}
  117. ${PNG_LIBRARIES}
  118. ${FREETYPE_LIBRARIES}
  119. ${PHYSFS_LIBRARY}
  120. ${OGG_LIBRARY}
  121. ${VORBIS_LIBRARY}
  122. ${VORBISFILE_LIBRARY}
  123. )
  124. add_custom_command (TARGET PolycodePlayer PRE_BUILD
  125. COMMAND mkdir -p ${PROJECT_BINARY_DIR}/Player/Contents/\${CONFIGURATION}/PolycodePlayer.app/Contents/Resources)
  126. add_custom_command (TARGET PolycodePlayer PRE_BUILD
  127. COMMAND cp ${Polycode_SOURCE_DIR}/Player/Contents/Platform/Darwin/app_file_icon.icns ${PROJECT_BINARY_DIR}/Player/Contents/\${CONFIGURATION}/PolycodePlayer.app/Contents/Resources)
  128. add_custom_command (TARGET PolycodePlayer PRE_BUILD
  129. COMMAND cp ${Polycode_SOURCE_DIR}/Player/Contents/Platform/Darwin/player_icon.icns ${PROJECT_BINARY_DIR}/Player/Contents/\${CONFIGURATION}/PolycodePlayer.app/Contents/Resources)
  130. add_custom_command (TARGET PolycodePlayer PRE_BUILD
  131. COMMAND cp ${Polycode_SOURCE_DIR}/Assets/Default\ asset\ pack/default.pak ${PROJECT_BINARY_DIR}/Player/Contents/\${CONFIGURATION}/PolycodePlayer.app/Contents/Resources)
  132. add_custom_command (TARGET PolycodePlayer PRE_BUILD
  133. COMMAND cp -R ${Polycode_SOURCE_DIR}/Bindings/Contents/LUA/API ${PROJECT_BINARY_DIR}/Player/Contents/\${CONFIGURATION}/PolycodePlayer.app/Contents/Resources)
  134. add_custom_command (TARGET StandalonePlayer PRE_BUILD
  135. COMMAND mkdir -p ${PROJECT_BINARY_DIR}/Player/Contents/\${CONFIGURATION}/StandalonePlayer.app/Contents/Resources)
  136. add_custom_command (TARGET StandalonePlayer PRE_BUILD
  137. COMMAND cp ${Polycode_SOURCE_DIR}/Player/Contents/Platform/Darwin/player_icon.icns ${PROJECT_BINARY_DIR}/Player/Contents/\${CONFIGURATION}/StandalonePlayer.app/Contents/Resources)
  138. add_custom_command (TARGET StandalonePlayer PRE_BUILD
  139. COMMAND cp ${Polycode_SOURCE_DIR}/Assets/Default\ asset\ pack/default.pak ${PROJECT_BINARY_DIR}/Player/Contents/\${CONFIGURATION}/StandalonePlayer.app/Contents/Resources)
  140. add_custom_command (TARGET StandalonePlayer PRE_BUILD
  141. COMMAND cp -R ${Polycode_SOURCE_DIR}/Bindings/Contents/LUA/API ${PROJECT_BINARY_DIR}/Player/Contents/\${CONFIGURATION}/StandalonePlayer.app/Contents/Resources)
  142. add_custom_command (TARGET StandalonePlayer PRE_BUILD
  143. COMMAND cp ${Polycode_SOURCE_DIR}/Assets/SamplePolyapp/main.polyapp ${PROJECT_BINARY_DIR}/Player/Contents/\${CONFIGURATION}/StandalonePlayer.app/Contents/Resources)
  144. foreach(xib ${PolycodePlayer_XIBS})
  145. add_custom_command (TARGET PolycodePlayer POST_BUILD
  146. COMMAND ${IBTOOL} --errors --warnings --notices --output-format human-readable-text
  147. --compile ${PROJECT_BINARY_DIR}/Player/Contents/\${CONFIGURATION}/PolycodePlayer.app/Contents/Resources/${xib}.nib
  148. ${Polycode_SOURCE_DIR}/Player/Contents/Platform/Darwin/${xib}.xib
  149. COMMENT "Compiling ${Polycode_SOURCE_DIR}/Player/Contents/Platform/Darwin/${xib}.xib")
  150. endforeach()
  151. foreach(xib ${PolycodePlayerStandalone_XIBS})
  152. add_custom_command (TARGET StandalonePlayer POST_BUILD
  153. COMMAND ${IBTOOL} --errors --warnings --notices --output-format human-readable-text
  154. --compile ${PROJECT_BINARY_DIR}/Player/Contents/\${CONFIGURATION}/StandalonePlayer.app/Contents/Resources/${xib}.nib
  155. ${Polycode_SOURCE_DIR}/Player/Contents/Platform/Darwin/Standalone/${xib}.xib
  156. COMMENT "Compiling ${Polycode_SOURCE_DIR}/Player/Contents/Platform/Darwin/Standalone/${xib}.xib")
  157. endforeach()
  158. ELSE(MSVC)
  159. SET(polycodeplayer_SRCS
  160. Source/PolycodePlayer.cpp
  161. Source/PolycodeLinuxPlayer.cpp
  162. Platform/Linux/main.cpp
  163. )
  164. SET(polycodeplayer_HDRS
  165. Include/PolycodePlayer.h
  166. Include/PolycodeLinuxPlayer.h
  167. )
  168. SET(polycodeplayerstandalone_SRCS
  169. Source/PolycodePlayer.cpp
  170. Source/PolycodeLinuxPlayer.cpp
  171. Platform/Linux/Standalone/main.cpp
  172. )
  173. SET(polycodeplayerstandalone_HDRS
  174. Include/PolycodePlayer.h
  175. Include/PolycodeLinuxPlayer.h
  176. )
  177. INCLUDE_DIRECTORIES(Include)
  178. ADD_EXECUTABLE(PolycodePlayer ${polycodeplayer_SRCS} ${polycodeplayer_HDRS})
  179. ADD_EXECUTABLE(StandalonePlayer ${polycodeplayerstandalone_SRCS} ${polycodeplayerstandalone_HDRS})
  180. TARGET_LINK_LIBRARIES(PolycodePlayer
  181. PolycodeLua
  182. Polycore
  183. ${LUA_LIBRARY}
  184. ${OPENGL_LIBRARIES}
  185. ${OPENAL_LIBRARY}
  186. ${PNG_LIBRARIES}
  187. ${FREETYPE_LIBRARIES}
  188. ${PHYSFS_LIBRARY}
  189. ${OGG_LIBRARY}
  190. ${VORBIS_LIBRARY}
  191. ${VORBISFILE_LIBRARY}
  192. ${SDL_LIBRARY}
  193. )
  194. TARGET_LINK_LIBRARIES(StandalonePlayer
  195. PolycodeLua
  196. Polycore
  197. ${LUA_LIBRARY}
  198. ${OPENGL_LIBRARIES}
  199. ${OPENAL_LIBRARY}
  200. ${PNG_LIBRARIES}
  201. ${FREETYPE_LIBRARIES}
  202. ${PHYSFS_LIBRARY}
  203. ${OGG_LIBRARY}
  204. ${VORBIS_LIBRARY}
  205. ${VORBISFILE_LIBRARY}
  206. ${SDL_LIBRARY}
  207. )
  208. ENDIF(MSVC)
  209. IF(POLYCODE_INSTALL_PLAYER)
  210. # IF(POLYCODE_BUILD_SHARED)
  211. # # install player
  212. # INSTALL(TARGETS PolycodePlayer_dynamic
  213. # DESTINATION ${POLYCODE_RELEASE_DIR}/Player)
  214. # ENDIF()
  215. # IF(POLYCODE_BUILD_STATIC)
  216. INSTALL(TARGETS PolycodePlayer
  217. DESTINATION Player)
  218. INSTALL(TARGETS StandalonePlayer
  219. DESTINATION Player)
  220. IF(MSVC)
  221. INSTALL(FILES "${Polycode_SOURCE_DIR}/Assets/Default\ asset\ pack/default.pak" DESTINATION Player)
  222. INSTALL(FILES "${Polycode_SOURCE_DIR}/Assets/Default\ asset\ pack/hdr.pak" DESTINATION Player)
  223. INSTALL(FILES "${Polycode_SOURCE_DIR}/Assets/SamplePolyapp/main.polyapp" DESTINATION Player)
  224. INSTALL(FILES "${Polycode_SOURCE_DIR}/Bindings/Contents/LUA/API/api.pak" DESTINATION Player)
  225. ELSEIF(APPLE)
  226. ELSE(MSVC)
  227. INSTALL(FILES "${Polycode_SOURCE_DIR}/Assets/Default\ asset\ pack/default.pak" DESTINATION Player)
  228. INSTALL(FILES "${Polycode_SOURCE_DIR}/Assets/Default\ asset\ pack/hdr.pak" DESTINATION Player)
  229. INSTALL(FILES "${Polycode_SOURCE_DIR}/Assets/SamplePolyapp/main.polyapp" DESTINATION Player)
  230. INSTALL(FILES "${Polycode_SOURCE_DIR}/Bindings/Contents/LUA/API/api.pak" DESTINATION Player)
  231. ENDIF(MSVC)
  232. # ENDIF()
  233. ENDIF(POLYCODE_INSTALL_PLAYER)