V2.0.0 #167
Workflow file for this run
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: CMake | |
| on: | |
| push: | |
| branches: ["master"] | |
| pull_request: | |
| branches: ["master"] | |
| env: | |
| BUILD_TYPE: Release | |
| jobs: | |
| test: | |
| name: ${{ matrix.os }} / ${{ matrix.compiler }} / shared=${{ matrix.shared }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| compiler: gcc | |
| version: '14' | |
| shared: false | |
| - os: ubuntu-latest | |
| compiler: gcc | |
| version: '14' | |
| shared: true | |
| - os: ubuntu-latest | |
| compiler: gcc | |
| version: '15' | |
| shared: false | |
| - os: ubuntu-latest | |
| compiler: gcc | |
| version: '15' | |
| shared: true | |
| - os: ubuntu-latest | |
| compiler: intel | |
| version: '2023.2' | |
| shared: false | |
| - os: ubuntu-latest | |
| compiler: intel | |
| version: '2023.2' | |
| shared: true | |
| - os: macos-latest | |
| compiler: gcc | |
| version: '14' | |
| shared: false | |
| - os: macos-latest | |
| compiler: gcc | |
| version: '14' | |
| shared: true | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: fortran-lang/setup-fortran@v1 | |
| id: setup-fortran | |
| with: | |
| compiler: ${{ matrix.compiler }} | |
| version: ${{ matrix.version }} | |
| - name: Show Fortran compiler version | |
| run: ${{ env.FC }} --version | |
| env: | |
| FC: ${{ steps.setup-fortran.outputs.fc }} | |
| CC: ${{ steps.setup-fortran.outputs.cc }} | |
| - name: Install BLAS/LAPACK dependencies | |
| run: | | |
| if [ "${{ runner.os }}" = "Linux" ]; then | |
| sudo apt-get update | |
| sudo apt-get install -y libblas-dev liblapack-dev | |
| elif [ "${{ runner.os }}" = "macOS" ]; then | |
| brew update | |
| brew install openblas | |
| fi | |
| - name: Configure CMake | |
| run: >- | |
| cmake -S . -B build | |
| -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} | |
| -DCMAKE_Fortran_COMPILER=${{ env.FC }} | |
| -DCMAKE_C_COMPILER=${{ env.CC }} | |
| -DBUILD_TESTING=TRUE | |
| -DBUILD_SHARED_LIBS=${{ matrix.shared && 'TRUE' || 'FALSE' }} | |
| env: | |
| FC: ${{ steps.setup-fortran.outputs.fc }} | |
| CC: ${{ steps.setup-fortran.outputs.cc }} | |
| - name: Build with CMake | |
| run: cmake --build build --config ${{ env.BUILD_TYPE }} | |
| - name: Test with CMake | |
| working-directory: build | |
| run: ctest --output-on-failure -C ${{ env.BUILD_TYPE }} | |
| - name: Install with CMake | |
| run: cmake --install build --prefix ${{ github.workspace }}/install --config ${{ env.BUILD_TYPE }} | |
| - name: Verify install with CMake consumer | |
| run: | | |
| mkdir -p consumer | |
| cat > consumer/CMakeLists.txt <<'EOF' | |
| cmake_minimum_required(VERSION 3.24) | |
| project(linalg_consumer LANGUAGES Fortran) | |
| find_package(linalg CONFIG REQUIRED) | |
| add_executable(linalg_consumer main.f90) | |
| target_link_libraries(linalg_consumer PRIVATE linalg::linalg) | |
| EOF | |
| cat > consumer/main.f90 <<'EOF' | |
| program main | |
| use linalg | |
| print *, "linalg package found" | |
| end program main | |
| EOF | |
| cmake -S consumer -B consumer/build -DCMAKE_PREFIX_PATH=${{ github.workspace }}/install | |
| cmake --build consumer/build |