Commit Graph

913 Commits

Author SHA1 Message Date
Jussi Pakkanen 0fbd09609f Clang-cl cross fix from Dale Curtis. Closes #5639. 2020-02-27 23:50:03 +02:00
Nirbheek Chauhan 3320e13d91 unit tests: Add a test for the symbolchecker script
When a source file for a library is changed without adding new extern
symbols, only that library should be rebuilt. Nothing that uses it
should be relinked.

Along the way, also remove trailing `.` in all Ninja rule
descriptions. It's very confusing to see messages like:

```
Linking target mylib.dll.
```

It's confusing that the period at the end of that is not part of the
filename. Instead of removing that period manually in the tests (which
feels wrong!) just don't print it at all.
2020-02-22 06:49:34 +05:30
Nirbheek Chauhan 5dcbf10a1b ninjabackend: Pass the import library to SHSYM
We actually use this while linking on Windows, and hence we need to
extract symbols from this file, and not the DLL.

However, we cannot pass it instead of the DLL because it's an optional
output of the compiler. It will not be written out at all if there are
no symbols in the DLL, and we cannot know that at configure time. This
means we cannot describe it as an output of any ninja target, or the
input of any ninja target. We must pass it as an argument without
semantic meaning.
2020-02-22 06:49:34 +05:30
Nirbheek Chauhan 72c6cbd990 ninjabackend: Minor refactoring 2020-02-22 06:49:34 +05:30
Nirbheek Chauhan be486a2ec8 ninjabackend: List PDBs in output list for targets
This is more correct, and forces the target(s) to be rebuilt if the
PDB files are missing. Increases the minimum required Ninja to 1.7,
which is available in Ubuntu 16.04 under backports.

