Skip to content

Commit

Permalink
Add a meson build system
Browse files Browse the repository at this point in the history
  • Loading branch information
amontoison authored Jun 13, 2024
1 parent ab635f7 commit bc0e47b
Show file tree
Hide file tree
Showing 59 changed files with 700 additions and 70 deletions.
48 changes: 48 additions & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
task:
matrix:
- name: Meson / freebsd/gcc-12/Int32
freebsd_instance:
image: freebsd-13-3-release-amd64
env:
- INT64: "false"
- name: Meson / freebsd/gcc-12/Int64
freebsd_instance:
image: freebsd-13-3-release-amd64
env:
- INT64: "true"
- name: Meson / macos-silicon/gcc-14/Int32
macos_instance:
image: ghcr.io/cirruslabs/macos-ventura-base:latest
env:
- INT64: "false"
- name: Meson / macos-silicon/gcc-14/Int64
macos_instance:
image: ghcr.io/cirruslabs/macos-ventura-base:latest
env:
- INT64: "true"
dependencies_script: |
echo $(uname)
if [ "$(uname)" = "FreeBSD" ]; then
pkg install -y py39-pip meson bash gcc12
else
brew install python meson gcc@14
fi
configure_script: |
if [ "$(uname -s)" = "FreeBSD" ]; then
FC=gfortran12 CC=gcc12 CXX=g++12 meson setup builddir -Dcutest_int64=${INT64} \
-Dquadruple=true \
--prefix=${CIRRUS_WORKING_DIR}/../meson
else
FC=gfortran-14 CC=gcc-14 CXX=g++-14 meson setup builddir -Dcutest_int64=${INT64} \
-Dquadruple=true \
--prefix=${CIRRUS_WORKING_DIR}/../meson
fi
build_script: |
meson compile -C builddir
install_script: |
meson install -C builddir
test_script: |
meson test -C builddir
on_failure:
log_artifacts:
path: builddir/meson-logs/*log.txt
115 changes: 115 additions & 0 deletions .github/workflows/meson.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: Meson
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
name: ${{ matrix.os }}/${{ matrix.compiler }}-v${{ matrix.version }}/Int${{ matrix.int }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-13]
arch: ['x64']
version: ['11']
int: ['32', '64']
include:
- compiler: gcc
- os: ubuntu-latest
compiler: intel-classic
version: '2021.10'
int: '32'
- os: ubuntu-latest
compiler: intel-classic
version: '2021.10'
int: '64'
- os: windows-latest
compiler: intel
version: '2023.2'
int: '32'
- os: windows-latest
compiler: intel
version: '2023.2'
int: '64'
- os: ubuntu-latest
compiler: intel
version: '2023.2'
int: '32'
- os: ubuntu-latest
compiler: intel
version: '2023.2'
int: '64'
# - os: ubuntu-latest
# compiler: nvidia-hpc
# version: '24.05'
runs-on: ${{ matrix.os }}
steps:
- name: Check out CUTEST
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install Meson and Ninja
run: pip install meson ninja

- name: Set the environment variables CUTEST
shell: bash
run: echo "CUTEST=$GITHUB_WORKSPACE" >> $GITHUB_ENV

- name: Install compilers
uses: fortran-lang/setup-fortran@main
with:
compiler: ${{ matrix.compiler }}
version: ${{ matrix.version }}

# Uncomment this section to obtain ssh access to VM
# - name: Setup tmate session
# if: matrix.os == 'macos-13'
# uses: mxschmitt/action-tmate@v3

- name: Setup CUTEST
shell: bash
run: |
INT64="false"
if [[ "${{matrix.int}}" == "64" ]]; then
INT64="true"
fi
meson setup builddir --buildtype=debug \
--prefix=$GITHUB_WORKSPACE/cutest \
-Dquadruple=true \
-Dcutest_int64=$INT64
- name: Build CUTEST
shell: bash
run: |
meson compile -C builddir
- uses: actions/upload-artifact@v3
if: failure()
with:
name: ${{ matrix.os }}_${{ matrix.compiler }}-v${{ matrix.version }}_Int${{ matrix.int }}_meson-log.txt
path: builddir/meson-logs/meson-log.txt

- name: Install CUTEST
shell: bash
run: |
meson install -C builddir
- uses: actions/upload-artifact@v3
if: failure()
with:
name: ${{ matrix.os }}_${{ matrix.compiler }}-v${{ matrix.version }}_Int${{ matrix.int }}_install-log.txt
path: builddir/meson-logs/install-log.txt

- name: Test CUTEST
shell: bash
run: |
meson test -C builddir
- uses: actions/upload-artifact@v3
if: failure()
with:
name: ${{ matrix.os }}_${{ matrix.compiler }}-v${{ matrix.version }}_Int${{ matrix.int }}_testlog.txt
path: builddir/meson-logs/testlog.txt
68 changes: 0 additions & 68 deletions .travis.yml

This file was deleted.

27 changes: 27 additions & 0 deletions install_modules.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env python3
# Initially proposed by Sebastian Ehlert (@awvwgk)
from os import environ, listdir, makedirs, walk
from os.path import join, isdir, exists
from sys import argv
from shutil import copy

build_dir = environ["MESON_BUILD_ROOT"]
if "MESON_INSTALL_DESTDIR_PREFIX" in environ:
install_dir = environ["MESON_INSTALL_DESTDIR_PREFIX"]
else:
install_dir = environ["MESON_INSTALL_PREFIX"]

include_dir = "modules"
module_dir = join(install_dir, include_dir)

modules = []
# finds $build_dir/**/*.mod and $build_dir/**/*.smod
for root, dirs, files in walk(build_dir):
modules += [join(root, f) for f in files if f.endswith(".mod") or f.endswith(".smod")]

if not exists(module_dir):
makedirs(module_dir)

for mod in modules:
print("Installing", mod, "to", module_dir)
copy(mod, module_dir)
Loading

0 comments on commit bc0e47b

Please sign in to comment.