diff options
| author | spycrab <spycrab@users.noreply.github.com> | 2019-05-14 21:07:26 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-05-14 21:07:26 +0200 |
| commit | ec734065db7d32b81805db72d65e8fbb56722a06 (patch) | |
| tree | f027f758f3f580170243335505d507b8372c20f2 /Source/Core | |
| parent | d5535a8ed9b42802e5402fc46c400b295ab12943 (diff) | |
| parent | ba83cec6fb58b339651f9f935ebf1f1f5fe00413 (diff) | |
Merge pull request #8087 from spycrab/cmake_win2019
Support CMake on Windows
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/AudioCommon/CMakeLists.txt | 10 | ||||
| -rw-r--r-- | Source/Core/CMakeLists.txt | 10 | ||||
| -rw-r--r-- | Source/Core/Common/CMakeLists.txt | 9 | ||||
| -rw-r--r-- | Source/Core/Core/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | Source/Core/Core/IOS/FS/FileSystem.h | 5 | ||||
| -rw-r--r-- | Source/Core/DolphinQt/CMakeLists.txt | 92 | ||||
| -rw-r--r-- | Source/Core/DolphinQt/qt.conf.win | 2 | ||||
| -rw-r--r-- | Source/Core/InputCommon/ControllerEmu/ControlGroup/ControlGroup.h | 1 | ||||
| -rw-r--r-- | Source/Core/InputCommon/ControllerInterface/DInput/DInput.h | 1 | ||||
| -rw-r--r-- | Source/Core/InputCommon/ControllerInterface/Device.cpp | 1 | ||||
| -rw-r--r-- | Source/Core/UICommon/VideoUtils.cpp | 4 | ||||
| -rw-r--r-- | Source/Core/VideoBackends/D3D/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | Source/Core/VideoBackends/D3DCommon/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | Source/Core/WinUpdater/CMakeLists.txt | 14 |
14 files changed, 133 insertions, 19 deletions
diff --git a/Source/Core/AudioCommon/CMakeLists.txt b/Source/Core/AudioCommon/CMakeLists.txt index 577bdb41fb..8d58daab72 100644 --- a/Source/Core/AudioCommon/CMakeLists.txt +++ b/Source/Core/AudioCommon/CMakeLists.txt @@ -57,16 +57,8 @@ if(WIN32) ) target_link_libraries(audiocommon PRIVATE audiocommon_xaudio27) - set(ENV{OPENALDIR} ${PROJECT_SOURCE_DIR}/Externals/OpenAL) # Dolphin loads openal32.dll at runtime - find_package(OpenAL) - if(OPENAL_FOUND) - message(STATUS "OpenAL found, enabling OpenAL sound backend") - target_sources(audiocommon PRIVATE OpenALStream.cpp) - target_link_libraries(audiocommon PRIVATE OpenAL::OpenAL) - else() - message(STATUS "OpenAL NOT found in Externals") - endif() + target_sources(audiocommon PRIVATE OpenALStream.cpp) endif() target_link_libraries(audiocommon PRIVATE cubeb SoundTouch FreeSurround) diff --git a/Source/Core/CMakeLists.txt b/Source/Core/CMakeLists.txt index b1a19522bf..d176fcbf25 100644 --- a/Source/Core/CMakeLists.txt +++ b/Source/Core/CMakeLists.txt @@ -15,7 +15,15 @@ if(ENABLE_QT) add_subdirectory(DolphinQt) endif() -if (APPLE) +if (APPLE OR WIN32) add_subdirectory(UpdaterCommon) +endif() + +if (APPLE) add_subdirectory(MacUpdater) endif() + + +if (WIN32) + add_subdirectory(WinUpdater) +endif() diff --git a/Source/Core/Common/CMakeLists.txt b/Source/Core/Common/CMakeLists.txt index 21f25d750e..1f544f4625 100644 --- a/Source/Core/Common/CMakeLists.txt +++ b/Source/Core/Common/CMakeLists.txt @@ -69,6 +69,14 @@ if (APPLE) ${COREFOUNDATION_LIBRARY} ${IOK_LIBRARY} ) +elseif(WIN32) + target_link_libraries(common + PRIVATE + kernel32.lib + shlwapi.lib + opengl32.lib + winmm.lib + ) endif() if(ANDROID) @@ -78,6 +86,7 @@ if(ANDROID) ) elseif(WIN32) target_sources(common PRIVATE + LdrWatcher.cpp Logging/ConsoleListenerWin.cpp ) else() diff --git a/Source/Core/Core/CMakeLists.txt b/Source/Core/Core/CMakeLists.txt index 60c23769ef..f72a43861d 100644 --- a/Source/Core/Core/CMakeLists.txt +++ b/Source/Core/Core/CMakeLists.txt @@ -343,6 +343,7 @@ if(WIN32) setupapi.lib iphlpapi.lib ) + target_compile_definitions(core PRIVATE "-D_WINSOCK_DEPRECATED_NO_WARNINGS") elseif(APPLE) target_sources(core PRIVATE HW/EXI/BBA-TAP/TAP_Apple.cpp diff --git a/Source/Core/Core/IOS/FS/FileSystem.h b/Source/Core/Core/IOS/FS/FileSystem.h index 2379ebe80b..6266ba6979 100644 --- a/Source/Core/Core/IOS/FS/FileSystem.h +++ b/Source/Core/Core/IOS/FS/FileSystem.h @@ -9,6 +9,11 @@ #include <string> #include <vector> +#ifdef _WIN32 +// TODO: Horrible hack, remove ASAP! +#include <Windows.h> +#endif + #include "Common/CommonTypes.h" #include "Common/Result.h" diff --git a/Source/Core/DolphinQt/CMakeLists.txt b/Source/Core/DolphinQt/CMakeLists.txt index 27eda16cb4..a5042bfb76 100644 --- a/Source/Core/DolphinQt/CMakeLists.txt +++ b/Source/Core/DolphinQt/CMakeLists.txt @@ -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() diff --git a/Source/Core/DolphinQt/qt.conf.win b/Source/Core/DolphinQt/qt.conf.win new file mode 100644 index 0000000000..4931bd1000 --- /dev/null +++ b/Source/Core/DolphinQt/qt.conf.win @@ -0,0 +1,2 @@ +[Paths] +Plugins = ./QtPlugins diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/ControlGroup.h b/Source/Core/InputCommon/ControllerEmu/ControlGroup/ControlGroup.h index 9383ec07f0..fff118d280 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/ControlGroup.h +++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/ControlGroup.h @@ -4,6 +4,7 @@ #pragma once +#include <algorithm> #include <cmath> #include <memory> #include <string> diff --git a/Source/Core/InputCommon/ControllerInterface/DInput/DInput.h b/Source/Core/InputCommon/ControllerInterface/DInput/DInput.h index 1772b32817..419a942cb4 100644 --- a/Source/Core/InputCommon/ControllerInterface/DInput/DInput.h +++ b/Source/Core/InputCommon/ControllerInterface/DInput/DInput.h @@ -8,6 +8,7 @@ #include <windows.h> #include <list> +#include <string> #include "InputCommon/ControllerInterface/DInput/DInput8.h" diff --git a/Source/Core/InputCommon/ControllerInterface/Device.cpp b/Source/Core/InputCommon/ControllerInterface/Device.cpp index 7624b359d1..38b11a932b 100644 --- a/Source/Core/InputCommon/ControllerInterface/Device.cpp +++ b/Source/Core/InputCommon/ControllerInterface/Device.cpp @@ -4,6 +4,7 @@ #include "InputCommon/ControllerInterface/Device.h" +#include <algorithm> #include <cmath> #include <memory> #include <sstream> diff --git a/Source/Core/UICommon/VideoUtils.cpp b/Source/Core/UICommon/VideoUtils.cpp index 3a9dcbd428..73c88a743a 100644 --- a/Source/Core/UICommon/VideoUtils.cpp +++ b/Source/Core/UICommon/VideoUtils.cpp @@ -7,6 +7,10 @@ #include "Common/Assert.h" #include "VideoCommon/VideoConfig.h" +#ifdef _WIN32 +#include <Windows.h> +#endif + #if defined(HAVE_XRANDR) && HAVE_XRANDR #include "UICommon/X11Utils.h" #endif diff --git a/Source/Core/VideoBackends/D3D/CMakeLists.txt b/Source/Core/VideoBackends/D3D/CMakeLists.txt index b80d9df818..0b4a859ec4 100644 --- a/Source/Core/VideoBackends/D3D/CMakeLists.txt +++ b/Source/Core/VideoBackends/D3D/CMakeLists.txt @@ -17,6 +17,7 @@ add_library(videod3d PerfQuery.h Render.cpp Render.h + SwapChain.cpp VertexManager.cpp VertexManager.h VideoBackend.h diff --git a/Source/Core/VideoBackends/D3DCommon/CMakeLists.txt b/Source/Core/VideoBackends/D3DCommon/CMakeLists.txt index ba24ba133f..fa624d54b7 100644 --- a/Source/Core/VideoBackends/D3DCommon/CMakeLists.txt +++ b/Source/Core/VideoBackends/D3DCommon/CMakeLists.txt @@ -11,5 +11,4 @@ target_link_libraries(videod3dcommon PUBLIC common videocommon - videod3dcommon ) diff --git a/Source/Core/WinUpdater/CMakeLists.txt b/Source/Core/WinUpdater/CMakeLists.txt new file mode 100644 index 0000000000..d31ef9bacb --- /dev/null +++ b/Source/Core/WinUpdater/CMakeLists.txt @@ -0,0 +1,14 @@ +set (MANIFEST_FILE Updater.exe.manifest) + +add_executable(winupdater WIN32 + Main.cpp + WinUI.cpp + ${MANIFEST_FILE}) + +target_link_libraries(winupdater PRIVATE + uicommon + updatercommon + Comctl32 +) + +set_target_properties(winupdater PROPERTIES OUTPUT_NAME "Updater") |
