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() 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") 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" + } + ] +} 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() 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