Skip to content

Commit 5d537d1

Browse files
Merge pull request #6 from jchristopherson/v1.1.0
V1.1.0
2 parents 3f75274 + 6ada1f1 commit 5d537d1

File tree

22 files changed

+19901
-298
lines changed

22 files changed

+19901
-298
lines changed

.github/workflows/cmake.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ jobs:
1818
os: [ubuntu-latest, macos-latest]
1919
toolchain:
2020
- {compiler: gcc, version: 11}
21-
- {compiler: intel-classic, version: '2021.9'}
21+
# - {compiler: intel-classic, version: '2021.9'}
2222
include:
2323
- os: ubuntu-latest
2424
toolchain: {compiler: intel, version: '2023.2'}
2525

2626
steps:
27-
- uses: awvwgk/setup-fortran@v1
27+
- uses: awvwgk/setup-fortran@v1.6.1
2828
id: setup-fortran
2929
with:
3030
compiler: ${{ matrix.toolchain.compiler }}

.github/workflows/fpm.yml

Lines changed: 10 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
fail-fast: false
1010
matrix:
1111
os: [ubuntu-latest]
12-
gcc_v: [10] # Version of GFortran we want to use.
12+
gcc_v: [12] # Version of GFortran we want to use.
1313
include:
1414
- os: ubuntu-latest
1515
os-arch: linux-x86_64
@@ -22,26 +22,25 @@ jobs:
2222
- name: Checkout code
2323
uses: actions/checkout@v1
2424

25-
- name: Install GFortran macOS
26-
if: contains(matrix.os, 'macos')
27-
run: |
28-
ln -s /usr/local/bin/gfortran-${GCC_V} /usr/local/bin/gfortran
29-
which gfortran-${GCC_V}
30-
which gfortran
31-
3225
- name: Install GFortran Linux
3326
if: contains(matrix.os, 'ubuntu')
3427
run: |
3528
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_V} 100 \
3629
--slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${GCC_V} \
3730
--slave /usr/bin/gcov gcov /usr/bin/gcov-${GCC_V}
3831
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+
3938
- name: Install fpm
40-
uses: fortran-lang/setup-fpm@v3
39+
uses: fortran-lang/setup-fpm@v5
4140
with:
42-
fpm-version: 'v0.10.0'
41+
fpm-version: 'v0.10.1'
4342

44-
- name: Build the library
43+
- name: Build FRICTION
4544
run: |
4645
gfortran --version
4746
fpm build
@@ -50,77 +49,3 @@ jobs:
5049
run: |
5150
gfortran --version
5251
fpm test
53-
54-
msys2-build:
55-
runs-on: windows-latest
56-
defaults:
57-
run:
58-
shell: msys2 {0}
59-
60-
steps:
61-
- uses: actions/checkout@v2
62-
- uses: msys2/setup-msys2@v2
63-
with:
64-
msystem: MINGW64
65-
update: true
66-
path-type: inherit
67-
install: |
68-
mingw-w64-x86_64-gcc-fortran
69-
mingw-w64-x86_64-fpm
70-
mingw-w64-x86_64-openblas
71-
mingw-w64-x86_64-lapack
72-
73-
- name: fpm build
74-
run: |
75-
gfortran --version
76-
fpm --version
77-
fpm build
78-
79-
- name: fpm test
80-
run: |
81-
fpm test
82-
83-
intel-build:
84-
runs-on: ubuntu-latest
85-
strategy:
86-
fail-fast: false
87-
88-
env:
89-
FPM_FC: ifx
90-
FC: ifx
91-
92-
steps:
93-
- name: Checkout code
94-
uses: actions/checkout@v3
95-
96-
- name: Add Intel repository (Linux)
97-
run: |
98-
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
99-
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
100-
rm GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
101-
echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
102-
sudo apt-get update
103-
104-
- name: Install Intel oneAPI compiler (Linux)
105-
run: |
106-
sudo apt-get install intel-oneapi-compiler-fortran
107-
108-
- name: Setup Intel oneAPI environment
109-
run: |
110-
source /opt/intel/oneapi/setvars.sh
111-
printenv >> $GITHUB_ENV
112-
113-
- name: Install fpm
114-
uses: fortran-lang/setup-fpm@v3
115-
with:
116-
fpm-version: 'v0.10.0'
117-
118-
- name: fpm build
119-
run: |
120-
ifx --version
121-
fpm --version
122-
fpm build --profile debug --flag "-warn nointerfaces"
123-
124-
- name: fpm test
125-
run: |
126-
fpm test --profile debug --flag "-warn nointerfaces"