We can't do the same for import libraries, because it is impossible
for us to know at configure time whether or not an import library will
be generated for a given DLL.
2020-02-22 06:49:34 +05:30
Nirbheek Chauhan 77d163a0e9 symbolextractor: Print one warning when no implementation found
So people know why all their binaries are getting relinked. Do this
only once per build-dir by writing a file to meson-private.
2020-02-16 03:11:51 +05:30
Jussi Pakkanen 47759550e5 Add unity block size option. 2020-02-12 22:31:08 +02:00
Xavier Claessens 0bf3c4ac4d backends: Remove unused method 2020-02-06 14:11:24 -05:00
Daniel Mensinger d0c7b51693 mintro: use interpreter data for buildsystem-files (fixes #6390) 2020-01-28 21:18:25 +02:00
Daniel Mensinger 668610c0d2 backend: refactor: set self.interpreter in the constructor 2020-01-28 21:18:25 +02:00
Jussi Pakkanen 9e07f8d8e6 Check for bad timestamps that cause eternal configure loops. 2020-01-27 18:27:20 +02:00
Nirbheek Chauhan b293852d07 vs: Write checksums in PE binaries (DLLs and EXEs)
This is needed for detecting data corruption, and its absence (or
an incorrect value) is also used as a hint by anti-viruses that the
binary may be malware.

Flag is only supported by MSVC `link.exe`, not `lld-link.exe`

https://docs.microsoft.com/en-us/cpp/build/reference/release-set-the-checksum
2020-01-22 19:34:05 +05:30
Daniel Mensinger 09b53c534f types: import typing as T (fixes #6333) 2020-01-08 15:28:17 +01:00
Jussi Pakkanen 17dd9e5bff
Merge pull request #6207 from dcbaker/linker-option
Add a way to select the dynamic linker meson uses
2019-12-11 23:29:33 +02:00
Daniel Mensinger fa4de71faf lgtm: Fix unused variable 2019-12-05 00:22:10 +02:00
Dylan Baker d856118006 environment: Fix selecting the linker with rustc 2019-12-03 13:08:42 -08:00
Dylan Baker 7658e67f92 backends/ninja: apply linker arguments when using rust
This will be required to make switching the linker work with rust.
2019-12-02 13:39:37 -08:00
Luca Bacci 279f72f8cd Prevent the presence of duplicated items in .vcxproj files
Visual Studio refuses to open projects that present duplicated
items, for example:

<ItemGroup>
  <CLInclude Include="glib-enumtypes.h"/>
  <CLInclude Include="glib-enumtypes.h"/>
</ItemGroup>

Note that MSBuild handles duplicated items without any issue,
this is useful only for compatibility with the VS IDE.

See pull request mesonbuild#6151
Fixes issue mesonbuild#6147
2019-11-30 22:02:18 +02:00
Daniel Mensinger 9435f11b17
ci: Add CI command to include text files in the CI log 2019-11-19 15:21:13 +01:00
Jussi Pakkanen 35e809fc5e Store run target names in build.
This way we can easily check that we only provide builtin targets such
as clang-format if the user has not provided their own.
2019-11-10 23:45:42 +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
Aleksey Gurtovoy 48e6db89ab Ask Ninja to expand rsp files in compile_commands.json 2019-11-02 16:16:09 +02:00
Marc-André Lureau 1ed70e22b9 Add source tags targets 2019-10-22 20:48:24 +03:00
Xavier Claessens 212a05b87e Remove duplicated object files in static libraries
When a static library link_whole to a bunch of other static libraries,
we have to extract all their objects recursively. But that could
introduce duplicated objects. ar is dumb enough to allow this without
error, but once the resulting static library is linked into an
executable or shared library, the linker will complain about duplicated
symbols.
2019-10-21 01:08:05 +03:00
Michael Hirsch, Ph.D ecaba8c234 xcode 64 bit for catalina [skip ci] 2019-10-18 01:07:52 +03:00
Jakub Adam 1bf1782476 Fix *.pdb files missing in meson introspect --installed output
On Windows, make sure the introspect command lists all Program database
(PDB) files containing debugging information that Meson will install.
2019-10-09 15:50:20 +02:00
Jussi Pakkanen d3b389f349 Add clang-tidy target. Closes #2383. 2019-10-01 22:02:51 +03:00
Jussi Pakkanen 5a52983f16 Refactor clang tool generation to its own function. 2019-10-01 22:02:51 +03:00
Ting-Wei Lan 0390b673f1 Find clang-format with alternative names
This is similar to what we currently do for scan-build except there is
no environment variable to choose a specific clang-format to run. If an
environment variable is needed for better control, we can add it later.
2019-09-29 00:11:15 +08:00
Dylan Baker f724cc2042 backends: Add needs_exe_wrapper to test serialization
We need to know if the test actually needs an exe wrapper to run or not.
2019-09-28 18:11:06 +03:00
Aleksey Gurtovoy 7dbabdc7b6 Correctly handle platform-specific LDFLAGS options 2019-09-27 00:57:21 +03:00
Aleksey Gurtovoy 6ac5db50c9 CUDA support on Windows 2019-09-24 14:22:20 -07:00
Gabriel Ganne e7197895b2 uniform scan-build detection process
Detect scan-build the same way when trying to launch it and when
generating the target.
The detection method is:
  1. look within SCANBUILD env variable
  2. shutil.which('scan-build')
  3. *on non-linux platforms only*: go through all the possible
     name candidates and test them individually.

The third step is added following this comment
https://github.com/mesonbuild/meson/pull/5857#issuecomment-528305788
However, going through a list of all the possible candidates is neither
easily maintainable nor performant, and is therefore skipped on
platforms that should not require such a step (currently, only Linux
platforms).

This is a follow-up to the issue raised by @lantw44 during PR:
https://github.com/mesonbuild/meson/pull/5857
2019-09-14 05:51:36 +03:00
David Seifert e19a49b895 Fix static archives stripping (#5905)
* Do not strip static archives

Stripping static archives without more fine-grained options (e.g. `-g`)
leads to failures such as

    ld: libfoo.a: error adding symbols: archive has no index; run ranlib to add one

because GNU strip removes *every* symbol in a static archive by default.
Given that static archives are not final build artifacts (unlike
executables and shared libraries), stripping them gains little and only
causes more edge case failures.

* Gentoo's portage only strips debug information:
  86f211e3a5/bin/estrip (L322)
* Fedora also only strips debug information:
  e9c13c6565/scripts/brp-strip-static-archive (L18)
* Debian also only does some very light stripping:
  72ed1d3261/dh_strip (L374)

Fixes #4138

* Add test case for static archive stripping
2019-09-08 19:48:57 -04:00
Jussi Pakkanen d67d5411bb
Merge pull request #5823 from scivision/linker-pgi-linux
PGI compiler fixes
2019-09-05 23:45:54 +03:00
Aleksey Gurtovoy 75daed27bc mesonlib.split_args/quote_arg/join_args 2019-09-05 23:42:47 +03:00
Michael Hirsch, Ph.D 25653cac07
PGI: windows workaround not-msvc-like enough function 2019-09-05 11:54:09 -04:00
Michael Hirsch, Ph.D 4c8b41a173 flatten list to subprocess.Popen, necessary for Python 3.8 2019-09-01 21:45:47 +03:00
Gabriel Ganne 4143c7bceb ninjabackend: do not generate scan-build target if it cannnot be run
as what was done with clang-format, test the presence of the tool before
generating a dedicated target. Pass silently if scan-build is not found.

Signed-off-by: Gabriel Ganne <gabriel.ganne@mindmaze.ch>
2019-08-28 20:36:10 +03:00
Peter Hutterer 4ebce2c3f2 Add test priorities to force test start order 2019-08-24 21:26:41 +03:00
Dylan Baker 110b562930 Vs backend compiler selection (#5448)
* backends/vs: Only set platform_toolset if it isn't already set

* interpreter: set backend up after the compiler

Otherwise we won't be able to check which VS toolchain to use.

* docs/using-visual-studio: wrap lines

* docs: recommend the py launcher instead of python3 for windows

* set backend.environment when building a dummy version

* backends/vs: Add support for clang-cl with vs2017 and vs2019 backends

* backends/vs: Add support for ICL (19.x) with vs2015 and vs2017 backends
2019-08-24 02:32:56 +03:00
Jussi Pakkanen 1ea3ddc6ad
Merge pull request #5681 from dcbaker/dynamic-linker-split
split dynamic linker representations from compilers
2019-08-20 23:14:05 +03:00
Jussi Pakkanen 80ef6fd69f Pass optimization flags to rustc properly. Closes: #5788. 2019-08-17 21:14:16 +03:00
Rachel Mant f431cff809 Make .extract_objects() work correctly as an input to custom_target 2019-08-17 21:12:56 +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
Aleksey Gurtovoy e5b515aa1d ninjabackend: Squish Coco support 2019-08-10 01:00:28 +03:00
Jussi Pakkanen 2e6df380f1
Merge pull request #5644 from bonzini/meson-exe-cmdline
Show command line in `ninja -v` for `capture: true` custom targets and generators
2019-08-03 01:28:27 +03:00
Jussi Pakkanen 7ce2a24f42 Made dist a top level command. 2019-07-23 23:26:46 +03:00
Dylan Baker 24c4c079e7 linkers: Add get_base_link_args method to static linkers
MSVC needs an argument to static linkers for doing LTO, so we need a way
for the static linker to tell us that.
2019-07-23 09:58:24 +00:00
Nirbheek Chauhan 9c2724bce5 Add optional progress bar when generating build.ninja 2019-07-20 17:02:15 +03:00