Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: change in structure of stdlib in order to compiler it using fypp script #675

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions API-doc-FORD-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ project: Fortran-lang/stdlib
summary: A community driven standard library for (modern) Fortran
src_dir: src
include: src
include
exclude_dir: src/tests
output_dir: API-doc
page_dir: doc
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ list(
"-DPROJECT_VERSION_MAJOR=${PROJECT_VERSION_MAJOR}"
"-DPROJECT_VERSION_MINOR=${PROJECT_VERSION_MINOR}"
"-DPROJECT_VERSION_PATCH=${PROJECT_VERSION_PATCH}"
"-I${PROJECT_SOURCE_DIR}/include"
)

add_subdirectory(src)
Expand Down
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,21 @@ To use `stdlib` within your `fpm` project, add the following lines to your `fpm.
stdlib = { git="https://github.com/fortran-lang/stdlib", branch="stdlib-fpm" }
```

### Build with [fypp-script](https://github.com/fortran-lang/fpm/pull/729)

Fortran Package Manager has a compiler wrapper `fypp-script` that can be used to compile stdlib without
switching to `stdlib-fpm` branch.

```sh
git clone https://github.com/fortran-lang/fpm.git
```
Comment on lines +207 to +209
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is that provided? IMO a link to fpm should be sufficient.


```
fpm run -- build --compiler "$PWD/fypp-gfortran.py" -C stdlib
```

**Note** : At this stage, building using `stdlib-fpm` branch should be the preferred way of using `stdlib` with `fpm`.

## Using stdlib in your project

The stdlib project exports CMake package files and pkg-config files to make stdlib usable for other projects.
Expand Down
5 changes: 1 addition & 4 deletions ci/fpm-deployment.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,14 @@ include=(

# Files to remove from collection
prune=(
"$destdir/test/test_always_fail.f90"
"$destdir/test/test_always_skip.f90"
"$destdir/test/test_hash_functions.f90"
"$destdir/src/common.f90"
"$destdir/src/f18estop.f90"
)

major=$(cut -d. -f1 VERSION)
minor=$(cut -d. -f2 VERSION)
patch=$(cut -d. -f3 VERSION)
fyflags="${fyflags} -DPROJECT_VERSION_MAJOR=${major} -DPROJECT_VERSION_MINOR=${minor} -DPROJECT_VERSION_PATCH=${patch}"
fyflags="${fyflags} -DPROJECT_VERSION_MAJOR=${major} -DPROJECT_VERSION_MINOR=${minor} -DPROJECT_VERSION_PATCH=${patch} -I include"

mkdir -p "$destdir/src" "$destdir/test" "$destdir/example"

Expand Down
16 changes: 16 additions & 0 deletions fpm.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name = "stdlib"

[dev-dependencies]
test-drive.git = "https://github.com/fortran-lang/test-drive.git"

[build]
auto-examples = false
auto-tests = true

[preprocess.cpp]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be

Suggested change
[preprocess.cpp]
[preprocess.fypp]

?
As far as I remember, CPP is not used within stdlib.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that is not used. But, we have not enabled fypp inside fpm as of now. So, it cannot identity it as a valid preprocessor. Considering fypp-gfortran.py as a temporary solution, I think when we have fypp integrated inside fpm then I think we should rename it as fypp instead of cpp.

macros = [
"PROJECT_VERSION_MAJOR=0",
"PROJECT_VERSION_MINOR=1",
"PROJECT_VERSION_PATCH=0",
Comment on lines +12 to +14
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we support extracting those values automatically in fpm?

Copy link
Member Author

@arteevraina arteevraina Sep 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think we should add support to extract them for the version number ?
I will take up this task.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR created for this fortran-lang/fpm#766

"MAXRANK=4",
]
File renamed without changes.
2 changes: 1 addition & 1 deletion src/f08estop.f90
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
submodule (stdlib_error) estop
submodule (stdlib_error) f08estop

implicit none

Expand Down
4 changes: 2 additions & 2 deletions src/f18estop.f90
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
submodule (stdlib_error) estop
submodule (stdlib_error) f18estop

implicit none

Expand Down Expand Up @@ -26,4 +26,4 @@
endif
end procedure

end submodule estop
end submodule f18estop
10 changes: 0 additions & 10 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ macro(ADDTEST name)
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
endmacro(ADDTEST)

list(
APPEND fyppFlags
"-I${PROJECT_SOURCE_DIR}/src"
)

add_subdirectory(array)
add_subdirectory(ascii)
add_subdirectory(bitsets)
Expand All @@ -34,8 +29,3 @@ add_subdirectory(system)
add_subdirectory(quadrature)
add_subdirectory(math)
add_subdirectory(stringlist)

ADDTEST(always_skip)
set_tests_properties(always_skip PROPERTIES SKIP_RETURN_CODE 77)
ADDTEST(always_fail)
set_tests_properties(always_fail PROPERTIES WILL_FAIL true)
8 changes: 0 additions & 8 deletions test/hash_functions/nmhash.c

This file was deleted.

Loading