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 OR MINGW)
  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. ${ZLIB_LIBRARIES}
  118. ${PNG_LIBRARIES}
  119. ${FREETYPE_LIBRARIES}
  120. ${PHYSFS_LIBRARY}
  121. ${OGG_LIBRARY}
  122. ${VORBIS_LIBRARY}
  123. ${VORBISFILE_LIBRARY}
  124. )
  125. TARGET_LINK_LIBRARIES(StandalonePlayer
  126. Polycore
  127. PolycodeLua
  128. "-framework Cocoa"
  129. "-framework IOKit"
  130. ${LUA_LIBRARY}
  131. ${OPENGL_LIBRARIES}
  132. ${OPENAL_LIBRARY}
  133. ${ZLIB_LIBRARIES}
  134. ${PNG_LIBRARIES}
  135. ${FREETYPE_LIBRARIES}
  136. ${PHYSFS_LIBRARY}
  137. ${OGG_LIBRARY}
  138. ${VORBIS_LIBRARY}
  139. ${VORBISFILE_LIBRARY}
  140. )
  141. add_custom_command (TARGET PolycodePlayer PRE_BUILD
  142. COMMAND mkdir -p ${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/app_file_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}/Player/Contents/Platform/Darwin/player_icon.icns ${PROJECT_BINARY_DIR}/Player/Contents/\${CONFIGURATION}/PolycodePlayer.app/Contents/Resources)
  147. add_custom_command (TARGET PolycodePlayer PRE_BUILD
  148. COMMAND cp ${Polycode_SOURCE_DIR}/Assets/Default\ asset\ pack/default.pak ${PROJECT_BINARY_DIR}/Player/Contents/\${CONFIGURATION}/PolycodePlayer.app/Contents/Resources)
  149. add_custom_command (TARGET PolycodePlayer PRE_BUILD
  150. COMMAND cp -R ${Polycode_SOURCE_DIR}/Bindings/Contents/LUA/API/api.pak ${PROJECT_BINARY_DIR}/Player/Contents/\${CONFIGURATION}/PolycodePlayer.app/Contents/Resources)
  151. add_custom_command (TARGET StandalonePlayer PRE_BUILD
  152. COMMAND mkdir -p ${PROJECT_BINARY_DIR}/Player/Contents/\${CONFIGURATION}/StandalonePlayer.app/Contents/Resources)
  153. add_custom_command (TARGET StandalonePlayer PRE_BUILD
  154. COMMAND cp ${Polycode_SOURCE_DIR}/Player/Contents/Platform/Darwin/player_icon.icns ${PROJECT_BINARY_DIR}/Player/Contents/\${CONFIGURATION}/StandalonePlayer.app/Contents/Resources)
  155. add_custom_command (TARGET StandalonePlayer PRE_BUILD
  156. COMMAND cp ${Polycode_SOURCE_DIR}/Assets/Default\ asset\ pack/default.pak ${PROJECT_BINARY_DIR}/Player/Contents/\${CONFIGURATION}/StandalonePlayer.app/Contents/Resources)
  157. add_custom_command (TARGET StandalonePlayer PRE_BUILD
  158. COMMAND cp -R ${Polycode_SOURCE_DIR}/Bindings/Contents/LUA/API/api.pak ${PROJECT_BINARY_DIR}/Player/Contents/\${CONFIGURATION}/StandalonePlayer.app/Contents/Resources)
  159. add_custom_command (TARGET StandalonePlayer PRE_BUILD
  160. COMMAND cp ${Polycode_SOURCE_DIR}/Assets/SamplePolyapp/main.polyapp ${PROJECT_BINARY_DIR}/Player/Contents/\${CONFIGURATION}/StandalonePlayer.app/Contents/Resources)
  161. foreach(xib ${PolycodePlayer_XIBS})
  162. add_custom_command (TARGET PolycodePlayer POST_BUILD
  163. COMMAND ${IBTOOL} --errors --warnings --notices --output-format human-readable-text
  164. --compile ${PROJECT_BINARY_DIR}/Player/Contents/\${CONFIGURATION}/PolycodePlayer.app/Contents/Resources/${xib}.nib
  165. ${Polycode_SOURCE_DIR}/Player/Contents/Platform/Darwin/${xib}.xib
  166. COMMENT "Compiling ${Polycode_SOURCE_DIR}/Player/Contents/Platform/Darwin/${xib}.xib")
  167. endforeach()
  168. foreach(xib ${PolycodePlayerStandalone_XIBS})
  169. add_custom_command (TARGET StandalonePlayer POST_BUILD
  170. COMMAND ${IBTOOL} --errors --warnings --notices --output-format human-readable-text
  171. --compile ${PROJECT_BINARY_DIR}/Player/Contents/\${CONFIGURATION}/StandalonePlayer.app/Contents/Resources/${xib}.nib
  172. ${Polycode_SOURCE_DIR}/Player/Contents/Platform/Darwin/Standalone/${xib}.xib
  173. COMMENT "Compiling ${Polycode_SOURCE_DIR}/Player/Contents/Platform/Darwin/Standalone/${xib}.xib")
  174. endforeach()
  175. ELSE(MSVC OR MINGW)
  176. SET(polycodeplayer_SRCS
  177. Source/PolycodePlayer.cpp
  178. Source/PolycodeLinuxPlayer.cpp
  179. Platform/Linux/main.cpp
  180. )
  181. SET(polycodeplayer_HDRS
  182. Include/PolycodePlayer.h
  183. Include/PolycodeLinuxPlayer.h
  184. )
  185. SET(polycodeplayerstandalone_SRCS
  186. Source/PolycodePlayer.cpp
  187. Source/PolycodeLinuxPlayer.cpp
  188. Platform/Linux/Standalone/main.cpp
  189. )
  190. SET(polycodeplayerstandalone_HDRS
  191. Include/PolycodePlayer.h
  192. Include/PolycodeLinuxPlayer.h
  193. )
  194. INCLUDE_DIRECTORIES(Include)
  195. ADD_EXECUTABLE(PolycodePlayer ${polycodeplayer_SRCS} ${polycodeplayer_HDRS})
  196. ADD_EXECUTABLE(StandalonePlayer ${polycodeplayerstandalone_SRCS} ${polycodeplayerstandalone_HDRS})
  197. TARGET_LINK_LIBRARIES(PolycodePlayer
  198. PolycodeLua
  199. Polycore
  200. ${LUA_LIBRARY}
  201. ${OPENGL_LIBRARIES}
  202. ${OPENAL_LIBRARY}
  203. ${PNG_LIBRARIES}
  204. ${FREETYPE_LIBRARIES}
  205. ${PHYSFS_LIBRARY}
  206. ${OGG_LIBRARY}
  207. ${VORBIS_LIBRARY}
  208. ${VORBISFILE_LIBRARY}
  209. ${SDL_LIBRARY}
  210. )
  211. TARGET_LINK_LIBRARIES(StandalonePlayer
  212. PolycodeLua
  213. Polycore
  214. ${LUA_LIBRARY}
  215. ${OPENGL_LIBRARIES}
  216. ${OPENAL_LIBRARY}
  217. ${PNG_LIBRARIES}
  218. ${FREETYPE_LIBRARIES}
  219. ${PHYSFS_LIBRARY}
  220. ${OGG_LIBRARY}
  221. ${VORBIS_LIBRARY}
  222. ${VORBISFILE_LIBRARY}
  223. ${SDL_LIBRARY}
  224. )
  225. ENDIF(MSVC OR MINGW)
  226. INSTALL(TARGETS PolycodePlayer
  227. DESTINATION Player)
  228. INSTALL(TARGETS StandalonePlayer
  229. DESTINATION Player)
  230. IF(MSVC OR MINGW)
  231. INSTALL(FILES "${Polycode_SOURCE_DIR}/Assets/Default\ asset\ pack/default.pak" DESTINATION Player)
  232. INSTALL(FILES "${Polycode_SOURCE_DIR}/Assets/Default\ asset\ pack/hdr.pak" DESTINATION Player)
  233. INSTALL(FILES "${Polycode_SOURCE_DIR}/Assets/SamplePolyapp/main.polyapp" DESTINATION Player)
  234. INSTALL(FILES "${Polycode_SOURCE_DIR}/Bindings/Contents/LUA/API/api.pak" DESTINATION Player)
  235. ELSEIF(APPLE)
  236. ELSE(MSVC OR MINGW)
  237. INSTALL(FILES "${Polycode_SOURCE_DIR}/Assets/Default\ asset\ pack/default.pak" DESTINATION Player)
  238. INSTALL(FILES "${Polycode_SOURCE_DIR}/Assets/Default\ asset\ pack/hdr.pak" DESTINATION Player)
  239. INSTALL(FILES "${Polycode_SOURCE_DIR}/Assets/SamplePolyapp/main.polyapp" DESTINATION Player)
  240. INSTALL(FILES "${Polycode_SOURCE_DIR}/Bindings/Contents/LUA/API/api.pak" DESTINATION Player)
  241. ENDIF(MSVC OR MINGW)