Skip to content

Latest commit

 

History

History
210 lines (154 loc) · 5.37 KB

File metadata and controls

210 lines (154 loc) · 5.37 KB

Build Scripts Guide

This document describes all the build scripts available for MalDestruct and how to use them.

Prerequisites

Before running any build script, ensure you have:

  • Visual Studio 2022 installed
  • Qt 6.9.3 installed at C:/Qt/6.9.3/mingw_64
  • CMake (included with Visual Studio)

Running Scripts

Important: All scripts should be run from:

  • Developer Command Prompt for VS 2022 (recommended), OR
  • Visual Studio's integrated terminal

To open Developer Command Prompt:

  1. Search for "Developer Command Prompt for VS 2022" in Start menu
  2. Navigate to project directory: cd C:\Users\cysec\OneDrive\Desktop\MalDestruct\MalDestruct
  3. Run the desired script

Available Scripts

1. rebuild_both.bat - Build Both Console and GUI

Usage:

rebuild_both.bat [Debug|Release]

Description:

  • Builds both Console and GUI versions
  • Defaults to Release configuration
  • Automatically configures CMake if needed
  • Detects and reconfigures if generator mismatch

Examples:

rebuild_both.bat          # Builds Release (default)
rebuild_both.bat Release # Builds Release
rebuild_both.bat Debug   # Builds Debug

Output Location: build\bin\


2. kill_and_rebuild.bat - Kill Processes and Rebuild

Usage:

kill_and_rebuild.bat [Debug|Release]

Description:

  • Kills any running MalDestruct processes first
  • Then rebuilds both versions
  • Defaults to Debug configuration
  • Useful when executables are locked

Examples:

kill_and_rebuild.bat          # Builds Debug (default)
kill_and_rebuild.bat Release  # Builds Release
kill_and_rebuild.bat Debug    # Builds Debug

Output Location: build\bin\


3. build_all.bat - Build Debug Version

Usage:

build_all.bat

Description:

  • Builds both Console and GUI in Debug configuration
  • Automatically configures CMake if needed
  • Uses build directory (matches CMakeSettings.json)

Output Location: build\bin\


4. build_release.bat - Build Release Version

Usage:

build_release.bat

Description:

  • Builds both Console and GUI in Release configuration
  • Automatically configures CMake if needed
  • Uses build directory (matches CMakeSettings.json)

Output Location: build\bin\


5. rebuild_gui.bat - Build GUI Only

Usage:

rebuild_gui.bat [Debug|Release]

Description:

  • Builds only the GUI version
  • Defaults to Release configuration
  • Automatically configures CMake if needed

Examples:

rebuild_gui.bat          # Builds Release (default)
rebuild_gui.bat Release # Builds Release
rebuild_gui.bat Debug   # Builds Debug

Output Location: build\bin\MalDestruct_GUI.exe


6. find_executables.bat - Locate Built Executables

Usage:

find_executables.bat

Description:

  • Searches for MalDestruct executables in common locations
  • Shows file information (size, date) for found executables
  • Checks multiple possible build output directories

Searches in:

  • build\bin\ (primary location)
  • out\build\x64-Debug\bin\
  • out\build\x64-Release\bin\

How Scripts Work

All scripts follow this pattern:

  1. Check Build Directory: Creates build directory if it doesn't exist
  2. Check CMake Configuration:
    • Verifies if CMake is already configured
    • Checks if generator matches (Ninja, as per CMakeSettings.json)
    • Reconfigures if needed
  3. Configure CMake (if needed):
    • Uses Ninja generator
    • Sets Qt path: C:/Qt/6.9.3/mingw_64
    • Sets C++ standard: 17
    • Sets build type (Debug or Release)
  4. Build Targets: Uses cmake --build command
  5. Verify Output: Checks if executables were created

Troubleshooting

"CMake configuration failed"

  • Make sure you're running from Developer Command Prompt for VS 2022
  • Verify Qt is installed at C:/Qt/6.9.3/mingw_64
  • Check that CMake is in your PATH

"Build failed" or "Access is denied"

  • Close any running MalDestruct executables
  • Use kill_and_rebuild.bat to kill processes first
  • Make sure you have write permissions to the build directory

"Executable not found"

  • Check the build output for errors
  • Verify CMake configuration completed successfully
  • Try cleaning and rebuilding: delete build folder and run script again

Generator Mismatch

  • Scripts automatically detect and fix generator mismatches
  • If issues persist, manually delete build\CMakeCache.txt and build\CMakeFiles\

Integration with Visual Studio

These scripts are designed to work alongside Visual Studio's CMake integration:

  • Visual Studio uses CMakeSettings.json which points to build directory
  • Scripts also use build directory for consistency
  • Both use Ninja generator
  • Both support Debug and Release configurations

You can:

  • Build from Visual Studio (right-click target → Build)
  • Build from command line using these scripts
  • Both methods produce executables in the same location: build\bin\

Quick Reference

Script Builds Config Auto-Config Kill Processes
rebuild_both.bat Both Release* Yes No
kill_and_rebuild.bat Both Debug* Yes Yes
build_all.bat Both Debug Yes No
build_release.bat Both Release Yes No
rebuild_gui.bat GUI only Release* Yes No

*Can be overridden with command-line argument