Commit Graph

537 Commits

Author SHA1 Message Date
Jussi Pakkanen 9fb0abb754 Write include dirs with absolute paths in the Xcode backend, relative ones do not seem to work. 2021-04-09 16:51:42 +03:00
Xavier Claessens df4314c7b8 backends: Remove @PRIVATE_OUTDIR_(ABS)@ substitution
It is not documented and does not seems to be used anywhere.
2021-03-26 23:39:01 +02:00
Xavier Claessens a9e9b7c750
devenv: Set GI_TYPELIB_PATH and LD_LIBRARY_PATH (#8548) 2021-03-23 23:35:05 +02:00
Dylan Baker 40e3577a65 split program related classes and functions out of dependencies
Dependencies is already a large and complicated package without adding
programs to the list. This also allows us to untangle a bit of spaghetti
that we have.
2021-03-19 08:47:10 -04:00
Xavier Claessens 598e968993 Add `meson devenv` command and meson.add_devenv() 2021-03-16 09:00:50 -04:00
Xavier Claessens e0fcccc6e2 EnvironmentVariables: Simplify and annotate 2021-03-16 09:00:50 -04:00
Eli Schwartz 6a0fabc647
mass rewrite of string formatting to use f-strings everywhere
performed by running "pyupgrade --py36-plus" and committing the results
2021-03-04 17:16:11 -05:00
Eli Schwartz 4340bf34fa
various python neatness cleanups
All changes were created by running

"pyupgrade --py3-only --keep-percent-format"

and committing the results. I have not touched string formatting for
now.

- use set literals
- simplify .format() parameter naming
- remove __future__
- remove default "r" mode for open()
- use OSError rather than compatibility aliases
- remove stray parentheses in function(generator) scopes
2021-03-04 17:11:26 -05:00
Xavier Claessens c8abede403 Windows Subsystem for Linux can run .exe without mono interpreter
Fixes: #8445
2021-03-03 08:05:00 -05:00
Jason Woodward 50af09de03 install_man locale support
Rather than having to manually build the locale aware man paths with

`install_data('foo.fr.1', install_dir: join_paths(get_option('mandir'), 'fr', 'man1'), rename: 'foo.1')`

Support doing

`install_man('foo.fr.1', locale: 'fr')`
2021-02-27 14:35:23 +02:00
Xavier Claessens 2fabd4c7dc minstall: Add --skip-subprojects option
By default all subprojects are installed. If --skip-subprojects is given
with no value only the main project is installed. If --skip-subprojects
is given with a value, it should be a coma separated list of subprojects
to skip and all others will be installed.

Fixes: #2550.
2021-02-22 23:03:55 +02:00
Miro Hrončok 756ea32e06 Don't access other enum members from self
This is deprecated in Python 3.10.
Instead, acces them from the class.

Fixes https://github.com/mesonbuild/meson/issues/8318
2021-02-18 00:08:44 +02:00
Xavier Claessens b6804bf49c Substitute @CURRENT_SOURCE_DIR@ in run_target() and custom_target()
run_target() does some variable substitutions since 0.57.0. This is a
new behavior, and undocumented, caused by sharing more code with
custom_target(). More consistency is better, so document it now.

custom_target() was doing variable substitution in the past, because it
shared some code with generator(), but that was undocumented. Some
refactoring in 0.57.0 caused it to not replace @CURRENT_SOURCE_DIR@,
@SOURCE_DIR@, and @BUILD_DIR@ anymore. This patch adds back
@CURRENT_SOURCE_DIR@ and document it. It does not add back @SOURCE_DIR@
because it is duplicate with @SOURCE_ROOT@ that has a better name. Also
do not add back @BUILD_DIR@ which is duplicate of @PRIVATE_DIR@, and
not @BUILD_ROOT@ surprisingly, adding to the confusion.
2021-02-17 14:48:04 +02:00
Xavier Claessens 2a8d6690f7 backends: Fix custom_target() with configure_file() exe 2021-02-09 19:32:20 +02:00
Xavier Claessens a155935d24 backends: Always use the command returned by as_meson_exe_cmdline()
Even if the command is not wrapped by meson, it could have been modified
to add java/mono interpreters. This fix potential inconsistency between
wrapped and unwrapped commands.
2021-02-09 19:32:20 +02:00
Jussi Pakkanen 71784e1002 Fix exe wrapper detection for run targets. 2021-02-08 23:19:41 +02:00
Jussi Pakkanen 8b82ffa9e4
Merge pull request #8305 from xclaesse/run-target-env
run_target: Add env kwarg
2021-02-07 11:46:41 +00:00
Dylan Baker 456844a4f3 vala: Disable unity builds
Our approach to unity builds with vala is broken, you cannot unify the
generated C files, as they contain duplicate symbols. We would need to
instead combine the files while they are still in their vala form, then
convert that to C and compile the unified C file.

This does not fix the linked issue, as this removed the ability to do
vala unity builds, but it does allow running vala with `--unity=on`.

Related: #5280
2021-02-05 16:31:33 -08:00
Xavier Claessens f63e168685 ninjabackend: Remove useless call to replace_paths()
Replacements are already done by eval_custom_target_command() and must
be done BEFORE calling as_meson_exe_cmdline() anyway. replace_paths() is
still used by generators.

Make eval_custom_target_command() more readable by handling error in the
final else case instead of in the middle of elif.
2021-02-05 18:17:08 -05:00
Xavier Claessens b52794b24b backend: Do not check for exe wrapper twice
It is already checked by as_meson_exe_cmdline().
2021-02-05 18:17:08 -05:00
Xavier Claessens 522392e755 run_target: Add env kwarg
Re-implement it in backend using the same code path as for
custom_target(). This for example handle setting PATH on Windows when
command is an executable.
2021-02-05 17:53:09 -05:00
Jeff Moguillansky 9226a92fe0 xcode-backend: add implicit includes
Move helper functions get_source_dir_include_args and
get_build_dir_include_args to backend base class
2021-02-04 13:05:17 -08:00
Xavier Claessens 6c6b5d77d6 add_install_script: add skip_if_destdir kwarg
It is common, at least in GNOME projects, to have scripts that must be
run only in the final destination, to update system icon cache, etc.
Skipping them from Meson ensures we can properly log that they have not
been run instead of relying on such scripts to to it (they don't
always).
2021-01-30 21:28:21 +00:00
Xavier Claessens 0626465ea8 Fix executable as script on Windows
On Windows this would fail because of missing DLL:
```
mylib = library(...)
exe = executable(..., link_with: mylib)
meson.add_install_script(exe)
```

The reason is on Windows we cannot rely on rpath to find libraries from
build directory, they are searched in $PATH. We already have all that
mechanism in place for custom_target() using ExecutableSerialisation
class, so reuse it for install/dist/postconf scripts too.

This has bonus side effect to also use exe_wrapper for those scripts.

Fixes: #8187
2021-01-30 09:51:06 +00:00
Xavier Claessens 633264984b custom_target: Add env kwarg 2021-01-27 09:00:54 -05:00
Jonas Lundholm Bertelsen 2636eebd64 Unity build reverts to normal for fortran fix
The `determine_ext_objs` function did not take into account that fortran
(and d) does not support unity builds. This caused failures in some
cases.
2021-01-21 14:46:20 +01:00
Jonas Lundholm Bertelsen ea34a92632 When iterating link_targets, include link_whole_targets too (fortran)
This fixes fortran includes and fortran orderdeps for libraries that
were under link_whole_targets.
2021-01-20 18:18:54 +01:00
Marios Staikopoulos a3d8dc546c Removal of /ZI on MSVC Debug
The /ZI flag adds in "Edit and Continue" debug information, which will
cause massive slowdown. It is not a flag that we should be adding by
default to debug builds.

/Zi will still be added.
2021-01-17 21:03:35 +00:00
Dylan Baker 96d7f6c7cd backends/backends: Add type annotations for InstallData
This adds enough type annotations for InstallData and friends to make
minstall happy. There is also a small change in that I've replaced the
List[List] with List[Tuple], as tuples are more appropraite data types
for the information (fixed length, position matters, different types at
different indexes)
2021-01-13 13:32:48 -08:00
Dylan Baker f202da0689 use PEP8 style naming for LANGUAGES_USING_* as well 2021-01-11 11:15:06 -08:00
Dylan Baker d89ec98b47 mtest: Add support for rust unit tests
Rust has it's own built in unit test format, which is invoked by
compiling a rust executable with the `--test` flag to rustc. The tests
are then run by simply invoking that binary. They output a custom test
format, which this patch adds parsing support for. This means that we
can report each subtest in the junit we generate correctly, which should
be helpful for orchestration systems like gitlab and jenkins which can
parse junit XML.
2021-01-05 10:23:41 -08:00
Dylan Baker e81acbd606 Use a single coredata dictionary for options
This patches takes the options work to it's logical conclusion: A single
flat dictionary of OptionKey: UserOptions. This allows us to simplify a
large number of cases, as we don't need to check if an option is in this
dict or that one (or any of 5 or 6, actually).
2021-01-04 12:20:58 -08:00
Dylan Baker 71db6b04a3 use OptionKey for builtin and base options
I would have prefered to do these seperatately, but they are combined in
some cases, so it was much easier to convert them together.

this eliminates the builtins_per_machine dict, as it's duplicated with
the OptionKey's machine parameter.
2021-01-04 12:20:40 -08:00
Dylan Baker fe973d9fc4 use OptionKey for compiler_options 2021-01-04 12:20:39 -08:00
Dylan Baker f6672c7a19 use real pathlib module
We added the _pathlib module to work around defeciencies in python 3.5's
implementation, since we now rely on 3.6 lets drop this
2020-11-20 15:08:40 -08:00
Paolo Bonzini 021d242f9c build: use PIE objects for static libraries if b_staticpic=false but b_pie=true
If static_library is used as a convenience library (e.g. for link_whole)
it should in principle not need position independent code.
However, if the executables that the libraries is linked to are PIE,
the non-PIC objects in the static library will cause linker errors.
To avoid this, obey b_pie for static libraries if either b_staticpic=false
or they use "pic: false".

Without this patch, QEMU cannot use b_staticpic, which causes a slowdown
on some QEMU benchmarks up to 20%.
2020-10-18 18:56:35 +03:00
Daniel Mensinger 7c377e5a5d intro: Add extra_files key to intro output (fixes #7310) 2020-10-15 01:56:59 +03:00
Daniel Mensinger 1dfaccfd91 pathlib: Fix resolve() by overriding it in Python 3.5 2020-10-04 10:45:48 +02:00
Jussi Pakkanen 400ec2d685
Merge pull request #7762 from jon-turney/meson-exe-output-improve
Improve the output for meson wrapped commands
2020-09-29 19:28:51 +03:00
Vili Väinölä d1638a4fde compilers/VS: fix build to use optimization and debug flags
- Fixed using debug and optimization built-in options in MSVC.
- Fixed that VS backend does not create pdb files in release mode.
VS implicitly adds the debug fields if left out.
- Fix that it is possible to add debug info with ninja backend with
optimizations.
2020-09-29 19:25:50 +03:00
Jon Turney 194dcdef03
Make meson_exe report pickled command when it fails
Make 'meson --internal exe --unpickle' report the actual command
executed when it fails, which is otherwise invisible.
2020-09-20 12:57:50 +01:00
Jon Turney c72625c2a7
Improve description of meson wrapped custom commands
I've always found ninja reporting 'a meson_exe.py custom command'
unclear and confusing. Instead say we are invoking a custom command,
wrapped by meson, and why.
2020-09-20 12:57:44 +01:00
Nirbheek Chauhan faba48d853 backends: Treat build target as generator only when it's the first arg
Otherwise it might be an argument to a script that just inspects the
binary itself.
2020-09-17 22:25:37 +00:00
Xavier Claessens 19696c3dcd Allow installing dir from build dir 2020-09-13 13:54:47 -04:00
Eli Schwartz d880f995ea Revert "Do not automatically set warning flags if buildtype is 'plain'"
This reverts commit 8ee1c9a07a.

No rationale was given for this change prior to merging. After the fact
it was described as desired by distro packagers, however as a distro
packager I believe this commit hurts me.

From a distro packaging perspective, we primarily care about one thing:
previously building code should still build. Hence, -Werror is bad for
our use case. meson handles this via -D werror which is different from
-D warning_level and as long as the former is disabled, warnings in the
build do not cause harm (but may attract review attention for upstream
to fix).

buildtype is a completely unrelated concern, and the intention for
=plain is to disable debug or optimization settings that result in
codegen differences and thus different built artifacts. This must not
happen in distro builds because the *distributed programs* should
conform to policy settings.

Unfortunately, completely disabling warnings happens silently, and
cannot be overridden even if you really, really believe you know what
you're doing. It is thematically broken, since use of
add_project_arguments() to add more -W flags is not likewise ignored.
But if you try to add -Wall in that manner, meson will lecture you to
use warning_level which you cannot do. And if you have custom warning
flags which depend on options enabled by judicious use of -Wall via
default_options: 'warning_level=1', then you end up with generated
warnings complaining about your command line rather than your code, such
as:

cc1: warning: ‘-Wformat-y2k’ ignored without ‘-Wformat’ [-Wformat-y2k]
cc1: warning: ‘-Wformat-extra-args’ ignored without ‘-Wformat’ [-Wformat-extra-args]
cc1: warning: ‘-Wformat-zero-length’ ignored without ‘-Wformat’ [-Wformat-zero-length]
cc1: warning: ‘-Wformat-contains-nul’ ignored without ‘-Wformat’ [-Wformat-contains-nul]
cc1: warning: ‘-Wformat-security’ ignored without ‘-Wformat’ [-Wformat-security]

which then break the build with -Werror.

Throughout all this, a buildtype of "plain" does *not* disable -D
werror=true, which is the part where distro builds actually break down!

Users who both wish to disable debug/optimization codegen, *and* disable
warning commentary, are encouraged to do so by doing both, not by doing
one and having the other be assumed.

Fixes #7399
2020-09-11 18:22:57 +00:00
Nirbheek Chauhan 9fb839687b minstall: Add version field to install data
And check the install data in the same way that mtest checks
serialisation data.

Fixes https://github.com/mesonbuild/meson/issues/2354
2020-09-10 12:38:05 +00:00
Nirbheek Chauhan fb7099c6cf mtest: Check version in the test data after loading
Same as coredata.dat and build.dat loading. Also, do not assert if
things change. Raise the appropriate exception.

Fixes https://github.com/mesonbuild/meson/issues/7613
2020-09-10 08:18:16 +00:00
Daniel Mensinger 23818fc5a3
typing: more fixes 2020-09-08 20:15:58 +02:00
James Hilliard 646ae846be backends: check external rpaths for all languages using ldflags
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
2020-09-06 21:07:14 +03:00
Paolo Bonzini fa5c2363eb introspect: add test dependencies info to test/benchmark JSON
Add the ids of any target that needs to be rebuilt before running the
tests as computed by the backend, to the introspection data for tests and benchmarks.
This also includes anything that appears on the test's command line.

Without this information, IDEs must update the entire build before running
any test.  They can now instead selectively build the test executable
itself and anything that is needed to run it.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-09-04 14:45:20 +02:00
Paolo Bonzini 71d33a5721 backends: do not look for extra paths unnecessarily
extra_paths only matter for the host machine if using an exe_wrapper.
However, because CustomTarget.for_machine is always MachineChoice.HOST,
they were computed unnecessarily in as_meson_exe_cmdline.

Defer computation of extra_paths until after we have found out if the
custom target executable is really for the host or the build machine,
so that we can use exe_for_machine; for_machine then becomes unused
and can be removed.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-08-31 23:01:05 +03:00
Xavier Claessens 1c403e20e7 Interpreter: Fix c_stdlib usage
- Exceptions raised during subproject setup were ignored.
- Allow c_stdlib in native file, was already half supported.
- Eliminate usage of subproject variable name by overriding
  '<lang>_stdlib' dependency name.
2020-08-18 14:47:38 -04:00
Jussi Pakkanen bbf8533a97
Merge pull request #7494 from keszybz/fix-two-warnings
Fix two warnings
2020-07-30 16:39:04 +03:00
James Hilliard 1ce4258c21 backends: fix rpath match pattern
Since -Wl,-rpath= is not the only valid rpath ldflags syntax we
need to try and match all valid rpath ldflags.

In addition we should prevent -Wl,--just-symbols from being used to
set rpath due to inconsistent compiler support.

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
2020-07-30 16:36:11 +03:00
Zbigniew Jędrzejewski-Szmek 1123f4f311 Avoid warning about multiple outputs when building private directory name
Fixup for b4b1a2c5a1.

A warning would be printed for any rule with multiple outputs, for
example:
WARNING: custom_target 'coredump.conf.5' has more than one output! Using the first one.
WARNING: custom_target 'dnssec-trust-anchors.d.5' has more than one output! Using the first one.
WARNING: custom_target 'halt.8' has more than one output! Using the first one.

Fixes https://github.com/systemd/systemd/issues/16461.
2020-07-28 19:51:58 +02:00
Dylan Baker 93c3ec7e2d compilers: Return CompilerArgs from compiler instance
Since the CompileArgs class already needs to know about the compiler,
and we really need at least per-lanaguage if not per-compiler
CompilerArgs classes, let's get the CompilerArgs instance from the
compiler using a method.
2020-06-22 12:06:10 -07:00
Dylan Baker 9d0ad66c29 compilers: Split CompilerArgs into a separate module
I've also moved this out of the compilers pacakge because we're soon
going to need it in linkers, and that creates some serious spagetti
2020-06-22 12:06:10 -07:00
Nirbheek Chauhan eab0e5a8b3 windows: Canonicalize `:` in filenames
Fixes https://github.com/mesonbuild/meson/issues/7265
2020-06-14 14:55:49 +00:00
Jon Turney b91355a29b Include the dep itself in extra_paths for Windows
This is needed in the case where a custom_target directly depends on a
shared library, and somehow loads it.

(Specifically this can be the case with gtkdoc, when it invokes
gtkdoc-scangobj, which will build and run it's own code to load a shared
library, to introspect it)
2020-06-13 18:48:35 +00:00
Jon Turney 1b7855c36d Handle multiple substitutions in eval_custom_target_command()
Handle command arguments which contain multiple substitutions correctly
in Backend.eval_custom_target_command()

In particular, gnome.gtkdoc() makes arguments of the form '--cflags
-I@SOURCE_ROOT@ -I@BUILD_ROOT' (where these arguments are then passed
down to a compiler invocation)

Normally, these are subsequently made right by
NinjaBackend.replace_paths(), but if Backend.as_meson_exe_cmdline()
decides that the command needs to be pickled, that doesn't happen.

(Although having two places where this substitution might happen smells
really bad)
2020-06-13 18:48:35 +00:00
Jon Turney aca93df184 backend: There is no need for 'compiler-specific escaping' anymore
Now that all command-line escaping for ninja is dealt with in the ninja
backend, escape_extra_args() shouldn't need to do anything.

But tests of existing behaviour rely on all backslashes in defines being
C escaped: This means that Windows-style paths including backslashes can
be safely used, but makes it impossible to have a define containing a C
escape.
2020-06-05 14:15:32 -07:00
Jussi Pakkanen 589a6249f0
Merge pull request #5986 from dcbaker/fix-tests-with-cross-binary-arguments
Fix tests with cross binary arguments
2020-05-19 00:23:19 +03:00
Jussi Pakkanen b4b1a2c5a1 Build private directory name from output file name. 2020-05-19 00:22:45 +03:00
Dylan Baker 0ec94ca062 backends: Consider arguments passed to a test when cross compiling
Otherwise a wrapper script which takes an executable as an argument will
mistakenly run when that executable is cross compiled. This does not
wrap said executable in an exe_wrapper, just skip it.

Fixes #5982
2020-05-18 13:53:58 -07:00
Dylan Baker cb6662b572 backends: ensure that test executables can be run when passed as arguments
If an executable is passed as an argument to a script in the build
directory that it resides in then it will not execute (on *nix) due to a
lack of ./. Ie, `foo` must be called as `./foo`. If it is called from a
different directory it will work. Ie `../foo` or `bar/foo`.

Fixes #5984
2020-05-18 13:53:58 -07:00
Jussi Pakkanen 751ea3df72
Merge pull request #7103 from dankegel/bug4027-rpath-remember
Let .pc files and LDFLAGS provide rpaths.
2020-05-18 23:17:34 +03:00
Dan Kegel f8cfb74e9b Let LDFLAGS specify rpath.
Fixes #2567
2020-05-16 20:26:03 +00:00
Dan Kegel d7235c5905 Let .pc files specify rpath.
Fixes #4027
2020-05-16 20:25:58 +00:00
Ole André Vadla Ravnås 859dc4255a Fix outdated cross-compilation checks 2020-05-13 15:51:54 +00:00
Jussi Pakkanen 4ea7c6ee12
Merge pull request #7064 from dcbaker/gtest-protocol
Add support for Gtest as a test protocol
2020-05-06 23:57:44 +03:00
Dylan Baker 083c5f6357 Add native support for gtest tests
Gtest can output junit results with a command line switch. We can parse
this to get more detailed results than the returncode, and put those in
our own Junit output. We basically just throw away the top level
'testsuites' object, then fixup the names of the tests, and shove that
into our junit.
2020-05-04 11:33:19 -07:00
Michael Brockus 3ac437cecf
rm python2 %s from backends.py and ninjabackend.py 2020-05-03 14:00:15 +03:00
Dylan Baker 0c51762463 backend/backends: Fix type annotation 2020-04-30 13:59:49 -07:00
Dylan Baker 28e3ce67ae Convert test protocol into an enum
This gives us better type safety, and will be important as we add more
test methods
2020-04-30 13:54:46 -07:00
Dylan Baker 793c3d706e backends/backends: sort and cleanup imports 2020-04-30 13:35:55 -07: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
Daniel Mensinger d4449ed613 backend: Fix file name confilcts by using the complete path 2020-04-16 17:54:27 +00:00
Marc-André Lureau a54506fe46 Handle BuildTarget as custom_target() argument #6914 2020-04-11 23:18:43 +03:00
Xavier Claessens 4d7ccd1399 Make werror per subproject option 2020-03-24 22:48:55 +02:00
John Ericson 3a4388e51d Fix legacy env var support with cross
Fix #3969
2020-03-23 17:51:36 +02:00
Dylan Baker 06b1a317d2 Make use of unholder
We have a lot of cases of code like:
```python
if hasattr(var, 'held_object'):
    var = var.held_object`
```

replace that with the unholder function.
2020-03-05 09:58:52 -08:00
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
Daniel Mensinger 09b53c534f types: import typing as T (fixes #6333) 2020-01-08 15:28:17 +01: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
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
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 6ac5db50c9 CUDA support on Windows 2019-09-24 14:22:20 -07: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
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
Rachel Mant f431cff809 Make .extract_objects() work correctly as an input to custom_target 2019-08-17 21:12:56 +03:00
Paolo Bonzini d34e532020 backends: do not split command and arguments in ExecutableSerialisation
This is not needed anymore, just make a single field with the whole
command line.
2019-07-19 00:17:29 +02:00
Paolo Bonzini b4d313b058 backends: remove unnecessary fields from ExecutableSerialisation
"exe.is_cross and exe.needs_exe_wrapper" is the same condition under which
meson chooses whether to include the exe_wrapper.  meson_exe has an assertion
for that, but now that meson_exe does not need anymore exe.is_cross,
we can simplify the code if we just "trust" meson to do the right thing.

Remove both fields from ExecutableSerialisation and just test the presence
of the wrapper, and also remove the executable basename which is only
used to "beautify" an assertion failure.
2019-07-19 00:17:29 +02:00
Paolo Bonzini ed348b7da8 backends: discover java/mono wrapper at generation time
Move the magic to execute jar and .exe files from "meson --internal exe"
to the backend, so that "ninja -v" shows more clearly what is happening.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-07-19 00:17:29 +02:00
Paolo Bonzini 8239d71025 backends: create ExecutableSerialisation in meson_exe if possible
If meson_exe is only being used to capture the output of the command,
we can skip going through a pickled ExecutableSerialization object.
This makes "ninja -v" output more useful.
2019-07-19 00:17:29 +02:00
Paolo Bonzini 2912f44e9c backends: always serialize custom targets if they need a wrapper 2019-07-19 00:17:29 +02:00
Paolo Bonzini f95c965043 backends: choose whether to serialize in as_meson_exe_cmdline
This removes more duplicate code between custom targets and generators.
In addition, generators can now have arguments with newlines in them.
2019-07-19 00:17:29 +02:00
Paolo Bonzini 3ef7b23178 backends: hide meson --internal exe cmdline from backends
Return the command line from serialize_executable, which is then
renamed to as_meson_exe_cmdline.  This avoids repeating code that
is common to custom targets and generators.
2019-07-19 00:17:29 +02:00
John Ericson 3f280a81fd Remove build host mixing warning on native
There are two problems with this:

 - It has false positives when the code that trips it is conditional and
   no run on cross.

 - It confuses users who never wrote any `native` flags and don't care
   about cross.

Fixes #5509
2019-06-28 22:12:55 +03:00
Dylan Baker 6e4e0028a1 meson_exe: Don't assert that we need an exe_wrapper when we say we don't need one
Fixes cross compiling mesa from x86_64 -> x86 on an x86_64 system.

Fixes #5567
2019-06-27 21:06:41 +03:00
Marcel Hollerbach f39d2cc3bf meson: add cache for getting options
calling this function too ~60 sec. before, now 0.000435 sec.
2019-06-24 22:26:58 +03: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 32e827dcdc Use `env.machines.*` to avoid some `is_cross`
This is a small example of the `is_cross` removal the that abstraction
enables.
2019-06-09 13:13:20 -04:00
Marcel Hollerbach d6407445b9 backend: refactor get_custom_target_provided_libraries
the problem here is, that get_custom_target_provided_libraries iterated
over all generated sources of a target. In each output we check if this
is a library or not. In projects like EFL we have added a lot of
generated target to many different targets, so the iterating of the
output is rather consistent, with this commit we drop from 19% of the
time spending in get_custom_target_provided_libraries down to 3.51%.
2019-06-03 20:37:27 +03:00
Jussi Pakkanen 67a5af99aa
Merge pull request #5395 from dcbaker/mtest-annotations
Mtest annotations and bug fixes
2019-05-16 00:31:01 +03: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
Dylan Baker e24c11336d backends: Annotate TestSerialisiation
Also, we should at some point decide whether we're going to use American
spelling (serialize/serialization) or British (serialise/serialisation)
because we have both, and both is always worse than one or the other.
2019-05-14 16:43:29 -07:00
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
Jussi Pakkanen 1f4023fa47
Merge pull request #5311 from mensinda/flake8Plugins
Added flake8 plugins and some code fixes
2019-05-02 23:30:29 +03:00
TheQwertiest d74ab216db Cleaned up `isinstance` usage 2019-04-29 17:57:02 +03:00
TheQwertiest 8c9a25456d Added custom_target[i] support for link_with and link_whole 2019-04-29 16:07:50 +03:00
Daniel Mensinger 2b5831f94f
Fix flake8-bugbear warnings 2019-04-29 12:22:50 +02:00
Jussi Pakkanen 04710b087a Add support for VS2019. Closes #4640. 2019-04-10 23:13:47 +03:00
Jussi Pakkanen 54db2c9bab
Merge pull request #5225 from dcbaker/threads-is-not-special
Threads is not special
2019-04-08 21:06:55 +03:00
Dylan Baker 6ad7fbf950 dependencies/misc: don't special case threads
Instad of having special casing of threads in the backends and
everywehre else, do what we did for openmp, create a real
dependency. Then make use of the fact that dependencies can now have
sub dependencies to add threads.
2019-04-05 16:41:08 -07:00
Dylan Baker 94ba53c6b6 backends/ninja: Add native files to rebuild dependencies
Just like cross files.
2019-04-04 16:28:16 +00:00
Jussi Pakkanen 5905533fcd
Merge pull request #5103 from mesonbuild/linkcustom
Can link against custom targets
2019-04-01 01:29:51 +03:00
Jussi Pakkanen 3a613564d3
Merge pull request #5116 from dcbaker/openmp-de-specialize
dependencies/openmp: Don't special case OpenMP
2019-03-21 01:21:37 +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
Dylan Baker 1f342a2081 dependencies/openmp: Don't special case OpenMP
Currently we specialcase OpenMP like we do threads, with a special
`need_openmp` method. This seems like a great idea, but doesn't work
out in practice, as well as it complicates the opemp
implementation. If GCC is built without opemp support for example, we
still add -fopenmp to the the command line, which results in
compilation errors.

This patch discards that and treats it like a normal dependency,
removes the need_openmp() method, and sets the compile_args attributes
from the compiler.

Fixes #5115
2019-03-19 12:48:22 -07:00
Jussi Pakkanen e81f48db16 Can link against custom targets. Closes #4908. 2019-03-18 22:01:07 +02:00
Jussi Pakkanen 4b95dd3a6d Add test script to generate a static library with a custom target. 2019-03-18 22:01:06 +02:00
Paolo Bonzini 4b5cf3f7c5 interpreter: add "protocol" kwarg to test
This is the first step towards adding support for TAP.
2019-03-02 09:07:54 +01:00
Nicolas Schneider ded0defc3f auto generate msvc pch source file if none is provided by the user 2019-03-01 21:50:31 +02:00
John Ericson d87744138a Remove remaining cross-specific compiler-args code
Since the consolidation of flags in `compiler_options.*`, this
cross/native special casing is not needed.
2019-02-15 09:17:24 -08: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
Michael Hirsch, Ph.D da34bea893 pep8 py37 2019-01-29 22:06:11 +02:00
Luca Boccassi 267792174c custom_target: do not let install override build_by_default
A custom_target, if install is set to true, will always be built by
default even if build_by_default is explicitly set to false.
Ensure that this does not happen if it's set explicitly. To keep
backward compatibility, if build_by_default is not set explicitly and
install is true, set build_by_default to true.

Fixes #4107
2019-01-17 20:40:19 +02:00
Jussi Pakkanen d085002d18 Calculate target paths correctly when workdir is set. 2019-01-07 23:09:24 +02:00
Daniel Mensinger df1434d5a5
Fixed CI issues 2019-01-06 12:19:34 +01:00
Daniel Mensinger 9d025f1374
Make custom command sources slightly more useful 2019-01-06 12:19:34 +01:00
Daniel Mensinger 2487e0a1fb
Simplefied absolute path generation 2019-01-06 12:19:32 +01:00
Daniel Mensinger 5c39dd0668
Doc updates and throw if no target type is set 2019-01-06 12:19:31 +01:00
Daniel Mensinger 7691b0460c
Ninja backend target introspection 2019-01-06 12:19:30 +01:00
Daniel Mensinger 4addd176db
Removed fallback detection logic 2019-01-06 12:19:28 +01:00
Daniel Mensinger a5be893b19
Some code cleanup 2019-01-06 12:19:28 +01:00
Daniel Mensinger 74274e23ca
Moved the source and compiler generation to the backend 2019-01-06 12:19:28 +01:00
Daniel Mensinger 111e596200
Fixed tests and benchmarks 2019-01-06 12:19:27 +01:00
Daniel Mensinger f4285f350e
Initial automatic target file generation 2019-01-06 12:19:27 +01:00
John Ericson 2b22576fb6 Remove cross_info; cross file is parsed up front and discarded 2019-01-02 16:22:47 -05:00
John Ericson dbf080afe9 Get rid of `need_cross_compiler`
Building a cross compiler (`build == host != target`) is not cross
compiling. As such, it doesn't make sense to handle it under
`is_cross_build`.

(N.B. Building a standard library for a cross compiler would require
cross compiling, but Meson has support to do such a thing as part of a
compiler build currently.)
2019-01-02 16:11:02 -05:00
Daniel Mensinger 10ce5deb71
Introspection refactoring 2018-12-29 23:55:45 +01:00
Phillip Cao 76333d2a1e Add prefix option for link args 2018-11-08 00:02:24 +13: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
Xavier Claessens f0e1342fb2 extract_all_sources: Also include generated object files
Closes #4281.
2018-11-02 21:40:04 +02:00
Marcel Hollerbach 468d1a05ec meson: cache get_target_generated_dir
This reduces the build time about 2 sec. The result itself is not hard
to calculate. However, persistent join calls with the same 2 strings are
not that usefull. This also caused about 600'000 calls to
get_target_dir, we are now down to 60'000 calls form this function to
get_target_dir.
2018-11-02 21:04:13 +02:00
Jon Turney 99b0a7acda Fix flake8 whitespace reports
$ flake8 | grep -E '(E128|E203|E221|E226|E303|W291|W293)'
./mesonbuild/backend/backends.py:32:1: E303 too many blank lines (3)
./mesonbuild/modules/i18n.py:90:56: E128 continuation line under-indented for visual indent
2018-10-24 19:11:46 +03:00
Jon Turney 93f7b83bf5 Fix flake8 'imported but unused' reports
$ flake8 | grep F401
./mesonbuild/minstall.py:15:1: F401 'gzip' imported but unused
./mesonbuild/backend/backends.py:26:1: F401 '..compilers.get_macos_dylib_install_name' imported but unused
./mesonbuild/backend/backends.py:29:1: F401 'functools.lru_cache' imported but unused
./mesonbuild/scripts/dist.py:27:1: F401 'mesonbuild.dependencies.ExternalProgram' imported but unused
2018-10-24 19:11:46 +03:00
Michał Górny e8232c7825 Remove implicit compression of man pages
Remove the code responsible for implicitly compressing manpages as .gz
files.  It has been established that manpage compression is a distro
packager's task, with existing distros already having their own
implementations of compression.

Fixes #4330
2018-10-20 13:16:28 +03:00
Xavier Claessens c453400d59 Add 'b_pie' compiler option
On Android executables must be position independent, many
distributions enable it by default too for security reasons.
2018-10-20 00:47:27 +03:00
Jon Turney a0a0c244e2 os.path.relpath() can fail on Windows
If builddir and sourcedir have different drive letters, a relative path
doesn't exist, and os.path.relpath fails with a ValueError exception.

This just fixes the places which are hit by test cases in a simple-minded
way.  There are several other uses of os.path.relpath(), which might be
suspect.
2018-10-10 19:43:24 +03:00
Dylan Baker a0e4548c41 backends: allow running host arch binaries on compatible build machines
Meson 0.48.0 some validation for using compiled binaries in custom
targets and generators, which is nice. It didn't take into account
though that as long as the OS is the same, some architectures support
running a related architecture natively (x86_64 can run x86 natively,
for example).

Fortunately we already have a method for covering this case available
through the Environment class.

Fixes #4254
2018-10-04 23:50:31 +03:00
Marcel Hollerbach c53d35aa72 build: generate the mappings in the Targets
Before, the mappings has been created over all the links, while it
actaully only used the Shared or Static Targets. This structure now is
tree like structured and cached, thus the results can be computed a lot
faster.
The generator step generate_install is now for EFL from 6 sec. down to
0.3s. Which improves the overall build time from ~20 sec. to ~14 sec.
2018-10-01 23:47:19 +02:00
Marcel Hollerbach c38544a6ec build: move default_install_dir to the Target classes
there is a huge amount of isinstance calls, this reduces the amount of
these calls while splitting up a rather big function. It also assosiates
every target type with theire default install directory.
2018-10-01 23:47:19 +02:00
Thibault Saunier 533997891e backend: Make sure to normalize paths before checking if it is a system dir
Otherwise if we for some reason get '/usr/lib/../lib' in there
we end up saying it is not a system path.

And for some reason here I got:

```
$ pkg-config --libs libffi                                                                                                             148  ST 117   hotdoc
-L/usr/lib/../lib -lffi
```
2018-09-28 12:58:16 -07:00
Nirbheek Chauhan 1af704a509 Sprinkle functools.lru_cache() in a few more places
This improves the backend generation time for gst-build from 7.4s to
6.6s. This is probably all the low-hanging fruit we can get, further
improvements will probably require refactoring, moving to pathlib.Path
or reimplementing CompilerArgs:

   222045    0.551    0.000    1.324    0.000 compilers.py:666(__iadd__)
     3691    0.230    0.000    0.885    0.000 ninjabackend.py:99(write)
   233560    0.441    0.000    0.701    0.000 posixpath.py:75(join)
      882    0.141    0.000    0.636    0.001 backends.py:509(generate_basic_compiler_args)
   256301    0.248    0.000    0.576    0.000 compilers.py:562(_can_dedup)
    37369    0.035    0.000    0.466    0.000 compilers.py:652(extend_direct)
    74650    0.067    0.000    0.431    0.000 compilers.py:641(append_direct)
   158153    0.089    0.000    0.405    0.000 ninjabackend.py:129(<lambda>)
      845    0.064    0.000    0.391    0.000 ninjabackend.py:279(get_target_generated_sources)
    58161    0.070    0.000    0.317    0.000 backends.py:217(get_target_generated_dir)
   216825    0.175    0.000    0.275    0.000 ninjabackend.py:48(ninja_quote)
      845    0.058    0.000    0.255    0.000 ninjabackend.py:2289(guess_external_link_dependencies)
      845    0.068    0.000    0.239    0.000 backends.py:793(get_custom_target_provided_libraries)
    52101    0.030    0.000    0.237    0.000 compilers.py:716(append)
  1319326    0.231    0.000    0.231    0.000 {built-in method builtins.isinstance}
  1189117    0.229    0.000    0.229    0.000 {method 'startswith' of 'str' objects}
     3235    0.102    0.000    0.228    0.000 compilers.py:614(to_native)

Note: there are 845 build targets.
2018-09-11 10:19:42 -07:00
Marcel Hollerbach 7ae3fbf88d mesonbuild: move subdir generation along link dep generation
The problem with the earlier position of the generation code was, that
the results could not be cached, because the list of all link_deps was
overall different. However, it shared a special kind of subsets with
other build build targets.

Generating the set of subdirs that are required for linking, alongside
with the link dependencies brings the possibility of caching this.
This reduces the buildting from 1 min. in efl down to 20 sec. And
reduces the amount of 30872534 calls down.

this saves ~40 sec.
2018-09-11 03:03:30 -07:00
Marcel Hollerbach c68460e2ee backends: save up the dylib generated names
this saves about 6 sec.
2018-09-11 03:03:30 -07:00
GoaLitiuM 6e160995b0 Improve D link argument handling 2018-09-06 03:57:45 +03:00
Jussi Pakkanen 54aed1a92c Added "native" kwarg to add_XXX_args. Closes #3669. 2018-08-22 23:22:48 +03:00
Bruce Richardson 8c9296e8e6 find_library: Use _build_wrapper to get library dirs
This means that we will take into account all the flags set in the
cross file when fetching the list of library dirs, which means we
won't incorrectly look for 64-bit libraries when building for 32-bit.

Signed-off-by: Nirbheek Chauhan <nirbheek@centricular.com>

Closes https://github.com/mesonbuild/meson/issues/3881
2018-08-22 12:24:43 -07:00
Jussi Pakkanen d83f77109a
Convert buildtype to optimization and debug options (#3489) 2018-08-18 20:39:47 +03:00
Nirbheek Chauhan c69030c123 Don't require an import library for shared modules
Shared modules may be resource-only DLLs, or might automatically
self-initialize using C constructors or WinMain at DLL load time.

When an import library is not found for a shared module, just print
a message about it instead of erroring out.

Fixes #3965
2018-08-09 18:39:19 +03:00
Jussi Pakkanen e75f6e4305
Merge pull request #3850 from mesonbuild/nirbheek/exe-wrapper-compiler-fallbacks
Be more permissive about not-found exe_wrapper
2018-07-31 19:33:06 +03:00
Jussi Pakkanen 8c735069b3
Merge pull request #3898 from mesonbuild/vsinstall
Add install target to VS
2018-07-27 14:38:50 +03:00
Rafael Ávila de Espíndola c7360dd426 Make the rpath order deterministic. (#3932) 2018-07-25 19:40:54 +03:00
Jussi Pakkanen 7bb5f82736 Added install target to VS. Closes #3841. 2018-07-22 16:05:09 +03:00
Jussi Pakkanen 808d229c37 Moved install data file generation to base class. 2018-07-17 13:04:07 +03:00
Nirbheek Chauhan e8dae2b966 cross: Be more permissive about not-found exe_wrapper
We used to immediately try to use whatever exe_wrapper was defined in
the cross file, but some people generate the cross file once and use
it for several projects, most of which do not even need an exe wrapper
to build.

Now we're a bit more resilient. We quietly fall back to using
non-exe-wrapper paths for compiler checks and skip the sanity check.
However, if some code needs the exe wrapper, f.ex., if you run a built
executable using custom_target() or run_target(), we will error out
during setup.

Tests will, of course, continue to error out when you run them if the
exe wrapper was not found. We don't want people's tests to silently
"pass" (aka skip) because of a bad CI setup.

Closes https://github.com/mesonbuild/meson/issues/3562

This commit also adds a test for the behaviour of exe_wrapper in these
cases, and refactors the unit tests a bit for it.
2018-07-09 05:39:40 +05:30
Nirbheek Chauhan 416a00308f cross: Use ExternalProgram for cross-file exe_wrapper
We already have code to fetch and find binaries specified in a cross
file, so use the same code for exe_wrapper. This allows us to handle
the same corner-cases that were fixed for other cross binaries.
2018-07-09 04:09:46 +05:30
Nirbheek Chauhan 58ae2c9a8c Rename clike_langs to clink_langs for clarity
D is not a 'c-like' language, but it can link to C libraries. The same
might be true of Rust in the future and Go when we add support for it.

This contains no functionality changes.
2018-06-20 11:27:08 +00:00
Jon Turney d17ce4ffd0 Correctly substitute the internal @BUILD_ROOT@ token with MSVC backend
To me, this looks like a mistake in 976c9abc, but perhaps there's something
I don't understand going on here.
2018-06-18 10:52:21 +00:00
Alex Hirsch cbe18e01e4 Deprecate `build_always`, add `build_always_stale`
Since `build_always` also adds a target to the set of default targets,
this option is marked deprecated in favour of the new option
`build_always_stale`.

`build_always_stale` *only* marks the target to be always considered out
of date, but does *not* add it to the set of default targets.

The old behaviour can still be achieved by combining
`build_always_stale` with `build_by_default`.

fixes #1942
2018-06-18 10:49:40 +00:00
Nirbheek Chauhan 96b7fdb723 macos: Rewrite install_name for dependent built libraries on install
On macOS, we set the install_name for built libraries to
@rpath/libfoo.dylib, and when linking to the library, we set the RPATH
to its path in the build directory. This allows all built binaries to
be run as-is from the build directory (uninstalled).

However, on install, we have to strip all the RPATHs because they
point to the build directory, and we change the install_name of all
built libraries to the absolute path to the library. This causes the
install name in binaries to be out of date.

We now change that install name to point to the absolute path to each
built library after installation.

Fixes https://github.com/mesonbuild/meson/issues/3038
Fixes https://github.com/mesonbuild/meson/issues/3077

With this, the default workflow on macOS matches what everyone seems
to do, including Autotools and CMake. The next step is providing a way
for build files to override the install_name that is used after
installation for use with, f.ex., private libraries when combined with
the install_rpath: kwarg on targets.
2018-06-18 06:33:23 +00:00
Nirbheek Chauhan 61c6f589f3 backends: Don't exclude system libraries for PATH
We reuse the same function for generating PATH, and we don't want to
exclude system paths there for obvious reasons.
2018-06-07 12:57:56 +00:00
Nirbheek Chauhan 6b7dba7f06 backends: Don't hardcode system library paths
Lookup the library paths using the available compilers instead.

This makes the code work on non-Linux platforms too.
2018-06-07 12:57:56 +00:00
Xavier Claessens aa879b7f0c Fix issues found by flake8 2018-06-06 20:02:37 +00:00
Xavier Claessens b7d442150d Move <lang>_args to coredata.compiler_options 2018-06-06 20:02:37 +00:00
Nirbheek Chauhan ad0121d259 Add prog/lib dirs from the mingw cross-compiler to PATH
These directories contain DLLs that the executable may need, such as
libstdc++-6.dll, libwinpthread, etc.
2018-06-05 10:50:22 +00:00
Nirbheek Chauhan eb383ef4a2 Automatically add cross-mingw root and sysroot bindir to WINEPATH
This ensures that all the system DLLs required by executables such as
libstdc++-6.dll can be found out of the box and tests can run
2018-06-05 10:50:22 +00:00
Nirbheek Chauhan efa9b75d5d Set WINEPATH when running serialized executables
When the exe runner is `wine` or `wine32` or `wine64`, etc.
This allows people to run tests with wine.

Note that you also have to set WINEPATH to point to your custom
prefix(es) if your tests use external dependencies.

Closes https://github.com/mesonbuild/meson/issues/3620
2018-06-05 10:50:22 +00:00
Mathieu Duponchelle b3feff3032 test extra paths: add extra paths for all build targets 2018-06-02 11:42:48 +00:00
Mathieu Duponchelle 35ab34d6cd test serialisation: determine windows extra paths ..
..  for executable arguments too.

This makes it possible to pass an executable to a test, which
can then run it in an appropriate environment.
2018-06-02 11:42:48 +00:00
Nirbheek Chauhan 1ffbddc31a backends: Also accept dylibs while finding RPATHs 2018-05-24 14:38:28 +00:00
Nirbheek Chauhan fecd580687 backends: Simplify loop getting rpaths for bundled libs
No functionality changes
2018-05-24 14:38:28 +00:00
Nirbheek Chauhan 165da6fb65 backends: Use a set while gathering RPATHs 2018-05-24 14:38:28 +00:00
Jussi Pakkanen 1918c0d231 Can combine D and C++ in a single target. Closes #3125. 2018-05-02 22:50:15 +03:00
Niklas Claesson 4f4cdee687 Allow custom_target do depend on indexed output of custom_target
Fixes: #3494
2018-05-01 11:51:55 +00:00
Jussi Pakkanen 9b0453d3e9
Merge pull request #3225 from filbranden/fixperms3
Introduce install_umask to determine permissions of files in install tree. Default it to 022
2018-04-26 23:14:00 +03:00
Xavier Claessens 9a82b0136a extract_all_objects: Add 'recursive' keyword argument
To maintain backward compatibility we cannot add recursive objects by
default. Print a warning when there are recursive objects to be pulled
and the argument is not set. After a while we'll do pull recursive
objects by default.
2018-04-18 14:54:52 -04:00
Xavier Claessens 60aaee55d4 extract_all_objects(): Recursively extract objects
Fixes #3401
2018-04-18 14:54:52 -04:00
Xavier Claessens b0e4d4047b Fix using object extracted from a unity build
- determine_ext_objs: What matters is if extobj.target is a unity build,
  not if the target using those objects is a unity build.
- determine_ext_objs: Return one object file per compiler, taking into
  account generated sources.
- object_filename_from_source: No need to special-case unity build, it
  does the same thing in both code paths.
- check_unity_compatible: For each compiler we must extract either none
  or all its sources, taking into account generated sources.
2018-04-18 14:49:52 -04:00
Filipe Brandenburger 8651d55c6a Add new builtin option --install-umask
This option controls the permissions of installed files (except for
those specified explicitly using install_mode option, e.g. in
install_data rules.)

An install-umask of 022 will install all binaries, directories and
executable files with mode rwxr-xr-x, while all data and non-executable
files will be installed with mode rw-r--r--.

Setting install-umask to the string 'preserve' will disable this
feature, keeping the permissions of installed files same as the files in
the build tree (or source tree for install_data and install_subdir.)
Note that, in this case, the umask used when building and that used when
checking out the source tree will leak into the install tree.

Keep the default as 'preserve', to show that no behavior is changed and
all tests keep passing unchanged.

Tested: ./run_tests.py
2018-04-18 11:44:54 -07:00
Jussi Pakkanen 628f910760
Merge pull request #3314 from sarum9in/test_depends
Add test(depends) keyword parameter
2018-04-18 00:40:52 +03: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 809f018333 extract_all_objects: Also extract generated sources 2018-04-03 15:20:19 -04:00