Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 74 additions & 33 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,61 +2,102 @@ name: CMake

on:
push:
branches: [ "master" ]
branches: ["master"]
pull_request:
branches: [ "master" ]
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:
os: [ubuntu-latest, macos-latest]
toolchain:
- {compiler: gcc, version: 15}
- {compiler: gcc, version: 16}
- {compiler: intel, version: '2021.1'}
- {compiler: intel, version: '2022.0'}
- {compiler: intel, version: '2023.0'}
- {compiler: intel, version: '2024.0'}
exclude:
- os: macos-latest
toolchain: {compiler: gcc, version: 16}
- os: macos-latest
toolchain: {compiler: intel, version: '2022.0'}
- os: macos-latest
toolchain: {compiler: intel, version: '2023.0'}
include:
- 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
toolchain: {compiler: intel, version: '2024.0'}
compiler: gcc
version: '15'
shared: false
- os: macos-latest
toolchain: {compiler: intel, version: '2025.0'}
- os: ubuntu-latest
toolchain: {compiler: intel, version: 2021.1}
compiler: gcc
version: '15'
shared: true

steps:
- uses: fortran-lang/setup-fortran@v1.6.1
- uses: actions/checkout@v4

- uses: fortran-lang/setup-fortran@v1
id: setup-fortran
with:
compiler: ${{ matrix.toolchain.compiler }}
version: ${{ matrix.toolchain.version }}

- run: ${{ env.FC }} --version
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 }}

- uses: actions/checkout@v3

- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_Fortran_COMPILER=${{ env.FC }} -DBUILD_TESTING=TRUE

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 ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
run: cmake --build build --config ${{ env.BUILD_TYPE }}

- name: Test with CMake
working-directory: ${{github.workspace}}/build
run: ctest -C ${{env.BUILD_TYPE}}
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(fplot_consumer LANGUAGES Fortran)

find_package(fplot CONFIG REQUIRED)

add_executable(fplot_consumer main.f90)
target_link_libraries(fplot_consumer PRIVATE fplot::fplot)
EOF

cat > consumer/main.f90 <<'EOF'
program main
use fplot_core
print *, "fplot package found"
end program main
EOF

cmake -S consumer -B consumer/build -DCMAKE_PREFIX_PATH=${{ github.workspace }}/install
cmake --build consumer/build
134 changes: 67 additions & 67 deletions .github/workflows/fpm.yml
Original file line number Diff line number Diff line change
@@ -1,82 +1,82 @@
name: fpm

on: [push, pull_request]
on:
push:
branches: ["master"]
pull_request:
branches: ["master"]

