File tree Expand file tree Collapse file tree 5 files changed +122
-0
lines changed Expand file tree Collapse file tree 5 files changed +122
-0
lines changed Original file line number Diff line number Diff line change 1+ name : fpm-deployment
2+
3+ on : [push, pull_request]
4+ env :
5+ GCC_V : " 10"
6+
7+ jobs :
8+ Build :
9+ runs-on : ubuntu-latest
10+
11+ steps :
12+ - name : Checkout 🛎️
13+ uses : actions/checkout@v2.3.1
14+
15+ - name : Set up Python 3.x
16+ uses : actions/setup-python@v1
17+ with :
18+ python-version : 3.x
19+
20+ - name : Install fypp
21+ run : pip install --upgrade fypp
22+
23+ - name : Generate stdlib-fpm package 🔧
24+ run : |
25+ bash ./ci/fpm-deployment.sh
26+
27+ - name : Install GFortran
28+ run : |
29+ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ env.GCC_V }} 100 \
30+ --slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${{ env.GCC_V }} \
31+ --slave /usr/bin/gcov gcov /usr/bin/gcov-${{ env.GCC_V }}
32+
33+ - name : Install fpm latest release
34+ uses : fortran-lang/setup-fpm@v3
35+ with :
36+ github-token : ${{ secrets.GITHUB_TOKEN }}
37+
38+ - name : Run fpm test ⚙
39+ run : |
40+ cp -r stdlib-fpm stdlib-fpm-test
41+ cd stdlib-fpm-test
42+ fpm test
43+ fpm test --profile release
44+
45+ # Update and deploy the f90 files generated by github-ci to the `stdlib-fpm` branch.
46+ - name : Deploy 🚀
47+ uses : JamesIves/github-pages-deploy-action@4.1.5
48+ if : github.event_name != 'pull_request'
49+ with :
50+ BRANCH : stdlib-fpm
51+ FOLDER : stdlib-fpm
Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ API-doc/
3939
4040# Build directory for out-of-tree builds
4141/build
42+ /stdlib-fpm
4243
4344# Emacs backup files
4445* ~
Original file line number Diff line number Diff line change 1111 - [ Supported compilers] ( #supported-compilers )
1212 - [ Build with CMake] ( #build-with-cmake )
1313 - [ Build with make] ( #build-with-make )
14+ - [ Build with fortran-lang/fpm] ( #build-with-fortran-langfpm )
1415* [ Using stdlib in your project] ( #using-stdlib-in-your-project )
1516* [ Documentation] ( #documentation )
1617* [ Contributing] ( #contributing )
@@ -176,7 +177,21 @@ You can limit the maximum rank by setting ``-DMAXRANK=<num>`` in the ``FYPPFLAGS
176177make -f Makefile.manual FYPPFLAGS=-DMAXRANK=4
177178```
178179
180+ ### Build with [ fortran-lang/fpm] ( https://github.com/fortran-lang/fpm )
179181
182+ Fortran Package Manager (fpm) is a package manager and build system for Fortran.
183+ You can build ` stdlib ` using provided ` fpm.toml ` :
184+
185+ ``` sh
186+ git checkout stdlib-fpm
187+ fpm build --profile release
188+ ```
189+
190+ To use ` stdlib ` within your ` fpm ` project, add the following lines to your ` fpm.toml ` file:
191+ ``` toml
192+ [dependencies ]
193+ stdlib = { git =" https://github.com/fortran-lang/stdlib" , branch =" stdlib-fpm" }
194+ ```
180195
181196## Using stdlib in your project
182197
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ set -ex
4+
5+ # Target directory to deploy stdlib to
6+ destdir=" ${DESTDIR:- stdlib-fpm} "
7+
8+ # Get fypp preprocessor
9+ fypp=" ${FYPP:- $(which fypp)} "
10+
11+ # Arguments for the fypp preprocessor
12+ fyflags=" ${FYFLAGS:- -DMAXRANK=4} "
13+
14+ # Number of parallel jobs for preprocessing
15+ njob=" $( nproc) "
16+
17+ # Additional files to include
18+ include=(
19+ " ci/fpm.toml"
20+ " LICENSE"
21+ )
22+
23+ # Files to remove from collection
24+ prune=(
25+ " $destdir /test/test_always_fail.f90"
26+ " $destdir /test/test_always_skip.f90"
27+ " $destdir /test/test_mean_f03.f90"
28+ " $destdir /src/common.f90"
29+ " $destdir /src/f18estop.f90"
30+ )
31+
32+ mkdir -p " $destdir /src" " $destdir /test"
33+
34+ # Preprocess stdlib sources
35+ find src -maxdepth 1 -iname " *.fypp" \
36+ | cut -f1 -d. | xargs -P " $njob " -I{} " $fypp " " {}.fypp" " $destdir /{}.f90" $fyflags
37+
38+ # Collect stdlib source files
39+ find src -maxdepth 1 -iname " *.f90" -exec cp {} " $destdir /src/" \;
40+ find src/tests -name " test_*.f90" -exec cp {} " $destdir /test/" \;
41+ find src/tests -name " *.dat" -exec cp {} " $destdir /" \;
42+
43+ # Include additional files
44+ cp " ${include[@]} " " $destdir /"
45+
46+ # Source file workarounds for fpm
47+ rm " ${prune[@]} "
48+
49+ # List stdlib-fpm package contents
50+ ls -R " $destdir "
Original file line number Diff line number Diff line change 1+ name = " stdlib"
2+ version = " 0.0.0"
3+ license = " MIT"
4+ author = " stdlib contributors"
5+ copyright = " 2019-2021 stdlib contributors"
You can’t perform that action at this time.
0 commit comments