Skip to content

Commit

Permalink
[build] Add vcpkg to the build pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
sorbatdev committed Aug 18, 2024
1 parent 64f7482 commit 738191b
Showing 1 changed file with 72 additions and 33 deletions.
105 changes: 72 additions & 33 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,41 +19,80 @@ jobs:

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: |
$VCPKG_ROOT/vcpkg install
- name: Cache vcpkg packages
uses: actions/cache@v3
with:
path: $VCPKG_ROOT/vcpkg_installed
key: ${{ runner.os }}-vcpkg-${{ hashFiles('vcpkg.json') }}
restore-keys: |
${{ runner.os }}-vcpkg-
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
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
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
# linux-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: ubuntu-latest
#
# steps:
# - uses: actions/checkout@v3
#
# - name: Install dependencies
# run: sudo apt-get install xorg-dev
#
# - name: Upgrade packages
# run: sudo apt-get update && sudo apt-get upgrade
#
# - name: Get GCC12
# run: sudo apt-get install gcc-12 g++-12
#
# - name: Configure CMake
# # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
# run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
# env:
# CC: gcc-12
# CXX: g++-12
#
# - name: Build
# # Build your program with the given configuration
# run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}

0 comments on commit 738191b

Please sign in to comment.