Files
vatrog-vm-introspection-engine/CMakeLists.txt
T
lirent 1ec70b7ede Windows guest VMI core: host library, CLI, guest agent
Static library over a flat RW mmap of guest RAM: GPA/GVA paging walks,
beacon-driven bootstrap, dynamic struct-offset profiling, process and
module enumeration, a region map, and value/pointer/signature scanners on
a shared windowed sweep. Public API in include/; internals under src/.

Thin CLI demonstrator over the public API. Guest agent cross-compiled to
Windows x86-64 via mingw-w64. CMake: static library + CLI + guest target,
C17.
2026-06-14 21:47:56 +03:00

41 lines
1.7 KiB
CMake

cmake_minimum_required(VERSION 3.18) # find_program(... REQUIRED)
project(w32ms C)
set(CMAKE_C_STANDARD 17) # generation B uses no C23 feature
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_EXTENSIONS ON) # deliberate: strnlen (POSIX) + void* arithmetic (GNU)
# ---- host: VMI core as a static library ---------------------------------
add_library(w32ms STATIC
src/gpa.c
src/gva.c
src/host.c
src/proc.c
src/profile.c
src/text.c
src/scan.c
src/sigscan.c)
target_include_directories(w32ms
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include # public API: include/*.h
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src) # private: src/include/*.h via "include/..."
target_compile_options(w32ms PRIVATE -O2 -Wall -Wextra)
# ---- host: CLI demonstrator over the library ----------------------------
add_executable(w32ms_cli src/cli.c)
target_link_libraries(w32ms_cli PRIVATE w32ms)
target_compile_options(w32ms_cli PRIVATE -Wall -Wextra)
# ---- guest: cross-compile to Windows x86-64 via mingw-w64 ---------------
find_program(MINGW_CC NAMES x86_64-w64-mingw32-gcc REQUIRED)
set(W32MS_GUEST ${CMAKE_CURRENT_BINARY_DIR}/w32ms_guest.exe)
add_custom_command(
OUTPUT ${W32MS_GUEST}
COMMAND ${MINGW_CC} -O2 -Wall -Wextra -static -s
-I${CMAKE_CURRENT_SOURCE_DIR}/src
-o ${W32MS_GUEST} ${CMAKE_CURRENT_SOURCE_DIR}/src/guest.c
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/src/guest.c
${CMAKE_CURRENT_SOURCE_DIR}/src/include/contract.h
COMMENT "Cross-compiling w32ms_guest.exe (mingw-w64, x86-64)"
VERBATIM)
add_custom_target(w32ms_guest ALL DEPENDS ${W32MS_GUEST})