linux-packaging-mono/external/corert/Documentation/how-to-build-and-run-ilcompiler-in-visual-studio.md

66 lines
2.3 KiB
Markdown
Raw Normal View History

_Please ensure that [pre-requisites](prerequisites-for-building.md) are installed for a successful build of the repo._
_Note_:
* Instructions below assume `c:\corert` is the repo root.
# Build ILCompiler #
Build your repo by issuing the following command at repo root:
```
build.cmd
```
If you changed `c:\corert\src\ILCompiler\repro\project.json`
```
build.cmd clean
```
_Note: The size of NuGet packages is approximately 2.75 GB, so download might take a few moments based on the speed of your internet connection. The build artifacts require additional ~1 GB, thus make sure you have at least 4 GB of free space._
## Using RyuJIT ##
1. Open c:\corert\src\ILCompiler\ILCompiler.sln in VS
- Set "desktop" project in solution explorer as your startup project
- Set startup command line to:
`@c:\corert\bin\obj\Windows_NT.x64.Debug\ryujit.rsp`
- Build & run using **F5**
- This will run the compiler. The output is `c:\corert\bin\obj\Windows_NT.x64.Debug\repro\native\repro.obj` file.
- The repro project has a dummy program that you can modify for ad-hoc testing
- To suppress spew from NuGet during the build, go to NuGet Package Manager in Options, and uncheck `Allow NuGet to download missing packages`.
2. Open `c:\corert\src\ILCompiler\reproNative\reproNative.vcxproj`
- Set breakpoint at ```__managed__Main``` in main.cpp
- Build & run using **F5**
- Once you hit the breakpoint, go to disassembly and step into - you are looking at the code generated by RyuJIT
## Using CPP Code Generator ##
1. Open `c:\corert\src\ILCompiler\ILCompiler.sln` in VS
- Set "desktop" project in solution explorer as your startup project
- Set startup command line to:
`@c:\corert\bin\obj\Windows_NT.x64.Debug\cpp.rsp`
- `--codegenopt:nolinenumbers` command line option can be used to suppress generation of line number mappings in C++ files - useful for debugging
- Build & run using **F5**
- This will run the compiler. The output is `c:\corert\bin\obj\Windows_NT.x64.Debug\repro\native\repro.cpp` file.
- The repro project has a dummy program that you can modify for ad-hoc testing
2. Open `c:\corert\src\ILCompiler\reproNative\reproNativeCpp.vcxproj`
- Set breakpoint at repro::Program::Main in main.cpp
- Build, run & step through as with any other C++ program