Skip to content

CMake adoption exploration — replace emule.vcxproj with CMakeLists.txt + Ninja

Closure

Abandoned by operator decision on 2026-05-21. The supported build and validation entrypoint remains python -m emule_workspace; do not promote CMake, Ninja, or vcpkg migration work from this item without a new active item.

Classification

Exploratory idea only. This is not an active implementation plan and is not beta 0.7.3 scope. The supported build path remains python -m emule_workspace unless a future active item promotes a narrow CMake slice.

Summary

Everything downstream — clang-tidy, clangd, scan-build, cppcheck with compile commands — depends on compile_commands.json. CMake + Ninja generates this. The exploratory idea would replace emule.vcxproj / .sln entirely if a future active item promoted it.

Would be prerequisite for: CI-002 (clang-format), CI-003 (MSVC hardening), CI-004 (clang-tidy), CI-005 (cppcheck), CI-006 (ASan).

Current State

  • Build system: emule.vcxproj (MSBuild, Visual Studio 2022)
  • Compiler: MSVC v143, x64 primary
  • C++ standard: C++17 (set in commit 93797f3)
  • Warning level: /Wall
  • No compile_commands.json → clang-tidy/clangd cannot work

Tools Required

winget install Ninja-build.Ninja   # generates compile_commands.json
# Already installed:
# - LLVM 22.1.0 on PATH
# - CMake 4.2.0 on PATH
# - MSVC v143 (VS 2022 Professional)

Target Directory Layout

eMule-main/
├── srchybrid/
│   ├── CMakeLists.txt     ← defines eMule target
│   └── stdafx.h / stdafx.cpp
├── CMakeLists.txt          ← workspace root, wires deps
└── CMakePresets.json       ← Debug/Release x64 presets

Key CMake Requirements

cmake_minimum_required(VERSION 3.25)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)      # enables clang-tidy/clangd
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")

Dependency Root Variables (CMakePresets.json)

"cacheVariables": {
  "CRYPTOPP_ROOT":  "${sourceDir}/../emulebb-cryptopp",
  "MINIUPNP_ROOT":  "${sourceDir}/../emulebb-miniupnp",
  "RESIZABLE_ROOT": "${sourceDir}/../emulebb-resizablelib",
  "ZLIB_ROOT":      "${sourceDir}/../emulebb-zlib"
}

Acceptance Criteria

  • [ ] cmake --preset Debug produces a working eMule.exe
  • [ ] compile_commands.json generated in the build directory
  • [ ] VS Code cmake-tools + clangd extension can build and provide IntelliSense from the CMake project
  • [ ] Both x64 Debug and x64 Release configurations pass
  • [ ] ARM64 configuration passes (or is documented as deferred)
  • [ ] emule.vcxproj is removed from the repository

Files

  • New: srchybrid/CMakeLists.txt
  • New: CMakeLists.txt (workspace root)
  • New: CMakePresets.json
  • Delete: emule.vcxproj, emule.sln