Skip to content

Conversation

@m3rcer
Copy link

@m3rcer m3rcer commented Nov 26, 2025

Windows VS 2022 Build Support

  • Switched the core library to static linkage, added MSVC-friendly warning/RTTI flags, and autodetect the VS2022 DIA SDK so the LLVM static component set can link cleanly on Windows. This follows the guidance in issue #26.
if (WIN32)
  find_library(
    DIA_GUIDS_LIB
    NAMES diaguids
    PATHS
      "$ENV{VSINSTALLDIR}/DIA SDK/lib/amd64"
      "$ENV{ProgramFiles}/Microsoft Visual Studio/2022/Community/DIA SDK/lib/amd64"
      "$ENV{ProgramFiles}/Microsoft Visual Studio/2022/BuildTools/DIA SDK/lib/amd64"
      "$ENV{ProgramFiles\(x86\)}/Microsoft Visual Studio/2022/Community/DIA SDK/lib/amd64"
      "$ENV{ProgramFiles\(x86\)}/Microsoft Visual Studio/2022/BuildTools/DIA SDK/lib/amd64"
    NO_DEFAULT_PATH
  )
  if (DIA_GUIDS_LIB)
    list(APPEND llvm_libs ${DIA_GUIDS_LIB})
  endif()
endif()

add_library(dbgir STATIC DebugIR.cpp)

if (NOT LLVM_ENABLE_RTTI)
  target_compile_options(
    dbgir
    PUBLIC
      $<$<CXX_COMPILER_ID:MSVC>:/GR->
      $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-fno-rtti>
  )
endif()

if (MSVC)
  set(DEBUGIR_WARN_FLAGS
    /W4
    /permissive-
  )
else()
  set(DEBUGIR_WARN_FLAGS
    -Wall
    -Werror
    -pedantic
    -Wextra
    -Wno-unknown-pragmas
    -Wno-unused-parameter
  )
endif()
  • Updated the LLVM export metadata so LLVMDebugInfoPDB now pulls diaguids.lib from the installed VS2022 Build Tools.
add_library(LLVMDebugInfoPDB STATIC IMPORTED)

set_target_properties(LLVMDebugInfoPDB PROPERTIES
  INTERFACE_LINK_LIBRARIES "C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/DIA SDK/lib/amd64/diaguids.lib;LLVMBinaryFormat;LLVMObject;LLVMSupport;LLVMDebugInfoCodeView;LLVMDebugInfoMSF"
)
  • Reconfigured and rebuilt with
    cmake -DLLVM_DIR="C:/IRvana/LLVM-18.1.5/lib/cmake/llvm" -DLINK_LLVM_SHARED=OFF -DCMAKE_BUILD_TYPE=Release ..
    cmake --build . --config Release

@vaivaswatha
Copy link
Owner

There are white-space changes in all files, can you remove them?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants