diff --git a/INSTALL.md b/INSTALL.md index c933f0c19..1f552a7d4 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -5,7 +5,7 @@ ```shell sudo apt update sudo apt install \ - clang-15 \ + clang-17 \ cmake \ curl \ flex \ @@ -18,8 +18,8 @@ sudo apt install \ libmpfr-dev \ libunwind-dev \ libyaml-dev \ - lld-15 \ - llvm-15-tools \ + lld-17 \ + llvm-17-tools \ maven \ openjdk-17-jdk \ pkg-config \ @@ -44,7 +44,7 @@ brew install \ jemalloc \ libffi libyaml \ - llvm@15 \ + llvm@17 \ maven \ mpfr \ pkg-config \ @@ -81,20 +81,20 @@ add it your `env` (`.zshrc`, `.bashrc`, etc.), so that the Homebrew installation of LLVM gets picked up correctly. We recommend adding it to your shell profile. ```shell -export LLVM_DIR=$($(brew --prefix llvm@15)/bin/llvm-config --cmakedir) +export LLVM_DIR=$($(brew --prefix llvm@17)/bin/llvm-config --cmakedir) ``` If you don't usually use the `clang` from your Homebrew installation as your default compiler, you can set the following CMake flg to use these `clang` and `clang++`: ```shell --DCMAKE_C_COMPILER="$(brew --prefix llvm@15)/bin/clang" \ --DCMAKE_CXX_COMPILER="$(brew --prefix llvm@15)/bin/clang++" +-DCMAKE_C_COMPILER="$(brew --prefix llvm@17)/bin/clang" \ +-DCMAKE_CXX_COMPILER="$(brew --prefix llvm@17)/bin/clang++" ``` Once again, we recommend adding them and other llvm binaries to your `PATH` in your shell profile: ```shell -export PATH="$(brew --prefix llvm@15)/bin:$PATH" +export PATH="$(brew --prefix llvm@17)/bin:$PATH" ``` Some tests rely on GNU Grep options, which are not available on macOS by diff --git a/package/debian/changelog b/package/debian/changelog index be4a39ba6..63776337b 100644 --- a/package/debian/changelog +++ b/package/debian/changelog @@ -1,4 +1,4 @@ -k-llvm-backend (0.1.5) unstable; urgency=medium +k-llvm-backend (0.1.137) unstable; urgency=medium * Initial release diff --git a/package/version b/package/version index 9faa1b7a7..e670da30e 100644 --- a/package/version +++ b/package/version @@ -1 +1 @@ -0.1.5 +0.1.137 diff --git a/scripts/clang-tidy.sh b/scripts/clang-tidy.sh index e477d1c9a..92f41b715 100755 --- a/scripts/clang-tidy.sh +++ b/scripts/clang-tidy.sh @@ -2,17 +2,50 @@ set -euxo pipefail -LLVM_VERSION=15 BUILD_DIR=build +# Try to detect available LLVM version if [[ "$OSTYPE" == "darwin"* ]]; then - clang_tidy="$(brew --prefix "llvm@${LLVM_VERSION}")/bin/clang-tidy" - driver="$(brew --prefix "llvm@${LLVM_VERSION}")/bin/run-clang-tidy" + # On macOS, try LLVM 17 first, then fall back to 15 + for version in 17 15; do + if brew list "llvm@${version}" >/dev/null 2>&1; then + LLVM_VERSION=$version + clang_tidy="$(brew --prefix "llvm@${version}")/bin/clang-tidy" + driver="$(brew --prefix "llvm@${version}")/bin/run-clang-tidy" + break + fi + done elif [[ "$OSTYPE" == "linux-gnu"* ]]; then - clang_tidy="clang-tidy-$LLVM_VERSION" - driver="run-clang-tidy-$LLVM_VERSION" + # On Linux, try different versions based on what's available + for version in 17 16 15 14; do + if command -v "clang-tidy-${version}" >/dev/null 2>&1 && command -v "run-clang-tidy-${version}" >/dev/null 2>&1; then + LLVM_VERSION=$version + clang_tidy="clang-tidy-${version}" + driver="run-clang-tidy-${version}" + break + fi + done + + # Fallback to default clang-tidy if no versioned one is found + if [[ -z "${LLVM_VERSION:-}" ]]; then + if command -v clang-tidy >/dev/null 2>&1 && command -v run-clang-tidy >/dev/null 2>&1; then + LLVM_VERSION="default" + clang_tidy="clang-tidy" + driver="run-clang-tidy" + else + echo "Error: No clang-tidy installation found" + exit 1 + fi + fi fi +if [[ -z "${LLVM_VERSION:-}" ]]; then + echo "Error: No suitable LLVM/clang-tidy installation found" + exit 1 +fi + +echo "Using LLVM version: ${LLVM_VERSION}" + source_dirs=( bindings include