add um and shared includ

This commit is contained in:
DevWiki 2024-09-26 15:01:18 +08:00
parent 94c19cf117
commit 8fd78ae625

View File

@ -1,3 +1,6 @@
message(STATUS "CMAKE_SIZEOF_VOID_P: ${CMAKE_SIZEOF_VOID_P}")
message(STATUS "CMAKE_LIBRARY_ARCHITECTURE: ${CMAKE_LIBRARY_ARCHITECTURE}")
# CMake # CMake
cmake_minimum_required(VERSION 3.12) cmake_minimum_required(VERSION 3.12)
@ -6,6 +9,8 @@ project(WinDevice VERSION 0.1 LANGUAGES CXX)
# Windows # Windows
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
# Windows
set(CMAKE_GENERATOR_TOOLSET "v142")
# C++ # C++
set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD 11)
@ -30,7 +35,8 @@ endif()
# DirectX # DirectX
set(Windows_Kits_DIR "C:\\Program Files (x86)\\Windows Kits\\10") set(Windows_Kits_DIR "C:\\Program Files (x86)\\Windows Kits\\10")
set(Windows_Kits_Version "10.0.19041.0") 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) if(CMAKE_SIZEOF_VOID_P EQUAL 8)
# 64-bit # 64-bit
@ -63,7 +69,8 @@ target_include_directories(WinDevice
PUBLIC PUBLIC
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src> $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src>
PRIVATE PRIVATE
${DirectX_SDK_INCLUDE_DIR} ${Windows_Kits_UM_DIR}
${Windows_Kits_SHARED_DIR}
${Third_Include_DIR} ${Third_Include_DIR}
) )
# d3d lib # d3d lib
@ -81,7 +88,7 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug")
add_executable(WinDeviceTest "src/main.cpp" ${SOURCE_FILES}) add_executable(WinDeviceTest "src/main.cpp" ${SOURCE_FILES})
target_include_directories(WinDeviceTest target_include_directories(WinDeviceTest
PUBLIC $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src> PUBLIC $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src>
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}) target_link_libraries(WinDeviceTest PRIVATE ${DirectX_LIBS})
else() else()
# Release # Release