Commit Graph

252 Commits

Author SHA1 Message Date
Nirbheek Chauhan 695b8f3a03 cc.has_multi_arguments: Convert all -Wno args
Also add a test for it.
2018-04-17 09:55:18 +00:00
Bruce Richardson 162a58b493 fix checks for gcc disable warning flags
GCC does not print a warning or error for unknown options if the options
are to disable warnings. Therefore, when checking for options starting
'-Wno-', also check the opposite enabling option.  This fixes the case
where e.g.  -Wno-implicit-fallthrough is incorrectly reported as supported
by gcc 5.4. To avoid missed warnings when using combinations of flags, such
as in test case "112 has arg", we limit the checking of for the positive
option to where the negative option is checked alone.
2018-04-17 09:55:18 +00:00
Elliott Sales de Andrade dbb025a175 Add an OpenMP dependency.
This works similarly to the thread dependency which stores the various
inconsistent flags in each compiler.
2018-04-17 02:04:37 -04:00
Xavier Claessens bd37afeeea Add has_link_argument() and friends
Closes: #3335.
2018-04-16 19:14:02 -04:00
Xavier Claessens 3d91a08bbc Compilers: Reduce code duplication between compiles and links
This also fix links() not calling args.to_native() unlike compiles()
2018-04-16 19:08:24 -04:00
Jussi Pakkanen c58dd64f8e Merged Arm CC support. 2018-04-16 23:02:09 +03:00
Tom Schoonjans fa6ca16054 Add macOS linker versioning information
This patch exploits the information residing in ltversion to set the
-compatibility_version and -current_version flags that are passed to the
linker on macOS.
2018-04-16 22:26:16 +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
Martin Hostettler aff597fb99 ninjabackend: Try to guess library dependencies for linker invocation.
The linkers currently do not support ninja compatible output of
dependencies used while linking. Try to guess which files will be used
while linking in python code and generate conservative dependencies to
ensure changes in linked libraries are detected.

This generates dependencies on the best match for static and shared
linking, but this should not be a problem, except for spurious
rebuilding when only one of them changes, which should not be a problem.

Also makes sure to ignore any libraries generated inside the build, to
keep the optimisation working where changes in a shared library only
cause relink if the symbols have changed as well.
2018-04-15 07:29:21 +00:00
Nirbheek Chauhan 2e5b2813d5 compilers: Cache compiler checks where we don't want the output
This caching is only for a single run, so it doesn't help reconfigure.
However, it is useful for subproject setups where different subprojects
will run the same compiler checks.

The cache is also per compiler instance and is not used for functions
that want to read or run the outputted object file or binary.

For gst-build, this halves the number of compiler checks that are run
and reduces configuration time by 20%.
2018-04-14 22:14:11 +03:00
Xavier Claessens 8a70e7cff5 Remove arbitrary [-1024,1024] limit in cross_compute_int()
Copy the algorithm used by autoconf.

It computes the upper and lower limits by starting at [-1,1] and
multiply by 2 at each iteration. This is even faster for small numbers
(the common case), for example it finds value 0 in just 2 compilations
where old algorithm would check for 1024, 512, ..., 0.
2018-04-08 16:56:33 +03:00
Somasekhar Penugonda e62b8109eb Updates to CPP support and update review changes 2018-03-27 17:04:26 -05:00
Thierry Reding c4192a04fd Support data types larger than 128 bytes
Recent versions of systemd (starting with v238) started to check for the
existence of the statx structure using the cc.sizeof() operation. The cc
compiler implementation fails to detect this structure because it's size
limit is 128, meaning it will fail for any type larger than 128 bytes in
the following way during cross-compilation checks:

        meson.build:10:2: ERROR: Cross-compile check overflowed

Increase the size limit for data types to 1024 bytes, which should give
plenty of room for even large data structures. This is obviously not
guaranteed to be an upper bound, but given the binary search algorithm
implemented in the cross-compile check, raising the limit too high may
significantly increase the time required for this check on smaller data
types.

Signed-off-by: Thierry Reding <treding@nvidia.com>
2018-03-25 17:22:05 +03:00
Aleksey Filippov 8b1e9a6f6a Enable b_ndebug on VisualStudioCCompiler 2018-03-23 21:10:04 +02:00
makise-homura 546f81e0f9 Fixed lchmod detection for lcc C/C++ compilers 2018-03-21 16:42:15 +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
Aleksey Filippov e4faf396e6 Do not use bare except [flake8]
Use more specific exception types where appropriate.
This patch does not change bare except calls if exception is re-raised.
2018-03-11 23:36:04 +00:00
Somasekhar Penugonda a470835778 Meson Github pull request - 3186 requested changes
- Fixing flake8 error in compilers.py - [E124] closing bracket does not match visual indentation
- Updating ARMCCompiler constructor in c.py to raise error as per comments
2018-03-07 17:42:53 -06:00
Bedarkar, Malhar a2ee76228e First cut of ARMCC support for MESON.
Change-Id: I15d8258e84d392baaccb8f670e33eefcfe8cd49a
2018-03-05 18:26:39 -06:00
Nirbheek Chauhan 8842839bb4 pkgconfig deps: Warn when a static library isn't found
A hard error makes this feature useless in most cases since a static
library usually won't be found for every library, particularly system
libraries like -lm. Instead, warn so the user can provide the static
library if they wish.

