Skip to content

Latest commit

 

History

History
319 lines (223 loc) · 5.51 KB

File metadata and controls

319 lines (223 loc) · 5.51 KB

🔧 Building MalDestruct

This guide provides detailed instructions for building MalDestruct from source.

Prerequisites

Required Software

  1. Operating System

    • Windows 10/11 (64-bit)
  2. Compiler

    • Microsoft Visual Studio 2019 or later (recommended)
    • OR MinGW-w64 GCC 9.0+
  3. CMake

  4. Qt Framework

  5. Windows SDK

    • Windows 10 SDK (10.0.19041.0 or later)
    • Included with Visual Studio

Optional

  • Git for version control
  • Ninja build system (faster than MSBuild)

Build Instructions

Option 1: Visual Studio (Recommended)

# Open x64 Native Tools Command Prompt for VS 2022

# Navigate to project directory
cd /d C:\Path\To\MalDestruct

# Create build directory
mkdir build
cd build

# Configure
cmake .. -G "Visual Studio 17 2022" -A x64 ^
    -DCMAKE_PREFIX_PATH="C:/Qt/6.5.0/msvc2019_64"

# Build
cmake --build . --config Release --parallel 8

# The executables will be in build/bin/

Option 2: MinGW

# Open MinGW terminal

# Navigate to project directory
cd /d C:/Path/To/MalDestruct

# Create build directory
mkdir build
cd build

# Configure
cmake .. -G "MinGW Makefiles" ^
    -DCMAKE_PREFIX_PATH="C:/Qt/6.5.0/mingw_64" ^
    -DCMAKE_BUILD_TYPE=Release

# Build
cmake --build . --parallel 8

Option 3: Ninja (Fastest)

# Open x64 Native Tools Command Prompt for VS 2022

cd /d C:\Path\To\MalDestruct
mkdir build
cd build

# Configure
cmake .. -G Ninja ^
    -DCMAKE_PREFIX_PATH="C:/Qt/6.5.0/msvc2019_64" ^
    -DCMAKE_BUILD_TYPE=Release

# Build
ninja

Build Targets

All Targets

cmake --build . --config Release

Console Application Only

cmake --build . --config Release --target MalDestruct_Console

GUI Application Only

cmake --build . --config Release --target MalDestruct_GUI

Install

cmake --install . --prefix "C:/Program Files/MalDestruct"

Package

cpack -C Release

Configuration Options

Qt Installation Path

If CMake can't find Qt automatically:

cmake .. -DCMAKE_PREFIX_PATH="C:/Qt/6.5.0/msvc2019_64"

Build Type

# Release (optimized, no debug info)
cmake .. -DCMAKE_BUILD_TYPE=Release

# Debug (with debug symbols)
cmake .. -DCMAKE_BUILD_TYPE=Debug

# RelWithDebInfo (optimized + debug info)
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo

Parallel Build

# Use 8 cores
cmake --build . --parallel 8

# Use all available cores
cmake --build . --parallel

Troubleshooting

Qt Not Found

Error: Could not find Qt6

Solution:

set Qt6_DIR=C:\Qt\6.5.0\msvc2019_64\lib\cmake\Qt6
cmake ..

Missing Windows SDK

Error: Windows SDK not found

Solution:

DbgHelp.lib Not Found

Error: Cannot find dbghelp.lib

Solution:

  • Ensure Windows SDK is installed
  • Add to CMake: -DCMAKE_LIBRARY_PATH="C:/Program Files (x86)/Windows Kits/10/Lib/10.0.xxxxx.0/um/x64"

Build Fails with Unicode Errors

Solution:

  • Ensure source files are saved as UTF-8
  • Add to CMakeLists.txt: add_compile_options(/utf-8)

Qt DLLs Not Found When Running

Solution:

# Copy Qt DLLs to bin directory
windeployqt build/bin/MalDestruct_GUI.exe

# Or add Qt bin to PATH
set PATH=%PATH%;C:\Qt\6.5.0\msvc2019_64\bin

Development Build

For development with faster compile times:

mkdir build_dev
cd build_dev

cmake .. -G Ninja ^
    -DCMAKE_BUILD_TYPE=Debug ^
    -DCMAKE_PREFIX_PATH="C:/Qt/6.5.0/msvc2019_64" ^
    -DCMAKE_EXPORT_COMPILE_COMMANDS=ON

ninja

Static Build (Single EXE)

For distribution without DLL dependencies:

cmake .. -G Ninja ^
    -DCMAKE_BUILD_TYPE=Release ^
    -DCMAKE_PREFIX_PATH="C:/Qt/6.5.0/msvc2019_64_static" ^
    -DBUILD_SHARED_LIBS=OFF

ninja

Cross-Compilation

MalDestruct can be cross-compiled for different Windows architectures:

x86 (32-bit)

cmake .. -G "Visual Studio 17 2022" -A Win32

ARM64

cmake .. -G "Visual Studio 17 2022" -A ARM64

Verification

After building, verify the executables:

cd build/bin

# Console version
MalDestruct_Console.exe --version

# GUI version
MalDestruct_GUI.exe

Performance Optimization

Enable Link-Time Optimization

Add to CMakeLists.txt:

set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)

Profile-Guided Optimization (PGO)

# 1. Build with instrumentation
cmake .. -DCMAKE_CXX_FLAGS="/GL"
cmake --build .

# 2. Run to generate profile data
bin/MalDestruct_Console.exe

# 3. Rebuild with optimization
cmake .. -DCMAKE_CXX_FLAGS="/GL /LTCG"
cmake --build .

Clean Build

# Remove build directory
rm -rf build

# Or use CMake
cmake --build . --target clean

Next Steps

After successful build:

  1. Read README.md for usage instructions
  2. Configure maldestruct.conf
  3. Run with administrator privileges
  4. Check logs in C:\ProgramData\MalDestruct\Logs\

Support

If you encounter build issues:

  1. Check this guide thoroughly
  2. Search GitHub Issues
  3. Create a new issue with:
    • CMake version
    • Qt version
    • Compiler version
    • Full error output
    • CMakeCache.txt (if applicable)

Happy Building! 🚀