Skip to content

Commit 7d34fe5

Browse files
Merge pull request #17 from jchristopherson/v2.1.3
V2.1.3
2 parents 0289ab8 + 131e360 commit 7d34fe5

92 files changed

Lines changed: 18311 additions & 28018 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/cmake.yml

Lines changed: 92 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,46 +2,120 @@ name: CMake
22

33
on:
44
push:
5-
branches: [ "master" ]
5+
branches: ["master"]
66
pull_request:
7-
branches: [ "master" ]
7+
branches: ["master"]
88

99
env:
1010
BUILD_TYPE: Release
1111

1212
jobs:
1313
test:
14+
name: ${{ matrix.os }} / ${{ matrix.compiler }} / shared=${{ matrix.shared }}
1415
runs-on: ${{ matrix.os }}
1516
strategy:
1617
fail-fast: false
1718
matrix:
18-
os: [ubuntu-latest, macos-latest]
19-
toolchain:
20-
- {compiler: gcc, version: '14'}
2119
include:
2220
- os: ubuntu-latest
23-
toolchain: {compiler: intel, version: '2025.0'}
21+
compiler: gcc
22+
version: '14'
23+
shared: false
24+
- os: ubuntu-latest
25+
compiler: gcc
26+
version: '14'
27+
shared: true
28+
- os: ubuntu-latest
29+
compiler: gcc
30+
version: '15'
31+
shared: false
32+
- os: ubuntu-latest
33+
compiler: gcc
34+
version: '15'
35+
shared: true
36+
- os: ubuntu-latest
37+
compiler: intel
38+
version: '2023.2'
39+
shared: false
40+
- os: ubuntu-latest
41+
compiler: intel
42+
version: '2023.2'
43+
shared: true
44+
- os: macos-latest
45+
compiler: gcc
46+
version: '14'
47+
shared: false
48+
- os: macos-latest
49+
compiler: gcc
50+
version: '14'
51+
shared: true
2452

2553
steps:
26-
- uses: fortran-lang/setup-fortran@v1.9
54+
- uses: actions/checkout@v4
55+
56+
- uses: fortran-lang/setup-fortran@v1
2757
id: setup-fortran
2858
with:
29-
compiler: ${{ matrix.toolchain.compiler }}
30-
version: ${{ matrix.toolchain.version }}
31-
32-
- run: ${{ env.FC }} --version
59+
compiler: ${{ matrix.compiler }}
60+
version: ${{ matrix.version }}
61+
62+
- name: Show Fortran compiler version
63+
run: ${{ env.FC }} --version
3364
env:
3465
FC: ${{ steps.setup-fortran.outputs.fc }}
3566
CC: ${{ steps.setup-fortran.outputs.cc }}
3667

37-
- uses: actions/checkout@v3
38-
68+
- name: Install BLAS/LAPACK dependencies
69+
run: |
70+
if [ "${{ runner.os }}" = "Linux" ]; then
71+
sudo apt-get update
72+
sudo apt-get install -y libblas-dev liblapack-dev
73+
elif [ "${{ runner.os }}" = "macOS" ]; then
74+
brew update
75+
brew install openblas
76+
fi
77+
3978
- name: Configure CMake
40-
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_Fortran_COMPILER=${{ env.FC }} -DBUILD_TESTING=TRUE
41-
79+
run: >-
80+
cmake -S . -B build
81+
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}
82+
-DCMAKE_Fortran_COMPILER=${{ env.FC }}
83+
-DCMAKE_C_COMPILER=${{ env.CC }}
84+
-DBUILD_TESTING=TRUE
85+
-DBUILD_SHARED_LIBS=${{ matrix.shared && 'TRUE' || 'FALSE' }}
86+
env:
87+
FC: ${{ steps.setup-fortran.outputs.fc }}
88+
CC: ${{ steps.setup-fortran.outputs.cc }}
89+
4290
- name: Build with CMake
43-
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
91+
run: cmake --build build --config ${{ env.BUILD_TYPE }}
4492

