Closed Ty3r0X closed 2 months ago
@Ty3r0X I guess it's not compatible with ninja. Try building without it. For example, the samples are built with the following command line:
cmake -Bbuild samples
cmake --build build --parallel --config Release
Also you can install Visual Studio 2022 Community. It's free for driver development or opensource projects.
You're right, ninja was the culprit! I managed to advance in the setup process, however now I'm getting Unsupported architecture
on FindWDK.cmake
. Full build log:
Z:\build>cmake ..
-- Selecting Windows SDK version 10.0.26100.0 to target Windows 10.0.19044.
-- The C compiler identification is MSVC 19.41.34120.0
-- The CXX compiler identification is MSVC 19.41.34120.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.41.34120/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.41.34120/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
[Debug] CMAKE_CURRENT_LIST_DIR: Z:/, CMAKE_MODULE_PATH: Z:/cmake, CMAKE_SIZEOF_VOID_P:
-- WDK_ROOT: C:/Program Files (x86)/Windows Kits/10
-- WDK_VERSION: 10.0.26100.0
CMake Error at make/FindWDK.cmake:112 (message):
Unsupported architecture
Call Stack (most recent call first):
CMakeLists.txt:13 (find_package)
-- Configuring incomplete, errors occurred!
This is where I think the problem occours:
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
list(APPEND WDK_COMPILE_DEFINITIONS "_X86_=1;i386=1;STD_CALL")
set(WDK_PLATFORM "x86")
elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
list(APPEND WDK_COMPILE_DEFINITIONS "_WIN64;_AMD64_;AMD64")
set(WDK_PLATFORM "x64")
else()
message(FATAL_ERROR "Unsupported architecture")
endif()
I tried manually displaying CMAKE_SIZEOF_VOID_P
's value using message()
however it doesn't contain anything :/ which is why I guess it breaks the logic. I have installed cmake 3.30.2 from the official website.
Try cleaning cmake caches (delete folders generated by cmake). Also can you build the FindWDK sampes?
Try cleaning cmake caches (delete folders generated by cmake). Also can you build the FindWDK sampes?
Looks like I can build your samples without any issues:
C:\Users\ty3r0x\Desktop\FindWDK-master>cmake -Bbuild samples
-- Building for: Visual Studio 17 2022
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
Compatibility with CMake < 3.5 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
-- Selecting Windows SDK version 10.0.26100.0 to target Windows 10.0.19044.
-- The C compiler identification is MSVC 19.41.34120.0
-- The CXX compiler identification is MSVC 19.41.34120.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.41.34120/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.41.34120/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found WDK: C:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/km/ntddk.h
-- WDK_ROOT: C:/Program Files (x86)/Windows Kits/10
-- WDK_VERSION: 10.0.26100.0
-- Configuring done (3.1s)
-- Generating done (0.1s)
-- Build files have been written to: C:/Users/ty3r0x/Desktop/FindWDK-master/build
C:\Users\ty3r0x\Desktop\FindWDK-master>cmake --build build --parallel --config Release
MSBuild version 17.11.2+c078802d4 for .NET Framework
1>Checking Build System
Building Custom Rule C:/Users/ty3r0x/Desktop/FindWDK-master/samples/WdmCppLib/CMakeLists.txt
WdmCppLib.cpp
Building Custom Rule C:/Users/ty3r0x/Desktop/FindWDK-master/samples/WdmLib/CMakeLists.txt
Building Custom Rule C:/Users/ty3r0x/Desktop/FindWDK-master/samples/KmdfCppLib/CMakeLists.txt
Building Custom Rule C:/Users/ty3r0x/Desktop/FindWDK-master/samples/MinifilterCppDriver/CMakeLists.txt
WdmLib.c
KmdfCppLib.cpp
Main.cpp
WdmCppLib.vcxproj -> C:\Users\ty3r0x\Desktop\FindWDK-master\build\WdmCppLib\Release\WdmCppLib.lib
WdmLib.vcxproj -> C:\Users\ty3r0x\Desktop\FindWDK-master\build\WdmLib\Release\WdmLib.lib
Building Custom Rule C:/Users/ty3r0x/Desktop/FindWDK-master/samples/WdmDriver/CMakeLists.txt
Main.c
KmdfCppLib.vcxproj -> C:\Users\ty3r0x\Desktop\FindWDK-master\build\KmdfCppLib\Release\KmdfCppLib.lib
Building Custom Rule C:/Users/ty3r0x/Desktop/FindWDK-master/samples/WdmCppDriver/CMakeLists.txt
Building Custom Rule C:/Users/ty3r0x/Desktop/FindWDK-master/samples/WdmIntrinsicFunctions/CMakeLists.txt
MinifilterCppDriver.vcxproj -> C:\Users\ty3r0x\Desktop\FindWDK-master\build\MinifilterCppDriver\Release\MinifilterCpp
Driver.sys
WdmDriver.vcxproj -> C:\Users\ty3r0x\Desktop\FindWDK-master\build\WdmDriver\Release\WdmDriver.sys
Building Custom Rule C:/Users/ty3r0x/Desktop/FindWDK-master/samples/KmdfCppDriver/CMakeLists.txt
Main.cpp
Main.cpp
Main.cpp
WdmCppDriver.vcxproj -> C:\Users\ty3r0x\Desktop\FindWDK-master\build\WdmCppDriver\Release\WdmCppDriver.sys
KmdfCppDriver.vcxproj -> C:\Users\ty3r0x\Desktop\FindWDK-master\build\KmdfCppDriver\Release\KmdfCppDriver.sys
WdmIntrinsicFunctions.vcxproj -> C:\Users\ty3r0x\Desktop\FindWDK-master\build\WdmIntrinsicFunctions\Release\WdmIntrin
sicFunctions.sys
Building Custom Rule C:/Users/ty3r0x/Desktop/FindWDK-master/samples/CMakeLists.txt
Deleting the cache files on my project yields no result. This is my project structure: Z:\CMakeLists.txt
cmake_minimum_required(VERSION 3.15)
project(centipede)
set_property(GLOBAL PROPERTY USER_FOLDERS ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /WX")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4 /WX")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}cmake") #I had to modify this variable so CMAKE_MODULE_PATH is generated properly
message("[Debug] CMAKE_CURRENT_LIST_DIR: ${CMAKE_CURRENT_LIST_DIR}, CMAKE_MODULE_PATH: ${CMAKE_MODULE_PATH}, CMAKE_SIZEOF_VOID_P: ${CMAKE_SIZEOF_VOID_P}")
find_package(WDK REQUIRED)
add_subdirectory(src)
Z:\src\CMakeLists.txt
cmake_minimum_required(VERSION 3.15)
wdk_add_driver(centipede
entrypoint.c
)
FindWDK is located in Z:\cmake\FindWDK.cmake
. Thank you for your help, I will continue to investigate!
I found the issue! For some bizzare reason, transferring my project from my mounted Z: drive to my desktop solved the CMAKE_SIZEOF_VOID_P issue. So for those who have this niche build enviroment of mounting an external folder (host to vm), bear that in mind!
Hello! I am attempting to build a personal project of mine https://github.com/Ty3r0X/centipede using just the Visual Studio build tools 2022 installation. I decided to replace my non-functional batch build script with cmake, however when compiling I get:
CMakeLists.txt
src/CMakeLists.txt
Apologies for my rather unprofessional issue, but I kept looking on other resources over to no avail. Thank you!