Use conan for deps #573
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: push | |
| env: | |
| BUILD_TYPE: Release | |
| EM_VERSION: 3.1.35 | |
| EM_CACHE_FOLDER: 'emsdk-cache' | |
| CONAN_USER_HOME: "conan" | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: | |
| - { name: Ubuntu GCC, os: ubuntu-latest, compiler: g++, arch: "64", cmakepp: "", suffix: "", flags: ""} | |
| - { name: Ubuntu Clang, os: ubuntu-latest, compiler: clang++, arch: "64", cmakepp: "", suffix: "", flags: ""} | |
| - { name: Windows 32, os: windows-latest, compiler: vs2019, arch: "32", cmakepp: "", suffix: "", flags: "-A Win32"} | |
| - { name: Windows 64, os: windows-latest, compiler: vs2019, arch: "64", cmakepp: "", suffix: "", flags: "-A x64"} | |
| - { name: MacOS, os: macos-latest, compiler: clang++, arch: "64", cmakepp: "", suffix: "", flags: ""} | |
| - { name: WebAssembly, os: ubuntu-latest, compiler: em++, arch: "32", cmakepp: "emcmake", suffix: "-emscripten", flags: "-DCMAKE_FIND_ROOT_PATH=/ -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 | |
| if: matrix.platform.compiler != 'em++' | |
| id: cache-conan-packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{env.CONAN_USER_HOME}} | |
| key: ${{matrix.platform.name}}-${{matrix.compiler}} | |
| - name: Get Conan dependencies | |
| if: matrix.platform.compiler != 'em++' | |
| shell: bash | |
| run: | |
| pip install conan | |
| conan profile detect --force | |
| conan create conan/observable_unique_ptr | |
| sudo conan install . --build=missing -c tools.system.package_manager:mode=install -c tools.system.package_manager:sudo=true --output-folder dependencies | |
| - name: Setup Emscripten | |
| if: matrix.platform.compiler == 'em++' | |
| uses: mymindstorm/setup-emsdk@v14 | |
| with: | |
| version: ${{env.EM_VERSION}} | |
| actions-cache-folder: ${{env.EM_CACHE_FOLDER}} | |
| - name: Create Build Environment | |
| run: cmake -E make_directory ${{github.workspace}}/build | |
| - name: Get Emscripten dependencies | |
| if: matrix.platform.compiler == 'em++' | |
| shell: bash | |
| working-directory: ${{github.workspace}}/dependencies | |
| run: unzip wasm.zip | |
| - name: Configure CMake | |
| shell: bash | |
| working-directory: ${{github.workspace}}/build | |
| run: ${{matrix.platform.cmakepp}} cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DLXGUI_BUILD_EXAMPLES=0 -DCMAKE_PREFIX_PATH=`pwd`/../dependencies -DCMAKE_INSTALL_PREFIX=`pwd`/../dependencies ${{matrix.platform.flags}} | |
| - name: Build | |
| shell: bash | |
| working-directory: ${{github.workspace}}/build | |
| run: cmake --build . --config ${BUILD_TYPE} --parallel 2 | |
| - name: Install | |
| shell: bash | |
| working-directory: ${{github.workspace}}/build | |
| run: cmake --install . --config ${BUILD_TYPE} | |
| - name: Build example SDL | |
| shell: bash | |
| working-directory: ${{github.workspace}}/build | |
| run: | | |
| rm -rf * | |
| ${{matrix.platform.cmakepp}} cmake ../examples/sdl${{matrix.platform.suffix}} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_PREFIX_PATH=`pwd`/../dependencies ${{matrix.platform.flags}} | |
| cmake --build . --config ${BUILD_TYPE} --parallel 2 | |
| - name: Build example OpenGL-SDL | |
| shell: bash | |
| working-directory: ${{github.workspace}}/build | |
| run: | | |
| rm -rf * | |
| ${{matrix.platform.cmakepp}} cmake ../examples/opengl-sdl${{matrix.platform.suffix}} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_PREFIX_PATH=`pwd`/../dependencies ${{matrix.platform.flags}} | |
| 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 * | |
| ${{matrix.platform.cmakepp}} cmake ../examples/sfml${{matrix.platform.suffix}} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_PREFIX_PATH=`pwd`/../dependencies ${{matrix.platform.flags}} | |
| 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 * | |
| ${{matrix.platform.cmakepp}} cmake ../examples/opengl-sfml${{matrix.platform.suffix}} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_PREFIX_PATH=`pwd`/../dependencies ${{matrix.platform.flags}} | |
| 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 |