Add Riscv Example #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
env: | |
LLVM_RELEASE_VERSION_WINDOWS: 18 | |
LLVM_RELEASE_VERSION_MAC: 18 | |
LLVM_RELEASE_VERSION_LINUX: 18 | |
LLVM_DEV_VERSION: 20 | |
jobs: | |
build-linux: | |
runs-on: ubuntu-latest | |
strategy: | |
# Don't abort runners if a single one fails | |
fail-fast: false | |
matrix: | |
build_type: [Release] | |
llvm_version: [18] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install common deps | |
run: | | |
sudo apt-get install zlib1g zlib1g-dev python3 ninja-build curl | |
- name: Install Clang ${{matrix.llvm_version}} | |
run: | | |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - | |
if [[ "${{matrix.llvm_version}}" < 18 ]]; then | |
sudo add-apt-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-${{matrix.llvm_version}} main" | |
sudo apt-get update | |
sudo apt-get install -y -t llvm-toolchain-focal-${{matrix.llvm_version}} libpolly-${{matrix.llvm_version}}-dev \ | |
clang-${{matrix.llvm_version}} llvm-${{matrix.llvm_version}} llvm-${{matrix.llvm_version}}-dev \ | |
lld-${{matrix.llvm_version}} liblld-${{matrix.llvm_version}}-dev libmlir-${{matrix.llvm_version}} \ | |
libmlir-${{matrix.llvm_version}}-dev mlir-${{matrix.llvm_version}}-tools | |
else | |
if [[ "${{matrix.llvm_version}}" < "${{env.LLVM_DEV_VERSION}}" ]]; then | |
sudo add-apt-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-${{matrix.llvm_version}} main" | |
sudo apt-get update | |
sudo apt-get install -y -t llvm-toolchain-focal-${{matrix.llvm_version}} libpolly-${{matrix.llvm_version}}-dev \ | |
clang-${{matrix.llvm_version}} llvm-${{matrix.llvm_version}} llvm-${{matrix.llvm_version}}-dev \ | |
lld-${{matrix.llvm_version}} liblld-${{matrix.llvm_version}}-dev | |
else | |
sudo add-apt-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal main" | |
sudo apt-get install -y -t llvm-toolchain-focal libpolly-${{matrix.llvm_version}}-dev \ | |
clang-${{matrix.llvm_version}} llvm-${{matrix.llvm_version}} llvm-${{matrix.llvm_version}}-dev \ | |
lld-${{matrix.llvm_version}} liblld-${{matrix.llvm_version}}-dev | |
fi | |
fi | |
- name: CMake | |
if: matrix.llvm_version < 18 || matrix.llvm_version == env.LLVM_DEV_VERSION | |
run: | | |
cmake -B build \ | |
-G Ninja \ | |
-DCMAKE_BUILD_TYPE=${{matrix.build_type}} \ | |
-DCMAKE_C_COMPILER=clang-${{matrix.llvm_version}} \ | |
-DCMAKE_CXX_COMPILER=clang++-${{matrix.llvm_version}} \ | |
-DCMAKE_LINKER=lld-link-${{matrix.llvm_version}} \ | |
-DCMAKE_OBJCOPY=llvm-objcopy-${{matrix.llvm_version}} \ | |
-DCMAKE_STRIP=llvm-strip-${{matrix.llvm_version}} \ | |
-DCMAKE_DLLTOOL=llvm-dlltool-${{matrix.llvm_version}} \ | |
-DC3_LLVM_VERSION=${{matrix.llvm_version}} | |
cmake --build build | |
- name: CMake18 | |
if: matrix.llvm_version >= 18 && matrix.llvm_version != env.LLVM_DEV_VERSION | |
run: | | |
cmake -B build \ | |
-G Ninja \ | |
-DCMAKE_BUILD_TYPE=${{matrix.build_type}} \ | |
-DCMAKE_C_COMPILER=clang-${{matrix.llvm_version}} \ | |
-DCMAKE_CXX_COMPILER=clang++-${{matrix.llvm_version}} \ | |
-DCMAKE_LINKER=lld-link-${{matrix.llvm_version}} \ | |
-DCMAKE_OBJCOPY=llvm-objcopy-${{matrix.llvm_version}} \ | |
-DCMAKE_STRIP=llvm-strip-${{matrix.llvm_version}} \ | |
-DCMAKE_DLLTOOL=llvm-dlltool-${{matrix.llvm_version}} \ | |
-DC3_LLVM_VERSION=${{matrix.llvm_version}}.1 | |
cmake --build build | |
- name: Install QEMU and Risc-V toolchain | |
run: | | |
sudo apt-get install qemu gcc-riscv64-linux-gnu | |
- name: Compile and run Risc-V Example | |
run: | | |
cd resources/examples/embedded/riscv-qemu | |
make C3C_PATH=../../../../build/ run | |