CMakeLists.txt

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,26 @@ project(
55
LANGUAGES Fortran
66
VERSION 1.0.0
77
)
8-
9-
# Get helper macros and functions
10-
include("${PROJECT_SOURCE_DIR}/cmake/helper.cmake")
8+
set(CMAKE_Fortran_STANDARD 2018)
9+
set(CMAKE_Fortran_STANDARD_REQUIRED TRUE)
1110

1211
# Confgiure everything
1312
add_subdirectory(configure)
1413

15-
# Deal with the dependencies
16-
add_subdirectory(dependencies)
17-
1814
# Source
1915
add_subdirectory(src)
20-
add_fortran_library(
21-
${PROJECT_NAME}
22-
${PROJECT_INCLUDE_DIR}
23-
${CMAKE_INSTALL_INCLUDEDIR}
24-
${PROJECT_VERSION}
25-
${PROJECT_VERSION_MAJOR}
26-
${FRICTION_SOURCES}
16+
17+
# Installation Instructions
18+
install(
19+
EXPORT ${PROJECT_NAME}-targets
20+
NAMESPACE ${PROJECT_NAME}::
21+
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
2722
)
28-
link_library(${PROJECT_NAME} ${ferror_LIBRARY} ${ferror_INCLUDE_DIR})
29-
link_library(${PROJECT_NAME} ${diffeq_LIBRARY} ${diffeq_INCLUDE_DIR})
30-
link_library(${PROJECT_NAME} ${fstats_LIBRARY} ${fstats_INCLUDE_DIR})
31-
link_library(${PROJECT_NAME} ${fitpack_LIBRARY} ${fitpack_INCLUDE_DIR})
3223

3324
# Testing
3425
option(BUILD_TESTING "Build tests")
3526
include(CTest)
36-
message(STATUS "Build tests: ${BUILD_TESTING}")
27+
message(STATUS "Build FRICTION tests: ${BUILD_TESTING}")
3728
if (BUILD_TESTING)
3829
enable_testing()
3930
add_subdirectory(test)

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,25 +38,25 @@ F = k \delta
3838
```
3939
- Generalized Maxwell Slip Model
4040
```math
41-
F = \sum_{i=1}^{n} \left( k_i z_i + b_i \frac{dz_i}{dt} \right) + b_v v
41+
F = \sum_{i=1}^{n} \left( k_{i} z_{i} + b_{i} \frac{dz_{i}}{dt} \right) + b_{v} v
4242
```
4343
```math
4444
\begin{equation}
45-
\frac{dz_i}{dt} =
45+
\frac{dz_{i}}{dt} =
4646
\begin{cases}
47-
v & \text{if $|z_i| \le g(v)$} \\
48-
\text{sgn} \left( v \right) \nu_i C \left( 1 - \frac{z_i}{\nu_i g(v)} \right) & \text{otherwise}
47+
v & \text{if} |z_{i}| \le g(v) \\
48+
\text{sgn} \left( v \right) \nu_{i} C \left( 1 - \frac{z_{i}}{\nu_{i} g(v)} \right) & \text{otherwise}
4949
\end{cases}
5050
\end{equation}
5151
```
5252
```math
53-
g(v) = a_{1} + \frac{a_2}{1 + s^{\alpha}}
53+
g(v) = a_{1} + \frac{a_{2}}{1 + s^{\alpha}}
5454
```
5555
```math
56-
a_{1} = \frac{\mu_c N}{\sigma_{0}}, a_{2} = \frac{\mu_s N - \mu_c N}{\sigma_{0}}, s = \frac{\left| v \right|}{v_s}
56+
a_{1} = \frac{\mu_{c} N}{\sigma_{0}}, a_{2} = \frac{\mu_{s} N - \mu_{c} N}{\sigma_{0}}, s = \frac{\left| v \right|}{v_{s}}
5757
```
5858
```math
59-
\sum_{i=1}^{n} \nu_i = 1
59+
\sum_{i=1}^{n} \nu_{i} = 1
6060
```
6161
- Stribeck Model
6262
```math

cmake/helper.cmake

Lines changed: 0 additions & 75 deletions
This file was deleted.

configure/CMakeLists.txt

Lines changed: 58 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# Get the macros and functions we'll need
2-
include("${PROJECT_SOURCE_DIR}/cmake/helper.cmake")
3-
41
# Set a default build type if none was specified
52
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
63
message(STATUS "Setting build type to 'Release' as none was specified.")
@@ -13,11 +10,67 @@ endif()
1310
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
1411

1512
# Export all symbols on Windows when building libraries
16-
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
13+
SET(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
1714

1815
# Utilize the GNU installation structure
1916
include(GNUInstallDirs)
2017

2118
# Locate the local include directory
2219
set(PROJECT_INCLUDE_DIR ${PROJECT_BINARY_DIR}/include)
23-
set(PROJECT_INCLUDE_DIR ${PROJECT_INCLUDE_DIR} PARENT_SCOPE)
20+
set(PROJECT_INCLUDE_DIR ${PROJECT_INCLUDE_DIR} PARENT_SCOPE)
21+
22+
if(NOT DEFINED CMAKE_INSTALL_MODULEDIR)
23+
set(
24+
CMAKE_INSTALL_MODULEDIR
25+
"${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/${CMAKE_Fortran_COMPILER_ID}-${CMAKE_Fortran_COMPILER_VERSION}"
26+
CACHE
27+
STRING
28+
"Directory in prefix to install generated module files"
29+
)
30+
endif()
31+
32+
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
33+
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" PARENT_SCOPE)
34+
35+
# Export a pkg-config file
36+
configure_file(
37+
"${CMAKE_CURRENT_SOURCE_DIR}/template.pc"
38+
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc"
39+
@ONLY
40+
)
41+
42+
install(
43+
FILES
44+
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc"
45+
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
46+
)
47+
48+
# Export CMake package file
49+
include(CMakePackageConfigHelpers)
50+
configure_package_config_file(
51+
"${CMAKE_CURRENT_SOURCE_DIR}/template.cmake"
52+
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake"
53+
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
54+
)
55+
56+
if(BUILD_SHARED_LIBS OR PROJECT_VERSION_MAJOR EQUAL 0)
57+
# Due to the uncertain ABI compatibility of Fortran shared libraries
58+
# limit compatibility for dynamic linking to same minor version.
59+
set(COMPATIBILITY SameMinorVersion)
60+
else()
61+
# Require API compatibility via semantic versioning for static linking.
62+
set(COMPATIBILITY SameMajorVersion)
63+
endif()
64+
65+
write_basic_package_version_file(
66+
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake"
67+
VERSION "${PROJECT_VERSION}"
68+
COMPATIBILITY ${COMPATIBILITY}
69+
)
70+
71+
install(
72+
FILES
73+
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake"
74+
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake"
75+
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
76+
)

configure/template.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
@PACKAGE_INIT@
2+
3+
if(NOT TARGET "@PROJECT_NAME@::@PROJECT_NAME@")
4+
include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]")
5+
endif()

configure/template.pc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
prefix=@CMAKE_INSTALL_PREFIX@
2+
libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
3+
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
4+
moduledir=${prefix}/@CMAKE_INSTALL_MODULEDIR@
5+
6+
Name: @PROJECT_NAME@
7+
Description: @PROJECT_DESCRIPTION@
8+
Version: @PROJECT_VERSION@
9+
Libs: -L${libdir} -l@PROJECT_NAME@
10+
Cflags: -I${includedir} -I${moduledir}

0 commit comments

Comments
 (0)