Skip to content

Commit e5a7555

Browse files
Copilotklendathu2k
andcommitted
Correct file discovery: Only add .f90 and .F90, not .f
Remove .f from file discovery as it uses separate preprocessing mechanism. Only .f90 and .F90 should be added for Fortran 90 support. The .F extension remains (was already in original code). Updated documentation to clarify which extensions are auto-discovered. Co-authored-by: klendathu2k <56083924+klendathu2k@users.noreply.github.com>
1 parent 06caad6 commit e5a7555

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

docs/fortran90-support.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,20 @@ To use Fortran 90 in your project:
4848
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-
**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
51+
**Note**: The build system uses the `find_sources` function to automatically discover source files. The following Fortran file extensions are recognized for automatic discovery:
5352
- `.F` - Fortran 77 fixed-form with preprocessing
5453
- `.f90` - Fortran 90 free-form
5554
- `.F90` - Fortran 90 free-form with preprocessing
5655

56+
**Important**: `.f` files (Fortran 77 fixed-form without preprocessing) use a separate preprocessing compilation mechanism and are not included in automatic source file discovery. They are handled through a different build path.
57+
5758
Example directory structure:
5859
```
5960
MyPackage/
6061
├── mycode.cxx
61-
├── myfortran.f # Fortran 77
62-
├── myfortran90.f90 # Fortran 90
63-
└── preprocessed.F90 # Fortran 90 with preprocessing
62+
├── myfortran.F # Fortran 77 with preprocessing (auto-discovered)
63+
├── myfortran90.f90 # Fortran 90 (auto-discovered)
64+
└── preprocessed.F90 # Fortran 90 with preprocessing (auto-discovered)
6465
```
6566

6667
The build system will automatically find all these files and compile them appropriately.

mgr/cons

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1264,11 +1264,10 @@ sub wanted {
12641264
/^\w.*\.cpp$/ ||
12651265
/^\w.*\.g$/ ||
12661266
/^\w.*\.age$/ ||
1267-
/^\w.*\.f$/ ||
1268-
/^\w.*\.F$/ ||
12691267
/^\w.*\.f90$/ ||
12701268
/^\w.*\.F90$/ ||
1271-
/^\w.*\.cdf$/) {# print " $File::Find::name\n";
1269+
/^\w.*\.cdf$/ ||
1270+
/^\w.*\.F$/) {# print " $File::Find::name\n";
12721271
push @main::search_files, $File::Find::name;
12731272
}
12741273
}

0 commit comments

Comments
 (0)