Skip to content

Use conan for deps #575

Use conan for deps

Use conan for deps #575

Workflow file for this run

name: CI
on: push
env:
BUILD_TYPE: Release
CONAN_USER_HOME: 'conan-cache'
jobs:
build:
strategy:
fail-fast: false
matrix:
platform:
- name: Ubuntu GCC
os: ubuntu-latest
compiler: g++
arch: "64"
suffix: ""
cmake-flags: ""
- name: Ubuntu Clang
os: ubuntu-latest
compiler: clang++
arch: "64"
suffix: ""
cmake-flags: ""
- name: Windows
os: windows-latest
compiler: msvc
arch: "64"
suffix: ""
cmake-flags: ""
- name: MacOS
os: macos-latest
compiler: clang++
arch: "64"
suffix: ""
cmake-flags: ""
- name: WebAssembly
os: ubuntu-latest
compiler: em++
arch: "32"
suffix: "-emscripten"
cmake-flags: "-DLXGUI_BUILD_GUI_SFML_IMPL=OFF -DLXGUI_BUILD_INPUT_SFML_IMPL=OFF -DLXGUI_TEST_IMPLEMENTATION=OPENGL_SDL"
name: ${{matrix.platform.name}}
runs-on: ${{matrix.platform.os}}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Setup Clang
if: matrix.platform.compiler == 'clang++' && matrix.platform.os == 'ubuntu-latest'
run: |
sudo apt install clang
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV
- name: Setup Conan cache
id: cache-conan-packages
uses: actions/cache@v4
with:
path: ${{env.CONAN_USER_HOME}}
key: ${{matrix.platform.name}}-${{matrix.compiler}}
- name: Get Conan dependencies
shell: bash
working-directory: ${{github.workspace}}
run: |
pip install conan
conan profile detect --force
conan create conan/observable_unique_ptr
-pr default \
-pr ./conan/profiles/${{matrix.platform.os}}-${{matrix.platform.arch}}-${{matrix.platform.compiler}}
conan install . \
--build=missing \
-c tools.system.package_manager:mode=install \
-c tools.system.package_manager:sudo=true \
--output-folder dependencies \
-pr:b default \
-pr:h default \
-pr:h ./conan/profiles/${{matrix.platform.os}}-${{matrix.platform.arch}}-${{matrix.platform.compiler}}
- name: Create Build Environment
run: cmake -E make_directory ${{github.workspace}}/build
- name: Configure CMake
shell: bash
working-directory: ${{github.workspace}}/build
run: |
source ../dependencies/conanbuild.sh
cmake .. \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DCMAKE_TOOLCHAIN_FILE=`pwd`/../dependencies/conan_toolchain.cmake \
-DLXGUI_BUILD_EXAMPLES=OFF \
-DLXGUI_DEV=ON \
-DCMAKE_INSTALL_PREFIX=`pwd`/../install \
${{matrix.platform.cmake-flags}}
- name: Build
shell: bash
working-directory: ${{github.workspace}}/build
run: |
source ../dependencies/conanbuild.sh
cmake --build . --config ${BUILD_TYPE} --parallel 2
- name: Install
shell: bash
working-directory: ${{github.workspace}}/build
run: |
source ../dependencies/conanbuild.sh
cmake --install . --config ${BUILD_TYPE}
- name: Build example SDL
shell: bash
working-directory: ${{github.workspace}}/build
run: |
rm -rf *
source ../dependencies/conanbuild.sh
cmake ../examples/sdl${{matrix.platform.suffix}} \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DCMAKE_TOOLCHAIN_FILE=`pwd`/../dependencies/conan_toolchain.cmake \
-DCMAKE_PREFIX_PATH=`pwd`/../install
cmake --build . --config ${BUILD_TYPE} --parallel 2
- name: Build example OpenGL-SDL
shell: bash
working-directory: ${{github.workspace}}/build
run: |
rm -rf *
source ../dependencies/conanbuild.sh
cmake ../examples/opengl-sdl${{matrix.platform.suffix}} \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DCMAKE_TOOLCHAIN_FILE=`pwd`/../dependencies/conan_toolchain.cmake \
-DCMAKE_PREFIX_PATH=`pwd`/../install
cmake --build . --config ${BUILD_TYPE} --parallel 2
- name: Build example SFML
if: matrix.platform.compiler != 'em++'
shell: bash
working-directory: ${{github.workspace}}/build
run: |
rm -rf *
source ../dependencies/conanbuild.sh
cmake ../examples/sfml${{matrix.platform.suffix}} \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DCMAKE_TOOLCHAIN_FILE=`pwd`/../dependencies/conan_toolchain.cmake \
-DCMAKE_PREFIX_PATH=`pwd`/../install
cmake --build . --config ${BUILD_TYPE} --parallel 2
- name: Build example OpenGL-SFML
if: matrix.platform.compiler != 'em++'
shell: bash
working-directory: ${{github.workspace}}/build
run: |
rm -rf *
source ../dependencies/conanbuild.sh
cmake ../examples/opengl-sfml${{matrix.platform.suffix}} \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DCMAKE_TOOLCHAIN_FILE=`pwd`/../dependencies/conan_toolchain.cmake \
-DCMAKE_PREFIX_PATH=`pwd`/../install
cmake --build . --config ${BUILD_TYPE} --parallel 2
- name: Prepare publish package
if: matrix.platform.compiler == 'em++' && github.ref == 'refs/heads/main'
shell: bash
working-directory: ${{github.workspace}}/bin
run: |
mkdir demo
cp lxgui-test*${{matrix.platform.suffix}}* demo/
- name: Publish
if: matrix.platform.compiler == 'em++' && github.ref == 'refs/heads/main'
uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: ${{github.workspace}}/bin/demo
target-folder: demo