diff --git a/3rdparty/3rdparty.props b/3rdparty/3rdparty.props
index 7a5f524943..5dd7d52112 100644
--- a/3rdparty/3rdparty.props
+++ b/3rdparty/3rdparty.props
@@ -9,9 +9,10 @@
$(ProjectDir);%(AdditionalIncludeDirectories)
- __WIN32__;WIN32;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)
+ __WIN32__;WIN32;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions)
true
false
+ false
TurnOffAllWarnings
ProgramDatabase
Default
diff --git a/3rdparty/soundtouch/CMakeLists.txt b/3rdparty/soundtouch/CMakeLists.txt
index 116bfd0354..5edcf65e2e 100644
--- a/3rdparty/soundtouch/CMakeLists.txt
+++ b/3rdparty/soundtouch/CMakeLists.txt
@@ -33,6 +33,8 @@ add_library(pcsx2-soundtouch
target_include_directories(pcsx2-soundtouch PUBLIC soundtouch)
target_compile_definitions(pcsx2-soundtouch PUBLIC SOUNDTOUCH_FLOAT_SAMPLES ST_NO_EXCEPTION_HANDLING)
+set_property(TARGET pcsx2-soundtouch PROPERTY CXX_STANDARD 17)
+set_property(TARGET pcsx2-soundtouch PROPERTY CXX_STANDARD_REQUIRED ON)
if(NOT "${CMAKE_BUILD_TYPE}" MATCHES "Debug")
if(MSVC)
diff --git a/3rdparty/soundtouch/SoundTouch.vcxproj b/3rdparty/soundtouch/SoundTouch.vcxproj
index 5c0f735441..aebab0a98c 100644
--- a/3rdparty/soundtouch/SoundTouch.vcxproj
+++ b/3rdparty/soundtouch/SoundTouch.vcxproj
@@ -31,6 +31,7 @@
+ ST_NO_EXCEPTION_HANDLING;%(PreprocessorDefinitions)
$(ProjectDir)soundtouch;%(AdditionalIncludeDirectories)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a76f32457d..4a46c02d4d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -62,8 +62,6 @@ endif()
# tests
if(ACTUALLY_ENABLE_TESTS)
- set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
- add_subdirectory(3rdparty/gtest EXCLUDE_FROM_ALL)
add_subdirectory(tests/ctest)
endif()
diff --git a/cmake/BuildParameters.cmake b/cmake/BuildParameters.cmake
index 86faa71939..61a9eb1f2d 100644
--- a/cmake/BuildParameters.cmake
+++ b/cmake/BuildParameters.cmake
@@ -144,8 +144,20 @@ if(MSVC AND NOT USE_CLANG_CL)
"/Zo"
"/utf-8"
)
-elseif(NOT MSVC)
+endif()
+
+if(MSVC)
+ # Disable RTTI
+ string(REPLACE "/GR" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
+
+ # Disable Exceptions
+ string(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
+else()
add_compile_options(-pipe -fvisibility=hidden -pthread -fno-builtin-strcmp -fno-builtin-memcmp -mfpmath=sse)
+ add_compile_options(
+ "$<$:-fno-rtti>"
+ "$<$:-fno-exceptions>"
+ )
endif()
set(CONFIG_REL_NO_DEB $,$>)
@@ -156,8 +168,9 @@ if(WIN32)
$<$:_ITERATOR_DEBUG_LEVEL=2>
$<$:_ITERATOR_DEBUG_LEVEL=1>
$<${CONFIG_ANY_REL}:_ITERATOR_DEBUG_LEVEL=0>
+ _HAS_EXCEPTIONS=0
)
- list(APPEND PCSX2_DEFS TIXML_USE_STL _SCL_SECURE_NO_WARNINGS _UNICODE UNICODE)
+ list(APPEND PCSX2_DEFS _SCL_SECURE_NO_WARNINGS _UNICODE UNICODE)
endif()
# Enable debug information in release builds for Linux.
diff --git a/common/Linux/LnxHostSys.cpp b/common/Linux/LnxHostSys.cpp
index 975b15bacf..631215ff4d 100644
--- a/common/Linux/LnxHostSys.cpp
+++ b/common/Linux/LnxHostSys.cpp
@@ -28,7 +28,6 @@
#include "common/Align.h"
#include "common/Assertions.h"
#include "common/Console.h"
-#include "common/Exceptions.h"
#include "common/General.h"
// Apple uses the MAP_ANON define instead of MAP_ANONYMOUS, but they mean
diff --git a/common/vsprops/common.props b/common/vsprops/common.props
index d6f28a7d75..b55b893087 100644
--- a/common/vsprops/common.props
+++ b/common/vsprops/common.props
@@ -19,19 +19,19 @@
true
$(SolutionDir);$(ProjectDir);%(AdditionalIncludeDirectories)
- __WIN32__;WIN32;_WINDOWS;WIN32_LEAN_AND_MEAN;NOMINMAX;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;WINVER=0x0A00;_WIN32_WINNT=0x0A00;%(PreprocessorDefinitions)
+ __WIN32__;WIN32;_WINDOWS;WIN32_LEAN_AND_MEAN;NOMINMAX;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_HAS_EXCEPTIONS=0;WINVER=0x0A00;_WIN32_WINNT=0x0A00;%(PreprocessorDefinitions)
PCSX2_DEBUG;PCSX2_DEVBUILD;_SECURE_SCL_=1;%(PreprocessorDefinitions)
PCSX2_DEVEL;PCSX2_DEVBUILD;NDEBUG;_SECURE_SCL_=1;%(PreprocessorDefinitions)
NDEBUG;_SECURE_SCL_=0;%(PreprocessorDefinitions)
true
false
+ false
Level3
ProgramDatabase
Default
4063;4100;%(DisableSpecificWarnings)
stdcpp17
true
- Async
false
true
$(IntDir)%(RelativeDir)
diff --git a/pcsx2-qt/CMakeLists.txt b/pcsx2-qt/CMakeLists.txt
index 801e49d1e3..e7a4a11b5c 100644
--- a/pcsx2-qt/CMakeLists.txt
+++ b/pcsx2-qt/CMakeLists.txt
@@ -197,6 +197,9 @@ target_link_libraries(pcsx2-qt PRIVATE
Qt6::Network
)
+# Our Qt builds may have exceptions on, so force them off.
+target_compile_definitions(pcsx2-qt PRIVATE QT_NO_EXCEPTIONS)
+
if(WIN32)
set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION "${CMAKE_SOURCE_DIR}/bin/translations")
qt_add_lrelease(pcsx2-qt TS_FILES ${TS_FILES})
diff --git a/pcsx2-qt/pcsx2-qt.vcxproj b/pcsx2-qt/pcsx2-qt.vcxproj
index 2d1052734d..24233b0a6b 100644
--- a/pcsx2-qt/pcsx2-qt.vcxproj
+++ b/pcsx2-qt/pcsx2-qt.vcxproj
@@ -49,6 +49,7 @@
Use
PrecompiledHeader.h
LZMA_API_STATIC;BUILD_DX=1;ENABLE_RAINTEGRATION;ENABLE_ACHIEVEMENTS;ENABLE_DISCORD_PRESENCE;ENABLE_OPENGL;ENABLE_VULKAN;SDL_BUILD;%(PreprocessorDefinitions)
+ QT_NO_EXCEPTIONS;%(PreprocessorDefinitions)
true
diff --git a/pcsx2/CMakeLists.txt b/pcsx2/CMakeLists.txt
index 6de650ed67..97de6a15c9 100644
--- a/pcsx2/CMakeLists.txt
+++ b/pcsx2/CMakeLists.txt
@@ -1233,6 +1233,9 @@ target_include_directories(PCSX2_FLAGS INTERFACE
"${CMAKE_SOURCE_DIR}/3rdparty/xbyak"
"${FFMPEG_INCLUDE_DIRS}"
)
+target_compile_definitions(PCSX2_FLAGS INTERFACE
+ XBYAK_NO_EXCEPTION
+)
if(COMMAND target_precompile_headers)
message("Using precompiled headers.")
diff --git a/pcsx2/pcsx2.vcxproj b/pcsx2/pcsx2.vcxproj
index 1386ca36de..455cfd6925 100644
--- a/pcsx2/pcsx2.vcxproj
+++ b/pcsx2/pcsx2.vcxproj
@@ -65,8 +65,8 @@
Use
PrecompiledHeader.h
PrecompiledHeader.h;%(ForcedIncludeFiles)
- ZIP_STATIC;LZMA_API_STATIC;ENABLE_DISCORD_PRESENCE;ENABLE_RAINTEGRATION;ENABLE_ACHIEVEMENTS;ENABLE_OPENGL;ENABLE_VULKAN;SPU2X_CUBEB;SDL_BUILD;%(PreprocessorDefinitions)
- ZYCORE_STATIC_DEFINE;ZYDIS_STATIC_DEFINE;%(PreprocessorDefinitions)
+ ZIP_STATIC;LZMA_API_STATIC;ST_NO_EXCEPTION_HANDLING;ENABLE_DISCORD_PRESENCE;ENABLE_RAINTEGRATION;ENABLE_ACHIEVEMENTS;ENABLE_OPENGL;ENABLE_VULKAN;SPU2X_CUBEB;SDL_BUILD;%(PreprocessorDefinitions)
+ XBYAK_NO_EXCEPTION;ZYCORE_STATIC_DEFINE;ZYDIS_STATIC_DEFINE;%(PreprocessorDefinitions)
diff --git a/tests/ctest/CMakeLists.txt b/tests/ctest/CMakeLists.txt
index f19e0d3251..f77b7eb489 100644
--- a/tests/ctest/CMakeLists.txt
+++ b/tests/ctest/CMakeLists.txt
@@ -17,5 +17,6 @@ macro(add_pcsx2_test target)
add_test(NAME ${target} COMMAND ${target})
endmacro()
+add_subdirectory(gtest)
add_subdirectory(common)
add_subdirectory(core)
diff --git a/tests/ctest/gtest/CMakeLists.txt b/tests/ctest/gtest/CMakeLists.txt
new file mode 100644
index 0000000000..2342c37ff3
--- /dev/null
+++ b/tests/ctest/gtest/CMakeLists.txt
@@ -0,0 +1,33 @@
+# We need to use a custom CMakeLists for GoogleTest, because we can't compile with exceptions on.
+set(GTEST_DIR "${CMAKE_SOURCE_DIR}/3rdparty/gtest/googletest")
+
+set(SRCS
+ "${GTEST_DIR}/src/gtest.cc"
+ "${GTEST_DIR}/src/gtest-assertion-result.cc"
+ "${GTEST_DIR}/src/gtest-death-test.cc"
+ "${GTEST_DIR}/src/gtest-filepath.cc"
+ "${GTEST_DIR}/src/gtest-matchers.cc"
+ "${GTEST_DIR}/src/gtest-port.cc"
+ "${GTEST_DIR}/src/gtest-printers.cc"
+ "${GTEST_DIR}/src/gtest-test-part.cc"
+ "${GTEST_DIR}/src/gtest-typed-test.cc"
+)
+
+set(MAIN_SRCS
+ "${GTEST_DIR}/src/gtest_main.cc"
+)
+
+add_library(gtest ${SRCS})
+target_include_directories(gtest PRIVATE "${GTEST_DIR}" "${GTEST_DIR}/include")
+target_include_directories(gtest INTERFACE "${GTEST_DIR}/include")
+target_link_libraries(gtest Threads::Threads)
+set_property(TARGET gtest PROPERTY CXX_STANDARD 17)
+set_property(TARGET gtest PROPERTY CXX_STANDARD_REQUIRED ON)
+
+add_library(gtest_main "${MAIN_SRCS}")
+target_include_directories(gtest_main PRIVATE "${GTEST_DIR}" "${GTEST_DIR}/include")
+target_include_directories(gtest_main INTERFACE "${GTEST_DIR}/include")
+target_link_libraries(gtest_main Threads::Threads)
+set_property(TARGET gtest_main PROPERTY CXX_STANDARD 17)
+set_property(TARGET gtest_main PROPERTY CXX_STANDARD_REQUIRED ON)
+