Skip to content

Commit 06caad6

Browse files
Copilotklendathu2k
andcommitted
Fix: Add missing file extensions to source file discovery
Added .f, .f90, and .F90 to the wanted() function in cons script so that Fortran 77 and Fortran 90 source files are properly discovered during build. Previously, the file discovery function was missing these extensions, causing F90 files to be ignored even though the compiler support was in place. Updated documentation to clarify automatic file discovery. Co-authored-by: klendathu2k <56083924+klendathu2k@users.noreply.github.com>
1 parent 6af9d66 commit 06caad6

2 files changed

Lines changed: 22 additions & 14 deletions

File tree

docs/fortran90-support.md

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,26 @@ Both extensions are mapped to the `build::command::f90` builder in the cons syst
4444

4545
To use Fortran 90 in your project:
4646

47-
1. Create your Fortran 90 source files with `.f90` or `.F90` extensions
48-
2. Add them to your Conscript file as you would other source files
47+
1. Create your Fortran 90 source files with `.f90` or `.F90` extensions in your source directory
48+
2. The cons build system will automatically discover these files when scanning the directory
4949
3. The build system will automatically use the Fortran 90 compiler for these files
5050

51-
Example:
52-
```perl
53-
# In your Conscript file
54-
my @src = qw(
55-
mycode.cxx
56-
myfortran.f
57-
myfortran90.f90
58-
);
51+
**Note**: The build system uses the `find_sources` function to automatically discover source files. As of this update, the following Fortran file extensions are recognized:
52+
- `.f` - Fortran 77 fixed-form
53+
- `.F` - Fortran 77 fixed-form with preprocessing
54+
- `.f90` - Fortran 90 free-form
55+
- `.F90` - Fortran 90 free-form with preprocessing
5956

60-
Library($env, 'MyLibrary', @src);
57+
Example directory structure:
6158
```
59+
MyPackage/
60+
├── mycode.cxx
61+
├── myfortran.f # Fortran 77
62+
├── myfortran90.f90 # Fortran 90
63+
└── preprocessed.F90 # Fortran 90 with preprocessing
64+
```
65+
66+
The build system will automatically find all these files and compile them appropriately.
6267

6368
## Differences from Fortran 77
6469

mgr/cons

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,9 +1263,12 @@ sub wanted {
12631263
/^\w.*\.cxx$/ ||
12641264
/^\w.*\.cpp$/ ||
12651265
/^\w.*\.g$/ ||
1266-
/^\w.*\.age$/ || #for STAR /^\w.*\.f$/ ||
1267-
/^\w.*\.cdf$/ ||
1268-
/^\w.*\.F$/) {# print " $File::Find::name\n";
1266+
/^\w.*\.age$/ ||
1267+
/^\w.*\.f$/ ||
1268+
/^\w.*\.F$/ ||
1269+
/^\w.*\.f90$/ ||
1270+
/^\w.*\.F90$/ ||
1271+
/^\w.*\.cdf$/) {# print " $File::Find::name\n";
12691272
push @main::search_files, $File::Find::name;
12701273
}
12711274
}

0 commit comments

Comments
 (0)