-
Notifications
You must be signed in to change notification settings - Fork 3
Windows
This page provides a tutorial on how to build the LLVM frontend for the Oberon programming language on Windows. Since this project uses CMake to manage its build process, it is recommended to use the latest version of Visual Studio Community Edition. Starting with Visual Studio 2019, Visual Studio provides full support for CMake projects. Furthermore, the Microsoft toolchain (CL) is assumed to be used to compile the frontend.
[[TOC]]
Before the Oberon LLVM frontend can be built, the Boost libraries (algorithm, convert, filesystem, and program-options components) and the LLVM Compiler Infrastructure (core libraries and tools) need to be installed. Using the Microsoft C++ Library Manager vcpkg for Windows is recommended to accomplish these tasks. Note that this tutorial assumes that standard build tools such as git
, nmake
, and cmake
are available to build the frontend. Most of these tools are included in the path, if the commands given below are launched from the Native Tools Command Prompt for VS.
Starting with Visual Studio 2022, a version of vcpkg is bundled with the Visual Studio installation. Even so, the installation of a stand-alone version by following the steps below is recommended.
-
Download and bootstrap vcpkg.
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
.\bootstrap-vcpkg.bat
-
If Visual Studio is used, configure automatic, user-wide integration of libraries managed by vcpkg.
.\vcpkg integrate install
.\vcpkg install boost-algorithm:x64-windows
.\vcpkg install boost-convert:x64-windows
.\vcpkg install boost-filesystem:x64-windows
.\vcpkg install boost-program-options:x64-windows
.\vcpkg install llvm[target-x86]:x64-windows
Note that vpkg will build and install the Debug
and RelWithDebInfo
version of LLVM. Since both builds contain debug information, this required a significant amount of free hard-disk space (typically around 100-150 GB) during compilation. Refer to the tutorial Building LLVM from Sources if that space is not available or if a later version of LLVM than the one provided by vcpkg is required.
To build and install Boost on LLVM use the platform triple arm64-windows
instead of x64-windows
in the commands above. Additionally, the command to build and install LLVM needs to include the option --allow-unsupported
and target-aarch64
instead of target-x86
as shown below.
> .\vcpkg --allow-unsupported install llvm[target-aarch64]:arm64-windows
The LLVM frontend for the Oberon programming language on Windows can be built from the command line or using an IDE that supports CMake projects such as Visual Studio 2019 (or later).
-
Navigate to the
oberon-lang
directory and create a newbuild
directory. Then, navigate to the newly createdbuild
directory.cd oberon-lang
mkdir build
cd build
-
Invoke CMake to set up the build toolchain and generate the required build files.
cmake .. -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE="%vcpkg_home%/scripts/buildsystems/vcpkg.cmake"
-
As a result, CMake will generate
Makefile
s that can be used to build the frontend.nmake
After the build successfully terminates, the oberon-lang
binary can be found in the oberon-lang/build/src
subdirectory.
In order to build the LLVM frontend for the Oberon programming language on Windows (x64), follow the steps below.
-
Clone the project repository from GitLab.
git clone https://gitlab.inf.uni-konstanz.de/michael.grossniklaus/oberon-lang.git
-
Start Visual Studio and select
File
→Open
→Folder...
from the menu or pressCtrl
+Shift
+Alt
+O
. -
Navigate to the
oberon-lang
folder to which you cloned the project repository and clickSelect Folder
. -
Visual Studio will now run CMake to set up the project. Make sure that the build configuration in the tool bar of Visual Studio matches the build type specified earlier. For example, if LLVM was compiled in
Release
mode, Visual Studio's build configuration has to bex64-Release
orarm64-Release
, depending on the hardware platform. -
Start the build using the
Build
→Build All
menu or pressCtrl
+Shift
+B
.
Once the build successfully terminates, the oberon-lang.exe
executable can be found in the oberon-lang\out\build\x64-Debug\src
or oberon-lang\out\build\x64-Release\src
directory. On Windows on Arm, the directories are oberon-lang\out\build\arm64-Debug\src
or oberon-lang\out\build\arm64-Release\src
, respectively.
Building the Frontend
Using the Compiler
- Apple Clang Toolchain
- GCC Toolchain
- Microsoft MSVC Toolchain
- Just-in-Time Compilation
- Embedded Devices
Oberon Compatibility
Miscellaneous