Commit Graph

287 Commits

Author SHA1 Message Date
Dylan Baker 541523eeba compilers: Split C-Like functionality into a mixin classes
Currently C++ inherits C, which can lead to diamond problems. By pulling
the code out into a standalone mixin class that the C, C++, ObjC, and
Objc++ compilers can inherit and override as necessary we remove one
source of diamonding. I've chosen to split this out into it's own file
as the CLikeCompiler class is over 1000 lines by itself. This also
breaks the VisualStudio derived classes inheriting from each other, to
avoid the same C -> CPP inheritance problems. This is all one giant
patch because there just isn't a clean way to separate this.

I've done the same for Fortran since it effectively inherits the
CCompiler (I say effectively because was it actually did was gross
beyond explanation), it's probably not correct, but it seems to work for
now. There really is a lot of layering violation going on in the
Compilers, and a really good scrubbing would do this code a lot of good.
2019-05-03 10:36:50 -07:00
Dylan Baker 604b2534e8 environment: Fix syntax error 2019-05-02 14:56:23 -07:00
Dylan Baker da5f07cf39 Revert "detect Intel ICL on windows"
This reverts commit 3a75bb5259.
2019-05-02 14:56:23 -07:00
Dylan Baker 482e26764e Revert "enable Windows Intel compiler"
This reverts commit 50f2381565.
2019-05-02 14:56:23 -07:00
John Ericson 4c2617a9c6 Add some type annotations and fix lints
Some things, like `method[...](...)` or `x: ... = ...` python 3.5
doesn't support, so I made a comment instead with the intention that it
can someday be made into a real annotation.
2019-05-02 10:58:23 -07:00
Michael Hirsch, Ph.D 50f2381565 enable Windows Intel compiler 2019-04-27 23:19:01 -04:00
Michael Hirsch, Ph.D 3a75bb5259 detect Intel ICL on windows
ICL CPP working
2019-04-27 23:19:01 -04:00
Michael Hirsch, Ph.D ee40533b61 better default order for fotran compiler search
correct PGI windows detection

doc

cleanup PGI detect
2019-04-27 23:19:01 -04:00
Michael Hirsch, Ph.D 25fa5d090f cleanup C/CXX compiler names, adding Intel like for Fortran 2019-04-27 23:19:01 -04:00
Michael Hirsch, Ph.D efff004651 cleanup unused imports PEP8 2019-04-27 23:19:01 -04:00
Michael Hirsch, Ph.D 1c70bae952 order fortran compiler search order more sanely, remove unsupported compiler names 2019-04-27 23:19:00 -04:00
Chun-wei Fan 13d59d75be environment.py: Fix architecture detection on older MSVC
The cl.exe from Visual Studio 2010 and earlier report '80x86', not
'x86', for the architecture that the compiler supports.  So, we ought
to check for that as well to see whether we are building for 32-bit x86.
2019-04-25 00:11:56 +03:00
Richard Kjerstadius 48ee6a6148 Add gcovr 4.2 support
The out-of-source build syntax for gcovr 4.2 is different compared to
previous versions and therefore an update was needed. In researching the
most appropriate solution it was found that any gcovr version older than
3.3 always resulted in 0% coverage. Because of this, rather than adding
an additional layer of logic, some already existing logic was modified
to ensure correct syntax for the new version, while versions older than
3.3 are flagged as not supported.

Closes mesonbuild#5089.
2019-04-24 20:05:21 +02:00
Fernando Ramos d81dfcba74 Add support for the Xtensa toolchain
From (almost) all points of view, the Xtensa toolchain can be treated as
a regular GCC toolchain.

