CMakeLists.txt 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. set(CMAKE_AUTOMOC ON)
  2. set(CMAKE_INCLUDE_CURRENT_DIR ON)
  3. set(SRCS
  4. config/controller_config.cpp
  5. config/controller_config_util.cpp
  6. config.cpp
  7. debugger/callstack.cpp
  8. debugger/disassembler.cpp
  9. debugger/graphics.cpp
  10. debugger/graphics_breakpoint_observer.cpp
  11. debugger/graphics_breakpoints.cpp
  12. debugger/graphics_cmdlists.cpp
  13. debugger/graphics_framebuffer.cpp
  14. debugger/graphics_tracing.cpp
  15. debugger/graphics_vertex_shader.cpp
  16. debugger/profiler.cpp
  17. debugger/ramview.cpp
  18. debugger/registers.cpp
  19. game_list.cpp
  20. util/spinbox.cpp
  21. util/util.cpp
  22. bootmanager.cpp
  23. hotkeys.cpp
  24. main.cpp
  25. citra-qt.rc
  26. Info.plist
  27. )
  28. set(HEADERS
  29. config/controller_config.h
  30. config/controller_config_util.h
  31. config.h
  32. debugger/callstack.h
  33. debugger/disassembler.h
  34. debugger/graphics.h
  35. debugger/graphics_breakpoint_observer.h
  36. debugger/graphics_breakpoints.h
  37. debugger/graphics_breakpoints_p.h
  38. debugger/graphics_cmdlists.h
  39. debugger/graphics_framebuffer.h
  40. debugger/graphics_tracing.h
  41. debugger/graphics_vertex_shader.h
  42. debugger/profiler.h
  43. debugger/ramview.h
  44. debugger/registers.h
  45. game_list.h
  46. util/spinbox.h
  47. util/util.h
  48. bootmanager.h
  49. hotkeys.h
  50. main.h
  51. version.h
  52. )
  53. set(UIS
  54. config/controller_config.ui
  55. debugger/callstack.ui
  56. debugger/disassembler.ui
  57. debugger/profiler.ui
  58. debugger/registers.ui
  59. hotkeys.ui
  60. main.ui
  61. )
  62. create_directory_groups(${SRCS} ${HEADERS} ${UIS})
  63. if (Qt5_FOUND)
  64. qt5_wrap_ui(UI_HDRS ${UIS})
  65. else()
  66. qt4_wrap_ui(UI_HDRS ${UIS})
  67. endif()
  68. if (APPLE)
  69. set(MACOSX_ICON "../../dist/citra.icns")
  70. set_source_files_properties(${MACOSX_ICON} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
  71. add_executable(citra-qt MACOSX_BUNDLE ${SRCS} ${HEADERS} ${UI_HDRS} ${MACOSX_ICON})
  72. set_target_properties(citra-qt PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist)
  73. else()
  74. add_executable(citra-qt ${SRCS} ${HEADERS} ${UI_HDRS})
  75. endif()
  76. target_link_libraries(citra-qt core video_core common qhexedit)
  77. target_link_libraries(citra-qt ${OPENGL_gl_LIBRARY} ${CITRA_QT_LIBS})
  78. target_link_libraries(citra-qt ${PLATFORM_LIBRARIES})
  79. if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD|OpenBSD|NetBSD")
  80. install(TARGETS citra-qt RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
  81. endif()
  82. if (Qt5_FOUND AND MSVC)
  83. set(Qt5_DLL_DIR "${Qt5_DIR}/../../../bin")
  84. set(Qt5_PLATFORMS_DIR "${Qt5_DIR}/../../../plugins/platforms/")
  85. set(Qt5_DLLS
  86. icudt*.dll
  87. icuin*.dll
  88. icuuc*.dll
  89. Qt5Core$<$<CONFIG:Debug>:d>.*
  90. Qt5Gui$<$<CONFIG:Debug>:d>.*
  91. Qt5OpenGL$<$<CONFIG:Debug>:d>.*
  92. Qt5Widgets$<$<CONFIG:Debug>:d>.*
  93. )
  94. set(DLL_DEST "${CMAKE_BINARY_DIR}/bin/$<CONFIG>/")
  95. set(PLATFORMS ${DLL_DEST}platforms/)
  96. # windows commandline expects the / to be \ so switch them
  97. string(REPLACE "/" "\\\\" Qt5_DLL_DIR ${Qt5_DLL_DIR})
  98. string(REPLACE "/" "\\\\" Qt5_PLATFORMS_DIR ${Qt5_PLATFORMS_DIR})
  99. string(REPLACE "/" "\\\\" DLL_DEST ${DLL_DEST})
  100. string(REPLACE "/" "\\\\" PLATFORMS ${PLATFORMS})
  101. # /NJH /NJS /NDL /NFL /NC /NS /NP - Silence any output
  102. # cmake adds an extra check for command success which doesn't work too well with robocopy
  103. # so trick it into thinking the command was successful with the || cmd /c "exit /b 0"
  104. add_custom_command(TARGET citra-qt POST_BUILD
  105. COMMAND robocopy ${Qt5_DLL_DIR} ${DLL_DEST} ${Qt5_DLLS} /NJH /NJS /NDL /NFL /NC /NS /NP || cmd /c "exit /b 0"
  106. COMMAND if not exist ${PLATFORMS} mkdir ${PLATFORMS} 2> nul
  107. COMMAND robocopy ${Qt5_PLATFORMS_DIR} ${PLATFORMS} qwindows$<$<CONFIG:Debug>:d>.* /NJH /NJS /NDL /NFL /NC /NS /NP || cmd /c "exit /b 0"
  108. )
  109. unset(Qt5_DLLS)
  110. unset(Qt5_DLL_DIR)
  111. unset(Qt5_PLATFORMS_DIR)
  112. unset(DLL_DEST)
  113. unset(PLATFORMS)
  114. endif()