Skip to content

Building the VSIX

Ramon Viladomat edited this page Nov 23, 2023 · 10 revisions

Struct Layout uses llvm + clang libtooling and DIA SDK to parse the C++ files and extract the requested memory layouts. This means that the C# VSIX extension uses several external applications that will need to be compiled first.

Get the LLvM libraries for the ClangLayout executable

Option A: Download & Build llvm-project

First step would be to get the llvm-project with clang.

For simplicity, it is recommended to place the llvm project in the <github-root>/External/llvm-project folder. (this is where the layout parser project will seek the includes and libraries).

There is more detailed information on how to set it up at the Getting Started with Clang page. The command line that needs to be run inside the llvm-project folder is:

mkdir build
cd build
cmake -DLLVM_ENABLE_PROJECTS=clang -G "Visual Studio 16 2019" -A x64 -Thost=x64 ..\llvm

Option B: Clone pre-built LLVM library

Clone the repository Viladoman/ClangArtifacts to folder <github-root>/External. This should bring the necesary includes and library used to built the latest version of this repository. This is the same process that the github action does.

Build ClangLayout executable

Open the ClangLayout solution found at Parsers/ClangLayout/ClangLayout.sln and build on Release.

Build the PDBLayout executable

Open the PDBLayout solution found at Parsers/PDBLayout/PDBLayout.sln and build on Release.

Generate the VSIX

Open and build the solution found at StructLayout/StructLayout.sln. This will automatically pull the ClangLayout.exe and PDBLayout.exe (and its dlls) from the previously generated output path. There are also sample projects for testing at TestProjects/.