Skip to content

CMake: allow use of installed dependencies, take 2 #1039

CMake: allow use of installed dependencies, take 2

CMake: allow use of installed dependencies, take 2 #1039

name: CI - Linux/OSX/Windows - Conda
on:
push:
pull_request:
jobs:
build-with-conda:
name: '[conda:${{ matrix.os }}:${{ matrix.build_type }}:c++${{ matrix.cxx_std }}]'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
build_type: [Release, Debug]
name: [ubuntu-latest, macos-latest, windows-2019-clang-cl, windows-latest, macos-14]
cxx_std: [17, 20]
continue_on_error: [false]
include:
- name: ubuntu-latest
os: ubuntu-latest
- name: macos-latest
os: macos-latest
- name: macos-14
os: macos-14
- name: windows-2019-clang-cl
os: windows-2019
compiler: clang-cl
- name: windows-latest
os: windows-latest
- name: macos-latest
os: macos-latest
build_type: Release
cxx_std: 14
- name: macos-latest
os: macos-latest
build_type: Debug
cxx_std: 17
continue_on_error: true
- name: macos-latest
os: macos-latest
build_type: Debug
cxx_std: 20
continue_on_error: true
exclude:
- name: macos-latest
build_type: Debug
cxx_std: 17
continue_on_error: false
- name: macos-latest
build_type: Debug
cxx_std: 20
continue_on_error: false
steps:
- uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v2
if: matrix.os != 'macos-14'
with:
miniforge-variant: Mambaforge
miniforge-version: latest
channels: conda-forge
python-version: "3.10"
activate-environment: proxsuite
- uses: conda-incubator/setup-miniconda@v3
if: matrix.os == 'macos-14'
with:
channels: conda-forge
python-version: "3.10"
activate-environment: proxsuite
installer-url: https://github.com/conda-forge/miniforge/releases/download/23.11.0-0/Mambaforge-23.11.0-0-MacOSX-arm64.sh
- name: Install dependencies [Conda]
shell: bash -l {0}
run: |
# Workaround for https://github.com/conda-incubator/setup-miniconda/issues/186
conda config --remove channels defaults
# Compilation related dependencies
mamba install cmake compilers make pkg-config doxygen ninja graphviz
# Main dependencies
mamba install eigen simde
# Test dependencies
mamba install libmatio numpy scipy
- name: Install julia [macOS/Linux]
if: contains(matrix.os, 'macos-latest') || contains(matrix.os, 'ubuntu')
shell: bash -l {0}
run: |
mamba install julia
- name: Activate ccache [Conda]
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ matrix.os }}-${{ matrix.type }}-${{ matrix.cxx_std }}
max-size: 1G
- name: Print environment [Conda]
shell: bash -l {0}
run: |
conda info
mamba list
env
- name: Configure [Conda/Linux&macOS]
if: contains(matrix.os, 'macos-latest') || contains(matrix.os, 'ubuntu')
shell: bash -l {0}
run: |
echo $(whereis ccache)
echo $(which ccache)
git submodule update --init
mkdir build
cd build
cmake .. -GNinja -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_STANDARD=${{ matrix.cxx_std }} -DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DBUILD_PYTHON_INTERFACE:BOOL=ON -DPYTHON_EXECUTABLE=$(which python3) -DBUILD_DOCUMENTATION:BOOL=ON -DINSTALL_DOCUMENTATION:BOOL=ON -DTEST_JULIA_INTERFACE:BOOL=ON -DOpenMP_ROOT=$CONDA_PREFIX
- name: Configure [Conda/macOS14]
if: contains(matrix.os, 'macos-14')
shell: bash -l {0}
run: |
echo $(whereis ccache)
echo $(which ccache)
git submodule update --init
mkdir build
cd build
cmake .. -GNinja -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_STANDARD=${{ matrix.cxx_std }} -DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DBUILD_PYTHON_INTERFACE:BOOL=ON -DPYTHON_EXECUTABLE=$(which python3) -DBUILD_DOCUMENTATION:BOOL=ON -DINSTALL_DOCUMENTATION:BOOL=ON -DTEST_JULIA_INTERFACE:BOOL=OFF -DOpenMP_ROOT=$CONDA_PREFIX
- name: Configure [Conda/macOS-debug/CheckMalloc]
if: contains(matrix.os, 'macos-latest') && contains(matrix.build_type, 'Debug')
shell: bash -l {0}
run: |
echo $(whereis ccache)
echo $(which ccache)
cd build
cmake .. -GNinja -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCHECK_RUNTIME_MALLOC:BOOL=ON -DCMAKE_CXX_STANDARD=${{ matrix.cxx_std }} -DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DBUILD_PYTHON_INTERFACE:BOOL=ON -DPYTHON_EXECUTABLE=$(which python3) -DBUILD_DOCUMENTATION:BOOL=ON -DINSTALL_DOCUMENTATION:BOOL=ON -DTEST_JULIA_INTERFACE:BOOL=ON -DBUILD_WITH_OPENMP_SUPPORT:BOOL=ON -DOpenMP_ROOT=$CONDA_PREFIX
- name: Configure [Conda/Windows-2019]
if: contains(matrix.os, 'windows-2019')
shell: bash -l {0}
run: |
echo $(where ccache)
ls C:\\Miniconda3\\envs\\proxsuite\\Library\\lib
git submodule update --init
mkdir build
cd build
cmake .. -G"Visual Studio 16 2019" -T "ClangCl" -DCMAKE_GENERATOR_PLATFORM=x64 -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX}/Library -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_CXX_STANDARD=${{ matrix.cxx_std }} -DBUILD_PYTHON_INTERFACE:BOOL=ON -DPYTHON_SITELIB=${CONDA_PREFIX}/Lib/site-packages -DPYTHON_EXECUTABLE=${CONDA_PREFIX}/python.exe -DOpenMP_ROOT=$CONDA_PREFIX -DBUILD_WITH_OPENMP_SUPPORT:BOOL=ON -DLINK_PYTHON_INTERFACE_TO_OPENMP:BOOL=ON -DBUILD_DOCUMENTATION:BOOL=ON -DINSTALL_DOCUMENTATION:BOOL=ON
- name: Configure [Conda/Windows-latest]
if: contains(matrix.os, 'windows-latest') && contains(matrix.cxx_std, '20')
shell: bash -l {0}
run: |
echo $(where ccache)
ls C:\\Miniconda3\\envs\\proxsuite\\Library\\lib
git submodule update --init
mkdir build
cd build
cmake .. -G"Visual Studio 17 2022" -T "ClangCl" -DCMAKE_GENERATOR_PLATFORM=x64 -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX}/Library -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_CXX_STANDARD=${{ matrix.cxx_std }} -DBUILD_PYTHON_INTERFACE:BOOL=ON -DPYTHON_SITELIB=${CONDA_PREFIX}/Lib/site-packages -DPYTHON_EXECUTABLE=${CONDA_PREFIX}/python.exe -DOpenMP_ROOT=$CONDA_PREFIX -DBUILD_WITH_OPENMP_SUPPORT:BOOL=ON -DLINK_PYTHON_INTERFACE_TO_OPENMP:BOOL=ON -DBUILD_DOCUMENTATION:BOOL=ON -DINSTALL_DOCUMENTATION:BOOL=ON
- name: Configure [Conda/Windows-latest]
if: contains(matrix.os, 'windows-latest') && contains(matrix.cxx_std, '17')
shell: bash -l {0}
run: |
echo $(where ccache)
ls C:\\Miniconda3\\envs\\proxsuite\\Library\\lib
git submodule update --init
mkdir build
cd build
cmake .. -G"Visual Studio 17 2022" -T "v143" -DCMAKE_GENERATOR_PLATFORM=x64 -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX}/Library -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_CXX_STANDARD=${{ matrix.cxx_std }} -DBUILD_PYTHON_INTERFACE:BOOL=ON -DPYTHON_SITELIB=${CONDA_PREFIX}/Lib/site-packages -DPYTHON_EXECUTABLE=${CONDA_PREFIX}/python.exe -DOpenMP_ROOT=$CONDA_PREFIX -DBUILD_WITH_OPENMP_SUPPORT:BOOL=ON -DLINK_PYTHON_INTERFACE_TO_OPENMP:BOOL=ON -DBUILD_DOCUMENTATION:BOOL=ON -DINSTALL_DOCUMENTATION:BOOL=ON
- name: Build [Conda]
shell: bash -l {0}
run: |
cd build
cmake --build . --config ${{ matrix.build_type }} -v -j 1
- name: Build documentation [Conda]
shell: bash -l {0}
run: |
cd build
cmake --build . --config ${{ matrix.build_type }} --target doc
- name: Install [Conda]
shell: bash -l {0}
run: |
cd build
cmake --install . --config ${{ matrix.build_type }}
- name: Test [Conda]
continue-on-error: ${{ matrix.continue_on_error }}
shell: bash -l {0}
run: |
find $CONDA_PREFIX -name proxsuite*
python -c "import proxsuite"
cd build
ctest --output-on-failure -C ${{ matrix.build_type }}
# - name: Test pkg-config [Conda]
# shell: bash -l {0}
# run: |
# cd build
# export PKG_CONFIG_PATH=$CONDA_PREFIX/lib/pkgconfig
# pkg-config --cflags proxsuite
# g++ -std=c++17 examples/cpp/overview-simple.cpp -o overview-simple $(pkg-config --cflags proxsuite)
# ./overview-simple
- name: Test CMake packaging [Conda/Linux&macOS]
if: contains(matrix.os, 'macos') || contains(matrix.os, 'ubuntu')
shell: bash -l {0}
run: |
cd test/packaging/cmake
mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DPACKAGE_PREFIX_DIR=${CONDA_PREFIX}
cmake --build . --config ${{ matrix.build_type }} --target all
./run-proxqp
- name: Uninstall [Conda]
shell: bash -l {0}
run: |
cd build
cmake --build . --config ${{ matrix.build_type }} --target uninstall
- name: Display ccache statistics [Conda]
shell: bash -l {0}
run: |
echo $(ccache -s)
check:
if: always()
name: check-ci-linux-osx-win-conda
needs:
- build-with-conda
runs-on: Ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}