Skip to content

Add example CMake for helpers/hotpatch #18

Add example CMake for helpers/hotpatch

Add example CMake for helpers/hotpatch #18

Workflow file for this run

name: Build
on: [push, pull_request]
# Automatically cancel previous runs of this workflow on the same branch
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
linux:
# Skip building pull requests from the same repository
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) }}
runs-on: ubuntu-22.04
# We use a clean container to avoid LLVM conflicts on the GH runner images
container:
image: ubuntu:22.04
steps:
- name: Install LLVM and build tools
run: |
export LLVM_VERSION=19
apt update
apt install --no-install-recommends -y \
lsb-release \
wget \
software-properties-common \
gnupg \
cmake \
ninja-build \
python-is-python3 \
python3-pip \
python3-setuptools \
python3-venv \
git
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
./llvm.sh $LLVM_VERSION
apt install --no-install-recommends -y \
llvm-$LLVM_VERSION-dev
echo "LLVM_PREFIX=$(llvm-config-$LLVM_VERSION --prefix)" >> $GITHUB_ENV
echo "CC=clang-$LLVM_VERSION" >> $GITHUB_ENV
echo "CXX=clang++-$LLVM_VERSION" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v5
- name: Add workspace as safe directory (necessary for docker)
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Build dependencies
run: |
cmake -G Ninja -S dependencies -B dependencies/build -DUSE_EXTERNAL_LLVM=ON "-DCMAKE_PREFIX_PATH:FILEPATH=$LLVM_PREFIX" -DCMAKE_BUILD_TYPE=Release
cmake --build dependencies/build
- name: Build project
run: |
cmake -G Ninja -B build "-DCMAKE_PREFIX_PATH:FILEPATH=$PWD/dependencies/install" -DCMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build build
- name: Run example
run: |
build/remill-example
macos:
# Skip building pull requests from the same repository
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) }}
runs-on: macos-latest
steps:
- name: Install LLVM
run: |
brew install llvm@19
LLVM_PREFIX=$(brew --prefix llvm@19)
echo "LLVM_PREFIX=$LLVM_PREFIX" >> $GITHUB_ENV
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v5
- name: Build dependencies
run: |
cmake -G Ninja -S dependencies -B dependencies/build -DUSE_EXTERNAL_LLVM=ON "-DCMAKE_PREFIX_PATH:FILEPATH=$LLVM_PREFIX" -DCMAKE_BUILD_TYPE=Release
cmake --build dependencies/build
- name: Build project
run: |
cmake -G Ninja -B build "-DCMAKE_PREFIX_PATH:FILEPATH=$PWD/dependencies/install" -DCMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build build
- name: Run example
run: |
build/remill-example
windows:
# Skip building pull requests from the same repository
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) }}
runs-on: windows-latest
steps:
- name: Visual Studio Developer Command Prompt
uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756
- name: Checkout
uses: actions/checkout@v5
- name: Install LLVM
run: |
curl.exe -L -o llvm.7z https://github.com/LLVMParty/remill-template/releases/download/llvm-prebuild/llvm-19.1.6-install.7z
7z x llvm.7z -ollvm-install
echo "LLVM_PREFIX=$PWD/llvm-install" >> $env:GITHUB_ENV
echo "CC=clang.exe" >> $env:GITHUB_ENV
echo "CXX=clang++.exe" >> $env:GITHUB_ENV
shell: pwsh
- name: Build dependencies
run: |
cmake -G Ninja -S dependencies -B dependencies/build -DUSE_EXTERNAL_LLVM=ON "-DCMAKE_PREFIX_PATH:FILEPATH=$env:LLVM_PREFIX" -DCMAKE_BUILD_TYPE=Release
cmake --build dependencies/build
shell: pwsh
- name: Build project
run: |
cmake -G Ninja -B build "-DCMAKE_PREFIX_PATH:FILEPATH=$PWD/dependencies/install" -DCMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build build
shell: pwsh
- name: Run example
run: |
build/remill-example.exe
shell: pwsh