Commit Graph

115 Commits

Author SHA1 Message Date
Dylan Baker 64c267c49c compilers: Add default search path stdlib_only_link_flags
This should be done in all cases of language_stdlib_only_link_flags, but
I don't have access to all of the compilers to test it.

This is required in cases where object files created by gfortran are
linked using another compiler with a differen default search path, such
as gfortran and clang together.
2021-09-25 00:18:22 +03:00
Rohit Goswami 32ba349f0a compilers: Use standards compliant test 2021-09-20 01:29:59 -04:00
Mat Cross 85a5aed60f nagfor preprocessor flag. 2021-09-10 16:08:57 -04:00
Mat Cross 436a257c50 Comments on nagfor options setup. 2021-09-10 16:08:57 -04:00
Mat Cross 0e86258748 Implemented some missing operation for the NAG Fortran Compiler. 2021-09-10 16:08:57 -04:00
Dylan Baker e3c72ad7c7 compilers: Fix extra_args parameter
which can also be a callable taking a CompileChekcMode as an argumetn
and returning a list of strings.
2021-08-16 16:21:51 -07:00
Eli Schwartz dd31891c1f more f-strings too complex to be caught by pyupgrade 2021-07-05 17:55:04 +03:00
Daniel Mensinger 3e396b3782
fix: Always explicitly set encoding for text files (fixes #8263) 2021-06-29 11:28:08 +02:00
Jussi Pakkanen 9ab4dadef9 Remove -pipe from default list of args. Closes #8508. 2021-03-23 17:26:08 +02:00
Dylan Baker 40e3577a65 split program related classes and functions out of dependencies
Dependencies is already a large and complicated package without adding
programs to the list. This also allows us to untangle a bit of spaghetti
that we have.
2021-03-19 08:47:10 -04:00
Dylan Baker f9b19e73a5 move OptionKey to mesonlib
There's starting to be a lot of things including coredata that coredata
needs to itself include. putting it in mesonlib makes more sense
2021-01-04 12:20:40 -08:00
Dylan Baker fe973d9fc4 use OptionKey for compiler_options 2021-01-04 12:20:39 -08:00
Dylan Baker bdca05e2e6 Add choices to OptionProxy
they're probably not strictly needed, but it makes mypy happy.
2021-01-04 12:15:41 -08:00
Dylan Baker 8915538c31 compilers/fortran: Add "none" to intel compielrs for standards
Fixes #8023
2020-11-24 23:11:23 -05:00
Dylan Baker f6672c7a19 use real pathlib module
We added the _pathlib module to work around defeciencies in python 3.5's
implementation, since we now rely on 3.6 lets drop this
2020-11-20 15:08:40 -08:00
Dylan Baker 2844afedde compilers: define standards in the base language compiler
And then update the choices in each leaf class. This way we don't end up
with another case where we implicitly allow an invalid standard to be
set on a compiler that doesn't have a 'std' setting currently.
2020-11-12 10:03:15 -08:00
Daniel Mensinger 1dfaccfd91 pathlib: Fix resolve() by overriding it in Python 3.5 2020-10-04 10:45:48 +02:00
Dylan Baker b309f4904b compilers/fortran: make ifort on windows signature match ICL's 2020-10-01 15:06:10 -07:00
Dylan Baker ff51e1c5aa compilers/clike: Store exe_wrapper as ExternalProgram
Which is what other languages do.
2020-10-01 15:06:10 -07:00
Dylan Baker 577a2de7e8 compilers/fortran: fix has_multi_*_arguments
The implementation of the link variant was what should have been the
compiler variant, and there was no valid compiler variant, which meant
it was getting C code.
2020-10-01 15:06:10 -07:00
Dylan Baker e039727e63 compilers/fortran: add type annotations 2020-10-01 15:05:01 -07:00
Dylan Baker e7f0890cb9 compilers: move get_dependency_gen_args to base Compiler
So that every subclass doesn't have to reimplement it. Especially since
the Gnu implementation moved out of the CCompiler and into the
GnuLikeCompiler mixin
2020-10-01 15:05:00 -07:00
Dylan Baker 2c0fbe161d compilers: make is_cross part of the base Compiler class
Every class needs to set this, so it should be part of the base. For
classes that require is_cross, the positional argument remains in their
signature. For those that don't, they just allow the base class to set
their value to it's default of False.
2020-09-24 12:14:13 -07:00
Dylan Baker bb3fe3c451 compilers/mixins/clike: fix mypy issues 2020-09-24 12:14:13 -07:00
Michael Hirsch, Ph.D f985bb7383
add Nvidia HPC SDK compilers 2020-07-13 00:16:52 -04:00
Yevhenii Kolesnikov 9dc3ca2c1c compilers: add fetching of define list for clang
Simmilar to gcc, the list of pre-processor defines can be fetched with
`-dM -E` option. The way cpu_family is determined on linux relies on
this list.

Fixes incorrect value of cpu_family on linux, when crosscompiling:

```
CC="clang -m32" meson ./build
```

Signed-off-by: Yevhenii Kolesnikov <yevhenii.kolesnikov@globallogic.com>
Co-authored-by: Dylan Baker <dylan@pnwbakers.com>
2020-05-22 16:58:12 +03:00
Nirbheek Chauhan 37bade6f87 gfortran: Fix has_header implementation with GCC 10
__has_include is not accepted as a pre-processor directive in Fortran
code since GCC 10.

Closes https://github.com/mesonbuild/meson/issues/7017
2020-05-14 09:31:16 +00:00
John Ericson 278c294aa4 Compiler options per lang
A current rather untyped storage of options is one of the things that
contributes to the options code being so complex. This takes a small
step in synching down by storing the compiler options in dicts per
language.

Future work might be replacing the langauge strings with an enum, and
defaultdict with a custom struct, just like `PerMachine` and
`MachineChoice`.
2020-04-20 23:23:15 +03:00
Michael Hirsch, Ph.D 5b4ebb5641 quality / test: Fortran type hinting
enhance fortran args tests
2020-04-05 13:43:53 +03:00
Ole André Vadla Ravnås 7195c0ee9c compilers: Fix accidental coredata mutations 2020-03-29 20:55:35 +03:00
makise-homura 7321cc776a Fix missing 'defines' argumet for Elbrus compiler
...But somehow it still remains in C++ compiler.
2020-01-27 22:35:26 +03:00
Daniel Mensinger 09b53c534f types: import typing as T (fixes #6333) 2020-01-08 15:28:17 +01:00
Dylan Baker 7460e4ccda compilers: Make get_display_language a class or static method
Currently this is done at the instance level, but we need it at the
class level to allow compiler "lang" args to be gotten early enough.
This patch also removes a couple of instance of branch/leaf classes
providing their own implementation that is identical to the Compiler
version.
2019-12-12 09:35:32 -08:00
Dylan Baker ee6e249f65 compilers: move language attribute to the class level
We know that if a compiler class inherits CCompiler it's language will
be C, so doing this at the class level makes more sense.
2019-12-12 09:35:30 -08:00
Daniel Mensinger 286b9f0921 lgtm: Fix Module imported with `import` and `import from` 2019-12-05 00:22:10 +02:00
Michael Hirsch, Ph.D b1c8f765fa intel/intel-cl: use appropriate buildtype options
This puts appropriate default options across buildtype for Intel and
Intel-Cl compilers, for C, C++ and Fortran. Prior to this PR, the
behavior of Intel compilers vs. GNUlike was not the same, in
particular, debug traceback available by default for GNUlike compilers
was not present with Intel compilers.
2019-12-04 21:48:34 +02:00
Michael Hirsch, Ph.D 07a2fe2f00 complete gfortran/intel/intel-cl fortran_std test 2019-11-25 13:08:56 +02:00
Michael Hirsch, Ph.D 1f751dacba fortran: sync implicit-none args for intel,pgi,gfortran
also, find intel-cl submodule .smod name pattern. this would fix
intermittent failures of ninja to resolve submodule file dependencies.
2019-11-18 23:45:24 +02:00
Michael Hirsch, Ph.D 050dcf80af fortran: note there is no has_function for Fortran
It would be very challenging if not futile to make has_function work for Fortran.
The meson.get_compiler('fortran').links() works very well instead.
As a reference, CMake's check_fortran_function_exists is completely broken in general.

This change raises a useful MesonException instead of giving bizarre errors.
2019-11-18 22:22:54 +02:00
Michael Hirsch, Ph.D 9c1bab67af
bugfix: fortran compiler assertionerror from 0c22798 2019-10-31 23:22:37 -04:00
Michael Hirsch, Ph.D 17f766105f intel-cl: correct argument order 2019-10-10 10:00:28 -07:00
Dylan Baker 0c22798b1a compilers: replace CompilerType with MachineInfo
Now that the linkers are split out of the compilers this enum is
only used to know what platform we're compiling for. Which is
what the MachineInfo class is for
2019-10-07 12:08:20 -07:00
Dylan Baker 0efab591da compilers: Move the compiler argument to proxy linker flags to the compiler class
Instead of the DynamicLinker returning a hardcoded value like
`-Wl,-foo`, it now is passed a value that could be '-Wl,', or could be
something '-Xlinker='

This makes a few things cleaner, and will make it possible to fix using
clang (not clang-cl) on windows, where it invokes either link.exe or
lld-link.exe instead of a gnu-ld compatible linker.
2019-08-30 00:01:32 +03:00
Dylan Baker 06dcbd50ee compilers: Dispatch to dynamic linker class
Most of the cuda code is from Olexa Bilaniuk.
Most of the PGI code is from Michael Hirsc
2019-08-14 13:13:23 -07:00
Dylan Baker 16e04a9bde compilers/fortran: Make ifort (windows) proxy extra args to Compiler 2019-08-14 13:13:23 -07:00
Dylan Baker b5c76a6c02 compilers/fortran: fix ifort (linux, mac) dependency generation
Ifort can generate dependency information (.d files), it just does it
differently than GNU compilers do. This also fixes a bug caused by
adding the dependency generation commands to the GNULike class later in
this series.
2019-08-14 13:13:23 -07:00
Michael Hirsch, Ph.D bc08ace84e
Flang: add links for non-flang main program 2019-07-29 01:18:54 -04:00
Dylan Baker fab47c5680 compilers: split pgi compiler out of compilers module 2019-07-15 10:59:22 -07:00
Dylan Baker 5d685e7a5c compilers: put elbrus in mixins 2019-07-15 10:59:22 -07:00
Dylan Baker bc4438b34f compilers: Put clang mixin in a module 2019-07-15 10:59:22 -07:00