- Purchasing and Activating Simply Fortran
- Using Simply Fortran
- The Simply Fortran Interface
- Editing in Simply Fortran
- Projects in Simply Fortran
- Building Projects
- Launching Projects
- Debugging Programs
- External Tools
- Version Control
- Options and Configuration
- Licensing
Compiler Personality Definitions
Simply Fortran supports different compiler families through “personalities,” which provide guidelines on how Simply Fortran should interface with the compiler. Defining a personality is achieved by creating a Javascript Object Notation, or JSON, file that provides some necessary details about how to use a compiler and its related tools. Simply Fortran itself
provides a default definition, but others can be created using the formatting outlined here.
Definition File
The definition file should contain a single JSON object wrapped in curly braces. Mandatory elements of the definition file appear in bold
- name – string – The name of the compiler
- base – string – The path to the executables for the compiler tools
- tools – object – The commands to invoke compiler tools
- fortran – string – The Fortran compiler
- c – string – The C compiler
- lib – string – The library manager
- resource – string – The Windows resource compiler
- link – string – The linker if an explicit linker is necessary
- extensions – object – File extensions used by the compilers and tools, all without a leading dot
- object – string – Object files
- module – string – Module compiler output files
- submodule – string – Submodule compiler output files
- executable – string – Executable files
- resource – string – Compiled resource files
- library – string – Static libraries
- shared-library – string – Shared libraries
- options – object – The necessary compiler options
- 32-bit – string or mode array – The flag to specify 32-bit output
- 64-bit – string or mode array – The flag to specify 64-bit output
- compile – string – A flag that specifies compilation only, no linking
- output – string – The flag to specify the compiler output, including the {filename$} variable
- debugging – string or mode array – Flag to enable debugging output in the object
- profiling – string or mode array – Flag to enable profiling output in the object
- preprocess – string – Flag to execute the C preprocessor and exit rather than compile
- error-limit – string – The flag to terminate compilation after {n%} errors
- necessary – object – Flags that must be supplied to the specified tools every time
- fortran – string or mode array – Flags that should always be passed to the Fortran compiler
- c – string or mode array – Flags that should always be passed to the C compiler
- resource – string or mode array – Flags that should always be passed to the resource compiler
- lib – string or mode array – Flags that should always be passed to the library manager
- link – string or mode array – Flags that should always be passed to the explicit linker
- prefer-forward-slash – boolean – True to specify that the compiler prefers paths using forward slashes on platforms where backslashes are used in paths
- gui – string or mode array – A flag to specify the application is a GUI on a platform where such a distinction matters
- optimization – object with default – Flags related to optimization
- None – string – Disable optimization entirely
- loop-optimize – string or mode array – Optimization flags related specifically to loops
- memory-model – object with default – Flags for specifying the memory model on architecture that support it (x86, namely)
- cpu – object – Flags for specifying the CPU architecture
- tune – string – Flag to specify the CPU using the {arch$} variable for which to tune code
- exact – string – Flag to specify the CPU using the {arch$} variable for which to compile specifically
- generic-arch – string – The string used to specify a generic CPU architecture to the compiler
- native-arch – string – The string used to specify current computer’s specific CPU architecture to the compiler
- fortran – object – Flags for specifying options related to Fortran
- double-promotion – string or mode array – Flag to promote all single-precision REALs to double-precision
- initialize-to-zero – string or mode array – Flag to cause the compiler to zero all variables
- cray-pointers – string or mode array – The flag to enable Cray pointers
- runtime-diagnostics – string or mode array – Flag to enable various runtime checks during the resultant program’s execution
- c-preprocessor – string – Flag to force the C preprocess to be used regardless of file extension
- openmp – string or mode array – Flag to enable OpenMP
- coarrays – string or mode array – Flags to enable Coarray support
- line-length – string – Flag using the {n%} variable to specify an alternate line length limit
- standard – object with default – Flags for forcing certain Fortran standards
- floating-point – object – Flags to enable trapping certain floating point exceptions
- invalid-operation – string – Flag to enable invalid floating point operation trap
- division-by-zero – string – Flag to enable trapping division by zero
- overflow – string – Flag to enable trapping floating point overflows
- underflow – string – Flag to enable trapping floating point underflows
- denormal – string – Flag to enable subnormal number traps
- inexact – string – Flag to enable trapping of inexact floating point errors
- disable – string – Flag to disable all floating point errors and warnings
- syntax-only – string – The flag to specify only checking source code syntax rather than compiling
- build-modules-only – string – The flag to specify building module comiler outputs only rather than compiling
- linker – object – Flags related to executing the linker
- dynamic-library – string – Flag specifying the output should be a shared library
- all-static – string – Flag specifying the compiler should attempt to compile a static executable
- static-runtime – object – Flags to specify linking static runtime libraries
- fortran – string – The flag to force static linking with the Fortran runtime library
- c – string – The flag to force static linking with the C runtime library
- cxx – string – The flag to force static linking with the C++ runtime library
- import-library – string – Flag to request an import library be generated when building a shared library
- definition-file – string – Flag to request a Windows library definition file be generated when building a shared library
- link-blas-lapack – string – Flags necessary to link LAPACK and BLAS
- objectfile-list – string – Flag to specify a file during linking that contains the object files to link rather than do so on the command line
- link-exe-command – string – The command line format, using {target$} and {objects$} variables, to generate an executable if using an explicit linker
- link-dll-command – string – The command line format, using {target$} and {objects$} variables, to generate a shared library if using an explicit linker
- library-manager – string – Options related to the library manager tool
- add-or-replace-object – string – The command line format, using {library$} and {object$}, to add/replace the object file to the specified library
- module-directory – string – The flag formatting, using the {directory$} variable, to specify the location of module outputs generated by the compiler
- include-directory – string – The flag formatting, using the {directory$} variable, to specify a location to search for included files and modules
- lib-directory – string – The flag formatting, using the {directory$} variable, to specify a location to search for libraries
Notes
In the above outline, the mode array implies that an option might need to be used differently depending on the tool in use. The array can have from one to four string entries defined as:
["<compiler>", "<linker>", "<library manager>", "<resource compiler>"]
Changing options depending on step might imply, for example, a necessary flag must be passed to the linker that would be meaningless during the compilation step.
Certain options, specified above as object with default, use their key/value objects as lists, where the key is shown in the Simply Fortran interface, and their value as the switch passed to the compiler. These objects should also contain an entry key default that has a string value equal to another key in the object. Simply Fortran will use the string specified by default as the default selection for this option.
The options must contain at least a single entry for 32-bit or 64-bit. These options can be empty strings if the compiler supports one or the other, but omitting one or the other implies the compiler cannot create that type of object/library/executable.
Variables
As mentioned earlier, some flags may be required to include variables, which Simply Fortran will replace during makefile generation. Variables must be wrapped in curly braces, and they are specified in the definition descriptions above.
Additionally, Simply Fortran will also define {sfinstall$} as the directory where Simply Fortran is installed.
Variables can be modified inside the curly braces by an operation appended to the variable name with a pipe character inside the curly braces. Available operations are:
- quote-space – If the variable contains a space, wrap the value in quotes
- replace-backslash – Replace all backslashes in the variable with forward slashes
- spaces-to-commas – Convert any spaces in a string to commas (for example, in a list of {objects$})
- unix-escape-special – Modify the variable value to escape spaces, parentheses, etc. with backslashes in a UNIX-compatible manner
For example, if one wanted to make sure the {filename$} variable was quoted if necessary, the flag for compiler output could instead be specified as:
"output": "-o {filename$|quote-spaces}"
Multiple operations can be applied to a single variable; they are performed left-to-right in order, each separated by another pipe character.