4593
- name: Test with CMake
46-
working-directory: ${{github.workspace}}/build
47-
run: ctest -C ${{env.BUILD_TYPE}} --output-on-failure
94+
working-directory: build
95+
run: ctest --output-on-failure -C ${{ env.BUILD_TYPE }}
96+
97+
- name: Install with CMake
98+
run: cmake --install build --prefix ${{ github.workspace }}/install --config ${{ env.BUILD_TYPE }}
99+
100+
- name: Verify install with CMake consumer
101+
run: |
102+
mkdir -p consumer
103+
cat > consumer/CMakeLists.txt <<'EOF'
104+
cmake_minimum_required(VERSION 3.24)
105+
project(nonlin_consumer LANGUAGES Fortran)
106+
107+
find_package(nonlin CONFIG REQUIRED)
108+
109+
add_executable(nonlin_consumer main.f90)
110+
target_link_libraries(nonlin_consumer PRIVATE nonlin::nonlin)
111+
EOF
112+
113+
cat > consumer/main.f90 <<'EOF'
114+
program main
115+
use nonlin
116+
print *, "nonlin package found"
117+
end program main
118+
EOF
119+
120+
cmake -S consumer -B consumer/build -DCMAKE_PREFIX_PATH=${{ github.workspace }}/install
121+
cmake --build consumer/build

.github/workflows/fpm.yml

Lines changed: 86 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -1,132 +1,97 @@
11
name: fpm
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches: ["master"]
6+
pull_request:
7+
branches: ["master"]
48

59
jobs:
6-
gcc-build:
10+
build-and-test:
11+
name: ${{ matrix.os }} / ${{ matrix.compiler }} / shared=${{ matrix.shared }}
712
runs-on: ${{ matrix.os }}
813
strategy:
914
fail-fast: false
1015
matrix:
11-
os: [ubuntu-latest]
12-
gcc_v: [14] # Version of GFortran we want to use.
1316
include:
14-
- os: ubuntu-latest
15-
os-arch: linux-x86_64
16-
17-
env:
18-
FC: gfortran
19-
GCC_V: ${{ matrix.gcc_v }}
17+
- os: ubuntu-latest
18+
compiler: gcc
19+
version: '14'
20+
shared: false
21+
- os: ubuntu-latest
22+
compiler: gcc
23+
version: '14'
24+
shared: true
25+
- os: ubuntu-latest
26+
compiler: gcc
27+
version: '15'
28+
shared: false
29+
- os: ubuntu-latest
30+
compiler: gcc
31+
version: '15'
32+
shared: true
33+
- os: ubuntu-latest
34+
compiler: intel
35+
version: '2023.2'
36+
shared: true
2037

