Skip to content

Latest commit

 

History

History
102 lines (73 loc) · 3.31 KB

File metadata and controls

102 lines (73 loc) · 3.31 KB

Building from source

Host platforms

CPULLVM is built and tested on Linux Ubuntu and Windows.

Please refer to the "Host Platforms" section in the README for details.

Prerequisites

CPULLVM requires the following software to be installed:

Library testing requires:

Testing with QEMU is enabled by default, but can be disabled using the -DENABLE_QEMU_TESTING=OFF CMake option if testing is not required or QEMU is not installed.

A relatively recent version of QEMU is required to support the latest RISC-V extensions. CPULLVM currently builds and tests with QEMU v10.1.3.

Patching

CPULLVM may contain patches with changes that are pending or unmerged in the upstream projects it uses. Generally, these patches are automatically applied, except for llvm-project which must be patched manually. The below command assumes you are in the cpullvm-toolchain directory:

python3 qualcomm-software/cmake/patch_repo.py --method apply qualcomm-software/patches/llvm-project

Other projects (eld, picolibc, etc.) are checked out and patched automatically. If you prefer, you can check out and patch the repos manually and use those, see developing.md.

Building

Linux

The commands in the sections below assume you are in the cpullvm-toolchain/qualcomm-software directory.

The toolchain can be built directly with CMake.

All dependencies are assumed to be present in your PATH.

# Alternatively, CMAKE_C_COMPILER/CMAKE_CXX_COMPILER may be set directly
export CC=clang
export CXX=clang++
mkdir build
cd build
cmake .. -GNinja -DFETCHCONTENT_QUIET=OFF
ninja llvm-toolchain

Windows

The commands in the sections below assume you are in the cpullvm-toolchain/qualcomm-software directory.

The toolchain can be built directly with CMake.

All dependencies are assumed to be present in your PATH.

mkdir build
cd build
cmake .. -GNinja -DFETCHCONTENT_QUIET=OFF -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl
ninja llvm-toolchain

Testing the toolchain

To run all LLVM, eld, and library tests together, the below command may be used:

ninja check-all-llvm-toolchain

Installing the toolchain

ninja install-llvm-toolchain

Packaging the toolchain

To create a zip or tar.xz file as appropriate for the platform:

ninja package-llvm-toolchain

Advanced usage

CPULLVM can be configured and built in a variety of ways, including changing the default libc to use for embedded, building Linux libraries, and building only a subset of library variants. These (and other) options are documented in part in developing.md.