Debian Codegraph @

Source/Core/DolphinQt/CMakeLists.txt

raw ◀ ▶
2 Debian patches touch this file
1 if (MSVC)
2 if(_M_ARM_64)
3 list(APPEND CMAKE_PREFIX_PATH "${CMAKE_SOURCE_DIR}/Externals/Qt/Qt6.5.1/ARM64")
4 else()
5 list(APPEND CMAKE_PREFIX_PATH "${CMAKE_SOURCE_DIR}/Externals/Qt/Qt6.5.1/x64")
6 endif()
7 endif()
8
9 set(CMAKE_AUTOMOC ON)
10 set(CMAKE_AUTORCC ON)
11
12 find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets Svg)
13
14 if (Qt6_VERSION VERSION_GREATER_EQUAL 6.10.0)
15 # GuiPrivate is needed to #include qplatformnativeinterface.h in MainWindow.cpp with Qt 6.10+.
16 set(NEED_QT_GUI_PRIVATE_COMPONENT ON)
17 find_package(Qt6 REQUIRED COMPONENTS GuiPrivate)
18 endif()
19
20 message(STATUS "Found Qt version ${Qt6_VERSION}")
21
22 set_property(TARGET Qt6::Core PROPERTY INTERFACE_COMPILE_FEATURES "")
23
24 add_executable(dolphin-emu
25 AboutDialog.cpp
26 AboutDialog.h
27 CheatSearchFactoryWidget.cpp
28 CheatSearchFactoryWidget.h
29 CheatSearchWidget.cpp
30 CheatSearchWidget.h
31 CheatsManager.cpp
32 CheatsManager.h
33 Achievements/AchievementBox.cpp
34 Achievements/AchievementBox.h
35 Achievements/AchievementHeaderWidget.cpp
36 Achievements/AchievementHeaderWidget.h
37 Achievements/AchievementLeaderboardWidget.cpp
38 Achievements/AchievementLeaderboardWidget.h
39 Achievements/AchievementProgressWidget.cpp
40 Achievements/AchievementProgressWidget.h
41 Achievements/AchievementSettingsWidget.cpp
42 Achievements/AchievementSettingsWidget.h
43 Achievements/AchievementsWindow.cpp
44 Achievements/AchievementsWindow.h
45 Config/ARCodeWidget.cpp
46 Config/ARCodeWidget.h
47 Config/CheatCodeEditor.cpp
48 Config/CheatCodeEditor.h
49 Config/CheatWarningWidget.cpp
50 Config/CheatWarningWidget.h
51 Config/CommonControllersWidget.cpp
52 Config/CommonControllersWidget.h
53 Config/ConfigControls/ConfigBool.cpp
54 Config/ConfigControls/ConfigBool.h
55 Config/ConfigControls/ConfigChoice.cpp
56 Config/ConfigControls/ConfigChoice.h
57 Config/ConfigControls/ConfigControl.h
58 Config/ConfigControls/ConfigInteger.cpp
59 Config/ConfigControls/ConfigInteger.h
60 Config/ConfigControls/ConfigRadio.cpp
61 Config/ConfigControls/ConfigRadio.h
62 Config/ConfigControls/ConfigFloatSlider.cpp
63 Config/ConfigControls/ConfigFloatSlider.h
64 Config/ConfigControls/ConfigSlider.cpp
65 Config/ConfigControls/ConfigSlider.h
66 Config/ConfigControls/ConfigText.cpp
67 Config/ConfigControls/ConfigText.h
68 Config/ConfigControls/ConfigUserPath.cpp
69 Config/ConfigControls/ConfigUserPath.h
70 Config/ControllerInterface/ControllerInterfaceWindow.cpp
71 Config/ControllerInterface/ControllerInterfaceWindow.h
72 Config/SDLHints/SDLHintsWindow.cpp
73 Config/SDLHints/SDLHintsWindow.h
74 Config/ControllerInterface/DualShockUDPClientEditServerDialog.cpp
75 Config/ControllerInterface/DualShockUDPClientEditServerDialog.h
76 Config/ControllerInterface/DualShockUDPClientWidget.cpp
77 Config/ControllerInterface/DualShockUDPClientWidget.h
78 Config/ControllerInterface/DualShockUDPSettings.cpp
79 Config/ControllerInterface/DualShockUDPSettings.h
80 Config/ControllerInterface/ServerStringValidator.cpp
81 Config/ControllerInterface/ServerStringValidator.h
82 Config/ControllersPane.cpp
83 Config/ControllersPane.h
84 Config/FilesystemWidget.cpp
85 Config/FilesystemWidget.h
86 Config/FreeLookWidget.cpp
87 Config/FreeLookWidget.h
88 Config/FreeLookWindow.cpp
89 Config/FreeLookWindow.h
90 Config/GameConfigEdit.cpp
91 Config/GameConfigEdit.h
92 Config/GameConfigHighlighter.cpp
93 Config/GameConfigHighlighter.h
94 Config/GameConfigWidget.cpp
95 Config/GameConfigWidget.h
96 Config/GamecubeControllersWidget.cpp
97 Config/GamecubeControllersWidget.h
98 Config/GeckoCodeWidget.cpp
99 Config/GeckoCodeWidget.h
100 Config/Graphics/AdvancedWidget.cpp
101 Config/Graphics/AdvancedWidget.h
102 Config/Graphics/EnhancementsWidget.cpp
103 Config/Graphics/EnhancementsWidget.h
104 Config/Graphics/GeneralWidget.cpp
105 Config/Graphics/GeneralWidget.h
106 Config/Graphics/GraphicsPane.cpp
107 Config/Graphics/GraphicsPane.h
108 Config/Graphics/HacksWidget.cpp
109 Config/Graphics/HacksWidget.h
110 Config/Graphics/ColorCorrectionConfigWindow.cpp
111 Config/Graphics/ColorCorrectionConfigWindow.h
112 Config/Graphics/PostProcessingConfigWindow.cpp
113 Config/Graphics/PostProcessingConfigWindow.h
114 Config/GraphicsModListWidget.cpp
115 Config/GraphicsModListWidget.h
116 Config/GraphicsModWarningWidget.cpp
117 Config/GraphicsModWarningWidget.h
118 Config/HardcoreWarningWidget.cpp
119 Config/HardcoreWarningWidget.h
120 Config/InfoWidget.cpp
121 Config/InfoWidget.h
122 Config/LogConfigWidget.cpp
123 Config/LogConfigWidget.h
124 Config/LogWidget.cpp
125 Config/LogWidget.h
126 Config/Mapping/FreeLookGeneral.cpp
127 Config/Mapping/FreeLookGeneral.h
128 Config/Mapping/FreeLookRotation.cpp
129 Config/Mapping/FreeLookRotation.h
130 Config/Mapping/GBAPadEmu.cpp
131 Config/Mapping/GBAPadEmu.h
132 Config/Mapping/GCKeyboardEmu.cpp
133 Config/Mapping/GCKeyboardEmu.h
134 Config/Mapping/GCMicrophone.cpp
135 Config/Mapping/GCMicrophone.h
136 Config/Mapping/GCPadEmu.cpp
137 Config/Mapping/GCPadEmu.h
138 Config/Mapping/GCPadWiiUConfigDialog.cpp
139 Config/Mapping/GCPadWiiUConfigDialog.h
140 Config/Mapping/Hotkey3D.cpp
141 Config/Mapping/Hotkey3D.h
142 Config/Mapping/HotkeyControllerProfile.cpp
143 Config/Mapping/HotkeyControllerProfile.h
144 Config/Mapping/HotkeyDebugging.cpp
145 Config/Mapping/HotkeyDebugging.h
146 Config/Mapping/HotkeyGBA.cpp
147 Config/Mapping/HotkeyGBA.h
148 Config/Mapping/HotkeyGeneral.cpp
149 Config/Mapping/HotkeyGeneral.h
150 Config/Mapping/HotkeyGraphics.cpp
151 Config/Mapping/HotkeyGraphics.h
152 Config/Mapping/HotkeyStates.cpp
153 Config/Mapping/HotkeyStates.h
154 Config/Mapping/HotkeyStatesOther.cpp
155 Config/Mapping/HotkeyStatesOther.h
156 Config/Mapping/HotkeyTAS.cpp
157 Config/Mapping/HotkeyTAS.h
158 Config/Mapping/HotkeyUSBEmu.cpp
159 Config/Mapping/HotkeyUSBEmu.h
160 Config/Mapping/HotkeyWii.cpp
161 Config/Mapping/HotkeyWii.h
162 Config/Mapping/IOWindow.cpp
163 Config/Mapping/MappingButton.cpp
164 Config/Mapping/MappingButton.h
165 Config/Mapping/MappingCommon.cpp
166 Config/Mapping/MappingCommon.h
167 Config/Mapping/MappingIndicator.cpp
168 Config/Mapping/MappingIndicator.h
169 Config/Mapping/MappingNumeric.cpp
170 Config/Mapping/MappingNumeric.h
171 Config/Mapping/MappingWidget.cpp
172 Config/Mapping/MappingWidget.h
173 Config/Mapping/MappingWindow.cpp
174 Config/Mapping/MappingWindow.h
175 Config/Mapping/WiimoteEmuExtension.cpp
176 Config/Mapping/WiimoteEmuExtension.h
177 Config/Mapping/WiimoteEmuExtensionMotionInput.cpp
178 Config/Mapping/WiimoteEmuExtensionMotionInput.h
179 Config/Mapping/WiimoteEmuExtensionMotionSimulation.cpp
180 Config/Mapping/WiimoteEmuExtensionMotionSimulation.h
181 Config/Mapping/WiimoteEmuGeneral.cpp
182 Config/Mapping/WiimoteEmuGeneral.h
183 Config/Mapping/WiimoteEmuMotionControl.cpp
184 Config/Mapping/WiimoteEmuMotionControl.h
185 Config/Mapping/WiimoteEmuMotionControlIMU.cpp
186 Config/Mapping/WiimoteEmuMotionControlIMU.h
187 Config/NewPatchDialog.cpp
188 Config/NewPatchDialog.h
189 Config/PatchesWidget.cpp
190 Config/PatchesWidget.h
191 Config/PropertiesDialog.cpp
192 Config/PropertiesDialog.h
193 Config/SettingsWindow.cpp
194 Config/SettingsWindow.h
195 Config/ToolTipControls/BalloonTip.cpp
196 Config/ToolTipControls/BalloonTip.h
197 Config/ToolTipControls/ToolTipCheckBox.cpp
198 Config/ToolTipControls/ToolTipCheckBox.h
199 Config/ToolTipControls/ToolTipComboBox.cpp
200 Config/ToolTipControls/ToolTipComboBox.h
201 Config/ToolTipControls/ToolTipPushButton.cpp
202 Config/ToolTipControls/ToolTipPushButton.h
203 Config/ToolTipControls/ToolTipRadioButton.cpp
204 Config/ToolTipControls/ToolTipRadioButton.h
205 Config/ToolTipControls/ToolTipSlider.cpp
206 Config/ToolTipControls/ToolTipSlider.h
207 Config/ToolTipControls/ToolTipSpinBox.cpp
208 Config/ToolTipControls/ToolTipSpinBox.h
209 Config/ToolTipControls/ToolTipWidget.h
210 Config/VerifyWidget.cpp
211 Config/VerifyWidget.h
212 Config/WiimoteControllersWidget.cpp
213 Config/WiimoteControllersWidget.h
214 ConvertDialog.cpp
215 ConvertDialog.h
216 Debugger/AssembleInstructionDialog.cpp
217 Debugger/AssembleInstructionDialog.h
218 Debugger/AssemblerWidget.cpp
219 Debugger/AssemblerWidget.h
220 Debugger/AssemblyEditor.cpp
221 Debugger/AssemblyEditor.h
222 Debugger/BranchWatchDialog.cpp
223 Debugger/BranchWatchDialog.h
224 Debugger/BranchWatchTableModel.cpp
225 Debugger/BranchWatchTableModel.h
226 Debugger/BreakpointDialog.cpp
227 Debugger/BreakpointDialog.h
228 Debugger/BreakpointWidget.cpp
229 Debugger/BreakpointWidget.h
230 Debugger/CodeViewWidget.cpp
231 Debugger/CodeViewWidget.h
232 Debugger/CodeWidget.cpp
233 Debugger/CodeWidget.h
234 Debugger/EditSymbolDialog.cpp
235 Debugger/EditSymbolDialog.h
236 Debugger/GekkoSyntaxHighlight.cpp
237 Debugger/GekkoSyntaxHighlight.h
238 Debugger/JitBlockTableModel.cpp
239 Debugger/JitBlockTableModel.h
240 Debugger/JITWidget.cpp
241 Debugger/JITWidget.h
242 Debugger/MemoryViewWidget.cpp
243 Debugger/MemoryViewWidget.h
244 Debugger/MemoryWidget.cpp
245 Debugger/MemoryWidget.h
246 Debugger/NetworkWidget.cpp
247 Debugger/NetworkWidget.h
248 Debugger/PatchInstructionDialog.cpp
249 Debugger/PatchInstructionDialog.h
250 Debugger/RegisterColumn.cpp
251 Debugger/RegisterColumn.h
252 Debugger/RegisterWidget.cpp
253 Debugger/RegisterWidget.h
254 Debugger/ThreadWidget.cpp
255 Debugger/ThreadWidget.h
256 Debugger/WatchWidget.cpp
257 Debugger/WatchWidget.h
258 DiscordHandler.cpp
259 DiscordHandler.h
260 DiscordJoinRequestDialog.cpp
261 DiscordJoinRequestDialog.h
262 EmulatedUSB/WiiSpeakWindow.cpp
263 EmulatedUSB/WiiSpeakWindow.h
264 EmulatedUSB/LogitechMicWindow.cpp
265 EmulatedUSB/LogitechMicWindow.h
266 FIFO/FIFOAnalyzer.cpp
267 FIFO/FIFOAnalyzer.h
268 FIFO/FIFOPlayerWindow.cpp
269 FIFO/FIFOPlayerWindow.h
270 GameCount.cpp
271 GameCount.h
272 GameList/GameList.cpp
273 GameList/GameList.h
274 GameList/GameListModel.cpp
275 GameList/GameListModel.h
276 GameList/GameTracker.cpp
277 GameList/GameTracker.h
278 GameList/GridProxyModel.cpp
279 GameList/GridProxyModel.h
280 GameList/ListProxyModel.cpp
281 GameList/ListProxyModel.h
282 GCMemcardCreateNewDialog.cpp
283 GCMemcardCreateNewDialog.h
284 GCMemcardManager.cpp
285 GCMemcardManager.h
286 Host.cpp
287 Host.h
288 HotkeyScheduler.cpp
289 HotkeyScheduler.h
290 InfinityBase/InfinityBaseWindow.cpp
291 InfinityBase/InfinityBaseWindow.h
292 Main.cpp
293 MainWindow.cpp
294 MainWindow.h
295 MenuBar.cpp
296 MenuBar.h
297 NetPlay/ChunkedProgressDialog.cpp
298 NetPlay/ChunkedProgressDialog.h
299 NetPlay/GameDigestDialog.cpp
300 NetPlay/GameDigestDialog.h
301 NetPlay/GameListDialog.cpp
302 NetPlay/GameListDialog.h
303 NetPlay/ClickBlurLabel.cpp
304 NetPlay/ClickBlurLabel.h
305 NetPlay/NetPlayBrowser.cpp
306 NetPlay/NetPlayBrowser.h
307 NetPlay/NetPlayDialog.cpp
308 NetPlay/NetPlayDialog.h
309 NetPlay/NetPlaySetupDialog.cpp
310 NetPlay/NetPlaySetupDialog.h
311 NetPlay/PadMappingDialog.cpp
312 NetPlay/PadMappingDialog.h
313 NANDRepairDialog.cpp
314 NANDRepairDialog.h
315 NKitWarningDialog.cpp
316 NKitWarningDialog.h
317 QtUtils/AnalyticsPrompt.cpp
318 QtUtils/AnalyticsPrompt.h
319 QtUtils/AspectRatioWidget.cpp
320 QtUtils/AspectRatioWidget.h
321 QtUtils/BlockUserInputFilter.cpp
322 QtUtils/BlockUserInputFilter.h
323 QtUtils/ClearLayoutRecursively.cpp
324 QtUtils/ClearLayoutRecursively.h
325 QtUtils/ClickableStatusBar.h
326 QtUtils/DolphinFileDialog.cpp
327 QtUtils/DolphinFileDialog.h
328 QtUtils/DoubleClickEventFilter.cpp
329 QtUtils/DoubleClickEventFilter.h
330 QtUtils/ElidedButton.cpp
331 QtUtils/ElidedButton.h
332 QtUtils/FileOpenEventFilter.cpp
333 QtUtils/FileOpenEventFilter.h
334 QtUtils/FromStdString.h
335 QtUtils/ImageConverter.cpp
336 QtUtils/ImageConverter.h
337 QtUtils/ModalMessageBox.cpp
338 QtUtils/ModalMessageBox.h
339 QtUtils/NonAutodismissibleMenu.cpp
340 QtUtils/NonAutodismissibleMenu.h
341 QtUtils/NonDefaultQPushButton.cpp
342 QtUtils/NonDefaultQPushButton.h
343 QtUtils/ParallelProgressDialog.h
344 QtUtils/PartiallyClosableTabWidget.cpp
345 QtUtils/PartiallyClosableTabWidget.h
346 QtUtils/QtUtils.cpp
347 QtUtils/QtUtils.h
348 QtUtils/SetWindowDecorations.cpp
349 QtUtils/SetWindowDecorations.h
350 QtUtils/SignalBlocking.h
351 QtUtils/UTF8CodePointCountValidator.cpp
352 QtUtils/UTF8CodePointCountValidator.h
353 QtUtils/WindowActivationEventFilter.cpp
354 QtUtils/WindowActivationEventFilter.h
355 QtUtils/WrapInScrollArea.cpp
356 QtUtils/WrapInScrollArea.h
357 RenderWidget.cpp
358 RenderWidget.h
359 ResourcePackManager.cpp
360 ResourcePackManager.h
361 Resources.cpp
362 Resources.h
363 RiivolutionBootWidget.cpp
364 RiivolutionBootWidget.h
365 SearchBar.cpp
366 SearchBar.h
367 Settings.cpp
368 Settings.h
369 Settings/AdvancedPane.cpp
370 Settings/AdvancedPane.h
371 Settings/AudioPane.cpp
372 Settings/AudioPane.h
373 Settings/BroadbandAdapterSettingsDialog.cpp
374 Settings/BroadbandAdapterSettingsDialog.h
375 Settings/GameCubePane.cpp
376 Settings/GameCubePane.h
377 Settings/GeneralPane.cpp
378 Settings/GeneralPane.h
379 Settings/InterfacePane.cpp
380 Settings/InterfacePane.h
381 Settings/OnScreenDisplayPane.cpp
382 Settings/OnScreenDisplayPane.h
383 Settings/PathPane.cpp
384 Settings/PathPane.h
385 Settings/TriforcePane.cpp
386 Settings/TriforcePane.h
387 Settings/USBDevicePicker.cpp
388 Settings/USBDevicePicker.h
389 Settings/WiiPane.cpp
390 Settings/WiiPane.h
391 SkylanderPortal/SkylanderModifyDialog.cpp
392 SkylanderPortal/SkylanderModifyDialog.h
393 SkylanderPortal/SkylanderPortalWindow.cpp
394 SkylanderPortal/SkylanderPortalWindow.h
395 TAS/GCTASInputWindow.cpp
396 TAS/GCTASInputWindow.h
397 TAS/GBATASInputWindow.cpp
398 TAS/GBATASInputWindow.h
399 TAS/IRWidget.cpp
400 TAS/IRWidget.h
401 TAS/StickWidget.cpp
402 TAS/StickWidget.h
403 TAS/TASCheckBox.cpp
404 TAS/TASCheckBox.h
405 TAS/TASControlState.cpp
406 TAS/TASControlState.h
407 TAS/TASInputWindow.cpp
408 TAS/TASInputWindow.h
409 TAS/TASSlider.cpp
410 TAS/TASSlider.h
411 TAS/TASSpinBox.cpp
412 TAS/TASSpinBox.h
413 TAS/WiiTASInputWindow.cpp
414 TAS/WiiTASInputWindow.h
415 ToolBar.cpp
416 ToolBar.h
417 Translation.cpp
418 Translation.h
419 Updater.cpp
420 Updater.h
421 WiiUpdate.cpp
422 WiiUpdate.h
423 )
424
425 if (WIN32)
426 target_sources(dolphin-emu PRIVATE
427 Styles/Dark/dark.qrc
428 )
429 endif()
430
431 if (NOT WIN32)
432 target_sources(dolphin-emu PRIVATE
433 QtUtils/SignalDaemon.cpp
434 QtUtils/SignalDaemon.h
435 )
436 endif()
437
438 target_compile_definitions(dolphin-emu
439 PRIVATE
440 -DQT_USE_QSTRINGBUILDER
441 -DQT_NO_CAST_FROM_ASCII
442 -DQT_NO_CAST_TO_ASCII
443 # This Qt version should match Externals/Qt.
444 # It disables deprecation warnings we can't fix yet.
445 -DQT_WARN_DEPRECATED_UP_TO=0x060501
446 )
447
•448 target_include_directories(dolphin-emu
449 PRIVATE
450 ${CMAKE_CURRENT_BINARY_DIR}
451 ${Qt6Gui_PRIVATE_INCLUDE_DIRS}
452 /usr/include/imgui
453 )
454
455 target_link_libraries(dolphin-emu
456 PRIVATE
457 core
•458 Qt6::Widgets
459 uicommon
460 imgui
461 implot
462 stb
463 )
464
465 if (NEED_QT_GUI_PRIVATE_COMPONENT)
466 target_link_libraries(dolphin-emu
467 PRIVATE
468 Qt6::GuiPrivate
469 )
470 endif()
471
472 if (WIN32)
473 target_link_libraries(dolphin-emu
474 PRIVATE
475 gdi32.lib
476 shell32.lib
477 dwmapi.lib # Needed to set window decorations for dark theme
478 )
479 endif()
480
481 if (MSVC)
482 set(qtGui "")
483 set(qtGuiPriv "")
484 set(qtWidgetsPriv "")
485 list(TRANSFORM Qt6Gui_INCLUDE_DIRS PREPEND "/external:I" OUTPUT_VARIABLE qtGui)
486 list(TRANSFORM Qt6Gui_PRIVATE_INCLUDE_DIRS PREPEND "/external:I" OUTPUT_VARIABLE qtGuiPriv)
487 list(TRANSFORM Qt6Widgets_PRIVATE_INCLUDE_DIRS PREPEND "/external:I" OUTPUT_VARIABLE qtWidgetsPriv)
488 target_compile_options(dolphin-emu PRIVATE "${qtGui}")
489 target_compile_options(dolphin-emu PRIVATE "${qtGuiPriv}")
490 target_compile_options(dolphin-emu PRIVATE "${qtWidgets}")
491
492 # Qt 6.3.0 headers use std::aligned_storage instead of alignas
493 target_compile_definitions(dolphin-emu PRIVATE _SILENCE_CXX23_ALIGNED_STORAGE_DEPRECATION_WARNING)
494
495 # Qt6 requires RTTI
496 remove_cxx_flag_from_target(dolphin-emu "/GR-")
497 target_compile_options(dolphin-emu PRIVATE "/GR")
498 endif()
499
500 if(WIN32)
501 target_sources(dolphin-emu PRIVATE DolphinQt.manifest DolphinQt.rc)
502
503 set_target_properties(dolphin-emu PROPERTIES
504 DEBUG_POSTFIX D
505 OUTPUT_NAME Dolphin
506 WIN32_EXECUTABLE TRUE
507 )
508
509 # Copy Sys dir
510 add_custom_command(TARGET dolphin-emu POST_BUILD
511 COMMAND ${CMAKE_COMMAND} -E remove_directory "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Sys"
512 COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_SOURCE_DIR}/Data/Sys" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Sys"
513 )
514
515 # Copy COPYING
516 add_custom_command(TARGET dolphin-emu POST_BUILD
517 COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/COPYING" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/COPYING"
518 )
519
520 # Copy Licenses dir
521 add_custom_command(TARGET dolphin-emu POST_BUILD
522 COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_SOURCE_DIR}/LICENSES" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Licenses"
523 )
524
525 # Copy qt.conf
526 add_custom_command(TARGET dolphin-emu POST_BUILD
527 COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/qt.conf.win" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/qt.conf"
528 )
529
530 if (ENABLE_AUTOUPDATE)
531 # Copy build_info.txt
532 add_custom_command(TARGET dolphin-emu POST_BUILD
533 COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_BINARY_DIR}/build_info.txt" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/build_info.txt"
534 )
535 endif()
536
537 # Delegate to Qt's official deployment binary on Windows to copy over the necessary Qt-specific libraries, etc.
538 get_target_property(MOC_EXECUTABLE_LOCATION Qt6::moc IMPORTED_LOCATION)
539 get_filename_component(QT_BINARY_DIRECTORY "${MOC_EXECUTABLE_LOCATION}" DIRECTORY)
540 find_program(WINDEPLOYQT_EXE windeployqt HINTS "${QT_BINARY_DIRECTORY}")
541
542 # Note: We set the PATH for the duration of this command so that the
543 # deployment application is able to locate the Qt libraries to copy.
544 # if the necessary paths aren't already set beforehand.
545 #
546 # For example, consider a hypothetical emulation project named Orca.
547 # Orca supplies its own version of Qt instead of having developers actually
548 # install the officially supported Qt libraries -- a method that would make
549 # wrangling around with Qt through CMake much nicer and lessen the external
550 # library maintenance burden of the project, but alas.
551 #
552 # In this case, as Qt is not installed through the official binary, this also
553 # means proper path variables will not be set up, thus the need to ensure they're
554 # always set up.
555 #
556 add_custom_command(TARGET dolphin-emu POST_BUILD
557 COMMAND "${CMAKE_COMMAND}" -E env PATH="${QT_BINARY_DIRECTORY}"
558 "${WINDEPLOYQT_EXE}" --libdir="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}"
559 --plugindir="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/QtPlugins"
560 $<IF:$<CONFIG:Debug>,--debug,--release>
561 --no-translations
562 --no-compiler-runtime
563 --no-system-d3d-compiler
564 --no-opengl-sw
565 "$<TARGET_FILE:dolphin-emu>"
566 )
567 endif()
568
569 # Handle localization
570 find_package(Gettext)
571
572 if(WIN32 AND NOT Gettext_FOUND)
573 message(STATUS "Using Gettext from Externals")
574 set(GETTEXT_MSGFMT_EXECUTABLE "${CMAKE_SOURCE_DIR}/Externals/gettext/msgfmt.exe")
575 endif()
576
577 if(GETTEXT_MSGFMT_EXECUTABLE)
578 set(pot_file "${CMAKE_SOURCE_DIR}/Languages/po/dolphin-emu.pot")
579 file(GLOB LINGUAS ${CMAKE_SOURCE_DIR}/Languages/po/*.po)
580
581 target_sources(dolphin-emu PRIVATE ${pot_file} ${LINGUAS})
582 source_group("Localization" FILES ${LINGUAS})
583 source_group("Localization\\\\Generated" FILES ${pot_file})
584
585 foreach(po ${LINGUAS})
586 get_filename_component(lang ${po} NAME_WE)
587 if(WIN32)
588 set(mo_dir ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Languages)
589 set(mo ${mo_dir}/${lang}.mo)
590 else()
591 set(mo_dir ${CMAKE_CURRENT_BINARY_DIR}/${lang})
592 set(mo ${mo_dir}/dolphin-emu.mo)
593 endif()
594
595 target_sources(dolphin-emu PRIVATE ${mo})
596 source_group("Localization\\\\Generated" FILES ${mo})
597
598 if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
599 set_source_files_properties(${mo} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources/${lang}.lproj")
600 else()
601 install(FILES ${mo} DESTINATION share/locale/${lang}/LC_MESSAGES)
602 endif()
603
604 if(WIN32)
605 add_custom_command(OUTPUT ${mo}
606 COMMAND ${CMAKE_COMMAND} -E make_directory ${mo_dir}
607 COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${mo} ${po}
608 DEPENDS ${po}
609 )
610 else()
611 add_custom_command(OUTPUT ${mo}
612 COMMAND ${CMAKE_COMMAND} -E make_directory ${mo_dir}
613 COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none ${po} ${pot_file}
614 COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${mo} ${po}
615 DEPENDS ${po}
616 )
617 endif()
618 endforeach()
619 endif()
620
621 if(APPLE)
622 include(BundleUtilities)
623
624 # Ask for an application bundle.
625 set_target_properties(dolphin-emu PROPERTIES
626 MACOSX_BUNDLE true
627 MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in"
628 XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY ""
629 OUTPUT_NAME DolphinQt
630 )
631
632 # Copy qt.conf into the bundle
633 target_sources(dolphin-emu PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/qt.conf")
634 set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/qt.conf" PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
635
636 # Copy icon into the bundle
637 target_sources(dolphin-emu PRIVATE "${CMAKE_SOURCE_DIR}/Data/Dolphin.icns")
638 set_source_files_properties("${CMAKE_SOURCE_DIR}/Data/Dolphin.icns" PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
639
640 # Manually include plugins
641 find_package(Qt6QMacStylePlugin REQUIRED PATHS ${Qt6Widgets_DIR})
642 find_package(Qt6QCocoaIntegrationPlugin REQUIRED PATHS ${Qt6Gui_DIR})
643
644 # Copy Qt plugins into the bundle
645 get_target_property(qtcocoa_location Qt6::QCocoaIntegrationPlugin LOCATION)
646 target_sources(dolphin-emu PRIVATE "${qtcocoa_location}")
647 set_source_files_properties("${qtcocoa_location}" PROPERTIES MACOSX_PACKAGE_LOCATION MacOS/platforms)
648
649 get_target_property(qtmacstyle_location Qt6::QMacStylePlugin LOCATION)
650 target_sources(dolphin-emu PRIVATE "${qtmacstyle_location}")
651 set_source_files_properties("${qtmacstyle_location}" PROPERTIES MACOSX_PACKAGE_LOCATION MacOS/styles)
652
653 # Copy resources into the bundle
654 set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${CMAKE_SOURCE_DIR}/Data/Sys")
655 file(GLOB_RECURSE resources RELATIVE "${CMAKE_SOURCE_DIR}/Data" "${CMAKE_SOURCE_DIR}/Data/Sys/*")
656 foreach(res ${resources})
657 target_sources(dolphin-emu PRIVATE "${CMAKE_SOURCE_DIR}/Data/${res}")
658 get_filename_component(resdir "${res}" DIRECTORY)
659 set_source_files_properties("${CMAKE_SOURCE_DIR}/Data/${res}" PROPERTIES
660 MACOSX_PACKAGE_LOCATION "Resources/${resdir}")
661 source_group("Resources" FILES "${CMAKE_SOURCE_DIR}/Data/${res}")
662 endforeach()
663
664 include(DolphinInjectVersionInfo)
665 dolphin_inject_version_info(dolphin-emu)
666
667 # Copy MoltenVK into the bundle
668 if(ENABLE_VULKAN)
669 if(USE_BUNDLED_MOLTENVK)
670 add_dependencies(dolphin-emu MoltenVK)
671 ExternalProject_Get_Property(MoltenVK SOURCE_DIR)
672 target_sources(dolphin-emu PRIVATE "${SOURCE_DIR}/Package/Release/MoltenVK/dynamic/dylib/macOS/libMoltenVK.dylib")
673 set_source_files_properties("${SOURCE_DIR}/Package/Release/MoltenVK/dynamic/dylib/macOS/libMoltenVK.dylib" PROPERTIES MACOSX_PACKAGE_LOCATION Frameworks GENERATED ON)
674 else()
675 find_file(MOLTENVK_DYLIB NAMES libMoltenVK.dylib PATH_SUFFIXES lib)
676 if(NOT MOLTENVK_DYLIB)
677 message(FATAL_ERROR "Couldn't find libMoltenVK.dylib. Enable USE_BUNDLED_MOLTENVK?")
678 endif()
679 target_sources(dolphin-emu PRIVATE ${MOLTENVK_DYLIB})
680 set_source_files_properties(${MOLTENVK_DYLIB} PROPERTIES MACOSX_PACKAGE_LOCATION Frameworks)
681 endif()
682 endif()
683
684 if(POSTPROCESS_BUNDLE)
685 # Update library references to make the bundle portable
686 include(DolphinPostprocessBundle)
687 dolphin_postprocess_bundle(dolphin-emu)
688 # Fix rpath
689 add_custom_command(TARGET dolphin-emu
690 POST_BUILD COMMAND
691 ${CMAKE_INSTALL_NAME_TOOL} -add_rpath "@executable_path/../Frameworks/"
692 $<TARGET_FILE:dolphin-emu>)
693 endif()
694
695 if(MACOS_CODE_SIGNING)
696 add_custom_command(TARGET dolphin-emu
697 POST_BUILD
698 COMMAND "${CMAKE_SOURCE_DIR}/Tools/mac-codesign.sh"
699 "-e" "${CMAKE_CURRENT_SOURCE_DIR}/DolphinEmu$<$<CONFIG:Debug>:Debug>.entitlements"
700 "${MACOS_CODE_SIGNING_IDENTITY}"
701 "$<TARGET_BUNDLE_DIR:dolphin-emu>"
702 )
703 endif()
704 else()
705 install(TARGETS dolphin-emu RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
706 endif()
707
708 if(USE_MGBA)
709 target_sources(dolphin-emu PRIVATE
710 GBAHost.cpp
711 GBAHost.h
712 GBAWidget.cpp
713 GBAWidget.h
714 )
715 endif()
716
717 if(USE_DISCORD_PRESENCE)
•718 target_compile_definitions(dolphin-emu PRIVATE -DUSE_DISCORD_PRESENCE)
719 endif()
720
721 if(USE_RETRO_ACHIEVEMENTS)
722 target_link_libraries(dolphin-emu PRIVATE ${CMAKE_INSTALL_FULL_LIBDIR}/rcheevoslib.a)
723 target_compile_definitions(dolphin-emu PRIVATE -DUSE_RETRO_ACHIEVEMENTS)
724 if(RC_CLIENT_SUPPORTS_RAINTEGRATION)
725 target_compile_definitions(dolphin-emu PRIVATE -DRC_CLIENT_SUPPORTS_RAINTEGRATION)
726 endif()
727 endif()