2138
steps:
22-
- name: Checkout code
23-
uses: actions/checkout@v1
24-
25-
- name: Install GFortran Linux
26-
if: contains(matrix.os, 'ubuntu')
27-
run: |
28-
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_V} 100 \
29-
--slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${GCC_V} \
30-
--slave /usr/bin/gcov gcov /usr/bin/gcov-${GCC_V}
31-
32-
- name: Install BLAS & LAPACK
33-
if: contains(matrix.os, 'ubuntu')
34-
run: |
35-
sudo apt-get update
36-
sudo apt-get install libopenblas-dev liblapack-dev
37-
38-
- name: Install fpm
39-
uses: fortran-lang/setup-fpm@v5
40-
with:
41-
fpm-version: 'v0.10.1'
42-
43-
- name: Build NONLIN
44-
run: |
45-
gfortran --version
46-
fpm build
47-
48-
- name: Run tests
49-
run: |
50-
gfortran --version
51-
fpm test
52-
53-
# msys2-build:
54-
# runs-on: windows-latest
55-
# defaults:
56-
# run:
57-
# shell: msys2 {0}
58-
59-
# steps:
60-
# - uses: actions/checkout@v2
61-
# - uses: msys2/setup-msys2@v2
62-
# with:
63-
# msystem: MINGW64
64-
# update: true
65-
# path-type: inherit
66-
# install: |
67-
# mingw-w64-x86_64-gcc-fortran
68-
# mingw-w64-x86_64-fpm
69-
# mingw-w64-x86_64-openblas
70-
# mingw-w64-x86_64-lapack
71-
72-
# - name: fpm build
73-
# run: |
74-
# gfortran --version
75-
# fpm --version
76-
# fpm build
77-
78-
# - name: fpm test
79-
# run: |
80-
# fpm test
81-
82-
# intel-build:
83-
# runs-on: ubuntu-latest
84-
# strategy:
85-
# fail-fast: false
86-
87-
# env:
88-
# FPM_FC: ifx
89-
# FC: ifx
90-
91-
# steps:
92-
# - name: Checkout code
93-
# uses: actions/checkout@v3
94-
95-
# - name: Add Intel repository (Linux)
96-
# run: |
97-
# wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
98-
# sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
99-
# rm GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
100-
# echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
101-
# sudo apt-get update
102-
103-
# - name: Install Intel oneAPI compiler (Linux)
104-
# run: |
105-
# sudo apt-get install intel-oneapi-compiler-fortran
106-
107-
# - name: Setup Intel oneAPI environment
108-
# run: |
109-
# source /opt/intel/oneapi/setvars.sh
110-
# printenv >> $GITHUB_ENV
111-
112-
# - name: Install MKL
113-
# run: |
114-
# sudo apt-get update
115-
# sudo apt-get -y install intel-mkl
116-
# sudo apt update
117-
# sudo apt -y install intel-mkl
118-
119-
# - name: Install fpm
120-
# uses: fortran-lang/setup-fpm@v3
121-
# with:
122-
# fpm-version: 'v0.8.2'
123-
124-
# - name: fpm build
125-
# run: |
126-
# ifx --version
127-
# fpm --version
128-
# fpm build --profile debug --flag "-warn nointerfaces"
129-
130-
# - name: fpm test
131-
# run: |
132-
# fpm test --profile debug --flag "-warn nointerfaces"
39+
- name: Checkout code
40+
uses: actions/checkout@v4
41+
42+
- name: Set up Fortran toolchain
43+
uses: fortran-lang/setup-fortran@v1
44+
id: setup-fortran
45+
with:
46+
compiler: ${{ matrix.compiler }}
47+
version: ${{ matrix.version }}
48+
49+
- name: Show compiler version
50+
shell: bash
51+
env:
52+
FC: ${{ steps.setup-fortran.outputs.fc }}
53+
CC: ${{ steps.setup-fortran.outputs.cc }}
54+
run: |
55+
"$FC" --version
56+
57+
- name: Install BLAS/LAPACK (Linux)
58+
if: runner.os == 'Linux'
59+
shell: bash
60+
run: |
61+
sudo apt-get update
62+
sudo apt-get install -y libopenblas-dev liblapack-dev
63+
64+
- name: Install fpm
65+
uses: fortran-lang/setup-fpm@v5
66+
with:
67+
fpm-version: 'v0.10.1'
68+
69+
- name: Build NONLIN
70+
shell: bash
71+
env:
72+
FC: ${{ steps.setup-fortran.outputs.fc }}
73+
CC: ${{ steps.setup-fortran.outputs.cc }}
74+
FPM_FC: ${{ steps.setup-fortran.outputs.fc }}
75+
FPM_CC: ${{ steps.setup-fortran.outputs.cc }}
76+
FPM_FLAGS: ${{ matrix.shared && '--flag=-fPIC' || '' }}
77+
run: |
78+
if [[ -n "$FPM_FLAGS" ]]; then
79+
fpm build $FPM_FLAGS
80+
else
81+
fpm build
82+
fi
83+
84+
- name: Run tests
85+
shell: bash
86+
env:
87+
FC: ${{ steps.setup-fortran.outputs.fc }}
88+
CC: ${{ steps.setup-fortran.outputs.cc }}
89+
FPM_FC: ${{ steps.setup-fortran.outputs.fc }}
90+
FPM_CC: ${{ steps.setup-fortran.outputs.cc }}
91+
FPM_FLAGS: ${{ matrix.shared && '--flag=-fPIC' || '' }}
92+
run: |
93+
if [[ -n "$FPM_FLAGS" ]]; then
94+
fpm test $FPM_FLAGS
95+
else
96+
fpm test
97+
fi

CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ cmake_minimum_required(VERSION 3.24)
33
project(
44
nonlin
55
LANGUAGES Fortran
6-
VERSION 2.1.2
6+
VERSION 2.1.3
77
)
88
set(CMAKE_Fortran_STANDARD 2018)
99
set(CMAKE_Fortran_STANDARD_REQUIRED TRUE)
1010

11-
# Confgiure everything
12-
add_subdirectory(configure)
13-
1411
# Source
1512
add_subdirectory(src)
1613

14+
# Confgiure everything
15+
add_subdirectory(configure)
16+
1717
# Installation Instructions
1818
install(
1919
EXPORT ${PROJECT_NAME}-targets

configure/template.cmake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
@PACKAGE_INIT@
22

3+
if (NOT BUILD_SHARED_LIBS)
4+
include(CMakeFindDependencyMacro)
5+
find_dependency(ferror QUIET)
6+
find_dependency(linalg QUIET)
7+
endif()
8+
39
if(NOT TARGET "@PROJECT_NAME@::@PROJECT_NAME@")
410
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake")
511
endif()

0 commit comments

Comments
 (0)