Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Include README info regarding python script preprocessing
  • Loading branch information
jalvesz committed Apr 27, 2024
commit d1f7b2bbc03d6c5850738c77a7fc05245671d7c8
29 changes: 24 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,19 +179,38 @@ earlier builds do not affect the new build.
Fortran Package Manager (fpm) is a package manager and build system for Fortran.
You can build `stdlib` using provided `fpm.toml`:

**Option 1**: From root folder

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:

```sh
git checkout stdlib-fpm
python config/fypp_deployment.py
fpm build --profile release
```

**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:
or the short-cut

```sh
source ./ci/fpm-deployment.sh
cd stdlib-fpm/
fpm build --profile release
python config/fypp_deployment.py --build 1
```

To modify the `maxrank` macro for instance:
```sh
python config/fypp_deployment.py --maxrank 7 --build 1
```

To see all the options:
```sh
python config/fypp_deployment.py --help
```
**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`.

**Option 2**: From the `stdlib-fpm` branch which has already been preprocessed with default macros:
```sh
git checkout stdlib-fpm
fpm build --profile release
```
#### Runing the examples
You can run the examples with `fpm` as:

```sh
Expand Down
7 changes: 0 additions & 7 deletions ci/.gitignore

This file was deleted.

99 changes: 0 additions & 99 deletions ci/fpm-deployment.sh

This file was deleted.

15 changes: 0 additions & 15 deletions ci/fpm.toml

This file was deleted.

5 changes: 3 additions & 2 deletions config/fypp_deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ def pre_process_fypp(args):
optparser = fypp.get_option_parser()
options, leftover = optparser.parse_args(args=kwd)
options.includes = ['include']
# options.line_numbering = True
if args.lnumbering:
options.line_numbering = True
tool = fypp.Fypp(options)

# Check destination folder for preprocessing. if not 'stdlib-fpm', it is assumed to be the root folder.
Expand Down Expand Up @@ -139,7 +140,7 @@ def fpm_build(args,unknown):
parser.add_argument("--maxrank",type=int, default=7, help="Set the maximum allowed rank for arrays")
parser.add_argument("--with_qp",type=bool, default=False, help="Include WITH_QP in the command")
parser.add_argument("--with_xdp",type=bool, default=False, help="Include WITH_XDP in the command")

parser.add_argument("--lnumbering",type=bool, default=False, help="Add line numbering in preprocessed files")
parser.add_argument("--deploy_stdlib_fpm",type=bool, default=False, help="create the stdlib-fpm folder")
# external libraries arguments
parser.add_argument("--build",type=bool, default=False, help="Build the project")
Expand Down