Skip to content

Commit 8e37737

Browse files
committed
update features_with_dependency test
1 parent 9ec4ebb commit 8e37737

File tree

2 files changed

+19
-14
lines changed

2 files changed

+19
-14
lines changed

example_packages/features_with_dependency/fpm.toml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,31 @@ name = "features_with_dependency"
88
source-dir = "app"
99
main = "main.f90"
1010

11-
# Enable cpp preprocessing on the main program
12-
[preprocess.cpp]
13-
1411
[dependencies]
1512
# Base dependencies (none for this demo - features will add them)
1613

1714
[features]
1815
# Feature that enables debug mode in the dependency
1916
with_feat_debug.dependencies.features_demo = { path = "../features_demo", features = ["debug"] }
20-
with_feat_debug.preprocess.cpp.macros = "WITH_DEBUG_DEPENDENCY"
17+
with_feat_debug.preprocess.cpp.macros = ["WITH_DEMO","WITH_DEBUG_DEPENDENCY"]
2118

2219
# Feature that enables release mode in the dependency
2320
with_feat_release.dependencies.features_demo = { path = "../features_demo", features = ["release"] }
24-
with_feat_release.preprocess.cpp.macros = "WITH_RELEASE_DEPENDENCY"
21+
with_feat_release.preprocess.cpp.macros = ["WITH_DEMO","WITH_RELEASE_DEPENDENCY"]
2522

2623
# Feature that enables multiple dependency features
2724
with_feat_multi.dependencies.features_demo = { path = "../features_demo", features = ["debug", "mpi"] }
28-
with_feat_multi.preprocess.cpp.macros = "WITH_MULTI_DEPENDENCY"
25+
with_feat_multi.preprocess.cpp.macros = ["WITH_DEMO","WITH_MULTI_DEPENDENCY"]
2926

3027
# Feature for platform-specific dependency features
3128
linux_specific.linux.dependencies.features_demo = { path = "../features_demo", features = ["linux"] }
32-
linux_specific.preprocess.cpp.macros = "LINUX_FEATURES"
29+
linux_specific.preprocess.cpp.macros = ["WITH_DEMO","LINUX_FEATURES"]
3330

3431
# Feature combining compiler and dependency features
3532
gfortran_optimized.gfortran.dependencies.features_demo = { path = "../features_demo", features = ["release", "gfortran"] }
3633
gfortran_optimized.gfortran.flags = "-O3 -march=native"
34+
gfortran_optimized.preprocess.cpp.macros = ["WITH_DEMO"]
35+
3736

3837
[profiles]
3938
debug_dep = ["with_feat_debug"]

example_packages/features_with_dependency/src/features_with_dependency.f90

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
module features_with_dependency
2-
use features_demo, only: show_features => show_features, get_build_info
2+
#ifdef WITH_DEMO
3+
use features_demo, only: show_demo_features => show_features
4+
#endif
35
implicit none
46
private
5-
public :: show_features => show_local_features
7+
public :: show_features
68

79
contains
810

9-
subroutine show_local_features()
11+
subroutine show_features()
1012
print *, "Local package features:"
1113

1214
#ifdef WITH_DEBUG_DEPENDENCY
@@ -31,9 +33,13 @@ subroutine show_local_features()
3133
#endif
3234

3335
print *, ""
34-
print *, "Dependency (features_demo) status:"
35-
call show_features() ! Call features_demo's show_features
36+
#ifdef WITH_DEMO
37+
print *, "Dependency (features_demo) status:"
38+
call show_demo_features() ! Call features_demo's show_features
39+
#else
40+
print *, "Dependency (features_demo) is not attached"
41+
#endif
3642

37-
end subroutine show_local_features
43+
end subroutine show_features
3844

39-
end module features_with_dependency
45+
end module features_with_dependency

0 commit comments

Comments
 (0)