Commit Graph

113 Commits

Author SHA1 Message Date
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
Drew Reed 697bb28084 Call to CPPCompilers initilisation function was missing the info parameter during ArmClangCPPCompiler initialisation 2020-05-16 16:35:32 +03: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
Ole André Vadla Ravnås d8094d26f3 compilers: Fix C++ stdlib flags used for Apple's Clang
Should target libc++, not libstdc++.
2020-03-29 20:53:15 +03:00
John Ericson 3a4388e51d Fix legacy env var support with cross
Fix #3969
2020-03-23 17:51:36 +02:00
alanNz 7460292810 -Add xc16 and c2000 C,Cpp toolchain support 2020-03-21 00:47:24 +02:00
Jussi Pakkanen 7234316dc7
Merge pull request #6688 from dcbaker/emcc-linker-bugs
Emcc linker bugs and improvments
2020-03-08 14:04:48 +02:00
Martin Storsjö 58db8d5e11 Set c_winlibs/cpp_winlibs for Clang in the same way as for GCC
clang-cl is handled as a separate case (ClangClCCompiler), which already
gets c_winlibs from VisualStudioLikeCCompilerMixin.
2020-03-03 21:49:42 +02:00
Dylan Baker 654f427759 compilers/linkers: Add a representation for wasm-ld
Emscripten does have a stand alone linker, wasm-ld. This patch adds the
linker, adds detection for the linker, and removes the IsLinkerMixin for
emscripten. This is a little more correct, and makes the code a lot
cleaner and more robust.
2020-02-27 16:35:02 -08:00
Dylan Baker 771b0d3ffb compilers/mixins/emscripten: Implement thread support
Emscripten has pthread support (as well as C++ threads), but we don't
currently implement them. This fixes that by adding the necessary code.
The one thing I'm not sure about is setting the pool size. The docs
suggest that you really want to do this to ensure that your code works
correctly, but the number should really be configurable, not sure how to
set that.

Fixes #6684
2020-02-27 16:35:02 -08:00
Dylan Baker 64f3174daa compilers/emcc: Fix inheritance order
Sot hat the BasicLinkerIsCompilerMixin comes before ClangCCompiler,
which hides its "call the linker" methods, as emcc doesn't have a
separate linker.
2020-02-27 16:35:02 -08:00
Dylan Baker 0f47ca95c1 compilers: Split ClangCL and MSVC mixins
Instead of checking the compiler id inside the VisualStudioLikeCompiler
class, this creates two subclasses that each represent the divergent
behavior of the two compilers
2020-01-28 10:52:00 -08:00
makise-homura ca1f7726d5 Remove RTTI option from get_option_compile_args() for Elbrus compiler 2020-01-27 22:35:26 +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
Jussi Pakkanen a2a9611e1d
Merge pull request #6065 from dcbaker/pass-options-to-linker-detection
Pass options to linker detection
2019-12-17 21:09:26 +02:00
Dylan Baker 7f0224fb88 compilers: make use of mlog.log_once
I'm sure there are other places that could use this, but I didn't see
any right off that bat.
2019-12-13 09:57:05 -05: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
Michael Hirsch, Ph.D 83b4e981c4 Use strict function prototypes 2019-11-18 22:21:36 +02:00
Wolfgang Stöggl f037e7ef45 Fix typos found by codespell
- Typos were found by codespell v1.16.0
2019-11-06 09:55:30 -05:00
Jussi Pakkanen b3fe4a0a18 Add option for controlling RTTI. 2019-11-02 19:49:14 +02:00
Jussi Pakkanen 760b8633bc Pass explicit command line argument to disable exceptions with MSVC. 2019-11-02 19:49:14 +02:00
Andrei Alexeyev 50646a8723 Refactor duplicate Emscripten code into a mixin 2019-10-18 00:31:57 +03:00
Andrei Alexeyev bd42cb965a Fix emscripten C compiler initialization 2019-10-15 21:52:35 +03:00
Andrei Alexeyev dd162dccaa Implement get_linker_output_args in Emscripten compilers 2019-10-14 13:04:34 -07:00
Andrei Alexeyev f347a980fe Implement get_allow_undefined_link_args in EmscriptenCPPCompiler 2019-10-14 13:04:34 -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 ff4a17dbef compilers: Add a specific type for AppleClangC
This allows us to detect use classes rather than methods to determine
what C standards are available.
2019-10-07 10:44:56 -07: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 18b1bf9292 compilers: Make MSVClike compilers proxy extra keyword arguments 2019-08-14 13:13:23 -07:00
Jussi Pakkanen f41bdae368 Add basic Webassembly support via Emscripten. 2019-08-05 19:31:32 +03:00
Michael Hirsch, Ph.D 1e53f67187 PGI: cpp_pch precompiled headers functionality
* PGI C++ PCH enable

