mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Merge pull request #8087 from spycrab/cmake_win2019
Support CMake on Windows
This commit is contained in:
@ -1,3 +1,7 @@
|
||||
if (NOT Qt5_DIR AND MSVC)
|
||||
set(Qt5_DIR "${CMAKE_SOURCE_DIR}/Externals/Qt5.11.1/5.11.1/msvc2017_64/lib/cmake/Qt5")
|
||||
endif()
|
||||
|
||||
find_package(Qt5 5.9 REQUIRED COMPONENTS Gui Widgets)
|
||||
|
||||
set_property(TARGET Qt5::Core PROPERTY INTERFACE_COMPILE_FEATURES "")
|
||||
@ -107,7 +111,6 @@ add_executable(dolphin-emu
|
||||
QtUtils/FlowLayout.cpp
|
||||
QtUtils/ModalMessageBox.cpp
|
||||
QtUtils/ImageConverter.cpp
|
||||
QtUtils/SignalDaemon.cpp
|
||||
QtUtils/WindowActivationEventFilter.cpp
|
||||
QtUtils/WinIconHelper.cpp
|
||||
QtUtils/WrapInScrollArea.cpp
|
||||
@ -130,6 +133,10 @@ add_executable(dolphin-emu
|
||||
Updater.cpp
|
||||
)
|
||||
|
||||
if (NOT WIN32)
|
||||
target_sources(dolphin-emu PRIVATE QtUtils/SignalDaemon.cpp)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(dolphin-emu
|
||||
PRIVATE
|
||||
-DQT_USE_QSTRINGBUILDER
|
||||
@ -152,11 +159,71 @@ PRIVATE
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
target_sources(dolphin-emu PRIVATE DolphinQt.manifest)
|
||||
target_sources(dolphin-emu PRIVATE DolphinQt.manifest DolphinQt.rc)
|
||||
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
set(Dolphin_NAME "DolphinD")
|
||||
else()
|
||||
set(Dolphin_NAME "Dolphin")
|
||||
endif()
|
||||
|
||||
set_target_properties(dolphin-emu PROPERTIES
|
||||
WIN32_EXECUTABLE TRUE
|
||||
OUTPUT_NAME ${Dolphin_NAME}
|
||||
)
|
||||
|
||||
target_compile_options(dolphin-emu PRIVATE "-D_SILENCE_CXX17_RESULT_OF_DEPRECATION_WARNING")
|
||||
|
||||
# Copy Sys dir
|
||||
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${CMAKE_SOURCE_DIR}/Data/Sys")
|
||||
file(GLOB_RECURSE resources RELATIVE "${CMAKE_SOURCE_DIR}/Data" "${CMAKE_SOURCE_DIR}/Data/Sys/*")
|
||||
|
||||
foreach(res ${resources})
|
||||
configure_file("${CMAKE_SOURCE_DIR}/Data/${res}" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${res}" COPYONLY)
|
||||
endforeach()
|
||||
|
||||
# Copy qt.conf
|
||||
configure_file(qt.conf.win "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/qt.conf" COPYONLY)
|
||||
|
||||
# Copy plugins
|
||||
set (Qt5_PLUGINS_DIR "${Qt5_DIR}/../../../plugins")
|
||||
file(GLOB_RECURSE plugins RELATIVE "${Qt5_PLUGINS_DIR}" "${Qt5_PLUGINS_DIR}/*.dll")
|
||||
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
list(FILTER plugins INCLUDE REGEX ".*d.dll")
|
||||
else()
|
||||
list(FILTER plugins EXCLUDE REGEX ".*d.dll")
|
||||
endif()
|
||||
|
||||
foreach(plugin ${plugins})
|
||||
configure_file("${Qt5_PLUGINS_DIR}/${plugin}" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/QtPlugins/${plugin}" COPYONLY)
|
||||
endforeach()
|
||||
|
||||
# Copy DLLs
|
||||
set (Qt5_DLL_DIR "${Qt5_DIR}/../../../bin")
|
||||
|
||||
file(GLOB_RECURSE dlls RELATIVE "${Qt5_DLL_DIR}" "${Qt5_DLL_DIR}/*.dll")
|
||||
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
list(FILTER dlls INCLUDE REGEX ".*d.dll")
|
||||
else()
|
||||
list(FILTER dlls EXCLUDE REGEX ".*d.dll")
|
||||
endif()
|
||||
|
||||
foreach(dll ${dlls})
|
||||
configure_file("${Qt5_DLL_DIR}/${dll}" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${dll}" COPYONLY)
|
||||
endforeach()
|
||||
|
||||
endif()
|
||||
|
||||
# Handle localization
|
||||
find_package(Gettext)
|
||||
|
||||
if(WIN32 AND NOT Gettext_FOUND)
|
||||
message(STATUS "Using Gettext from Externals")
|
||||
set(GETTEXT_MSGFMT_EXECUTABLE "${CMAKE_SOURCE_DIR}/Externals/gettext/msgfmt.exe")
|
||||
endif()
|
||||
|
||||
if(GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE)
|
||||
set(pot_file "${CMAKE_SOURCE_DIR}/Languages/po/dolphin-emu.pot")
|
||||
file(GLOB LINGUAS ${CMAKE_SOURCE_DIR}/Languages/po/*.po)
|
||||
@ -179,12 +246,21 @@ if(GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE)
|
||||
install(FILES ${mo} DESTINATION share/locale/${lang}/LC_MESSAGES)
|
||||
endif()
|
||||
|
||||
add_custom_command(OUTPUT ${mo}
|
||||
COMMAND cmake -E make_directory ${mo_dir}
|
||||
COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${po} ${pot_file}
|
||||
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${mo} ${po}
|
||||
DEPENDS ${po}
|
||||
)
|
||||
if(WIN32)
|
||||
add_custom_command(OUTPUT ${mo}
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${mo_dir}
|
||||
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${mo} ${po}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${mo} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Languages/${lang}/dolphin-emu.mo
|
||||
DEPENDS ${po}
|
||||
)
|
||||
else()
|
||||
add_custom_command(OUTPUT ${mo}
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${mo_dir}
|
||||
COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${po} ${pot_file}
|
||||
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${mo} ${po}
|
||||
DEPENDS ${po}
|
||||
)
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
|
2
Source/Core/DolphinQt/qt.conf.win
Normal file
2
Source/Core/DolphinQt/qt.conf.win
Normal file
@ -0,0 +1,2 @@
|
||||
[Paths]
|
||||
Plugins = ./QtPlugins
|
Reference in New Issue
Block a user