Commit Graph

46 Commits

Author SHA1 Message Date
Michael Hirsch, Ph.D 72486afd08 Add PGI C and C++ compilers (#4803) 2019-01-21 20:09:36 +02:00
Jon Turney a872b925ea
Store the target architecture for CL-like compilers
Store the MSVC compiler target architecture ('x86', 'x64' or 'ARM' (this
is ARM64, I believe)), rather than just if it's x64 or not.

The regex used for target architecture should be ok, based on this list
of [1] version outputs, but we assume x86 if no match, for safety's
sake.

[1] https://stackoverflow.com/a/1233332/1951600

Also detect arch even if cl outputs version to stdout.

Ditto for clang-cl

Future work: is_64 is now only used in get_instruction_set_args()
2018-12-06 13:25:16 +00:00
Jon Turney a33acd31da Fix flake8 'imported but unused' reports
$ flake8 | grep F401
./run_unittests.py:43:1: F401 'mesonbuild.mesonlib.is_linux' imported but unused
./mesonbuild/compilers/c.py:32:1: F401 '.compilers.CompilerType' imported but unused
./mesonbuild/compilers/cpp.py:23:1: F401 '.compilers.CompilerType' imported but unused
2018-11-19 21:07:37 +02:00
Dylan Baker de175aac00 compilers: Use keyword only arguments for compiler interfaces
Because we need to inherit them in some cases, and python's
keyword-or-positional arguments make this really painful, especially
with inheritance. They do this in two ways:

1) If you want to intercept the arguments you need to check for both a
   keyword and a positional argument, because you could get either. Then
   you need to make sure that you only pass one of those down to the
   next layer.

2) After you do that, if the layer below you decides to do the same
   thing, but uses the other form (you used keyword by the lower level
   uses positional or vice versa), then you'll get a TypeError since two
   layers down got the argument as both a positional and a keyword.

All of this is bad. Fortunately python 3.x provides a mechanism to solve
this, keyword only arguments. These arguments cannot be based
positionally, the interpreter will give us an error in that case.

I have made a best effort to do this correctly, and I've verified it
with GCC, Clang, ICC, and MSVC, but there are other compilers like Arm
and Elbrus that I don't have access to.
2018-11-13 00:40:13 +02:00
Phillip Cao 68c83cb213 Add support for Renesas CC-RX toolchain 2018-11-08 00:02:22 +13:00
Jon Turney a025c98d30
Qualify checks of self.version by self.id in VisualStudioC/CPPCompiler 2018-11-04 15:42:06 +00:00
Jon Turney 64edfd5069
Detect clang-cl as msvc-like, not clang-like
Handle clang's cl or clang-cl being in PATH, or set in CC/CXX

Future work: checking the name of the executable here seems like a bad idea.
These compilers will fail to be detected if they are renamed.

v2:
Update compiler.get_argument_type() test
Fix comparisons of id inside CCompiler, backends and elsewhere

v3:
ClangClCPPCompiler should be a subclass of ClangClCCompier, as well

Future work: mocking in test_find_library_patterns() is effected, as we
now test for a subclass, rather than self.id in CCompiler.get_library_naming()
2018-11-04 15:42:00 +00:00
Josh Gao edda80cc75 Generalize gnulike-targeting-windows checks.
Replace several checks against GCC_MINGW or (GCC_MINGW, GCC_CYGWIN) with
is_windows_compiler instead, so that clang and other gcc-like compilers
using MinGW work appropriately with vs_module_defs, c_winlibs, and
cpp_winlibs.

Fixes #4434.
2018-10-30 20:25:32 +02:00
Nicole Mazzuca d5bf869dec add support for `/permissive-`
We do this with `std_ver=vc++NM` - `vc++` does not add `/permissive-`,
while `std_ver=c++NM` adds `/permissive-`.
2018-10-27 16:09:38 +03:00
Nicole Mazzuca f1546e289c add cpp_std support for MSVC 2018-10-22 19:14:00 +03:00
Mohammed Amer Khalidi 18204b8ed6 Adding "compiler_type" flag to ARM compilers. 2018-10-07 19:21:26 +03:00
David Seifert 115962e466 Abstract shared GCC/Clang/ICC methods in GnuLikeCompiler 2018-09-17 23:31:55 +03:00
David Seifert 8f16d0f3c9 Fix ICC on macOS 2018-09-16 18:27:19 +03:00
David Seifert 69ec001b06 Use enum instead of `int` for compiler variants
* Enums are strongly typed and make the whole
  `gcc_type`/`clang_type`/`icc_type` distinction
  redundant.
* Enums also allow extending via member functions,
  which makes the code more generalisable.
2018-09-16 00:47:32 +03:00
Dylan Baker 51e9db370a Add method to check for C/C++ function attributes
It's fairly common on Linux and *BSD platforms to check for these
attributes existence, so it makes sense to me to have this checking
build into meson itself. Autotools also has a builtin for handling
these, and by building them in we can short circuit cases that we know
that these don't exist (MSVC).

Additionally this adds support for two common MSVC __declspec
attributes, dllimport and dllexport. This implements the declspec
version (even though GCC has an __attribute__ version that both it and
clang support), since GCC and Clang support the MSVC version as well.
Thus it seems reasonable to assume that most projects will use the
__declspec version over teh __attribute__ version.
2018-09-07 11:52:15 -07:00
David Seifert 28c1f31d7e Make `-std=` fallback remapping more robust
* The current version matching logic is brittle
  with respect to Clang. LLVM and Apple Clang use
  slightly different but nowadays overlapping
  version ranges. Instead, we now just check whether
  the compiler supports the given `-std=` variant
  and try its respective fallback instead of
  testing version ranges.
2018-08-29 20:57:35 +03:00
David Seifert e0120b4586 Remap -std=c++14 dialect names for older compilers
* GCC 4.8 and Clang 3.2, 3.3, 3.4 only understand
  `-std={c,gnu}++1y` for enabling C++14 dialects.
  GCC 4.8 is especially important as it is the basis
  of RHEL/CentOS 7.
2018-08-20 20:26:18 +03:00
Jussi Pakkanen d83f77109a
Convert buildtype to optimization and debug options (#3489) 2018-08-18 20:39:47 +03:00
Zachary Michaels 8417c1a20f Add support for c++2a and gnu++2a 2018-08-09 11:09:21 -07:00
Thomas Hindoe Paaboel Andersen e2c36457c5 Avoid concatenating two options in list
'c++17' and 'gnu++98' were concatenated due to a missing comma
2018-07-13 20:00:50 +03:00
Vasu Penugonda 7140afc0a8 Added ARMCLANG compiler support for C/C++ (#3717) 2018-06-21 00:55:39 +03:00
Xavier Claessens aa879b7f0c Fix issues found by flake8 2018-06-06 20:02:37 +00:00
Xavier Claessens 6eeea9dd54 Compilers: Chain-up to parent class in get_options()
Parent class could have common options for all compilers, and we'll soon
add some.
2018-06-06 20:02:37 +00:00
Jussi Pakkanen 1918c0d231 Can combine D and C++ in a single target. Closes #3125. 2018-05-02 22:50:15 +03:00
Xavier Claessens bd37afeeea Add has_link_argument() and friends
Closes: #3335.
2018-04-16 19:14:02 -04:00
Xavier Claessens bca2ff6def VisualStudioCPPCompiler: Fix -fpermissive still being added
super(VisualStudioCCompiler, self) calls CPPCompiler and that's what we
want to avoid.
2018-04-16 19:11:16 -04:00
Jussi Pakkanen c58dd64f8e Merged Arm CC support. 2018-04-16 23:02:09 +03:00
Jussi Pakkanen 86f725c1e5
Merge pull request #3115 from makise-homura/e2k-lcc-support
Support lcc compiler for e2k (Elbrus) architecture
2018-04-15 17:18:44 +03:00
Somasekhar Penugonda 7f89083363 Fix for issue in cpp.py
Change-Id: Iad9623d20eb5086528dacefce5d2f4f9bb9d0312
2018-03-31 19:23:31 -05:00
Somasekhar Penugonda e62b8109eb Updates to CPP support and update review changes 2018-03-27 17:04:26 -05:00
makise-homura 546f81e0f9 Fixed lchmod detection for lcc C/C++ compilers 2018-03-21 16:42:15 +03:00
makise-homura 6230c2a2f6 Fixed indentation and space issues found by SideCI 2018-03-19 23:39:06 +03:00
makise-homura 7cc41baa98 Added Elbrus lcc compilers support as inheritance from gcc ones 2018-03-19 23:30:00 +03:00
Bedarkar, Malhar 831d1e4c2e - Updating cpp_std options similar to other compiler classes
- Updating environment.py for selecting '--vsn' option for armcc only.
- Updating build type arguments from GitHub pull request - 3157

Change-Id: Id3151e7715ec1016afdbd65391bb0d414ec7de13
2018-03-14 22:42:06 -05:00
Jon Turney 2f6ed47077 Fix various flake8 indentation reports
$ flake8 | grep -E '(E123|E127|E128)'
./run_unittests.py:1358:37: E127 continuation line over-indented for visual indent
./run_unittests.py:1360:37: E127 continuation line over-indented for visual indent
./mesonbuild/minit.py:311:66: E128 continuation line under-indented for visual indent
./mesonbuild/minit.py:312:66: E128 continuation line under-indented for visual indent
./mesonbuild/minit.py:313:66: E128 continuation line under-indented for visual indent
./mesonbuild/compilers/cpp.py:115:63: E127 continuation line over-indented for visual indent
./msi/createmsi.py:156:13: E123 closing bracket does not match indentation of opening bracket's line
./msi/createmsi.py:188:13: E123 closing bracket does not match indentation of opening bracket's line
2018-03-03 21:35:53 +00:00
Aleksey Filippov 2cf85ae16f Use os.path: basename() and dirname() instead of split()
According to Python documentation[1] dirname and basename
are defined as follows:
    os.path.dirname() = os.path.split()[0]
    os.path.basename() = os.path.split()[1]
For the purpose of better readability split() is replaced
by appropriate function if only one part of returned tuple
is used.

[1]: https://docs.python.org/3/library/os.path.html#os.path.split
2018-01-30 07:08:22 +11:00
Ting-Wei Lan ec50073644 Print warning when linker arguments are passed to has_argument
has_argument and other similar methods of compiler objects only support
checking compiler flags. If they are used to check linker flags, the
results are very likely to be wrong and developers should be warned.
2018-01-30 06:34:34 +11:00
Christoph Behle c6acf75617 More version information for compilers.
See issue #2762
Adds full_version to class Compiler. If set full_version will be printed
additionally.
Added support for CCompiler and CPPCompiler
Added support for gcc/g++, clang/clang++, icc.
2017-12-16 14:52:08 +01:00
Jussi Pakkanen 4ae0cadb7f Renamed UserStringArrayOption to UserArrayOption for short. 2017-12-07 00:00:34 +02:00
Jussi Pakkanen c2d23dd678 Add C++17 flags to GCC and Clang. 2017-12-06 23:59:56 +02:00
Solomon Choina 2fdfb50da8 adding C++98 to versions that meson can support 2017-11-29 21:27:00 +02:00
Gabríel Arthúr Pétursson 0ad448f890 Pass -fpch-preprocess to GCC when precompiled headers are used
CCache requires this flag when building with precompiled headers.
Without it, the preprocessor fails and CCache fallbacks to running the
real compiler.

Users still need to set 'sloppiness' to 'pch_defines,time_macros' in
their ccache.conf file for CCache to cache builds that use precompiled
headers. See the CCache manual for more info:

	https://ccache.samba.org/manual.html#_precompiled_headers
2017-08-13 21:24:28 +03:00
Jussi Pakkanen d335a84b9e A few more lgtm fixes. 2017-08-04 12:54:31 +03:00
Jussi Pakkanen 8396c4f3e6 Added VS support to simd detector. 2017-07-17 19:15:04 +03:00
Guillaume Poirier-Morency fab5634916 Add 'Compiler.get_display_language'
Use this when we print language-related information to the console and
via the Ninja backend.
2017-06-26 14:15:44 -04:00
Alistair Thomas 117f4ab8b5 Split out languages from compilers.py 2017-06-23 00:42:41 +01:00