From 8fd78ae6256a7d2d9822a818c8d14ff801e4b16a Mon Sep 17 00:00:00 2001 From: DevWiki Date: Thu, 26 Sep 2024 15:01:18 +0800 Subject: [PATCH] add um and shared includ --- WinDevice/CMakeLists.txt | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/WinDevice/CMakeLists.txt b/WinDevice/CMakeLists.txt index 12ee2ed..6840619 100644 --- a/WinDevice/CMakeLists.txt +++ b/WinDevice/CMakeLists.txt @@ -1,3 +1,6 @@ +message(STATUS "CMAKE_SIZEOF_VOID_P: ${CMAKE_SIZEOF_VOID_P}") +message(STATUS "CMAKE_LIBRARY_ARCHITECTURE: ${CMAKE_LIBRARY_ARCHITECTURE}") + # 设置CMake的最低版本要求 cmake_minimum_required(VERSION 3.12) @@ -6,6 +9,8 @@ project(WinDevice VERSION 0.1 LANGUAGES CXX) # 允许 Windows 导出所有符号 set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) +# 设置Windows相关配置 +set(CMAKE_GENERATOR_TOOLSET "v142") # 设置C++标准 set(CMAKE_CXX_STANDARD 11) @@ -30,7 +35,8 @@ endif() # DirectX目录 set(Windows_Kits_DIR "C:\\Program Files (x86)\\Windows Kits\\10") set(Windows_Kits_Version "10.0.19041.0") -set(DirectX_SDK_INCLUDE_DIR "${Windows_Kits_DIR}\\Include\\${Windows_Kits_Version}\\um") +set(Windows_Kits_UM_DIR "${Windows_Kits_DIR}\\Include\\${Windows_Kits_Version}\\um") +set(Windows_Kits_SHARED_DIR "${Windows_Kits_DIR}\\Include\\${Windows_Kits_Version}\\shared") if(CMAKE_SIZEOF_VOID_P EQUAL 8) # 64-bit 架构 @@ -63,7 +69,8 @@ target_include_directories(WinDevice PUBLIC $ PRIVATE - ${DirectX_SDK_INCLUDE_DIR} + ${Windows_Kits_UM_DIR} + ${Windows_Kits_SHARED_DIR} ${Third_Include_DIR} ) # 链接 d3d 的 lib @@ -81,7 +88,7 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug") add_executable(WinDeviceTest "src/main.cpp" ${SOURCE_FILES}) target_include_directories(WinDeviceTest PUBLIC $ - PRIVATE ${Third_Include_DIR} ${DirectX_SDK_INCLUDE_DIR}) + PRIVATE ${Third_Include_DIR} ${Windows_Kits_UM_DIR} ${Windows_Kits_SHARED_DIR}) target_link_libraries(WinDeviceTest PRIVATE ${DirectX_LIBS}) else() # Release 模式下的配置