From fa336edcb6a1f424c1b1fd9d8e4113471bee1eca Mon Sep 17 00:00:00 2001 From: haorui wang <1905811497@qq.com> Date: Sat, 24 Jun 2023 21:36:46 +0800 Subject: [PATCH] [what] update cmake compilation configuration in windows [why] support some other IDE like VScode or clion [how] 1. update CMakeLists.txt according to *.vcxproj 2. include some header like `windows.h` to support raw cmake compilation 3. exclude libcmt.lib --- CMakeLists.txt | 11 +++++++++-- Windows/Debugger/Debugger_Disasm.cpp | 1 + Windows/Debugger/Debugger_Lists.cpp | 1 + Windows/Debugger/Debugger_MemoryDlg.cpp | 1 + Windows/Debugger/Debugger_VFPUDlg.cpp | 1 + Windows/GEDebugger/GEDebugger.cpp | 1 + Windows/GEDebugger/TabDisplayLists.cpp | 1 + Windows/GEDebugger/TabState.cpp | 1 + Windows/GEDebugger/TabVertices.cpp | 1 + Windows/MainWindow.cpp | 1 + Windows/W32Util/DarkMode.h | 3 ++- Windows/W32Util/IatHook.h | 4 ++++ Windows/W32Util/Misc.cpp | 1 + Windows/W32Util/TabControl.cpp | 1 + 14 files changed, 26 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 70d46202cd..fd40d84a34 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -419,6 +419,7 @@ else() endif() set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -D_NDEBUG") + set(CMAKE_EXE_LINKER_FLAGS /NODEFAULTLIB:"libcmt.lib") endif() if(WIN32) @@ -2360,7 +2361,6 @@ set(WindowsFiles Windows/Debugger/Debugger_MemoryDlg.h Windows/Debugger/Debugger_Lists.cpp Windows/Debugger/Debugger_Lists.h - Windows/Debugger/Debugger_SymbolMap.h Windows/Debugger/Debugger_VFPUDlg.cpp Windows/Debugger/Debugger_VFPUDlg.h Windows/Debugger/WatchItemWindow.cpp @@ -2408,6 +2408,13 @@ set(WindowsFiles Windows/W32Util/ShellUtil.h Windows/W32Util/TabControl.cpp Windows/W32Util/TabControl.h + Windows/W32Util/IatHook.h + Windows/W32Util/ContextMenu.h + Windows/W32Util/ContextMenu.cpp + Windows/W32Util/DarkMode.h + Windows/W32Util/DarkMode.cpp + Windows/W32Util/UAHMenuBar.h + Windows/W32Util/UAHMenuBar.cpp Windows/WindowsHost.cpp Windows/WindowsHost.h Windows/MainWindow.cpp @@ -2431,7 +2438,7 @@ set(WindowsFiles list(APPEND LinkCommon ${CoreLibName} ${CMAKE_THREAD_LIBS_INIT}) if(WIN32) - list(APPEND LinkCommon kernel32 user32 gdi32 shell32 comctl32 dsound xinput d3d9 winmm dinput8 ole32 winspool ksuser mf mfplat mfreadwrite mfuuid shlwapi) + list(APPEND LinkCommon kernel32 user32 gdi32 shell32 comctl32 dsound xinput d3d9 winmm dinput8 ole32 winspool ksuser mf uxtheme mfplat mfreadwrite mfuuid shlwapi) #setup_target_project(${TargetBin} Windows) list(APPEND NativeAppSource ${WindowsFiles}) endif() diff --git a/Windows/Debugger/Debugger_Disasm.cpp b/Windows/Debugger/Debugger_Disasm.cpp index 05b36f12aa..a216bb636e 100644 --- a/Windows/Debugger/Debugger_Disasm.cpp +++ b/Windows/Debugger/Debugger_Disasm.cpp @@ -29,6 +29,7 @@ #include "Common/CommonWindows.h" #include "Common/StringUtils.h" +#include #include #include diff --git a/Windows/Debugger/Debugger_Lists.cpp b/Windows/Debugger/Debugger_Lists.cpp index 8e65ea2770..4cc774a2f5 100644 --- a/Windows/Debugger/Debugger_Lists.cpp +++ b/Windows/Debugger/Debugger_Lists.cpp @@ -1,6 +1,7 @@ #include "Windows/Debugger/Debugger_Lists.h" #include "Common/CommonWindows.h" #include +#include #include #include "Windows/Debugger/BreakpointWindow.h" #include "Windows/Debugger/CtrlDisAsmView.h" diff --git a/Windows/Debugger/Debugger_MemoryDlg.cpp b/Windows/Debugger/Debugger_MemoryDlg.cpp index b247459bbf..590f749f8f 100644 --- a/Windows/Debugger/Debugger_MemoryDlg.cpp +++ b/Windows/Debugger/Debugger_MemoryDlg.cpp @@ -1,5 +1,6 @@ #include "Windows/stdafx.h" #include +#include #include #include "..\resource.h" diff --git a/Windows/Debugger/Debugger_VFPUDlg.cpp b/Windows/Debugger/Debugger_VFPUDlg.cpp index a82f0793e7..224477d3ac 100644 --- a/Windows/Debugger/Debugger_VFPUDlg.cpp +++ b/Windows/Debugger/Debugger_VFPUDlg.cpp @@ -1,5 +1,6 @@ #include "Common/CommonWindows.h" #include +#include #include #include "Windows/resource.h" #include "Common/Data/Encoding/Utf8.h" diff --git a/Windows/GEDebugger/GEDebugger.cpp b/Windows/GEDebugger/GEDebugger.cpp index c96643cc38..f704b3e6a4 100644 --- a/Windows/GEDebugger/GEDebugger.cpp +++ b/Windows/GEDebugger/GEDebugger.cpp @@ -22,6 +22,7 @@ #include #include "Common/CommonWindows.h" +#include #include #include "Common/Data/Convert/ColorConv.h" diff --git a/Windows/GEDebugger/TabDisplayLists.cpp b/Windows/GEDebugger/TabDisplayLists.cpp index 2b29a91d36..7c6de9f0e0 100644 --- a/Windows/GEDebugger/TabDisplayLists.cpp +++ b/Windows/GEDebugger/TabDisplayLists.cpp @@ -8,6 +8,7 @@ #include "GPU/GPUState.h" #include "Core/Config.h" #include +#include #include enum { WM_GEDBG_LISTS_CHANGELIST = WM_USER+400, WM_GEDBG_LISTS_GOTOSTACKPC }; diff --git a/Windows/GEDebugger/TabState.cpp b/Windows/GEDebugger/TabState.cpp index 0a50b4fd19..69fb02ea8e 100644 --- a/Windows/GEDebugger/TabState.cpp +++ b/Windows/GEDebugger/TabState.cpp @@ -15,6 +15,7 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. +#include #include #include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" diff --git a/Windows/GEDebugger/TabVertices.cpp b/Windows/GEDebugger/TabVertices.cpp index 35ab37e498..19d900e9e2 100644 --- a/Windows/GEDebugger/TabVertices.cpp +++ b/Windows/GEDebugger/TabVertices.cpp @@ -15,6 +15,7 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. +#include #include #include "Common/CommonTypes.h" #include "Common/Data/Encoding/Utf8.h" diff --git a/Windows/MainWindow.cpp b/Windows/MainWindow.cpp index fbba1e23cf..47752342e0 100644 --- a/Windows/MainWindow.cpp +++ b/Windows/MainWindow.cpp @@ -27,6 +27,7 @@ #include #include +#include #include #include diff --git a/Windows/W32Util/DarkMode.h b/Windows/W32Util/DarkMode.h index 50ac9498db..81d5037a1a 100644 --- a/Windows/W32Util/DarkMode.h +++ b/Windows/W32Util/DarkMode.h @@ -3,7 +3,8 @@ #define WIN32_LEAN_AND_MEAN #define NOMINMAX #include -#include +#include +#include #include #include #include diff --git a/Windows/W32Util/IatHook.h b/Windows/W32Util/IatHook.h index 1f259a5f20..edfedbe68c 100644 --- a/Windows/W32Util/IatHook.h +++ b/Windows/W32Util/IatHook.h @@ -5,6 +5,10 @@ #pragma once +#include +#include +#include + template constexpr T RVA2VA(T1 base, T2 rva) { diff --git a/Windows/W32Util/Misc.cpp b/Windows/W32Util/Misc.cpp index 97f4e475e5..7a731ecd8e 100644 --- a/Windows/W32Util/Misc.cpp +++ b/Windows/W32Util/Misc.cpp @@ -3,6 +3,7 @@ #include #include +#include #include #include "Misc.h" diff --git a/Windows/W32Util/TabControl.cpp b/Windows/W32Util/TabControl.cpp index d4556725b6..bca564267f 100644 --- a/Windows/W32Util/TabControl.cpp +++ b/Windows/W32Util/TabControl.cpp @@ -2,6 +2,7 @@ #include "DialogManager.h" #include "Windows/MainWindow.h" #include +#include #include const DWORD tabControlStyleMask = ~(WS_POPUP | WS_TILEDWINDOW);