Duckstation/src/duckstation-qt/CMakeLists.txt

223 lines
7.6 KiB
CMake
Raw Normal View History

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
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
cheatmanagerdialog.cpp
cheatmanagerdialog.h
cheatmanagerdialog.ui
cheatcodeeditordialog.cpp
cheatcodeeditordialog.h
cheatcodeeditordialog.ui
2019-12-31 06:17:17 +00:00
consolesettingswidget.cpp
consolesettingswidget.h
consolesettingswidget.ui
controllersettingswidget.cpp
controllersettingswidget.h
2020-12-16 15:18:13 +00:00
debuggermodels.cpp
debuggermodels.h
debuggerwindow.cpp
debuggerwindow.h
debuggerwindow.ui
displaysettingswidget.cpp
displaysettingswidget.h
displaysettingswidget.ui
emulationsettingswidget.cpp
emulationsettingswidget.h
emulationsettingswidget.ui
enhancementsettingswidget.cpp
enhancementsettingswidget.h
enhancementsettingswidget.ui
gamelistmodel.cpp
gamelistmodel.h
gamelistsearchdirectoriesmodel.cpp
gamelistsearchdirectoriesmodel.h
2019-12-31 06:17:17 +00:00
gamelistsettingswidget.cpp
gamelistsettingswidget.h
gamelistsettingswidget.ui
gamelistwidget.cpp
gamelistwidget.h
2020-05-16 10:02:44 +00:00
gamepropertiesdialog.cpp
gamepropertiesdialog.h
gamepropertiesdialog.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
inputbindingmonitor.cpp
inputbindingmonitor.h
2020-01-05 02:46:03 +00:00
inputbindingwidgets.cpp
inputbindingwidgets.h
2019-12-31 06:17:17 +00:00
main.cpp
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
2020-09-12 15:20:02 +00:00
postprocessingchainconfigwidget.cpp
postprocessingchainconfigwidget.h
postprocessingchainconfigwidget.ui
postprocessingsettingswidget.cpp
postprocessingsettingswidget.h
postprocessingsettingswidget.ui
2020-09-12 15:20:02 +00:00
postprocessingshaderconfigwidget.cpp
postprocessingshaderconfigwidget.h
qtdisplaywidget.cpp
qtdisplaywidget.h
2019-12-31 06:17:17 +00:00
qthostinterface.cpp
qthostinterface.h
qtprogresscallback.cpp
qtprogresscallback.h
2019-12-31 06:17:17 +00:00
qtutils.cpp
qtutils.h
settingsdialog.cpp
settingsdialog.h
settingsdialog.ui
)
2021-02-26 14:44:53 +00:00
if(WITH_CHEEVOS)
set(SRCS ${SRCS}
achievementlogindialog.cpp
achievementlogindialog.h
achievementlogindialog.ui
achievementsettingswidget.cpp
achievementsettingswidget.h
achievementsettingswidget.ui
)
endif()
2020-07-28 09:16:12 +00:00
set(TS_FILES
2020-08-03 03:27:20 +00:00
translations/duckstation-qt_de.ts
2020-08-15 01:37:45 +00:00
translations/duckstation-qt_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
translations/duckstation-qt_nl.ts
translations/duckstation-qt_pl.ts
2020-08-02 03:21:16 +00:00
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_zh-cn.ts
2020-07-28 09:16:12 +00:00
)
set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/translations")
qt5_add_translation(QM_FILES ${TS_FILES})
add_executable(duckstation-qt ${SRCS} ${QM_FILES})
target_include_directories(duckstation-qt PRIVATE "${Qt5Gui_PRIVATE_INCLUDE_DIRS}")
2020-06-18 14:18:53 +00:00
target_link_libraries(duckstation-qt PRIVATE frontend-common core common imgui glad minizip scmversion vulkan-loader Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Network)
if(WIN32)
# 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 Qt5::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
--no-angle
"$<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"
)
endif()
2020-08-25 12:04:55 +00:00
if(APPLE)
include(BundleUtilities)
set(BUNDLE_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/DuckStation.app)
# Ask for an application bundle.
set_target_properties(duckstation-qt PROPERTIES
MACOSX_BUNDLE true
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in
OUTPUT_NAME DuckStation
)
# Copy qt.conf into the bundle
target_sources(duckstation-qt PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/qt.conf")
set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/qt.conf" PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
# 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)
# Copy Qt plugins into the bundle
get_target_property(qtcocoa_location Qt5::QCocoaIntegrationPlugin LOCATION)
target_sources(duckstation-qt PRIVATE "${qtcocoa_location}")
set_source_files_properties("${qtcocoa_location}" PROPERTIES MACOSX_PACKAGE_LOCATION MacOS/platforms)
get_target_property(qtmacstyle_location Qt5::QMacStylePlugin LOCATION)
target_sources(duckstation-qt PRIVATE "${qtmacstyle_location}")
set_source_files_properties("${qtmacstyle_location}" PROPERTIES MACOSX_PACKAGE_LOCATION MacOS/styles)
# Copy resources into the bundle
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${CMAKE_SOURCE_DIR}/data")
file(GLOB_RECURSE resources RELATIVE "${CMAKE_SOURCE_DIR}/data" "${CMAKE_SOURCE_DIR}/data/*")
foreach(res ${resources})
target_sources(duckstation-qt PRIVATE "${CMAKE_SOURCE_DIR}/data/${res}")
get_filename_component(resdir "${res}" DIRECTORY)
set_source_files_properties("${CMAKE_SOURCE_DIR}/data/${res}" PROPERTIES
MACOSX_PACKAGE_LOCATION "MacOS/${resdir}")
source_group("Resources" FILES "${CMAKE_SOURCE_DIR}/data/${res}")
endforeach()
# Copy translations into the bundle
add_custom_command(TARGET duckstation-qt
POST_BUILD
COMMAND mkdir -p $<TARGET_FILE_DIR:duckstation-qt>/translations
2020-08-25 12:04:55 +00:00
COMMAND cp ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/translations/*.qm $<TARGET_FILE_DIR:duckstation-qt>/translations)
# Copy MoltenVK into the bundle
target_sources(duckstation-qt PRIVATE "${CMAKE_SOURCE_DIR}/dep/mac/MoltenVK/libvulkan.dylib")
set_source_files_properties("${CMAKE_SOURCE_DIR}/dep/mac/MoltenVK/libvulkan.dylib" PROPERTIES MACOSX_PACKAGE_LOCATION Frameworks)
# Update library references to make the bundle portable
include(DolphinPostprocessBundle)
dolphin_postprocess_bundle(duckstation-qt)
# Fix rpath
add_custom_command(TARGET duckstation-qt
POST_BUILD COMMAND
${CMAKE_INSTALL_NAME_TOOL} -add_rpath "@executable_path/../Frameworks/"
$<TARGET_FILE:duckstation-qt>)
endif()