Duckstation/src/duckstation-qt/CMakeLists.txt

242 lines
7.9 KiB
CMake
Raw Normal View History

include(CopyBaseTranslations)
2019-12-31 06:17:17 +00:00
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
2020-07-28 09:16:12 +00:00
set(SRCS
2020-06-24 15:31:23 +00:00
resources/resources.qrc
2020-06-11 04:36:48 +00:00
aboutdialog.cpp
aboutdialog.h
aboutdialog.ui
2023-09-16 04:39:13 +00:00
achievementlogindialog.cpp
achievementlogindialog.h
achievementlogindialog.ui
achievementsettingswidget.cpp
achievementsettingswidget.h
achievementsettingswidget.ui
2020-04-30 14:59:31 +00:00
advancedsettingswidget.cpp
advancedsettingswidget.h
advancedsettingswidget.ui
2020-01-24 04:51:13 +00:00
audiosettingswidget.cpp
audiosettingswidget.h
audiosettingswidget.ui
2020-08-06 12:08:22 +00:00
autoupdaterdialog.cpp
autoupdaterdialog.h
autoupdaterdialog.ui
biossettingswidget.cpp
biossettingswidget.h
biossettingswidget.ui
2020-10-19 15:14:49 +00:00
cheatcodeeditordialog.cpp
cheatcodeeditordialog.h
cheatcodeeditordialog.ui
cheatmanagerdialog.cpp
cheatmanagerdialog.h
cheatmanagerdialog.ui
2021-05-15 17:23:26 +00:00
collapsiblewidget.cpp
collapsiblewidget.h
colorpickerbutton.cpp
colorpickerbutton.h
2019-12-31 06:17:17 +00:00
consolesettingswidget.cpp
consolesettingswidget.h
consolesettingswidget.ui
controllerbindingwidget_analog_controller.ui
controllerbindingwidget_analog_joystick.ui
controllerbindingwidget_digital_controller.ui
controllerbindingwidget_guncon.ui
controllerbindingwidget_mouse.ui
controllerbindingwidget_negcon.ui
controllerbindingwidgets.cpp
controllerbindingwidgets.h
controllerbindingwidget.ui
controllerglobalsettingswidget.cpp
controllerglobalsettingswidget.h
controllerglobalsettingswidget.ui
controllerledsettingsdialog.ui
controllermacroeditwidget.ui
controllermacrowidget.ui
controllersettingswindow.cpp
controllersettingswindow.h
controllersettingswindow.ui
controllersettingwidgetbinder.h
2022-09-13 10:29:17 +00:00
coverdownloaddialog.cpp
coverdownloaddialog.h
coverdownloaddialog.ui
2020-12-16 15:18:13 +00:00
debuggermodels.cpp
debuggermodels.h
debuggerwindow.cpp
debuggerwindow.h
debuggerwindow.ui
displaysettingswidget.cpp
displaysettingswidget.h
displaysettingswidget.ui
displaywidget.cpp
displaywidget.h
emptygamelistwidget.ui
emulationsettingswidget.cpp
emulationsettingswidget.h
emulationsettingswidget.ui
enhancementsettingswidget.cpp
enhancementsettingswidget.h
enhancementsettingswidget.ui
foldersettingswidget.cpp
foldersettingswidget.h
foldersettingswidget.ui
gamelistmodel.cpp
gamelistmodel.h
gamelistrefreshthread.cpp
gamelistrefreshthread.h
gamelistsearchdirectoriesmodel.cpp
gamelistsearchdirectoriesmodel.h
2019-12-31 06:17:17 +00:00
gamelistsettingswidget.cpp
gamelistsettingswidget.h
gamelistsettingswidget.ui
gamelistwidget.cpp
gamelistwidget.h
gamelistwidget.ui
gamesummarywidget.cpp
gamesummarywidget.h
gamesummarywidget.ui
2020-12-17 17:32:29 +00:00
gdbconnection.cpp
gdbconnection.h
gdbserver.cpp
gdbserver.h
generalsettingswidget.cpp
generalsettingswidget.h
generalsettingswidget.ui
2020-01-05 02:46:03 +00:00
hotkeysettingswidget.cpp
hotkeysettingswidget.h
inputbindingdialog.cpp
inputbindingdialog.h
inputbindingdialog.ui
2020-01-05 02:46:03 +00:00
inputbindingwidgets.cpp
inputbindingwidgets.h
2023-09-30 04:40:50 +00:00
logwindow.cpp
logwindow.h
2019-12-31 06:17:17 +00:00
mainwindow.cpp
mainwindow.h
mainwindow.ui
2020-09-18 14:28:07 +00:00
memorycardeditordialog.cpp
memorycardeditordialog.h
memorycardeditordialog.ui
memorycardsettingswidget.cpp
memorycardsettingswidget.h
2020-12-16 15:18:13 +00:00
memoryviewwidget.cpp
memoryviewwidget.h
postprocessingsettingswidget.cpp
postprocessingsettingswidget.h
postprocessingsettingswidget.ui
qthost.cpp
qthost.h
qtkeycodes.cpp
qtprogresscallback.cpp
qtprogresscallback.h
qttranslations.cpp
2019-12-31 06:17:17 +00:00
qtutils.cpp
qtutils.h
resource.h
settingswindow.cpp
settingswindow.h
settingswindow.ui
settingwidgetbinder.h
2023-09-02 07:27:34 +00:00
setupwizarddialog.cpp
setupwizarddialog.h
setupwizarddialog.ui
2019-12-31 06:17:17 +00:00
)
2020-07-28 09:16:12 +00:00
set(TS_FILES
2020-08-03 03:27:20 +00:00
translations/duckstation-qt_de.ts
translations/duckstation-qt_en.ts
2020-08-15 01:37:45 +00:00
translations/duckstation-qt_es.ts
translations/duckstation-qt_es-ES.ts
2020-12-24 20:01:33 +00:00
translations/duckstation-qt_fr.ts
2020-08-14 14:12:47 +00:00
translations/duckstation-qt_he.ts
2020-08-17 01:54:10 +00:00
translations/duckstation-qt_it.ts
2020-12-24 20:01:33 +00:00
translations/duckstation-qt_ja.ts
2023-08-19 12:47:49 +00:00
translations/duckstation-qt_ko.ts
2020-12-24 20:01:33 +00:00
translations/duckstation-qt_nl.ts
translations/duckstation-qt_pl.ts
translations/duckstation-qt_pt-BR.ts
translations/duckstation-qt_pt-PT.ts
2020-12-24 20:01:33 +00:00
translations/duckstation-qt_ru.ts
translations/duckstation-qt_tr.ts
translations/duckstation-qt_zh-CN.ts
2020-07-28 09:16:12 +00:00
)
add_executable(duckstation-qt ${SRCS} ${QM_FILES})
2023-09-02 03:41:41 +00:00
target_precompile_headers(duckstation-qt PRIVATE "pch.h")
target_include_directories(duckstation-qt PRIVATE "${Qt6Gui_PRIVATE_INCLUDE_DIRS}" "${CMAKE_CURRENT_SOURCE_DIR}")
target_link_libraries(duckstation-qt PRIVATE core common imgui minizip scmversion Qt6::Core Qt6::Gui Qt6::Widgets Qt6::Network)
2023-09-10 04:14:27 +00:00
# Our Qt builds may have exceptions on, so force them off.
target_compile_definitions(duckstation-qt PRIVATE QT_NO_EXCEPTIONS)
add_core_resources(duckstation-qt)
if(WIN32)
2023-09-02 03:41:41 +00:00
target_sources(duckstation-qt PRIVATE duckstation-qt.rc)
# We want a Windows subsystem application not console.
set_target_properties(duckstation-qt PROPERTIES
WIN32_EXECUTABLE TRUE
DEBUG_POSTFIX "-debug")
# Copy in Qt DLLs. Borrowed from Dolphin.
get_target_property(MOC_EXECUTABLE_LOCATION Qt6::moc IMPORTED_LOCATION)
get_filename_component(QT_BINARY_DIRECTORY "${MOC_EXECUTABLE_LOCATION}" DIRECTORY)
find_program(WINDEPLOYQT_EXE windeployqt HINTS "${QT_BINARY_DIRECTORY}")
add_custom_command(TARGET duckstation-qt POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E env PATH="${QT_BINARY_DIRECTORY}"
"${WINDEPLOYQT_EXE}" --libdir="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}"
--plugindir="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/QtPlugins"
$<IF:$<CONFIG:Debug>,--debug,--release>
--no-translations
--no-compiler-runtime
"$<TARGET_FILE:duckstation-qt>"
)
add_custom_command(TARGET duckstation-qt POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/qt.conf.win" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/qt.conf"
)
2023-09-10 04:14:27 +00:00
#set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/translations")
elseif(APPLE)
# Don't generate a bundle for XCode, it makes code signing fail...
if(NOT CMAKE_GENERATOR MATCHES "Xcode")
set(BUNDLE_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/DuckStation.app)
set_target_properties(duckstation-qt PROPERTIES
MACOSX_BUNDLE true
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in
OUTPUT_NAME DuckStation
)
# Inject Qt Libraries into bundle.
if(NOT SKIP_POSTPROCESS_BUNDLE)
find_program(MACDEPLOYQT_EXE macdeployqt HINTS "${QT_BINARY_DIRECTORY}")
add_custom_target(duckstation-postprocess-bundle ALL
COMMAND "${MACDEPLOYQT_EXE}" "${BUNDLE_PATH}" -no-strip
)
add_dependencies(duckstation-postprocess-bundle duckstation-qt)
endif()
endif()
2020-08-25 12:04:55 +00:00
# Copy icon into the bundle
target_sources(duckstation-qt PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/DuckStation.icns")
set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/DuckStation.icns" PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
2023-09-10 04:14:27 +00:00
# Translation setup
qt_add_lrelease(duckstation-qt TS_FILES ${TS_FILES} QM_FILES_OUTPUT_VARIABLE QM_FILES)
foreach (QM_FILE IN LISTS QM_FILES)
target_sources(duckstation-qt PRIVATE ${QM_FILE})
set_source_files_properties(${QM_FILE} PROPERTIES MACOSX_PACKAGE_LOCATION Resources/translations)
endforeach()
copy_base_translations(duckstation-qt)
2023-09-10 04:14:27 +00:00
else()
qt_add_lrelease(duckstation-qt TS_FILES ${TS_FILES} QM_FILES_OUTPUT_VARIABLE QM_FILES)
set(QM_OUTPUT_DIR "$<TARGET_FILE_DIR:duckstation-qt>/translations")
add_custom_command(TARGET duckstation-qt POST_BUILD COMMAND "${CMAKE_COMMAND}" -E make_directory "${QM_OUTPUT_DIR}")
foreach (QM_FILE IN LISTS QM_FILES)
get_filename_component(QM_FILE_NAME ${QM_FILE} NAME)
add_custom_command(TARGET duckstation-qt POST_BUILD COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${QM_FILE}" "${QM_OUTPUT_DIR}/${QM_FILE_NAME}")
endforeach()
copy_base_translations(duckstation-qt)
2020-08-25 12:04:55 +00:00
endif()