Skip to content

Commit 49d4a95

Browse files
committed
Merge branch 'master' into qsmerge
2 parents 4ab5fcf + 57cfaf0 commit 49d4a95

File tree

95 files changed

+11611
-7648
lines changed

Some content is hidden

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

95 files changed

+11611
-7648
lines changed

.github/workflows/CI.yml

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,18 @@ jobs:
2121
matrix:
2222
os: [ubuntu-latest, macos-latest]
2323
gcc_v: [9, 10, 11] # Version of GFortran we want to use.
24+
build: [cmake]
25+
include:
26+
- os: ubuntu-latest
27+
gcc_v: 10
28+
build: cmake-inline
29+
- os: ubuntu-latest
30+
gcc_v: 10
31+
build: make
2432
env:
2533
FC: gfortran-${{ matrix.gcc_v }}
2634
GCC_V: ${{ matrix.gcc_v }}
35+
BUILD_DIR: ${{ matrix.build == 'cmake' && 'build' || '.' }}
2736

2837
steps:
2938
- name: Checkout code
@@ -58,35 +67,32 @@ jobs:
5867
brew link gcc@${GCC_V}
5968
6069
- name: Configure with CMake
70+
if: ${{ contains(matrix.build, 'cmake') }}
6171
run: >-
6272
cmake -Wdev
6373
-DCMAKE_BUILD_TYPE=Release
6474
-DCMAKE_MAXIMUM_RANK:String=4
6575
-DCMAKE_INSTALL_PREFIX=$PWD/_dist
66-
-S . -B build
76+
-S . -B ${{ env.BUILD_DIR }}
6777
6878
- name: Build and compile
69-
run: cmake --build build --parallel
79+
if: ${{ contains(matrix.build, 'cmake') }}
80+
run: cmake --build ${{ env.BUILD_DIR }} --parallel
7081

7182
- name: catch build fail
72-
run: cmake --build build --verbose --parallel 1
73-
if: failure()
83+
run: cmake --build ${{ env.BUILD_DIR }} --verbose --parallel 1
84+
if: ${{ failure() && contains(matrix.build, 'cmake') }}
7485

7586
- name: test
76-
run: ctest --test-dir build --parallel --output-on-failure
87+
if: ${{ contains(matrix.build, 'cmake') }}
88+
run: ctest --test-dir ${{ env.BUILD_DIR }} --parallel --output-on-failure
7789

7890
- name: Install project
79-
run: cmake --install build
80-
81-
- name: Test in-tree builds
82-
if: contains( matrix.gcc_v, '10') # Only test one compiler on each platform
83-
run: |
84-
cmake -DCMAKE_MAXIMUM_RANK=4 .
85-
cmake --build .
86-
cmake --build . --target test
91+
if: ${{ contains(matrix.build, 'cmake') }}
92+
run: cmake --install ${{ env.BUILD_DIR }}
8793

8894
- name: Test manual makefiles
89-
if: contains(matrix.os, 'ubuntu') && contains(matrix.gcc_v, '10')
95+
if: ${{ matrix.build == 'make' }}
9096
run: |
9197
make -f Makefile.manual FYPPFLAGS="-DMAXRANK=4" -j
9298
make -f Makefile.manual test

.github/workflows/fpm-deployment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
- name: Install fpm latest release
3434
uses: fortran-lang/setup-fpm@v3
3535
with:
36-
github-token: ${{ secrets.GITHUB_TOKEN }}
36+
fpm-version: 'v0.4.0'
3737

3838
- name: Run fpm test ⚙
3939
run: |

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ if(CMAKE_Fortran_COMPILER_ID STREQUAL GNU)
2424
add_compile_options(-Wall)
2525
add_compile_options(-Wextra)
2626
add_compile_options(-Wimplicit-procedure)
27-
add_compile_options(-Wconversion-extra)
2827
# -pedantic-errors triggers a false positive for optional arguments of elemental functions,
2928
# see test_optval and https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95446
3029
if(CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 11.0)