jobs:
test_fpm:
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
name: ${{ matrix.os }}_${{ matrix.compiler }}_fpm
build-and-test:
name: ${{ matrix.os }} / ${{ matrix.compiler }} / shared=${{ matrix.shared }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- {os: ubuntu-latest, compiler: gfortran }
- {os: ubuntu-latest, compiler: ifx }
- {os: windows-latest, compiler: gfortran }
- {os: windows-latest, compiler: ifx, fpm-version: "0.12.0"}
- {os: macos-latest, compiler: gfortran }
- 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: true

steps:
- name: Setup Fortran
uses: gha3mi/setup-fortran-conda@latest
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Fortran toolchain
uses: fortran-lang/setup-fortran@v1
id: setup-fortran
with:
compiler: ${{ matrix.compiler }}
fpm-version: ${{ matrix.fpm-version }}

- name: fpm test (debug)
if: always()
run: fpm test --profile debug --compiler ${{ matrix.compiler }} --verbose

- name: fpm test (release)
if: always()
run: fpm test --profile release --compiler ${{ matrix.compiler }} --verbose

- name: fpm example (debug)
if: always()
run: fpm run --example --all --profile debug --compiler ${{ matrix.compiler }} --verbose
version: ${{ matrix.version }}

- name: Show compiler version
shell: bash
env:
FC: ${{ steps.setup-fortran.outputs.fc }}
CC: ${{ steps.setup-fortran.outputs.cc }}
run: |
"$FC" --version

- name: fpm example (release)
if: always()
run: fpm run --example --all --profile release --compiler ${{ matrix.compiler }} --verbose

# jobs:
# gcc-build:
# runs-on: ${{ matrix.os }}
# strategy:
# fail-fast: false
# matrix:
# os: [ubuntu-latest]
# gcc_v: [15] # Version of GFortran we want to use.
# include:
# - os: ubuntu-latest
# os-arch: linux-x86_64

# env:
# FC: gfortran
# GCC_V: ${{ matrix.gcc_v }}

# steps:
# - name: Checkout code
# uses: actions/checkout@v1

# - name: Install GFortran Linux
# if: contains(matrix.os, 'ubuntu')
# run: |
# sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_V} 100 \
# --slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${GCC_V} \
# --slave /usr/bin/gcov gcov /usr/bin/gcov-${GCC_V}

# - name: Install fpm
# uses: fortran-lang/setup-fpm@v5
# with:
# fpm-version: 'v0.10.1'
- name: Install fpm
uses: fortran-lang/setup-fpm@v5
with:
fpm-version: 'v0.10.1'

# - name: Build FPLOT
# run: |
# gfortran --version
# fpm build
- name: Build FPLOT
shell: bash
env:
FC: ${{ steps.setup-fortran.outputs.fc }}
CC: ${{ steps.setup-fortran.outputs.cc }}
FPM_FC: ${{ steps.setup-fortran.outputs.fc }}
FPM_CC: ${{ steps.setup-fortran.outputs.cc }}
FPM_FLAGS: ${{ matrix.shared && '--flag=-fPIC' || '' }}
run: |
if [[ -n "$FPM_FLAGS" ]]; then
fpm build $FPM_FLAGS
else
fpm build
fi

# - name: Run tests
# run: |
# gfortran --version
# fpm test
- name: Run tests
shell: bash
env:
FC: ${{ steps.setup-fortran.outputs.fc }}
CC: ${{ steps.setup-fortran.outputs.cc }}
FPM_FC: ${{ steps.setup-fortran.outputs.fc }}
FPM_CC: ${{ steps.setup-fortran.outputs.cc }}
FPM_FLAGS: ${{ matrix.shared && '--flag=-fPIC' || '' }}
run: |
if [[ -n "$FPM_FLAGS" ]]; then
fpm test $FPM_FLAGS
else
fpm test
fi
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ cmake_minimum_required(VERSION 3.24)
project(
fplot
LANGUAGES Fortran
VERSION 1.8.9
VERSION 1.8.10
)

# Confgiure everything
add_subdirectory(configure)

# Source
add_subdirectory(src)

# Confgiure everything
add_subdirectory(configure)

# Install
install(
EXPORT ${PROJECT_NAME}-targets
Expand Down
9 changes: 9 additions & 0 deletions configure/template.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
@PACKAGE_INIT@

# For static libraries, consumers need to find dependencies
if(NOT BUILD_SHARED_LIBS)
include(CMakeFindDependencyMacro)
find_dependency(ferror QUIET)
find_dependency(collections QUIET)
find_dependency(geompack QUIET)
find_dependency(fstring QUIET)
endif()

if(NOT TARGET "@PROJECT_NAME@::@PROJECT_NAME@")
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake")
endif()
5 changes: 1 addition & 4 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
find_package(fstring QUIET)

# Example 1
add_executable(generic_2d_plot generic_2d_plot.f90)
target_link_libraries(generic_2d_plot fplot)
Expand Down Expand Up @@ -131,7 +129,6 @@ target_link_libraries(arrow_example fplot)
# Example 33
add_executable(custom_colormap_example custom_colormap_example.f90)
target_link_libraries(custom_colormap_example fplot)
target_link_libraries(custom_colormap_example forcolormap)

# Example 34
add_executable(variable_point_size_2d_example variable_point_size_2d_example.f90)
Expand All @@ -151,7 +148,7 @@ target_link_libraries(margins_example fplot)

# Example 38
add_executable(box_whisker_example box_whisker_example.f90)
target_link_libraries(box_whisker_example fplot fstring::fstring)
target_link_libraries(box_whisker_example fplot)

# Example 39
add_executable(jitter_plot_example jitter_plot_example.f90)
Expand Down
2 changes: 1 addition & 1 deletion fpm.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name = "fplot"
version = "1.8.9"
version = "1.8.10"
license = "GPL-3.0"
author = "Jason Christopherson"
maintainer = "Jason Christopherson"
Expand Down
Loading
Loading