Skip to content

Commit d1f7b2b

Browse files
committed
Include README info regarding python script preprocessing
1 parent 85ac351 commit d1f7b2b

File tree

5 files changed

+27
-128
lines changed

5 files changed

+27
-128
lines changed

README.md

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,19 +179,38 @@ earlier builds do not affect the new build.
179179
Fortran Package Manager (fpm) is a package manager and build system for Fortran.
180180
You can build `stdlib` using provided `fpm.toml`:
181181

182+
**Option 1**: From root folder
183+
184+
As `fpm` does not currently support `fypp` natively, `stdlib` now proposes a python script to preprocess and build. This script enables modification of the different `fypp` macros available in `stdlib`. The preprocessed files will be dumped at `<current_folder>/temp/*.f90` or `*.F90`. You can use the following command line:
185+
182186
```sh
183-
git checkout stdlib-fpm
187+
python config/fypp_deployment.py
184188
fpm build --profile release
185189
```
186190

187-
**Alternative**: as `fpm` does not currently support `fypp` natively, building `stdlib` with `fpm` can be done in two steps: a) launch the preprocessor through the `fpm-deployment.sh` script, which creates a subfolder `stdlib-fpm` and b) build the project using the processed files within the latter subfolder. This process can be done with the following commands:
191+
or the short-cut
188192

189193
```sh
190-
source ./ci/fpm-deployment.sh
191-
cd stdlib-fpm/
192-
fpm build --profile release
194+
python config/fypp_deployment.py --build 1
195+
```
196+
197+
To modify the `maxrank` macro for instance:
198+
```sh
199+
python config/fypp_deployment.py --maxrank 7 --build 1
193200
```
194201

202+
To see all the options:
203+
```sh
204+
python config/fypp_deployment.py --help
205+
```
206+
**Note**: If you use a compiler different than GNU compilers, the script will try to catch it from the environment variables `FPM_FC`, `FPM_CC`, `FPM_CXX`.
207+
208+
**Option 2**: From the `stdlib-fpm` branch which has already been preprocessed with default macros:
209+
```sh
210+
git checkout stdlib-fpm
211+
fpm build --profile release
212+
```
213+
#### Runing the examples
195214
You can run the examples with `fpm` as:
196215

197216
```sh

ci/.gitignore

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

ci/fpm-deployment.sh

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

ci/fpm.toml

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

config/fypp_deployment.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ def pre_process_fypp(args):
4646
optparser = fypp.get_option_parser()
4747
options, leftover = optparser.parse_args(args=kwd)
4848
options.includes = ['include']
49-
# options.line_numbering = True
49+
if args.lnumbering:
50+
options.line_numbering = True
5051
tool = fypp.Fypp(options)
5152

5253
# Check destination folder for preprocessing. if not 'stdlib-fpm', it is assumed to be the root folder.
@@ -139,7 +140,7 @@ def fpm_build(args,unknown):
139140
parser.add_argument("--maxrank",type=int, default=7, help="Set the maximum allowed rank for arrays")
140141
parser.add_argument("--with_qp",type=bool, default=False, help="Include WITH_QP in the command")
141142
parser.add_argument("--with_xdp",type=bool, default=False, help="Include WITH_XDP in the command")
142-
143+
parser.add_argument("--lnumbering",type=bool, default=False, help="Add line numbering in preprocessed files")
143144
parser.add_argument("--deploy_stdlib_fpm",type=bool, default=False, help="create the stdlib-fpm folder")
144145
# external libraries arguments
145146
parser.add_argument("--build",type=bool, default=False, help="Build the project")

0 commit comments

Comments
 (0)