ci/fpm-deployment.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ fypp="${FYPP:-$(which fypp)}"
1212
fyflags="${FYFLAGS:--DMAXRANK=4}"
1313

1414
# Number of parallel jobs for preprocessing
15-
njob="$(nproc)"
15+
if [ $(uname) = "Darwin" ]; then
16+
njob="$(sysctl -n hw.ncpu)"
17+
else
18+
njob="$(nproc)"
19+
fi
1620

1721
# Additional files to include
1822
include=(
@@ -24,7 +28,6 @@ include=(
2428
prune=(
2529
"$destdir/test/test_always_fail.f90"
2630
"$destdir/test/test_always_skip.f90"
27-
"$destdir/test/test_mean_f03.f90"
2831
"$destdir/src/common.f90"
2932
"$destdir/src/f18estop.f90"
3033
)
@@ -43,7 +46,7 @@ find src/tests -name "*.dat" -exec cp {} "$destdir/" \;
4346
# Include additional files
4447
cp "${include[@]}" "$destdir/"
4548

46-
# Source file workarounds for fpm
49+
# Source file workarounds for fpm; ignore missing files
4750
rm "${prune[@]}"
4851

4952
# List stdlib-fpm package contents

ci/fpm.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@ license = "MIT"
44
author = "stdlib contributors"
55
maintainer = "@fortran-lang/stdlib"
66
copyright = "2019-2021 stdlib contributors"
7+
8+
[dev-dependencies]
9+
test-drive.git = "https://github.com/fortran-lang/test-drive"
10+
test-drive.tag = "v0.4.0"

config/CMakeLists.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,27 @@ if(NOT DEFINED CMAKE_INSTALL_MODULEDIR)
1010
)
1111
endif()
1212

13+
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
14+
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" PARENT_SCOPE)
15+
16+
# Check for available features
17+
# Note: users can overwrite the automatic check by setting the value at configure time
18+
include(CheckFortranSourceRuns)
19+
if (NOT DEFINED WITH_QP)
20+
check_fortran_source_runs(
21+
"if (selected_real_kind(33) == -1) stop 1; end"
22+
WITH_QP
23+
)
24+
set(WITH_QP ${WITH_QP} PARENT_SCOPE)
25+
endif()
26+
if (NOT DEFINED WITH_XDP)
27+
check_fortran_source_runs(
28+
"if (any(selected_real_kind(18) == [-1, selected_real_kind(33)])) stop 1; end"
29+
WITH_XDP
30+
)
31+
set(WITH_XDP ${WITH_XDP} PARENT_SCOPE)
32+
endif()
33+
1334
# Export a pkg-config file
1435
configure_file(
1536
"${CMAKE_CURRENT_SOURCE_DIR}/template.pc"

config/cmake/Findtest-drive.cmake

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
# SPDX-Identifier: MIT
2+
3+
#[[.rst:
4+
Find test-drive
5+
---------------
6+
7+
Makes the test-drive project available.
8+
9+
Imported Targets
10+
^^^^^^^^^^^^^^^^
11+
12+
This module provides the following imported target, if found:
13+
14+
``test-drive::test-drive``
15+
The test-drive library
16+
17+
18+
Result Variables
19+
^^^^^^^^^^^^^^^^
20+
21+
This module will define the following variables:
22+
23+
``TEST_DRIVE_FOUND``
24+
True if the test-drive library is available
25+
26+
``TEST_DRIVE_SOURCE_DIR``
27+
Path to the source directory of the test-drive project,
28+
only set if the project is included as source.
29+
30+
``TEST_DRIVE_BINARY_DIR``
31+
Path to the binary directory of the test-drive project,
32+
only set if the project is included as source.
33+
34+
Cache variables
35+
^^^^^^^^^^^^^^^
36+
37+
The following cache variables may be set to influence the library detection:
38+
39+
``TEST_DRIVE_FIND_METHOD``
40+
Methods to find or make the project available. Available methods are
41+
- ``cmake``: Try to find via CMake config file
42+
- ``pkgconf``: Try to find via pkg-config file
43+
- ``subproject``: Use source in subprojects directory
44+
- ``fetch``: Fetch the source from upstream
45+
46+
``TEST_DRIVE_DIR``
47+
Used for searching the CMake config file
48+
49+
``TEST_DRIVE_SUBPROJECT``
50+
Directory to find the test-drive subproject, relative to the project root
51+
52+
#]]
53+
54+
set(_lib "test-drive")
55+
set(_pkg "TEST_DRIVE")
56+
set(_url "https://github.com/fortran-lang/test-drive")
57+
58+
if(NOT DEFINED "${_pkg}_FIND_METHOD")
59+
if(DEFINED "${PROJECT_NAME}-dependency-method")
60+
set("${_pkg}_FIND_METHOD" "${${PROJECT_NAME}-dependency-method}")
61+
else()
62+
set("${_pkg}_FIND_METHOD" "cmake" "pkgconf" "subproject" "fetch")
63+
endif()
64+
set("_${_pkg}_FIND_METHOD")
65+
endif()
66+
67+
foreach(method ${${_pkg}_FIND_METHOD})
68+
if(TARGET "${_lib}::${_lib}")
69+
break()
70+
endif()
71+
72+
if("${method}" STREQUAL "cmake")
73+
message(STATUS "${_lib}: Find installed package")
74+
if(DEFINED "${_pkg}_DIR")
75+
set("_${_pkg}_DIR")
76+
set("${_lib}_DIR" "${_pkg}_DIR")
77+
endif()
78+
find_package("${_lib}" CONFIG QUIET)
79+
if("${_lib}_FOUND")
80+
message(STATUS "${_lib}: Found installed package")
81+
break()
82+
endif()
83+
endif()
84+
85+
if("${method}" STREQUAL "pkgconf")
86+
find_package(PkgConfig QUIET)
87+
pkg_check_modules("${_pkg}" QUIET "${_lib}")
88+
if("${_pkg}_FOUND")
89+
message(STATUS "Found ${_lib} via pkg-config")
90+
91+
add_library("${_lib}::${_lib}" INTERFACE IMPORTED)
92+
target_link_libraries(
93+
"${_lib}::${_lib}"
94+
INTERFACE
95+
"${${_pkg}_LINK_LIBRARIES}"
96+
)
97+
target_include_directories(
98+
"${_lib}::${_lib}"
99+
INTERFACE
100+
"${${_pkg}_INCLUDE_DIRS}"
101+
)
102+
103+
break()
104+
endif()
105+
endif()
106+
107+
if("${method}" STREQUAL "subproject")
108+
if(NOT DEFINED "${_pkg}_SUBPROJECT")
109+
set("_${_pkg}_SUBPROJECT")
110+
set("${_pkg}_SUBPROJECT" "subprojects/${_lib}")
111+
endif()
112+
set("${_pkg}_SOURCE_DIR" "${PROJECT_SOURCE_DIR}/${${_pkg}_SUBPROJECT}")
113+
set("${_pkg}_BINARY_DIR" "${PROJECT_BINARY_DIR}/${${_pkg}_SUBPROJECT}")
114+
if(EXISTS "${${_pkg}_SOURCE_DIR}/CMakeLists.txt")
115+
message(STATUS "Include ${_lib} from ${${_pkg}_SUBPROJECT}")
116+
add_subdirectory(
117+
"${${_pkg}_SOURCE_DIR}"
118+
"${${_pkg}_BINARY_DIR}"
119+
)
120+
121+
add_library("${_lib}::${_lib}" INTERFACE IMPORTED)
122+
target_link_libraries("${_lib}::${_lib}" INTERFACE "${_lib}")
123+
124+
# We need the module directory in the subproject before we finish the configure stage
125+
if(NOT EXISTS "${${_pkg}_BINARY_DIR}/include")
126+
make_directory("${${_pkg}_BINARY_DIR}/include")
127+
endif()
128+
129+
break()
130+
endif()
131+
endif()
132+
133+
if("${method}" STREQUAL "fetch")
134+
message(STATUS "Retrieving ${_lib} from ${_url}")
135+
include(FetchContent)
136+
FetchContent_Declare(
137+
"${_lib}"
138+
GIT_REPOSITORY "${_url}"
139+
GIT_TAG "v0.4.0"
140+
)
141+
FetchContent_MakeAvailable("${_lib}")
142+
143+
add_library("${_lib}::${_lib}" INTERFACE IMPORTED)
144+
target_link_libraries("${_lib}::${_lib}" INTERFACE "${_lib}")
145+
146+
# We need the module directory in the subproject before we finish the configure stage
147+
FetchContent_GetProperties("${_lib}" SOURCE_DIR "${_pkg}_SOURCE_DIR")
148+
FetchContent_GetProperties("${_lib}" BINARY_DIR "${_pkg}_BINARY_DIR")
149+
if(NOT EXISTS "${${_pkg}_BINARY_DIR}/include")
150+
make_directory("${${_pkg}_BINARY_DIR}/include")
151+
endif()
152+
153+
break()
154+
endif()
155+
156+
endforeach()
157+
158+
if(TARGET "${_lib}::${_lib}")
159+
set("${_pkg}_FOUND" TRUE)
160+
else()
161+
set("${_pkg}_FOUND" FALSE)
162+
endif()
163+
164+
if(DEFINED "_${_pkg}_SUBPROJECT")
165+
unset("${_pkg}_SUBPROJECT")
166+
unset("_${_pkg}_SUBPROJECT")
167+
endif()
168+
if(DEFINED "_${_pkg}_DIR")
169+
unset("${_lib}_DIR")
170+
unset("_${_pkg}_DIR")
171+
endif()
172+
if(DEFINED "_${_pkg}_FIND_METHOD")
173+
unset("${_pkg}_FIND_METHOD")
174+
unset("_${_pkg}_FIND_METHOD")
175+
endif()
176+
unset(_lib)
177+
unset(_pkg)
178+
unset(_url)

config/template.cmake

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

3+
set("@PROJECT_NAME@_WITH_QP" @WITH_QP@)
4+
set("@PROJECT_NAME@_WITH_XDP" @WITH_XDP@)
5+
36
if(NOT TARGET "@PROJECT_NAME@::@PROJECT_NAME@")
47
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake")
58
endif()

doc/specs/stdlib_kinds.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,28 @@ The `stdlib_kinds` module provides kind parameters for the Fortran intrinsic dat
1616

1717
### `sp`
1818

19-
Alias for intrinsic named constant `real32` imported from `iso_fortran_env`.
19+
Single precision real kind parameter.
20+
Provides real kind parameter for floating point numbers with a minimal precision of 6 significant digits.
2021

2122

2223
### `dp`
2324

24-
Alias for intrinsic named constant `real64` imported from `iso_fortran_env`.
25+
Double precision real kind parameter.
26+
Provides real kind parameter for floating point numbers with a minimal precision of 15 significant digits.
27+
28+
29+
### `xdp`
30+
31+
Extended double precision real kind parameter.
32+
Provides real kind parameter for floating point numbers with a minimal precision of 18 significant digits.
33+
If not available it has value `-1`.
2534

2635

2736
### `qp`
2837

29-
Alias for intrinsic named constant `real128` imported from `iso_fortran_env`.
38+
Quadruple precision real kind parameter.
39+
Provides real kind parameter for floating point numbers with a minimal precision of 33 significant digits.
40+
If not available it has value `-1`.
3041

3142

3243
### `int8`

doc/specs/stdlib_string_type.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1993,7 +1993,7 @@ An unallocated `string_type` instance is equivalent to an empty string.
19931993

19941994
#### Class
19951995

1996-
Pure Subroutine.
1996+
Pure subroutine (Elemental subroutine, only when both `from` and `to` are `type(string_type)`)
19971997

19981998
#### Argument
19991999

0 commit comments

Comments
 (0)