-
-
Notifications
You must be signed in to change notification settings - Fork 35
Use out-of-source directory for .mod files by default #231
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
Comments
+1, this workaround works perfectly, thanks. |
Interesting idea. I am not sure though that this should be the default option. As you mentioned yourself, we rely on Now when it comes to building a copy of the directory structure just for the .mod files things tend to become a bit more complicated. However, as you said, this would only be an issue if you had multiple source files with identical names, which in general is not considered a good idea, for reasons such as this one, regardless the project's complexity. The only "easy" solution that I can think off for your problem is to get the extension to generate the .mod files using the relative paths to the Either way, using multiple out-of-place directories for your .mod files because of identical names would run into the same problems as not using For example:Let . ├── a │ └── foo.f90 ├── b │ └── foo.f90 ├── c │ └── bar.f90 └── .fmod ├── a │ └── foo.mod ├── b │ └── foo.mod └── c └── bar.mod When linting any one of the Truth be told, I don't see a way that you can robustly provide linting for files with the same name without doing a major overhaul of how the extension handles linting. Of course I also don't think that's a problem that will dominate someone's workflow since you can create the correct .mod file by simply saving the appropriate .f90 file. |
The out-of-source directory option has been added to |
This is an enhancement request related to both #176 and #187
By default the linter runs gfortran against source code in the directory where it is found, generating
.mod
files in those directories. This works fine until you use an out-of-source build system like CMake. The.mod
files written by the linter into the source tree interfere with compilation and linking under CMake and complicate version control.The workaround is to manually tell the linter to write
.mod
files to a separate out-of-source directory and to include that directory for the linter's use.An example: For a project with the base directory
C:/Users/me/Documents/git_projects/my_project
, I will create the directory.fmod
under the project root (C:/Users/me/Documents/git_projects/my_project/.fmod
). I then modify the workspace'ssettings.json
to add:This gives me the benefit of linting and syntax checking while keeping temporary files out of my source directory.
The big problem is that I have to manually configure every project like this if I want to use both CMake and Fortran linting.
It seems like this could be easily solved by setting the default configuration to something like:
The directory
.fmod
needs to be created. There may be issues using a single directory to store files generated from a source tree if the source tree contains multiple files with the same name. In that case, replicate the source directory structure under.fmod
. That is, for the source directory${workspaceFolder}/.fmod/src/tree
, set the include path and-J
path to${workspaceFolder}/.fmod/src/tree
. This is slightly more complex but would solve the problem for projects with multilevel source directories, the sort of complex projects CMake was designed to manage.If #176 adds
${workspaceFolder}
support, this change would be an invisible resolution of #187.The text was updated successfully, but these errors were encountered: