Skip to content

Commit 78471d4

Browse files
Merge pull request #18 from jchristopherson/FPM
FPM
2 parents c9b741d + 1dd251f commit 78471d4

26 files changed

Lines changed: 943 additions & 216 deletions

.github/workflows/fpm.yml

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
name: fpm
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
gcc-build:
7+
runs-on: ${{ matrix.os }}
8+
strategy:
9+
fail-fast: false
10+
matrix:
11+
os: [ubuntu-latest, macos-11]
12+
gcc_v: [10] # Version of GFortran we want to use.
13+
include:
14+
- os: ubuntu-latest
15+
os-arch: linux-x86_64
16+
17+
- os: macos-11
18+
os-arch: macos-x86_64
19+
20+
env:
21+
FC: gfortran
22+
GCC_V: ${{ matrix.gcc_v }}
23+
24+
steps:
25+
- name: Checkout code
26+
uses: actions/checkout@v1
27+
28+
- name: Install GFortran macOS
29+
if: contains(matrix.os, 'macos')
30+
run: |
31+
ln -s /usr/local/bin/gfortran-${GCC_V} /usr/local/bin/gfortran
32+
which gfortran-${GCC_V}
33+
which gfortran
34+
35+
- name: Install GFortran Linux
36+
if: contains(matrix.os, 'ubuntu')
37+
run: |
38+
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_V} 100 \
39+
--slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${GCC_V} \
40+
--slave /usr/bin/gcov gcov /usr/bin/gcov-${GCC_V}
41+
42+
- name: Install fpm
43+
uses: fortran-lang/setup-fpm@v3
44+
with:
45+
fpm-version: 'v0.8.2'
46+
47+
- name: Build LINALG
48+
run: |
49+
gfortran --version
50+
fpm build
51+
52+
- name: Run tests
53+
run: |
54+
gfortran --version
55+
fpm test
56+
57+
msys2-build:
58+
runs-on: windows-latest
59+
defaults:
60+
run:
61+
shell: msys2 {0}
62+
63+
steps:
64+
- uses: actions/checkout@v2
65+
- uses: msys2/setup-msys2@v2
66+
with:
67+
msystem: MINGW64
68+
update: true
69+
path-type: inherit
70+
install: |
71+
mingw-w64-x86_64-gcc-fortran
72+
mingw-w64-x86_64-fpm
73+
mingw-w64-x86_64-openblas
74+
mingw-w64-x86_64-lapack
75+
76+
- name: fpm build
77+
run: |
78+
gfortran --version
79+
fpm --version
80+
fpm build
81+
82+
- name: fpm test
83+
run: |
84+
fpm test
85+
86+
intel-build:
87+
runs-on: ubuntu-latest
88+
strategy:
89+
fail-fast: false
90+
91+
env:
92+
FPM_FC: ifort
93+
FC: ifort
94+
95+
steps:
96+
- name: Checkout code
97+
uses: actions/checkout@v3
98+
99+
- name: Add Intel repository (Linux)
100+
run: |
101+
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
102+
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
103+
rm GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
104+
echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
105+
sudo apt-get update
106+
107+
- name: Install Intel oneAPI compiler (Linux)
108+
run: |
109+
sudo apt-get install intel-oneapi-compiler-fortran
110+
111+
- name: Setup Intel oneAPI environment
112+
run: |
113+
source /opt/intel/oneapi/setvars.sh
114+
printenv >> $GITHUB_ENV
115+
116+
- name: Install fpm
117+
uses: fortran-lang/setup-fpm@v3
118+
with:
119+
fpm-version: 'v0.8.2'
120+
121+
- name: fpm build
122+
run: |
123+
ifort --version
124+
fpm --version
125+
fpm build --profile debug --flag "-warn nointerfaces"
126+
127+
- name: fpm test
128+
run: |
129+
fpm test --profile debug --flag "-warn nointerfaces"

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.24)
33
project(
44
linalg
55
LANGUAGES Fortran C
6-
VERSION 1.7.2
6+
VERSION 1.7.3
77
)
88

99
# Get helper macros and functions
@@ -18,7 +18,6 @@ add_subdirectory(configure)
1818
# Deal with the dependencies
1919
find_package(BLAS)
2020
find_package(LAPACK)
21-
find_package(ferror 1.4.0 QUIET)
2221
add_subdirectory(dependencies)
2322

2423
# Source
@@ -48,6 +47,7 @@ message(STATUS "Build tests: ${BUILD_TESTING}")
4847
if (BUILD_TESTING)
4948
enable_testing()
5049
add_subdirectory(tests)
50+
add_subdirectory(tests_c)
5151
endif()
5252

5353
# Examples

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ A linear algebra library that provides a user-friendly interface to several BLAS
33

