CMakeLists.txt 8.1 KB

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