From ed8422cd5f4c8c2560296c65ad79ca2f21f0f802 Mon Sep 17 00:00:00 2001 From: Aaron Jomy <75925957+maximusron@users.noreply.github.com> Date: Mon, 29 Jan 2024 16:51:12 +0100 Subject: [PATCH] Update developer build process (#743) Fixes #689 --- README.md | 42 +++++++++++++++++++++++++++++++----------- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 4b05524a2..00703d1eb 100644 --- a/README.md +++ b/README.md @@ -272,18 +272,38 @@ cmake ../clad -DLLVM_DIR=/opt/homebrew/opt/llvm@12/lib/cmake/llvm -DClang_DIR=/o make && make install make check-clad ``` -### Building from source LLVM, Clang and Clad (development environment) +### Developer Environment - Build LLVM, Clang and Clad from source: ``` -sudo -H pip install lit -git clone https://github.com/llvm/llvm-project.git src -cd src; git checkout llvmorg-13.0.0 -cd llvm/tools -git clone https://github.com/vgvassilev/clad.git clad -cd ../../../ -mkdir obj inst -cd obj -cmake -S ../src/llvm -DLLVM_ENABLE_PROJECTS="clang" -DCMAKE_BUILD_TYPE="Debug" -DLLVM_TARGETS_TO_BUILD=host -DCMAKE_INSTALL_PREFIX=../inst -make && make install +pip3 install lit +``` +Clone the LLVM project and checkout the required LLVM version (Currently supported versions 7.x - 17.x) + +``` +git clone https://github.com/llvm/llvm-project.git +cd llvm-project +git checkout llvmorg-16.0.0 +``` +Build Clang: +``` +mkdir build && cd build +cmake -DLLVM_ENABLE_PROJECTS="clang" -DCMAKE_BUILD_TYPE="DEBUG" -DLLVM_TARGETS_TO_BUILD=host -DLLVM_INSTALL_UTILS=ON ../llvm +cmake --build . --target clang --parallel $(nproc --all) +make -j8 check-clang # this installs llvm-config required by lit +cd ../.. +``` + +Clone and build Clad: +``` +git clone https://github.com/vgvassilev/clad.git +cd clad +mkdir build && cd build +cmake -DLLVM_DIR=PATH/TO/llvm-project/build -DCMAKE_BUILD_TYPE=DEBUG -DLLVM_EXTERNAL_LIT="$(which lit)" ../ +make -j8 clad +``` + +Run the Clad tests: +``` +make -j8 check-clad ``` ## Further reading