From: Icenowy Zheng Date: Tue, 25 Mar 2025 14:37:02 +0000 (+0800) Subject: ci: add a Clang RISCV test target X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=64d16e10bc08f94453e31c77ba658efa997c651a;p=thirdparty%2Fzlib-ng.git ci: add a Clang RISCV test target Similar to the GCC one, this test target uses system toolchain and QEMU too. Signed-off-by: Icenowy Zheng --- diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index f6d69791..ddfb5268 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -312,6 +312,11 @@ jobs: gcov-exec: riscv64-linux-gnu-gcov codecov: ubuntu_gcc_riscv64 + - name: Ubuntu Clang RISC-V + os: ubuntu-latest + cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-riscv-clang.cmake + packages: qemu-user crossbuild-essential-riscv64 + - name: Ubuntu GCC SPARC64 # qemu appears to be broken in newer versions of Ubuntu (see issue 1378) os: ubuntu-20.04 diff --git a/cmake/toolchain-riscv-clang.cmake b/cmake/toolchain-riscv-clang.cmake new file mode 100644 index 00000000..71fa7f4c --- /dev/null +++ b/cmake/toolchain-riscv-clang.cmake @@ -0,0 +1,16 @@ +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_PROCESSOR riscv64) +set(CMAKE_SYSTEM_VERSION 1) + +set(CMAKE_C_COMPILER clang) +set(CMAKE_C_COMPILER_TARGET riscv64-linux-gnu) +set(CMAKE_CXX_COMPILER clang++) +set(CMAKE_CXX_COMPILER_TARGET riscv64-linux-gnu) + +set(CMAKE_CROSSCOMPILING TRUE) +set(CMAKE_CROSSCOMPILING_EMULATOR qemu-riscv64 -cpu rv64,zba=true,zbb=true,zbc=true,zbs=true,v=true,vlen=512,elen=64,vext_spec=v1.0 -L /usr/${CMAKE_C_COMPILER_TARGET}/) + +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)