enable shared/static builds #584
Workflow file for this run
This file contains 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: Build | |
on: [push, pull_request] | |
env: | |
BUILD_TYPE: Release | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-22.04, macos-13, windows-2022] | |
shared_libs: ['ON', 'OFF'] | |
include: | |
- os: ubuntu-22.04 | |
package_manager: "apt" | |
test: "ON" | |
- os: macos-13 | |
package_manager: "brew" | |
test: "OFF" | |
- os: windows-2022 | |
package_manager: "vcpkg" | |
test: "OFF" | |
steps: | |
- name: Checkout Pangolin | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: "(vcpkg only) Install Microsoft Visual C++" | |
if: ${{ matrix.package_manager == 'vcpkg' }} | |
uses: ilammy/msvc-dev-cmd@v1 | |
- name: "(vcpkg only) Restore any cached ports" | |
uses: lukka/run-vcpkg@v11 | |
if: ${{ matrix.package_manager == 'vcpkg' }} | |
with: | |
vcpkgDirectory: '${{github.workspace}}/scripts/vcpkg' | |
- name: "(vcpkg only) Setup CMake Toolchain file" | |
if: ${{ matrix.package_manager == 'vcpkg' }} | |
run: | | |
export TOOLCHAIN_FILE="${{github.workspace}}/scripts/vcpkg/scripts/buildsystems/vcpkg.cmake" | |
echo "${{github.workspace}}/scripts/vcpkg" >> $GITHUB_PATH | |
echo "TOOLCHAIN_FILE=$TOOLCHAIN_FILE" >> $GITHUB_ENV | |
- name: Install Dependencies | |
run: | | |
echo "vcpkg location: $(which vcpkg)" | |
echo "CMake toolchain file: $TOOLCHAIN_FILE" | |
$GITHUB_WORKSPACE/scripts/install_prerequisites.sh -v -u -m ${{matrix.package_manager}} all | |
- name: Configure CMake | |
run: > | |
cmake -G Ninja -B build | |
-D CMAKE_BUILD_TYPE=$BUILD_TYPE | |
-D CMAKE_TOOLCHAIN_FILE="$TOOLCHAIN_FILE" | |
-D BUILD_SHARED_LIBS=${{ matrix.shared_libs }} | |
-D BUILD_TESTS=${{ matrix.test }} | |
- name: Build | |
run: cmake --build build --config $BUILD_TYPE | |
- name: Run all tests | |
if: ${{ matrix.test == 'ON' }} | |
run: | | |
cmake --build build --target test | |
emscripten: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout Pangolin | |
uses: actions/checkout@v4 | |
- name: install build dependencies | |
run: | | |
sudo apt update | |
sudo apt install -y emscripten ninja-build libeigen3-dev catch2 | |
- name: Configure Pangolin | |
run: emcmake cmake -G Ninja -B pangolin-build -D CMAKE_BUILD_TYPE=$BUILD_TYPE -D Eigen3_DIR=/usr/share/eigen3/cmake/ | |
- name: Build Pangolin | |
run: cmake --build pangolin-build | |
- name: Copy Examples to www folder | |
run: | | |
mkdir -p ${{runner.workspace}}/www/emscripten | |
rsync -zarvm --include="*/" --include="*.html" --include="*.js" --include="*.wasm" --exclude="*" pangolin-build/examples ${{runner.workspace}}/www/emscripten | |
- name: Copy README to www folder | |
run: | | |
cp "${{github.workspace}}/README.md" "${{runner.workspace}}/www/index.md" | |
- name: Deploy Examples to GitHub Pages (for pushes to master) | |
if: success() && (github.ref == 'refs/heads/master') | |
uses: crazy-max/ghaction-github-pages@v4 | |
with: | |
target_branch: gh-pages | |
keep_history: true | |
# build_dir path relative to ${{runner.workspace}}/Pangolin | |
build_dir: ../www | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |