CMakeLists.txt 11 KB

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