From c2903f8b4e2be07b84c7cc68993ea080cf8a896b Mon Sep 17 00:00:00 2001 From: spycrab Date: Wed, 8 May 2019 20:57:34 +0200 Subject: [PATCH 01/18] Externals/libpng: Link against zlib --- Externals/libpng/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Externals/libpng/CMakeLists.txt b/Externals/libpng/CMakeLists.txt index 4396e4a34c..622e65b207 100644 --- a/Externals/libpng/CMakeLists.txt +++ b/Externals/libpng/CMakeLists.txt @@ -23,6 +23,8 @@ PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ) +target_link_libraries(png PUBLIC z) + if(NOT MSVC) target_compile_options(png PRIVATE From 51e025f6dc03fcfe6173b60fd1a0b45bd7d6e759 Mon Sep 17 00:00:00 2001 From: spycrab Date: Wed, 8 May 2019 20:58:16 +0200 Subject: [PATCH 02/18] Externals/minizip: Link against zlib --- Externals/minizip/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Externals/minizip/CMakeLists.txt b/Externals/minizip/CMakeLists.txt index 3b8d84043f..cfd1f88d59 100644 --- a/Externals/minizip/CMakeLists.txt +++ b/Externals/minizip/CMakeLists.txt @@ -13,4 +13,6 @@ endif() add_library(minizip STATIC ${SRCS}) target_include_directories(minizip PUBLIC .) +target_link_libraries(minizip PUBLIC z) + add_library(MiniZip::minizip ALIAS minizip) From d4633ceded324aa325802ac3cb3a800d0a8621e3 Mon Sep 17 00:00:00 2001 From: spycrab Date: Wed, 8 May 2019 20:58:44 +0200 Subject: [PATCH 03/18] Externals/Qt: Update to latest commit --- Externals/Qt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals/Qt b/Externals/Qt index b344ea0961..e5b972af93 160000 --- a/Externals/Qt +++ b/Externals/Qt @@ -1 +1 @@ -Subproject commit b344ea0961dba93a1a38502ac4cc77b981cfc681 +Subproject commit e5b972af9368c8498546151a6961cd0fe87f13b2 From 35f7abfe76dbe758e0f1e4c81c6a7b22fa995299 Mon Sep 17 00:00:00 2001 From: spycrab Date: Wed, 8 May 2019 20:59:15 +0200 Subject: [PATCH 04/18] VideoBackends/D3DCommon: Fix linking against self --- Source/Core/VideoBackends/D3DCommon/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) 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 ) From 5625baa32cda637cc2151183d07fd78b875aeb53 Mon Sep 17 00:00:00 2001 From: spycrab Date: Wed, 8 May 2019 21:00:23 +0200 Subject: [PATCH 05/18] UICommon/VideoUtils.cpp: Add missing include --- Source/Core/UICommon/VideoUtils.cpp | 4 ++++ 1 file changed, 4 insertions(+) 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 +#endif + #if defined(HAVE_XRANDR) && HAVE_XRANDR #include "UICommon/X11Utils.h" #endif From 98d808ab71b5ef41a0ef0d9d9a2f37052c7dcbed Mon Sep 17 00:00:00 2001 From: spycrab Date: Wed, 8 May 2019 21:01:46 +0200 Subject: [PATCH 06/18] InputCommon/DInput.h: Add missing include --- Source/Core/InputCommon/ControllerInterface/DInput/DInput.h | 1 + 1 file changed, 1 insertion(+) 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 #include +#include #include "InputCommon/ControllerInterface/DInput/DInput8.h" From 7eaece8814702fdcbe362efa6a4260e683ce4cf9 Mon Sep 17 00:00:00 2001 From: spycrab Date: Wed, 8 May 2019 21:02:26 +0200 Subject: [PATCH 07/18] InputCommon/Device.cpp: Add missing include --- Source/Core/InputCommon/ControllerInterface/Device.cpp | 1 + 1 file changed, 1 insertion(+) 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 #include #include #include From 12a26453e9fa1c4db6d2b924a5b36ce263b44580 Mon Sep 17 00:00:00 2001 From: spycrab Date: Wed, 8 May 2019 21:03:11 +0200 Subject: [PATCH 08/18] InputCommon/ControlGroup.h: Add missing include --- .../Core/InputCommon/ControllerEmu/ControlGroup/ControlGroup.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/ControlGroup.h b/Source/Core/InputCommon/ControllerEmu/ControlGroup/ControlGroup.h index 146dc16fcb..8b1b4424cf 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/ControlGroup.h +++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/ControlGroup.h @@ -4,6 +4,7 @@ #pragma once +#include #include #include #include From 967252dded140964676c9da78cdaf556f37ea790 Mon Sep 17 00:00:00 2001 From: spycrab Date: Wed, 8 May 2019 21:06:17 +0200 Subject: [PATCH 09/18] IOS/FS/Filesystem: Work around macro problem --- Source/Core/Core/IOS/FS/FileSystem.h | 5 +++++ 1 file changed, 5 insertions(+) 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 #include +#ifdef _WIN32 +// TODO: Horrible hack, remove ASAP! +#include +#endif + #include "Common/CommonTypes.h" #include "Common/Result.h" From f1fae37a813f3d6eb0a35b176966f7512bc0e6d6 Mon Sep 17 00:00:00 2001 From: spycrab Date: Wed, 8 May 2019 21:10:41 +0200 Subject: [PATCH 10/18] DolphinQt/CMake: Don't build SignalDaemon on Windows --- Source/Core/DolphinQt/CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Source/Core/DolphinQt/CMakeLists.txt b/Source/Core/DolphinQt/CMakeLists.txt index 27eda16cb4..587f31b55d 100644 --- a/Source/Core/DolphinQt/CMakeLists.txt +++ b/Source/Core/DolphinQt/CMakeLists.txt @@ -107,7 +107,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 +129,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 From c7dcba1c5ff51024acb4871fdd81c10381e52867 Mon Sep 17 00:00:00 2001 From: spycrab Date: Wed, 8 May 2019 21:17:30 +0200 Subject: [PATCH 11/18] WinUpdater: Add CMakeLists.txt --- Source/Core/CMakeLists.txt | 10 +++++++++- Source/Core/WinUpdater/CMakeLists.txt | 14 ++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 Source/Core/WinUpdater/CMakeLists.txt 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/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") From b5160ec6854d6ee42f3040b1ecb4609c493230e8 Mon Sep 17 00:00:00 2001 From: spycrab Date: Wed, 8 May 2019 21:41:07 +0200 Subject: [PATCH 12/18] Common/CMake: Fix Windows build --- Source/Core/AudioCommon/CMakeLists.txt | 10 +--------- Source/Core/Common/CMakeLists.txt | 9 +++++++++ 2 files changed, 10 insertions(+), 9 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/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() From 6cef70c1827d82945a8be08c815ebf38609823cd Mon Sep 17 00:00:00 2001 From: spycrab Date: Wed, 8 May 2019 21:42:18 +0200 Subject: [PATCH 13/18] VideoBackends/D3D: Fix CMakeLists.txt --- Source/Core/VideoBackends/D3D/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) 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 From 199c0943a499e7f8d7c1c6e18ffabbcef1f3eedc Mon Sep 17 00:00:00 2001 From: spycrab Date: Wed, 8 May 2019 23:55:44 +0200 Subject: [PATCH 14/18] DolphinQt/CMake: Building on Windows --- Source/Core/DolphinQt/CMakeLists.txt | 81 +++++++++++++++++++++++++--- Source/Core/DolphinQt/qt.conf.win | 2 + 2 files changed, 76 insertions(+), 7 deletions(-) create mode 100644 Source/Core/DolphinQt/qt.conf.win diff --git a/Source/Core/DolphinQt/CMakeLists.txt b/Source/Core/DolphinQt/CMakeLists.txt index 587f31b55d..45c5f48905 100644 --- a/Source/Core/DolphinQt/CMakeLists.txt +++ b/Source/Core/DolphinQt/CMakeLists.txt @@ -155,11 +155,69 @@ 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} + ) + + # 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) @@ -182,12 +240,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 From 53ef641da49671f37464e14d8d387cf8effcbc7d Mon Sep 17 00:00:00 2001 From: spycrab Date: Wed, 8 May 2019 23:57:47 +0200 Subject: [PATCH 15/18] CMake: Add MSVC support --- CMakeLists.txt | 15 ++++++++++++++- CMakeSettings.json | 42 ++++++++++++++++++++++++++++++------------ Source/CMakeLists.txt | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5bd5ad7b9d..0ed0f2f091 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -107,6 +107,14 @@ endif() # as defined above. set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Binaries) +if (MSVC) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) + +endif() + # setup CCache include(CCache) @@ -361,6 +369,11 @@ if(ENABLE_VTUNE) ) endif() +if(WIN32) + message(STATUS "Building for Windows, disabling NoGUI frontend.") + set(ENABLE_NOGUI OFF) +endif() + if(ANDROID) message(STATUS "Building for Android") if(NOT ENABLE_HEADLESS) @@ -594,7 +607,7 @@ endif() message(STATUS "Using static FreeSurround from Externals") add_subdirectory(Externals/FreeSurround) -if (APPLE) +if (APPLE OR WIN32) message(STATUS "Using ed25519 from Externals") add_subdirectory(Externals/ed25519) endif() diff --git a/CMakeSettings.json b/CMakeSettings.json index e6f3349a3a..49676259a3 100644 --- a/CMakeSettings.json +++ b/CMakeSettings.json @@ -1,20 +1,38 @@ -{ +{ "configurations": [ { - "name": "x64-Debug", - "generator": "Visual Studio 15 2017 Win64", - "configurationType": "Debug", - "buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}", + "name": "Release", + "configurationType": "Release", + "generator": "Visual Studio 16 2019 Win64", + "inheritEnvironments": [ "msvc_x64_x64" ], + "buildCommandArgs": "-m -p:PreferredToolArchitecture=x64", + "buildRoot": "${workspaceRoot}\\build", "cmakeCommandArgs": "", - "buildCommandArgs": "-m -p:PreferredToolArchitecture=x64" + "variables": [ + { + "name": "Qt5_DIR", + "value": "${workspaceRoot}\\Externals\\Qt\\Qt5.11.1\\5.11.1\\msvc2017_64\\lib\\cmake\\Qt5" + } + ] }, { - "name": "x64-Release", - "generator": "Visual Studio 15 2017 Win64", - "configurationType": "Release", - "buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}", + "name": "Debug", + "generator": "Visual Studio 16 2019 Win64", + "configurationType": "Debug", + "inheritEnvironments": [ "msvc_x64_x64" ], + "buildCommandArgs": "-m -p:PreferredToolArchitecture=x64", + "buildRoot": "${workspaceRoot}\\build", "cmakeCommandArgs": "", - "buildCommandArgs": "-m -p:PreferredToolArchitecture=x64" + "variables": [ + { + "name": "CMAKE_BUILD_TYPE", + "value": "Debug" + }, + { + "name": "Qt5_DIR", + "value": "${workspaceRoot}\\Externals\\Qt\\Qt5.11.1\\5.11.1\\msvc2017_64\\lib\\cmake\\Qt5" + } + ] } ] -} +} \ No newline at end of file diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 7d435e1ca2..2563a618c1 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -13,6 +13,39 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) +if (MSVC) + # Set warning level to 4 + add_compile_options(/W4) + + # Disable some warnings + add_compile_options( + /wd4201 # nonstandard extension used : nameless struct/union + /wd4127 # conditional expression is constant + /wd4100 # 'identifier' : unreferenced formal parameter + /wd4200 # InputCommon fix temp. + /wd4244 # 'conversion' conversion from 'type1' to 'type2', possible loss of data + /wd4121 # 'symbol' : alignment of a member was sensitive to packing + /wd4324 # Padding was added at the end of a structure because you specified a __declspec(align) value. + /wd4714 # function 'function' marked as __forceinline not inlined + /wd4351 # new behavior: elements of array 'array' will be default initialized + # TODO: Enable this warning once possible + /wd4245 # conversion from 'type1' to 'type2', signed/unsigned mismatch + # Currently jits use some annoying code patterns which makes this common + ) + + # Additional warnings + add_compile_options( + /w44263 # Non-virtual member function hides base class virtual function + /w44265 # Class has virtual functions, but destructor is not virtual + ) + + # Treat all warnings as errors + add_compile_options(/WX) + + add_definitions(/D _CRT_NONSTDC_NO_WARNINGS) + add_definitions(/utf-8) +endif() + # These aren't actually needed for C11/C++11 # but some dependencies require them (LLVM, libav). add_definitions(-D__STDC_LIMIT_MACROS) From 1121a04718ee4751a0c8c56fe40905246c273c4e Mon Sep 17 00:00:00 2001 From: spycrab Date: Thu, 9 May 2019 00:18:09 +0200 Subject: [PATCH 16/18] DolphinQt/CMake: Silence some warnings --- Source/Core/DolphinQt/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Source/Core/DolphinQt/CMakeLists.txt b/Source/Core/DolphinQt/CMakeLists.txt index 45c5f48905..2c1b59868e 100644 --- a/Source/Core/DolphinQt/CMakeLists.txt +++ b/Source/Core/DolphinQt/CMakeLists.txt @@ -168,6 +168,8 @@ if(WIN32) 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/*") From c8795f799eacfbc9de96da5b384e6ecaec8f0290 Mon Sep 17 00:00:00 2001 From: spycrab Date: Thu, 9 May 2019 00:18:14 +0200 Subject: [PATCH 17/18] Core/CMake: Silence some warnings --- Source/CMakeLists.txt | 6 ++++-- Source/Core/Core/CMakeLists.txt | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 2563a618c1..8d6f475fe2 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -7,6 +7,7 @@ if(CMAKE_SYSTEM_NAME MATCHES "Windows") add_definitions(-D_SCL_SECURE_NO_WARNINGS) add_definitions(-D_CRT_SECURE_NO_WARNINGS) add_definitions(-D_CRT_SECURE_NO_DEPRECATE) + add_definitions(-D_CRT_NONSTDC_NO_WARNINGS) endif() set(CMAKE_CXX_STANDARD 17) @@ -42,8 +43,9 @@ if (MSVC) # Treat all warnings as errors add_compile_options(/WX) - add_definitions(/D _CRT_NONSTDC_NO_WARNINGS) - add_definitions(/utf-8) + # All files are encoded as UTF-8 + add_compile_options(/utf-8) + endif() # These aren't actually needed for C11/C++11 diff --git a/Source/Core/Core/CMakeLists.txt b/Source/Core/Core/CMakeLists.txt index 4a9a0e7b74..7c2f06ff2b 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 From ba83cec6fb58b339651f9f935ebf1f1f5fe00413 Mon Sep 17 00:00:00 2001 From: spycrab Date: Sun, 12 May 2019 00:41:45 +0200 Subject: [PATCH 18/18] Qt/CMake: Support MSVC w/ external CMake --- Source/Core/DolphinQt/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Source/Core/DolphinQt/CMakeLists.txt b/Source/Core/DolphinQt/CMakeLists.txt index 2c1b59868e..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 "")