Skip to content

Commit

Permalink
Update FindWDK.cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
gmh5225 committed Oct 30, 2023
1 parent 3d2241c commit 7ca8229
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions cmake/FindWDK.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -116,17 +116,24 @@ set(WDK_COMPILE_FLAGS
set(WDK_COMPILE_DEFINITIONS "WINNT=1")
set(WDK_COMPILE_DEFINITIONS_DEBUG "MSC_NOOPT;DEPRECATE_DDK_FUNCTIONS=1;DBG=1")

if(CMAKE_WIN64_DRIVER)
if("${CMAKE_GENERATOR_PLATFORM}" STREQUAL "AMD64")
list(APPEND WDK_COMPILE_DEFINITIONS "_WIN64;_AMD64_;AMD64")
set(WDK_PLATFORM "x64")
elseif(CMAKE_ARM64_DRIVER)
elseif("${CMAKE_GENERATOR_PLATFORM}" STREQUAL "ARM64")
list(APPEND WDK_COMPILE_DEFINITIONS "_ARM64_;ARM64;STD_CALL")
set(WDK_PLATFORM "ARM64")
elseif("${CMAKE_GENERATOR_PLATFORM}" STREQUAL "" AND "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "ARM64")
list(APPEND WDK_COMPILE_DEFINITIONS "_ARM64_;ARM64;STD_CALL")
set(WDK_PLATFORM "ARM64")
elseif("${CMAKE_GENERATOR_PLATFORM}" STREQUAL "" AND "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "AMD64")
list(APPEND WDK_COMPILE_DEFINITIONS "_WIN64;_AMD64_;AMD64")
set(WDK_PLATFORM "x64")
else()
message(FATAL_ERROR "Unsupported architecture")
endif()

message(STATUS "WDK_PLATFORM: " ${WDK_PLATFORM})
message(STATUS "ARCH: ${CMAKE_GENERATOR_PLATFORM}")

string(CONCAT WDK_LINK_FLAGS
"/MANIFEST:NO " #
Expand Down Expand Up @@ -186,12 +193,11 @@ function(wdk_add_driver _target)
WDK::WDMSEC
WDK::WDM
WDK::LIBCNTPR
WDK::BUFFEROVERFLOWFASTFAILK
)

if(CMAKE_WIN64_DRIVER)
if("${WDK_PLATFORM}" STREQUAL "x64")
target_link_libraries(${_target} PRIVATE WDK::BUFFEROVERFLOWK)
elseif(CMAKE_ARM64_DRIVER)
target_link_libraries(${_target} PRIVATE WDK::BUFFEROVERFLOWFASTFAILK)
endif()

if(WDK_KMDF)
Expand Down

0 comments on commit 7ca8229

Please sign in to comment.