This feature will be expanded and made more extensible and more usable
in the future.

Closes https://github.com/mesonbuild/meson/issues/2785
2018-02-20 19:26:51 +02:00
Jon Turney 0774f319e8 Don't use --export-dynamic on Cygwin
After PR #2662, running test case common/125 shared module/ on Cygwin gets
me:

$ ninja -C _build
ninja: Entering directory `_build'
[7/7] Linking target prog.exe.
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: warning: --export-dynamic is not supported for PE+ targets, did you mean --export-all-symbols?

Also, fix doc for correct version of first apperance.

Future work: Notwithstanding the hint that ld gives, these options are not
equivalent, and it's not clear we should be using it here:
--export-all-symbols is the default behaviour, and if the exports are
restricted by explicit annotations or a .def file, this option might be
overriding that...
2018-02-08 23:51:06 +02: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
Nikita Churaev de8018a17d Add `export_dynamic` argument to `executable`. (#2662) 2018-01-09 21:36:13 +02:00
Jussi Pakkanen b6dd50db31
Merge pull request #2791 from behlec/compiler-version
Add more version information to compiler
2017-12-20 20:42:01 +02:00
Christoph Behle c772841af7 Fix: More information for C compilers.
Add full version to gnu and icc C compiler.
2017-12-19 19:58:19 +01:00
Jussi Pakkanen 8eaa0a2732 Use -MD instead of -MMD for reliability. 2017-12-18 21:19:18 +02: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
Ismael González d946b03496 Use LC_ALL=C in CCompiler.get_library_dirs
Use LC_ALL=C in CCompiler.get_library_dirs to fix wrong results with non
English locales.
2017-12-13 21:30:22 +02:00
Dylan Baker fc547ad05e haiku: do not add pthread arguments
Haiku has pthreads, but they are part of the standard C library, and do
not need either special compiler or linker flags.
2017-12-07 09:35:12 -08:00
Jussi Pakkanen 4ae0cadb7f Renamed UserStringArrayOption to UserArrayOption for short. 2017-12-07 00:00:34 +02:00
Nirbheek Chauhan 45dbc0d30e find_library: Prefer .dll.a and .lib over .dll for shared
We can't know if the .lib is a static or import library, but that's
a problem in general too. The only way to figure out if a specific
file is an import or a static library is to dump its symbols and check
if it starts with __imp or not.

Even then, some libs are hybrid import and static, i.e., they contain
references to DLLs for some symbols and also provide implementations
for other symbols so this is a difficult problem.

Closes https://github.com/mesonbuild/meson/issues/2659
2017-12-03 10:06:11 +05:30
Jussi Pakkanen fa6f01d096 Use absolute paths for rpaths on OSX. 2017-11-26 17:34:01 +02:00
Jussi Pakkanen 655137a74b Add headerpad linker argument on OSX. 2017-11-26 17:34:01 +02:00
Nirbheek Chauhan d2a250412c compilers: Improve manual library searching
We can now specify the library type we want to search for, and whether
we want to prefer static libraries over shared ones or the other way
around. This functionality is not exposed to build files yet.
2017-11-11 23:06:48 +05:30
Niklas Claesson 09ccd0eeaa C/C++: Get default include dirs from compilers 2017-10-01 18:35:33 +02:00
Niklas Claesson 488e57332f VisualC: Add support for msvc toolset version 2017-10-01 18:35:33 +02:00
Jussi Pakkanen cf6693a4eb Linker flag for Windows GUI applications was missing on MSVC. 2017-09-26 21:46:32 +03:00
Jussi Pakkanen bea6b1a6f6 Merge pull request #2187 from centricular/fix-pcap-dependency
Fix pcap dependency, str.strip() now takes an argument, add cc.get_return_value()
2017-09-22 22:04:18 +03:00
Luke Shumaker bb25260f00 flake8: Perform suggested whitespace/formatting changes
This only touches newlines, spaces, and (occaisionally) commas.  Anything
else is left for another commit.
2017-09-21 11:59:03 -04:00
Nirbheek Chauhan 59473e9ed7 Add a new compiler method: get_return_value()
This method accepts a single function that takes no arguments and
returns a single value which can be a value that can be cast to
a 64-bit signed integer, or a string, and returns that value.

Mostly useful for running foolib_version() functions that return the
currently-available version of libraries.
2017-09-20 13:36:42 +05:30
Alexis Jeandet e553d0807b Last round with listify function refactoring.
Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>
2017-09-18 22:25:34 +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 0ab9f23061 Add thread flags to checks if needed. Closes #2106. 2017-08-01 19:09:07 -04:00
Nirbheek Chauhan de2d59cc27 find_library: Ignore libs on MSVC properly
In addition to filtering libs out while generating the command-line, we
must also filter them out in find_library() otherwise these libs will be
detected as "found" on Windows with MSVC.

Closes https://github.com/mesonbuild/meson/issues/1509
2017-07-23 02:12:00 +03:00
Jussi Pakkanen 2269b7f60b Add build_rpath as new property allowing people to specify rpath entries that are used in the build tree but will be removed on install. 2017-07-21 19:40:54 +03:00
Jussi Pakkanen ce77fb89b9 Renamed test case number to avoid dupes. 2017-07-17 19:53:00 +03:00
Jussi Pakkanen 181510bd6e Fix checks on MinGW and VS2010. 2017-07-17 19:19:24 +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