This patch adds very basic support so that, at least, meson does not
fail when trying to use "xt-xcc" (which makes it possible to use it
without problems).
2019-04-22 18:24:47 +03:00
Dylan Baker 3edc7f343b coredata: store cross/native files in the same form they will be used (#5224)
* coredata: store cross/native files in the same form they will be used

Currently they're forced to absolute paths when they're stored in the
coredata datastructure, then when they're loaded we de-absolute path
them to check if they're in the system wide directories. This doesn't
work at all, since the ninja backend will generat a dependency on a
file that is in the source directory unless the path was already given
as absolute. This results in builds being retriggereed forever due to
a non-existant file.

The right way to do this is to figure out whether the file is in the
build directory, is absolute, or is in one of the system paths at
creation time, and store that path as absolute. Then the code that
reads the file and the code that generates the dependencies in the
ninja backend just takes the computed list and there is no mismatch
between them.

Fixes #5257

* run_unittests: Add a test for correct native file storage

This tests the bug in #5257
2019-04-21 23:10:02 +03:00
Jon Turney 050b7d8584
Note when clang objc/objc++ compiler is Windows targeted
When using clang as an objc/objc++ compiler, identify if it's a Windows
targeted compiler, so that GnuLikeCompiler::get_pic_args() doesn't use
'-fPIC', which clang considers an error for the Window target.

Future work: Factor out parsing the clang target string from the
detectors for various languages.
2019-04-15 12:07:17 +01:00
Jon Turney e5008b0109
Unfold cross-compilation case from compilers_from_language() 2019-04-12 11:47:29 +01:00
Janne Grunau 663517d233 detect 'arm64' as aarch64 CPU family
OpenBSD uses arm64 as identifier for the 64-bit ARM architecture.
Refs #1578.
2019-04-01 13:58:05 -07:00
Paolo Bonzini 826ddec4c6 improve log for ninja detection
Print "Found samurai-x.y" when samu is found instead of ninja,
and do not print "Found ninja-1.8-1.8" when NINJA points to
/usr/bin/ninja-1.8.
2019-03-26 22:18:37 +02:00
Paolo Bonzini 6b9b118bf5 support a NINJA environment variable
This can be useful to test a local ninja version (for example while developing
changes to ninja or samurai) without modifying the PATH.

The ninja binary that is detected is then hardcoded in the build.ninja
rules for scan-build and clean, so that it is always used until reconfiguration.
2019-03-26 22:18:37 +02:00
François Revol 31d7255553 Properly detect 'bepc' as 'x86' CPU for Haiku 2019-03-26 22:02:55 +02:00
John Ericson 3037ade41d Inline check_compilers
This function is used just once. It also seems all policy and no
mechanism (it raises, it calls the same function to do all the work
twice in a simple way). This makes it seem to be as a good candidate for
inlining.

`environment` and `coredata` are woefully intertwined and while this
change doesn't fix that, but at least it makes it easier to follow.
2019-03-24 13:33:27 +02:00
Ross Burton 65e59c84a1 mesonbuild: allow multiple --cross-file options
Just like --native-file, allow multiple --cross-file options.  This is mostly
unifying the logic between cross_files and config_files.
2019-03-20 10:06:17 +00:00
Ross Burton d57dd1092e load_configs: generalise the search path
Instead of hard-coding the fact that load_configs() searches for files under
meson/native, pass in the subdirectory allowing the cross-file code to use the
same logic.
2019-03-19 19:16:30 +00:00
Jussi Pakkanen 44dd5535f0
Merge pull request #4724 from jon-turney/lib-machine-always
Fix linking when cross-compiling and a windows resource is first object
2019-03-19 20:39:34 +02:00
jrl64 969e291835 A more verbose RE Definiton in search_version. Closes #5020 2019-03-11 20:29:30 +02:00
Antoine Jacoutot 7bc04996c0 environment: support OpenBSD in detect_objc_compiler
We need to match the "clang --version" output on OpenBSD:
$ clang --version | head -1
OpenBSD clang version 7.0.1 (tags/RELEASE_701/final) (based on LLVM 7.0.1)
2019-03-11 11:37:02 +00:00
Jussi Pakkanen 38a3c30bc5 Fix javac version lookup in JDK11. Closes #4322. 2019-03-05 11:25:21 +02:00
John Ericson c2db7a9cee Sync up initialization logic with Properties and BinaryTable
1. They (and the others) all use PerMachineDefaultable. It's not the
    best class, but consistency come first. (It and all of them can be
    improved accross the board later.)

 2. They use `None` as the default argument so as not to mutate what's
    effectively a global variables. (Thanks @dcbaker!)

 3. They have a `fallback` field to centralize authority on when
    environment variables should be consulted.
2019-02-27 13:10:16 -08:00
John Ericson 2622e9ec32 Move some configuration classes out of environment.py
First of all, I'd like compilers and other modules that environment.py
currently imports to be able to take these without creating
hard-to-follow module cycles.

Second of all, environment.py's exact purpose seems a bit obscured.
Splitting the data types (and basic pure functions) from the more
complex logic that infers that data seems like a good way to separate
concerns.
2019-02-27 13:10:16 -08:00
John Ericson 8c6d6393f2 Remove redundant definition of `cflags_mapping`
It seems this was erroneously coppied in `54b6afa67`.
2019-02-26 15:44:06 +00:00
Dylan Baker b5d847e38c allow paths to be set in the cross file
Just like the previous patch, but for cross files

Fixes #1433
2019-02-11 12:50:32 -08:00
Dylan Baker 5b896ed70b allow setting directory locations in a native file
This allows the person running configure (either a developer, user, or
distro maintainer) to keep a configuration of where various kinds of
files should end up.
2019-02-11 12:50:32 -08:00
Dylan Baker b50899419c environment: Add class for storing directories from cross and config files 2019-02-11 12:09:25 -08:00
Jussi Pakkanen 902aaf2ce6
Merge pull request #4626 from Ericson2314/consolidate-properties
Go through coreutils.compiler_options.{build.host.target}
2019-02-04 23:06:46 +01:00
Jussi Pakkanen e26b5a119e
Merge pull request #4835 from obilaniu/cudaimprovements
CUDA support improvements
2019-02-04 20:33:26 +01:00
John Ericson 19f81d3e33 Never access environment.properties downstream
Instead use coredata.compiler_options.<machine>. This brings the cross
and native code paths closer together, since both now use that.

Command line options are interpreted just as before, for backwards
compatibility. This does introduce some funny conditionals. In the
future, I'd like to change the interpretation of command line options so

 - The logic is cross-agnostic, i.e. there are no conditions affected by
   `is_cross_build()`.

 - Compiler args for both the build and host machines can always be
   controlled by the command line.

 - Compiler args for both machines can always be controlled separately.
2019-02-02 13:59:14 -05:00
Nirbheek Chauhan 310b518921 env: Add a repr() for MachineInfo
Makes it easier to debug with print()
2019-01-31 20:36:49 +00:00
Nirbheek Chauhan bd8eff7438 qtdep: Look for QMAKE env var again + sprinkle debug
We used to look for the QMAKE env var in earlier versions of Meson,
start looking for it again.
2019-02-01 00:14:09 +05:30
Olexa Bilaniuk 4199e61389 Better NVCC version detection. 2019-01-31 04:26:37 -05:00
John Ericson 940c6de3ae Overhaul pkg-config and CMake lookup, fixing the latter
First, I noticed there was a dangling use of now-removed cross_info in
the CMake lookup. No tests had caught this, but it means that CMake deps
were totally broken. [It also meant that CMake could not be specified
from a native file.]

In a previous of mine PR which removed cross_info, I overhauled finding
pkg-config a bit so that the native and cross paths were shared. I
noticed that the CMake code greatly resembled the pkg-config code, so I
set about fixing it to match.

I then realized I could refactor things further, separating caching,
finding alternatives, and validating them, while also making the
validations less duplicated. So I ended up changing pkg config lookup a
lot too (and CMake again, to keep matching).

Overall, I think I have the proper ideom for tool lookup now, repated in
two places. I think it would make sense next to share this logic between
these two, compilers, static linkers, and any other tool similarly
specifiable. Either the `BinaryTable` class in environment.py, or a new
class for `Compiler` and friends to subclass, would be good candidates
for this.
2019-01-30 00:12:47 +02:00
Michael Hirsch, Ph.D 8636f31d9c BUGFIX: broken/missing Fortran code/unit tests 2019-01-27 20:57:21 +02:00
Jussi Pakkanen e1b50309df All the fixes needed to make work against current master. 2019-01-21 23:59:20 +02:00
Beau Johnston 54b6afa675 added cuda compiler 2019-01-21 23:35:38 +02:00
Michael Hirsch, Ph.D 72486afd08 Add PGI C and C++ compilers (#4803) 2019-01-21 20:09:36 +02:00
Michael Hirsch, Ph.D b40c1af900
Flang Fortran compiler added. 2019-01-16 17:06:43 -05:00
Daniel Mensinger af38722f89 mintro: Introspection interpreter refactoring (#4733)
* Fixed spelling

* Merged the Buildoptions and Projectinfo interpreter

* Moved detect_compilers to Environment

* Added removed test case

* Split detect_compilers and moved even more code into Environment

* Moved set_default_options to coredata

* Small code simplification in mintro.run

* Move cmd_line_options back to `environment`

We don't actually wish to persist something this unstructured, so we
shouldn't make it a field on `coredata`. It would also be data
denormalization since the information we already store in coredata
depends on the CLI args.
2019-01-16 23:42:54 +02:00
Michael Hirsch, Ph.D fff88b354a restore PGI compile functioning 2019-01-15 20:27:31 +02:00
Antoine Jacoutot e02b79dc1e OpenBSD: register machine cpu "macppc" as cpu_family "ppc"
On OpenBSD, the main PowerPC machine is known as macppc, while the processor
family is powerpc:
$ uname -{m,p}
macppc powerpc
$ echo 'import platform; print (platform.machine())' | python3
macppc
$ echo 'import platform; print (platform.processor())' | python3
powerpc

This allows for e.g. GLib configure to properly detect that cpu:
Build machine cpu family: ppc
Build machine cpu: macppc
While it failed before with: WARNING: Unknown CPU family 'macppc' <snip>
2019-01-13 14:23:16 +02:00
John Ericson 8165fa6ad0 Fix finding the static linker for native compiler in cross build
Native ar and cross ar are not the same!
2019-01-10 23:04:41 +02:00