CMakeLists.txt 11 KB

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