44
## Status
55
![Build Status](https://github.com/jchristopherson/linalg/actions/workflows/cmake.yml/badge.svg)
6+
[![Actions Status](https://github.com/jchristopherson/linalg/workflows/fpm/badge.svg)](https://github.com/jchristopherson/linalg/actions)
67

78
## Example 1
89
This example solves a normally defined system of 3 equations of 3 unknowns.
@@ -183,7 +184,17 @@ Mode 3: (923.5669 Hz)
183184
The documentation can be found [here](https://jchristopherson.github.io/linalg/).
184185

185186
## Building LINALG
186-
This library can be built using CMake. For instructions see [Running CMake](https://cmake.org/runningcmake/).
187+
[CMake](https://cmake.org/)This library can be built using CMake. For instructions see [Running CMake](https://cmake.org/runningcmake/).
188+
189+
[FPM](https://github.com/fortran-lang/fpm) can also be used to build this library using the provided fpm.toml.
190+
```txt
191+
fpm build
192+
```
193+
The LINALG library can be used within your FPM project by adding the following to your fpm.toml file.
194+
```toml
195+
[dependencies]
196+
linalg = { git = "https://github.com/jchristopherson/linalg" }
197+
```
187198

188199
## External Libraries
189200
Here is a list of external code libraries utilized by this library.

dependencies/ferror/CMakeLists.txt

Lines changed: 22 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,48 +2,33 @@
22
include("${PROJECT_SOURCE_DIR}/cmake/helper.cmake")
33
include(FetchContent)
44

5-
# If found, use the installed version; else, import the library
6-
if (${ferror_FOUND})
7-
# Inform the user of what's going on
8-
message(STATUS "FERROR (${ferror_VERSION}) library found.")
5+
# Fetch the proper content
6+
FetchContent_Declare(
7+
ferror
8+
GIT_REPOSITORY "https://github.com/jchristopherson/ferror"
9+
)
910

10-
# Get the mod file location
11-
get_target_property(ferror_INCLUDE_DIR ferror INTERFACE_INCLUDE_DIRECTORIES)
12-
else()
13-
# Inform the user of what's going on
14-
message(STATUS "FERROR library not found. Downloading appropriate repository.")
15-
16-
# Fetch the proper content
17-
FetchContent_Declare(
18-
ferror
19-
GIT_REPOSITORY "https://github.com/jchristopherson/ferror"
20-
OVERRIDE_FIND_PACKAGE
21-
)
11+
FetchContent_MakeAvailable(ferror)
2212

23-
FetchContent_MakeAvailable(ferror)
24-
25-
if (WIN32)
26-
if (${BUILD_SHARED_LIBS})
27-
add_custom_command(
28-
TARGET ${PROJECT_NAME} POST_BUILD
29-
COMMAND ${CMAKE_COMMAND} -E copy_if_different
30-
$<TARGET_FILE:ferror>
31-
$<TARGET_FILE_DIR:${PROJECT_NAME}
32-
)
33-
endif()
13+
if (WIN32)
14+
if (BUILD_SHARED_LIBS)
15+
add_custom_command(
16+
TARGET ${PROJECT_NAME} POST_BUILD
17+
COMMAND ${CMAKE_COMMAND} -E copy_if_different
18+
$<TARGET_FILE:ferror>
19+
$<TARGET_FILE_DIR:${PROJECT_NAME}
20+
)
3421
endif()
35-
36-
set(ferror_INCLUDE_DIR ${ferror_BINARY_DIR}/include)
37-
configure_file(
38-
"${ferror_SOURCE_DIR}/include/ferror.h"
39-
"${ferror_INCLUDE_DIR}/ferror.h"
40-
COPYONLY
41-
)
4222
endif()
4323

24+
set(ferror_INCLUDE_DIR ${ferror_BINARY_DIR}/include)
25+
set(ferror_INCLUDE_DIR ${ferror_INCLUDE_DIR} PARENT_SCOPE)
26+
configure_file(
27+
"${ferror_SOURCE_DIR}/include/ferror.h"
28+
"${ferror_INCLUDE_DIR}/ferror.h"
29+
COPYONLY
30+
)
31+
4432
# Make a parent-scope variable for the library
4533
set(ferror_LIBRARY ferror)
4634
set(ferror_LIBRARY ${ferror_LIBRARY} PARENT_SCOPE)
47-
48-
# Make a parent-scope variable locating the include directory for ferror
49-
set(ferror_INCLUDE_DIR ${ferror_INCLUDE_DIR} PARENT_SCOPE)

docs/Doxyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ PROJECT_NAME = linalg
4848
# could be handy for archiving the generated documentation or if some version
4949
# control system is used.
5050

51-
PROJECT_NUMBER = 1.7.2
51+
PROJECT_NUMBER = 1.7.3
5252

5353
# Using the PROJECT_BRIEF tag one can provide an optional one line description
5454
# for a project that appears at the top of each page and should give viewer a

fpm.toml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name = "linalg"
2+
version = "1.7.3"
3+
license = "GPL-3.0"
4+
author = "Jason Christopherson"
5+
maintainer = "Jason Christopherson"
6+
copyright = "Copyright 2017-2023, Jason Christopherson"
7+
description = "A linear algebra library that provides a user-friendly interface to several BLAS and LAPACK routines."
8+
homepage = "https://github.com/jchristopherson/linalg"
9+
10+
[library]
11+
source-dir = "src"
12+
13+
[fortran]
14+
source-form = "default"
15+
implicit-external = true
16+
17+
[dependencies]
18+
ferror = { git = "https://github.com/jchristopherson/ferror" }
19+
20+
[dev-dependencies]
21+
fortran_test_helper = { git = "https://github.com/jchristopherson/fortran_test_helper" }
22+
23+
[install]
24+
library = true
25+
26+
[build]
27+
link = ["blas", "lapack"]
28+
auto-executables = false
29+
auto-examples = false
30+
auto-tests = false
31+
32+
[[test]]
33+
name = "linalg_test"
34+
source-dir = "tests"
35+
main = "linalg_test.f90"

src/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ set(LINALG_SOURCES
8787
${dir}/linalg_solve.f90
8888
${dir}/linalg_sorting.f90
8989
${dir}/linalg_basic.f90
90+
${dir}/blas.f90
91+
${dir}/lapack.f90
92+
${dir}/qrupdate.f90
9093
)
9194
if (${BUILD_C_API})
9295
set(LINALG_C_SOURCES

0 commit comments

Comments
 (0)