You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
81 lines
1.8 KiB
YAML
81 lines
1.8 KiB
YAML
name: CMake Build
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
install_prefix:
|
|
description: 'CMake install prefix (relative to workspace)'
|
|
default: 'install'
|
|
required: true
|
|
build_type:
|
|
description: 'CMake build type'
|
|
default: 'Release'
|
|
required: true
|
|
run_install_only:
|
|
description: 'Run only install step'
|
|
default: 'false'
|
|
required: true
|
|
|
|
push:
|
|
branches:
|
|
- cmake
|
|
- test_dev
|
|
|
|
pull_request:
|
|
branches:
|
|
- cmake
|
|
- test_dev
|
|
|
|
env:
|
|
BUILD_TYPE: Release
|
|
INSTALL_PREFIX: ${{ github.workspace }}/install
|
|
RUN_INSTALL_ONLY: false
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up dependencies
|
|
run: |
|
|
sudo apt update
|
|
sudo apt install -y \
|
|
cmake \
|
|
build-essential \
|
|
gfortran \
|
|
mpich \
|
|
libmpich-dev \
|
|
libopenblas-dev \
|
|
liblapack-dev
|
|
|
|
- name: Check MPI installation
|
|
run: |
|
|
mpicc --version
|
|
mpifort --version
|
|
which mpicc
|
|
which mpifort
|
|
|
|
- name: Configure and Build
|
|
if: ${{ env.RUN_INSTALL_ONLY != 'true' }}
|
|
run: |
|
|
# Export MPI compilers
|
|
export CC=mpicc
|
|
export CXX=mpicxx
|
|
export FC=mpifort
|
|
export F77=mpifort
|
|
|
|
# Configure CMake
|
|
cmake -S . -B build \
|
|
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
|
|
-DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX \
|
|
-DCMAKE_Fortran_COMPILER=$FC \
|
|
-DCMAKE_C_COMPILER=$CC \
|
|
-DMPI_C_COMPILER=$CC \
|
|
-DMPI_Fortran_COMPILER=$FC \
|
|
-DMPI_Fortran_INCLUDE_DIR=$MPI_Fortran_INCLUDE_DIR
|
|
|
|
# Build
|
|
cmake --build build -- -j$(nproc)
|