|
| 1 | +name: build-ock |
| 2 | +description: Action to build the oneapi-construction-kit |
| 3 | + |
| 4 | +# Some of these are riscv or host target specific, but it does not harm at present to |
| 5 | +# overset cmake values |
| 6 | +inputs: |
| 7 | + # os: |
| 8 | + # type: string |
| 9 | + # description: 'TBD' |
| 10 | + # default: ubuntu_22.04 |
| 11 | + arch: |
| 12 | + type: string |
| 13 | + description: 'TBD' |
| 14 | + default: 'x86_64' |
| 15 | + build_type: |
| 16 | + type: string |
| 17 | + description: 'build type e.g Release, ReleaseAssert (default ReleaseAssert)' |
| 18 | + default: ReleaseAssert |
| 19 | + llvm_branch_id: |
| 20 | + type: string |
| 21 | + description: "TBD" |
| 22 | + default: "" |
| 23 | + llvm_branch: |
| 24 | + type: string |
| 25 | + description: "TBD" |
| 26 | + |
| 27 | +runs: |
| 28 | + using: "composite" |
| 29 | + steps: |
| 30 | + - name: Setup Windows |
| 31 | + if: startsWith(runner.os, 'Windows') |
| 32 | + uses: llvm/actions/setup-windows@main |
| 33 | + with: |
| 34 | + arch: amd64 |
| 35 | + |
| 36 | + - name: Checkout repo llvm |
| 37 | + uses: actions/checkout@v4 |
| 38 | + with: |
| 39 | + repository: llvm/llvm-project |
| 40 | + ref: ${{inputs.llvm_branch}} |
| 41 | + |
| 42 | + - name: Install Ninja |
| 43 | + uses: llvm/actions/install-ninja@main |
| 44 | + |
| 45 | + - name: Setup ccache |
| 46 | + # if: inputs.arch == 'x86_64' |
| 47 | + uses: hendrikmuhs/ccache-action@53911442209d5c18de8a31615e0923161e435875 # v1.2.16 |
| 48 | + with: |
| 49 | + max-size: 200M |
| 50 | + key: ccache-llvm-build-${{ inputs.arch }}-${{ runner.os }} |
| 51 | + variant: ccache |
| 52 | + # TODO: How do we handle that these are parallel? |
| 53 | + save: true |
| 54 | + |
| 55 | + - name: Install Ninja |
| 56 | + uses: llvm/actions/install-ninja@a1ea791b03c8e61f53a0e66f2f73db283aa0f01e # main branch |
| 57 | + |
| 58 | + - name: install aarch64 build tools |
| 59 | + shell: bash |
| 60 | + if: ${{ inputs.arch == 'aarch64' }} |
| 61 | + run: | |
| 62 | + sudo apt-get install --yes g++-aarch64-linux-gnu |
| 63 | + echo 'ARCH_FLAGS=-DCMAKE_TOOLCHAIN_FILE="$GITHUB_WORKSPACE/ock/platform/aarch64-linux/aarch64-gcc-toolchain.cmake" \ |
| 64 | + -DLLVM_HOST_TRIPLE=aarch64-unknown-linux-gnu' > $GITHUB_ENV |
| 65 | +
|
| 66 | + - name: install riscv64 build tools |
| 67 | + shell: bash |
| 68 | + if: ${{ inputs.arch == 'riscv64' }} |
| 69 | + run: | |
| 70 | + sudo apt-get install --yes g++-riscv64-linux-gnu |
| 71 | + echo 'ARCH_FLAGS=-DCMAKE_TOOLCHAIN_FILE="$GITHUB_WORKSPACE/ock/platform/arm-linux/riscv64-gcc-toolchain.cmake" \ |
| 72 | + -DLLVM_HOST_TRIPLE=riscv64-unknown-linux-gnu' > $GITHUB_ENV |
| 73 | +
|
| 74 | + - name: install x86 build tools |
| 75 | + shell: bash |
| 76 | + if: ${{ inputs.arch == 'x86' }} |
| 77 | + run: | |
| 78 | + sudo dpkg --add-architecture i386 |
| 79 | + sudo apt-get update |
| 80 | + sudo apt-get install --yes gcc-multilib g++-multilib libc6-dev:i386 lib32tinfo-dev |
| 81 | + echo 'ARCH_FLAGS=-DLLVM_BUILD_32_BITS=ON -DLIBXML2_LIBRARIES=IGNORE -DLLVM_ENABLE_TERMINFO=OFF |
| 82 | + -DLLVM_HOST_TRIPLE=i686-unknown-linux-gnu' > $GITHUB_ENV |
| 83 | +
|
| 84 | + - name: Run cmake |
| 85 | + shell: ${{ contains(runner.os, 'windows') && 'pwsh' || 'bash' }} |
| 86 | + run: |
| 87 | + cmake llvm |
| 88 | + -DLLVM_ENABLE_DIA_SDK=OFF |
| 89 | + -DCMAKE_INSTALL_PREFIX=llvm_install |
| 90 | + -DLLVM_ENABLE_ZLIB=FALSE |
| 91 | + -DLLVM_ENABLE_ZSTD=FALSE |
| 92 | + -DLLVM_ENABLE_Z3_SOLVER=FALSE |
| 93 | + -DLLVM_ENABLE_PROJECTS="clang;lld" |
| 94 | + -DLLVM_TARGETS_TO_BUILD="X86;ARM;AArch64;RISCV" |
| 95 | + -DLLVM_CCACHE_BUILD=ON |
| 96 | + -Bbuild |
| 97 | + -GNinja |
| 98 | + ${{ inputs.build_type == 'RelAssert' && '-DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON' || '' }} |
| 99 | + ${{ inputs.os == 'windows-2019' && '' || '-DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON' }} |
| 100 | + ${{ inputs.os == 'windows-2019' && '' || $ARCH_FLAGS }} |
| 101 | + |
| 102 | + - name: Run build on llvm |
| 103 | + shell: ${{ contains(runner.os, 'windows') && 'pwsh' || 'bash' }} |
| 104 | + run: |
| 105 | + cmake --build build --target install |
| 106 | + |
| 107 | + - name: Copy lit tools |
| 108 | + shell: bash |
| 109 | + run: | |
| 110 | + cp build/bin/FileCheck* llvm_install/bin |
| 111 | + cp build/bin/not* llvm_install/bin |
| 112 | +
|
| 113 | + - name: upload artefact |
| 114 | + uses: actions/upload-artifact@v4 |
| 115 | + with: |
| 116 | + name: llvm-${{ input.os }}-${{ inputs.arch }}-${{ inputs.llvm_branch_id }}-${{ input.build_type }} |
| 117 | + path: llvm_install |
| 118 | + retention-days: 7 |
0 commit comments