CMakeLists.txt 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. # because of generated UI files
  2. include_directories(${CMAKE_CURRENT_BINARY_DIR})
  3. add_definitions(-DQT_USE_QSTRINGBUILDER -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII)
  4. set(CMAKE_AUTOMOC ON)
  5. set(SRCS
  6. AboutDialog.cpp
  7. AboutDialog.h
  8. Host.cpp
  9. Main.cpp
  10. MainWindow.cpp
  11. MainWindow.h
  12. SystemInfo.cpp
  13. GameList/GameFile.cpp
  14. GameList/GameGrid.cpp
  15. GameList/GameTracker.cpp
  16. GameList/GameTree.cpp
  17. Utils/Resources.cpp
  18. Utils/Utils.cpp
  19. VideoInterface/RenderWidget.cpp
  20. )
  21. set(UIS
  22. AboutDialog.ui
  23. MainWindow.ui
  24. SystemInfo.ui
  25. GameList/GameGrid.ui
  26. GameList/GameTree.ui
  27. )
  28. list(APPEND LIBS core uicommon)
  29. if(APPLE)
  30. set(DOLPHINQT_BINARY DolphinQt)
  31. else()
  32. set(DOLPHINQT_BINARY dolphin-emu-qt)
  33. endif()
  34. qt5_wrap_ui(UI_HEADERS ${UIS})
  35. add_executable(${DOLPHINQT_BINARY} ${SRCS} ${UI_HEADERS})
  36. target_link_libraries(${DOLPHINQT_BINARY} ${LIBS})
  37. qt5_use_modules(${DOLPHINQT_BINARY} Widgets)
  38. if(APPLE)
  39. # Note: This is based on the DolphinWX version.
  40. include(BundleUtilities)
  41. set(BUNDLE_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${DOLPHINQT_BINARY}.app)
  42. # Ask for an application bundle.
  43. set_target_properties(${DOLPHINQT_BINARY} PROPERTIES
  44. MACOSX_BUNDLE true
  45. MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in
  46. )
  47. # get rid of any old copies
  48. file (REMOVE_RECURSE ${BUNDLE_PATH}/Contents/Resources/Sys)
  49. if(NOT SKIP_POSTPROCESS_BUNDLE)
  50. # Fix up the bundle after it is finished.
  51. # There does not seem to be an easy way to run CMake commands post-build,
  52. # so we invoke CMake again on a generated script.
  53. file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/postprocess_bundle.cmake "
  54. include(BundleUtilities)
  55. message(\"Fixing up application bundle: ${BUNDLE_PATH}\")
  56. message(\"(Note: This is only necessary to produce a redistributable binary.\")
  57. message(\"To skip, pass -DSKIP_POSTPROCESS_BUNDLE=1 to cmake.)\")
  58. set(BU_CHMOD_BUNDLE_ITEMS ON)
  59. execute_process(COMMAND ${CMAKE_SOURCE_DIR}/Tools/deploy-mac.py -p platforms/libqcocoa.dylib \"${BUNDLE_PATH}\")
  60. file(INSTALL ${CMAKE_SOURCE_DIR}/Data/Sys
  61. DESTINATION ${BUNDLE_PATH}/Contents/Resources
  62. )
  63. ")
  64. add_custom_command(TARGET ${DOLPHINQT_BINARY} POST_BUILD
  65. COMMAND ${CMAKE_COMMAND} -P postprocess_bundle.cmake
  66. )
  67. else()
  68. add_custom_command(OUTPUT ${BUNDLE_PATH}/Contents/Resources/Sys
  69. COMMAND ln -nfs ${CMAKE_SOURCE_DIR}/Data/Sys ${BUNDLE_PATH}/Contents/Resources/Sys
  70. VERBATIM
  71. )
  72. add_custom_target(CopyDataIntoBundleQt ALL
  73. DEPENDS ${BUNDLE_PATH}/Contents/Resources/Sys
  74. )
  75. endif()
  76. endif()