Skip to content

Commit 4e06727

Browse files
author
Jim-215-Fisher
committed
Merge branch 'master' into Distribution-Normal
2 parents ed7c2cb + d2a611e commit 4e06727

File tree

107 files changed

+12906
-7654
lines changed

Some content is hidden

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

107 files changed

+12906
-7654
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<!--
2+
Thank you for contributing to stdlib.
3+
To help us get your pull request merged more quickly, please consider reviewing any of the already open pull requests.
4+
-->

.github/workflows/CI.yml

Lines changed: 23 additions & 15 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,39 +67,38 @@ 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: |
91-
make -f Makefile.manual FYPPFLAGS="-DMAXRANK=4" -j
97+
make -f Makefile.manual -j
9298
make -f Makefile.manual test
9399
make -f Makefile.manual clean
100+
env:
101+
FYPPFLAGS: "-DMAXRANK=4"
94102

95103
intel-build:
96104
runs-on: ${{ matrix.os }}

.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: |

API-doc-FORD-file.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ media_dir: doc/media
99
fpp_extensions: fypp
1010
preprocess: true
1111
macro: MAXRANK=3
12+
PROJECT_VERSION_MAJOR=0
13+
PROJECT_VERSION_MINOR=0
14+
PROJECT_VERSION_PATCH=0
1215
preprocessor: fypp
1316
display: public
1417
protected

CMakeLists.txt

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
cmake_minimum_required(VERSION 3.14.0)
22
project(fortran_stdlib
33
LANGUAGES Fortran
4-
VERSION 0.1.0
54
DESCRIPTION "Community driven and agreed upon de facto standard library for Fortran"
65
)
6+
7+
# Read version from file
8+
file(STRINGS "${PROJECT_SOURCE_DIR}/VERSION" PROJECT_VERSION)
9+
string(REPLACE "." ";" VERSION_LIST ${PROJECT_VERSION})
10+
list(GET VERSION_LIST 0 PROJECT_VERSION_MAJOR)
11+
list(GET VERSION_LIST 1 PROJECT_VERSION_MINOR)
12+
list(GET VERSION_LIST 2 PROJECT_VERSION_PATCH)
13+
unset(VERSION_LIST)
14+
715
enable_testing()
816

917
# Follow GNU conventions for installation directories
@@ -24,7 +32,6 @@ if(CMAKE_Fortran_COMPILER_ID STREQUAL GNU)
2432
add_compile_options(-Wall)
2533
add_compile_options(-Wextra)
2634
add_compile_options(-Wimplicit-procedure)
27-
add_compile_options(-Wconversion-extra)
2835
# -pedantic-errors triggers a false positive for optional arguments of elemental functions,
2936
# see test_optval and https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95446
3037
if(CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 11.0)
@@ -55,7 +62,7 @@ endif()
5562
# --- find preprocessor
5663
find_program(FYPP fypp)
5764
if(NOT FYPP)
58-
message(FATAL_ERROR "Preprocessor fypp not found!")
65+
message(FATAL_ERROR "Preprocessor fypp not found! Please install fypp following the instructions in https://fypp.readthedocs.io/en/stable/fypp.html#installing")
5966
endif()
6067

6168
add_subdirectory(src)

Makefile.manual

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ FC ?= gfortran
44
FFLAGS ?= -Wall -Wextra -Wimplicit-interface -fPIC -g -fcheck=all
55
FYPPFLAGS ?=
66

7+
VERSION := $(subst ., ,$(file < VERSION))
8+
FYPPFLAGS += \
9+
-DPROJECT_VERSION_MAJOR=$(word 1,$(VERSION)) \
10+
-DPROJECT_VERSION_MINOR=$(word 2,$(VERSION)) \
11+
-DPROJECT_VERSION_PATCH=$(word 3,$(VERSION))
12+
713
export FC
814
export FFLAGS
915
export FYPPFLAGS

VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.1.0

ci/fpm-deployment.sh

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,32 @@ 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=(
1923
"ci/fpm.toml"
2024
"LICENSE"
25+
"VERSION"
2126
)
2227

2328
# Files to remove from collection
2429
prune=(
2530
"$destdir/test/test_always_fail.f90"
2631
"$destdir/test/test_always_skip.f90"
27-
"$destdir/test/test_mean_f03.f90"
2832
"$destdir/src/common.f90"
2933
"$destdir/src/f18estop.f90"
3034
)
3135

36+
major=$(cut -d. -f1 VERSION)
37+
minor=$(cut -d. -f2 VERSION)
38+
patch=$(cut -d. -f3 VERSION)
39+
fyflags="${fyflags} -DPROJECT_VERSION_MAJOR=${major} -DPROJECT_VERSION_MINOR=${minor} -DPROJECT_VERSION_PATCH=${patch}"
40+
3241
mkdir -p "$destdir/src" "$destdir/test"
3342

3443
# Preprocess stdlib sources
@@ -43,7 +52,7 @@ find src/tests -name "*.dat" -exec cp {} "$destdir/" \;
4352
# Include additional files
4453
cp "${include[@]}" "$destdir/"
4554

46-
# Source file workarounds for fpm
55+
# Source file workarounds for fpm; ignore missing files
4756
rm "${prune[@]}"
4857

4958
# List stdlib-fpm package contents

ci/fpm.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name = "stdlib"
2-
version = "0.1.0"
2+
version = "VERSION"
33
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"

0 commit comments

Comments
 (0)