Skip to content

Handle third-party libraries with vcpkg #182

Handle third-party libraries with vcpkg

Handle third-party libraries with vcpkg #182

Workflow file for this run

name: CMake
on:
push:
branches: [ master, project]
pull_request:
branches: [ master, project]
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
jobs:
win-build:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Set up vpckg
run: |
git clone https://github.com/microsoft/vcpkg.git
.\vcpkg\bootstrap-vcpkg.bat
echo "VCPKG_ROOT=$(pwd)\\vcpkg" >> $env:GITHUB_ENV
- name: Install vcpkg dependencies
run: |
$vcpkgPath = Join-Path $env:VCPKG_ROOT "vcpkg.exe"
& $vcpkgPath install
- name: Cache vcpkg packages
uses: actions/cache@v4
with:
path: vcpkg_installed
key: ${{ runner.os }}-vcpkg-${{ hashFiles('vcpkg.json') }}
restore-keys: |
${{ runner.os }}-vcpkg-
- name: Configure CMake
run: |
cmake . `
-B ${{github.workspace}}\\build `
-D CMAKE_TOOLCHAIN_FILE=${{github.workspace}}\\CMake\\cache_entries.cmake `
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
- name: Build
run: cmake --build ${{github.workspace}}\build --config ${{env.BUILD_TYPE}}
linux-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Upgrade packages
run: sudo apt-get update && sudo apt-get upgrade
- name: Install dependencies
run: |
sudo apt install -y \
libxinerama-dev \
libxcursor-dev \
xorg-dev \
libglu1-mesa-dev \
pkg-config
- name: Set up vcpkg
run: |
git clone https://github.com/microsoft/vcpkg.git
./vcpkg/bootstrap-vcpkg.sh
echo "VCPKG_ROOT=$(pwd)/vcpkg" >> $GITHUB_ENV
- name: Install vcpkg dependencies
run: |
$env:VCPKG_ROOT/vcpkg install
- name: Cache vcpkg packages
uses: actions/cache@v3
with:
path: $env:VCPKG_ROOT/vcpkg_installed
key: ${{ runner.os }}-vcpkg-${{ hashFiles('vcpkg.json') }}
restore-keys: |
${{ runner.os }}-vcpkg-
- name: Configure CMake
run: |
cmake . \
-B ${{github.workspace}}/build \
-D CMAKE_TOOLCHAIN_FILE=${{github.workspace}}\\CMake\\cache_entries.cmake \
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
env:
CC: clang-15
CXX: clang-15
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}