Skip to content

Latest commit

 

History

History
47 lines (28 loc) · 2.7 KB

VISUAL_STUDIO.org

File metadata and controls

47 lines (28 loc) · 2.7 KB

Building Intercept Compiler with Visual Studio

Although it is not recommended, if you prefer to work in Visual Studio, the following is a guide to help you out.

It should be noted that Intercept compiler likely does not compile with MSVC due to the use of typeof, a C23 language feature currently only supported by GCC and Clang. Luckily, Visual Studio can work with clang-cl, a tool that mimics MSVC on the command line but is just Clang in a trenchcoat.

NOTE: This assumes you already have some version of Visual Studio installed, and that you are on Windows.

Installing clang-cl with Visual Studio Installer

If you already have clang-cl (MSBuild support for LLVM toolset) installed, feel free to skip this section.

img/VS_Installer_ArrowToModifyButton.png

In the Windows Search Bar (accessible by pressing the “Windows key” and then typing), enter “Visual Studio Installer” and then press return/enter.

Upon clicking the button labelled Modify, pointed to by the giant red arrow in the picture above, a new window will appear.

img/VS_Installer_Modify_ArrowToIndividualComponentsTab.png

Within this new window, navigate to the Individual components tab, shown just below.

img/VS_Installer_Modify_IndividualComponents.png

Once there, type “clang” into the search box, and select both “C++ Clang Compiler for Windows” and “MSBuild support for LLVM (clang-cl) toolset”.

Finally, with the toolset selected, click the button in the bottom right labelled “Modify”.

Generate a CMake Build Tree

It would be kind of a mess if all of the intermediate build files were interspersed with all of the source files, so CMake delineates what are called “build trees” where all of these files are stored for a particular build of the program.

cmake -B bld -T ClangCL

Assuming everything was installed properly with the Visual Studio Installer, the above command should generate a Visual Studio Solution using the clang-cl toolset.

Run the following command to launch Visual Studio into the generated solution.

start bld\Intercept.sln

Alternatively, navigate to the bld subdirectory in explorer and double click the .sln file to open the Visual Studio project and build Intercept just like any other program!