PGI compilers support precompiled headers for C++ only.
The common/13 pch test passes if run manually with no spaces in the build path.
However, since Meson run_project_tests.py makes temporary build directories
with spaces in each tests, PGI --pch_dir can't handle this and fails.
So we skip the test for PGI despite it working for usual case with no-spaces
in build dir.
Note: it's fine to have spaces in full path for sourcedir, just no spaces in
relative path to builddir.

* doc
2019-07-30 18:07:20 +03: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
Dylan Baker e879992114 compilers: move ArmClang into mixins/arm.py 2019-07-15 10:59:22 -07:00
Dylan Baker b8368c1617 compilers: Put Intel compiler classes into the mixins folder 2019-07-15 10:59:22 -07:00
Dylan Baker cd5360821a compilers: split gnu and gnulike compilers out of compilers
I debated a bit whether both classes really belong in the same module,
and decided that they do because the share a number of helpers.
2019-07-15 10:59:22 -07:00
Dylan Baker 214ab455d3 compilers: Move the VisualStudioLikeCompiler class into mixins 2019-07-15 10:59:22 -07:00
Dylan Baker ef448b95ae compilers: Move ArmCompiler to a mixin module 2019-07-15 10:59:22 -07:00
Dylan Baker 4d5c745bdc compilers: move ccrx compiler abstraction into mixins 2019-07-15 10:59:22 -07:00
Dylan Baker d483da46a9 compilers: Move clike into a mixins directory
The compilers module is rather large and confusing, with spaghetti
dependencies going every which way. I'm planning to start breaking out
the internal representations into a mixins submodule, for things that
shouldn't be required outside of the compilers module itself.
2019-07-15 10:59:22 -07:00
David Seifert fcf27c2a2d Do not fail on passing `-Werror=unused-parameter` from environment 2019-07-14 15:12:16 +00:00
Robin Kertels 96a6d621bf Add (v)c++latest to VC_VERSION_MAP 2019-07-08 23:46:12 +03:00
sompen 201ecf52d1 compilers/cpp: Fix removal of name from Combo options for Armclang 2019-06-11 11:38:07 -07:00
John Ericson 07777e15d4 Purge `is_cross` and friends without changing user interfaces
In most cases instead pass `for_machine`, the name of the relevant
machines (what compilers target, what targets run on, etc). This allows
us to use the cross code path in the native case, deduplicating the
code.

As one can see, environment got bigger as more information is kept
structured there, while ninjabackend got a smaller. Overall a few amount
of lines were added, but the hope is what's added is a lot simpler than
what's removed.
2019-06-09 13:13:25 -04:00
John Ericson 4030e7cb7a UserOption no longer has a name field.
This avoids the duplication where the option is stored in a dict at its
name, and also contains its own name. In general, the maxim in
programming is things shouldn't know their own name, so removed the name
field just leaving the option's position in the dictionary as its name.
2019-05-15 14:21:47 +03:00
Jussi Pakkanen 7b8ef78bc0
Merge pull request #5331 from dcbaker/icl
ICL (Intel for Windows) support
2019-05-14 00:24:48 +03:00
Dylan Baker fa54f05f09 compilers: Add basic ICL abstractions 2019-05-13 11:22:31 -07:00