From 9572a5105d0bf809e942a107865bd96d7ded237f Mon Sep 17 00:00:00 2001 From: Florent Castelli Date: Wed, 8 Mar 2017 02:20:13 +0100 Subject: [PATCH 1/5] cmake: Add initial CMake support for VS2017 --- CMakeSettings.json | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 CMakeSettings.json diff --git a/CMakeSettings.json b/CMakeSettings.json new file mode 100644 index 0000000000..f0788e1b39 --- /dev/null +++ b/CMakeSettings.json @@ -0,0 +1,20 @@ +{ + "configurations": [ + { + "name": "x64-Debug", + "generator": "Visual Studio 15 2017 Win64", + "configurationType": "Debug", + "buildRoot": "${env.LOCALAPPDATA}\\CMakeBuild\\${workspaceHash}\\build\\${name}", + "cmakeCommandArgs": "", + "buildCommandArgs": "-m -p:PreferredToolArchitecture=x64" + }, + { + "name": "x64-Release", + "generator": "Visual Studio 15 2017 Win64", + "configurationType": "Release", + "buildRoot": "${env.LOCALAPPDATA}\\CMakeBuild\\${workspaceHash}\\build\\${name}", + "cmakeCommandArgs": "", + "buildCommandArgs": "-m -p:PreferredToolArchitecture=x64" + } + ] +} From 33ceb042b70ac035962569e57da894e50aaa3960 Mon Sep 17 00:00:00 2001 From: Florent Castelli Date: Mon, 20 Feb 2017 04:18:49 +0100 Subject: [PATCH 2/5] cmake: Fix check_and_add_flag() with Visual Studio generators --- CMake/CheckAndAddFlag.cmake | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/CMake/CheckAndAddFlag.cmake b/CMake/CheckAndAddFlag.cmake index 9494664e0a..edd0e8cc7e 100644 --- a/CMake/CheckAndAddFlag.cmake +++ b/CMake/CheckAndAddFlag.cmake @@ -27,13 +27,23 @@ function(check_and_add_flag var flag) message(FATAL_ERROR "check_and_add_flag called with incorrect arguments: ${ARGN}") endif() + set(is_c "$") + set(is_cxx "$") + + # The Visual Studio generators don't support COMPILE_LANGUAGE + # So we fail all the C flags and only actually test CXX ones + if(CMAKE_GENERATOR MATCHES "Visual Studio") + set(is_c "0") + set(is_cxx "1") + endif() + check_c_compiler_flag(${flag} FLAG_C_${var}) if(FLAG_C_${var}) - add_compile_options("$<$,${genexp_config_test}>:${flag}>") + add_compile_options("$<$:${flag}>") endif() check_cxx_compiler_flag(${flag} FLAG_CXX_${var}) if(FLAG_CXX_${var}) - add_compile_options("$<$,${genexp_config_test}>:${flag}>") + add_compile_options("$<$:${flag}>") endif() endfunction() From 5514680bc8917a9b4266985069556b16edb6c35e Mon Sep 17 00:00:00 2001 From: Florent Castelli Date: Wed, 8 Mar 2017 06:31:02 +0100 Subject: [PATCH 3/5] cmake: Fix typo in dolphin_compile_definitions --- CMake/DolphinCompileDefinitions.cmake | 2 +- CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMake/DolphinCompileDefinitions.cmake b/CMake/DolphinCompileDefinitions.cmake index 7368f921f0..d150cb535c 100644 --- a/CMake/DolphinCompileDefinitions.cmake +++ b/CMake/DolphinCompileDefinitions.cmake @@ -30,5 +30,5 @@ function(dolphin_compile_definitions) endif() set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS - "$<${genexp_config_test}:${ARGN}>") + "$<${genexp_config_test}:${defs}>") endfunction() diff --git a/CMakeLists.txt b/CMakeLists.txt index a2a6d1d051..eccaa86d60 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -206,7 +206,7 @@ endif() if(CMAKE_C_COMPILER_ID MATCHES "MSVC") check_and_add_flag(EXCEPTIONS /EHsc) - dolphin_compile_definitions(-D_DEBUG DEBUG_ONLY) + dolphin_compile_definitions(_DEBUG DEBUG_ONLY) string(APPEND CMAKE_EXE_LINKER_FLAGS " /NXCOMPAT") string(APPEND CMAKE_EXE_LINKER_FLAGS " /BASE:0x00400000") From cf68ecf06657789dac1eff655279e5e2eeb1ea1f Mon Sep 17 00:00:00 2001 From: Florent Castelli Date: Wed, 8 Mar 2017 06:31:36 +0100 Subject: [PATCH 4/5] core: Add missing include --- Source/Core/Core/IOS/ES/ES.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/Core/Core/IOS/ES/ES.cpp b/Source/Core/Core/IOS/ES/ES.cpp index dbd970583f..de5580a440 100644 --- a/Source/Core/Core/IOS/ES/ES.cpp +++ b/Source/Core/Core/IOS/ES/ES.cpp @@ -5,6 +5,7 @@ #include "Core/IOS/ES/ES.h" #include +#include #include #include #include From b69d3f13cba0d29b66462e82974dc01c75510e8e Mon Sep 17 00:00:00 2001 From: Florent Castelli Date: Wed, 8 Mar 2017 06:38:05 +0100 Subject: [PATCH 5/5] common: Don't include intrin.h in a namespace Fixes compilation with VS2017 --- Source/Core/Common/MathUtil.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Source/Core/Common/MathUtil.h b/Source/Core/Common/MathUtil.h index c5409be663..e91358c5c1 100644 --- a/Source/Core/Common/MathUtil.h +++ b/Source/Core/Common/MathUtil.h @@ -10,6 +10,10 @@ #include "Common/CommonTypes.h" +#ifdef _MSC_VER +#include +#endif + namespace MathUtil { template @@ -24,7 +28,6 @@ constexpr T SNANConstant() // will use __builtin_nans, which is improperly handled by the compiler and generates // a bad constant. Here we go back to the version MSVC used before the builtin. // TODO: Remove this and use numeric_limits directly whenever this bug is fixed. -#include template <> constexpr double SNANConstant()