Commit Graph

564 Commits

Author SHA1 Message Date
Raphael Salamon c23ac0b3dc Allow custom targets with same name in project and subprojects
closes #4377
2019-02-19 19:41:57 +02:00
Jussi Pakkanen 6e15bcc504
Merge pull request #4929 from mensinda/rwAddRmTgt
rewriter: Add and remove targets
2019-02-19 00:08:58 +02:00
jml1795 a9e63568fe Add warning level zero 2019-02-19 00:06:27 +02:00
Daniel Mensinger 5184465280
rewriter: Added support for adding targets 2019-02-16 14:17:01 +01:00
Daniel Mensinger 056c533ede
rewriter: Added support for removing targets 2019-02-16 14:14:16 +01:00
Jussi Pakkanen 939b011114
Merge pull request #4858 from mensinda/rwKWARGS
rewriter: Add support for kwargs modification
2019-02-16 14:17:49 +02:00
Dylan Baker b5d847e38c allow paths to be set in the cross file
Just like the previous patch, but for cross files

Fixes #1433
2019-02-11 12:50:32 -08:00
Dylan Baker 5b896ed70b allow setting directory locations in a native file
This allows the person running configure (either a developer, user, or
distro maintainer) to keep a configuration of where various kinds of
files should end up.
2019-02-11 12:50:32 -08:00
Jussi Pakkanen 902aaf2ce6
Merge pull request #4626 from Ericson2314/consolidate-properties
Go through coreutils.compiler_options.{build.host.target}
2019-02-04 23:06:46 +01:00
Daniel Mensinger 69cb314718 Fix introspection test case for solaris (fixes #4866) 2019-02-04 20:25:03 +01: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
Daniel Mensinger da7b9df16c Ensure that func dicts provide the same set of functions 2019-02-01 11:49:52 +00:00
Nirbheek Chauhan 50b863032e find_library: Check arch of libraries on Darwin
macOS provides the tool `lipo` to check the archs supported by an
object (executable, static library, dylib, etc). This is especially
useful for fat archives, but it also helps with thin archives.

Without this, the linker will fail to link to the library we mistakenly
'found' like so:

ld: warning: ignoring file /path/to/libfoo.a, missing required architecture armv7 in file /path/to/libfoo.a
2019-01-31 20:36:49 +00:00
Nirbheek Chauhan c0166355ce Rewrite appleframework and extraframework dependency classes
Instead of only doing a naive filesystem search, also run the linker
so that it can tell us whether the -F path specified actually contains
the framework we're looking for.

Unfortunately, `extraframework` searching is still not 100% correct in
the case when since we want to search in either /Library/Frameworks or
in /System/Library/Frameworks but not in both. The -Z flag disables
searching in those prefixes and would in theory allow this, but then
you cannot force the linker to look in those by manually adding -F
args, so that doesn't work.
2019-02-01 00:14:09 +05:30
Daniel Mensinger 8c364952af
Added dependecy kwargs support 2019-01-31 15:57:02 +01:00
Daniel Mensinger 5655865246
Added test case 2019-01-31 15:43:04 +01:00
Daniel Mensinger 8bb942ef25
Rewriter infodump modifications 2019-01-31 15:43:04 +01:00
Daniel Mensinger 8224ecfbe6
Some fixes and assignment based target find 2019-01-31 15:43:04 +01:00
Nirbheek Chauhan 00b59c9ad6 pkg-config: Fix another case where we were throwing a traceback
Also add a test for it. In the process, also remove an overly-zealous
try..except statement that was catching *all* exceptions, not just
expected ones, which was masking programming errors.
2019-01-31 20:12:21 +05:30
Nirbheek Chauhan 4268e156a3 unit tests: darwin tests must never require pkg-config 2019-01-31 20:12:21 +05:30
Nirbheek Chauhan 3997e8762e unit tests: Fix sdl2 failure test on macOS
Also ensure that the test's no-pkg-config codepath will always be run,
even on the CI where we always have pkg-config available.

This counts as a test case for #4728
2019-01-31 20:12:21 +05:30
Nirbheek Chauhan 58852e6290 unit tests: Simplify get_fake_env()
Almost every test already uses '' for the srcdir/builddir/etc.
Make it official.
2019-01-31 20:12:21 +05:30
Nirbheek Chauhan 36779c0500 unit tests: Run native file tests on the CI
The native file tests were never run on the CI since they were skipped
on Windows and also skipped on Linux and macOS since CC/CXX/etc are
always set by the CI.

Also fix test failure on macOS. The test was assuming that because
/usr/bin/gcc and /usr/bin/clang exist on macOS, they must be different
compilers. They're not. gcc is just a wrapper around clang, and we
correctly detect it as such.
2019-01-30 23:21:59 +02:00
Michael Hirsch, Ph.D da34bea893 pep8 py37 2019-01-29 22:06:11 +02:00
Michael Hirsch, Ph.D 8636f31d9c BUGFIX: broken/missing Fortran code/unit tests 2019-01-27 20:57:21 +02:00
Jussi Pakkanen 733f9a7765
Merge pull request #4814 from mensinda/astVisitor
rewriter: Rewrote the meson rewriter - now works with AST modification
2019-01-27 20:46:29 +02:00
Christoph Reiter 8df5afc98a configure_file: preserve newlines of the input file. Fixes #4817
In some cases (see #4817) it's helpful if the output file uses the
same newlines as the input file without translating them to the
platform defaults.

open() by default recognizes all newline styles and translates them
to "\n" and then to the platform default when writing.
Passing "" to "newline" disables the translation and lets us pass through
the original newline characters.
2019-01-24 21:02:34 +02:00
Nirbheek Chauhan d02ec7111e coredata: Only reject a load if major version differs
Our builddir ABI is stable across minor (stable) releases, so there is
no need to force a wipe. We already release pretty often, no need to
force people to wipe twice as often.
2019-01-23 19:50:50 +05:30
Daniel Mensinger 4b3e21b894
Fixed test case and setup.py 2019-01-22 17:47:51 +01:00
Daniel Mensinger 6fe2c2b209
Fixed flake8 issues 2019-01-22 17:31:15 +01:00
Daniel Mensinger 027c3c9ac7
Added subdir test 2019-01-22 17:04:43 +01:00
Daniel Mensinger b7c6f3ec72
Can now rewrite files 2019-01-22 16:41:25 +01:00
Daniel Mensinger 8dd9b44831
Added support for removing sources from a target 2019-01-22 16:41:25 +01:00
Daniel Mensinger 0ce6632393
Added suport for adding sources to a target 2019-01-22 16:41:25 +01:00
Daniel Mensinger 86d5799bc4
First rewriter test case 2019-01-22 16:41:06 +01:00
Daniel Mensinger 277dc10a5d
AST post processing 2019-01-22 16:09:34 +01:00
Simon McVittie 65192af2ff run_unittests: Use Python 3.5-compatible subprocess invocation
subprocess.run() didn't get the encoding parameter until 3.6.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-01-17 23:09:17 +02:00
Daniel Mensinger af38722f89 mintro: Introspection interpreter refactoring (#4733)
* Fixed spelling

* Merged the Buildoptions and Projectinfo interpreter

* Moved detect_compilers to Environment

* Added removed test case

* Split detect_compilers and moved even more code into Environment

* Moved set_default_options to coredata

* Small code simplification in mintro.run

* Move cmd_line_options back to `environment`

We don't actually wish to persist something this unstructured, so we
shouldn't make it a field on `coredata`. It would also be data
denormalization since the information we already store in coredata
depends on the CLI args.
2019-01-16 23:42:54 +02:00
Daniel Mensinger 2bb69ad50b Renamed unit test directories 2019-01-16 19:10:47 +02:00
Xavier Claessens 66ac6f6b3d find_external_dependency: Return NotFoundDependency()
The returned not-found object can be from any type because we were
returning the first of the failed attempts. It also can happen that we
don't have any dependency object in which case we should just return
NotFoundDependency() object as well instead of raising an exception.
That exception was happening before, but dependency_impl() was
calling find_external_dependency() in a try block so it was hidden.
2019-01-16 11:16:46 -05:00
Xavier Claessens 815f1205a8 do_subproject: Improve log messages and formatting 2019-01-16 11:16:46 -05:00
Daniel Mensinger 609ecba37f mintro: Added `defined_in` key in the targets introspection 2019-01-15 20:28:12 +02:00
Daniel Mensinger 5c139032b8
Deprecated --target-files API 2019-01-07 22:35:56 +01:00
Daniel Mensinger 29dd57dcbf
Fixed flake8 2019-01-07 22:26:09 +01:00
Daniel Mensinger e67ba0fd64
Also made buildsystem files absolute 2019-01-07 22:26:09 +01:00
Daniel Mensinger a1d8c1d3e9
Changed introspection target format 2019-01-07 22:24:49 +01:00
Daniel Mensinger ab32f1fe00 Added meson-info.json 2019-01-06 22:03:29 +01:00
Daniel Mensinger bd8bad46c3
Code cleanup and renamed variables 2019-01-06 12:19:33 +01:00
Daniel Mensinger 8ac5b36c70
Fixed mac unit test 2019-01-06 12:19:32 +01:00
Daniel Mensinger 02734cc5c3
Better documentation 2019-01-06 12:19:31 +01:00
Daniel Mensinger 2e81631d0c
Keep 'filename' and 'install_filename' as strings 2019-01-06 12:19:31 +01:00
textshell 7eb8621ea6
Update run_unittests.py
Co-Authored-By: mensinda <daniel@mensinger-ka.de>
2019-01-06 12:19:30 +01:00
Daniel Mensinger 7691b0460c
Ninja backend target introspection 2019-01-06 12:19:30 +01:00
Daniel Mensinger d4ac832bf6
Split the monolithic introspection file into chunks 2019-01-06 12:19:29 +01:00
Daniel Mensinger e4e0e89ea8
Fixed mac build 2019-01-06 12:19:29 +01:00
Daniel Mensinger a9ade54707
Should fix azure 2019-01-06 12:19:29 +01:00
Daniel Mensinger c326ae2e75
Fixed flake8 2019-01-06 12:19:29 +01:00
Daniel Mensinger b11df88395
Documentation and unit test update 2019-01-06 12:19:29 +01:00
Daniel Mensinger b034f52656
Filenames are now lists 2019-01-06 12:19:29 +01:00
Daniel Mensinger b91c5aad85
Update intro dump on meson configure 2019-01-06 12:19:29 +01:00
Daniel Mensinger c4eb5c79fe
Added unit test 2019-01-06 12:19:28 +01:00
Daniel Mensinger 24d668bea0
Removed determine_installed_path since it is no longer needed 2019-01-06 12:19:28 +01:00
Daniel Mensinger 98eb7a48ab
Added unit test 2019-01-06 12:19:27 +01:00
Xavier Claessens 83964f64fa pkgconfig: Fix flag deduplication
This is a regression introduced by 2cbf7caf5, generated pkg-config files
have many duplicated '-pthread' flags.
2019-01-05 21:44:53 +02:00
John Ericson 2b22576fb6 Remove cross_info; cross file is parsed up front and discarded 2019-01-02 16:22:47 -05:00
Daniel Mensinger e5099357c2
Tests and docs 2018-12-29 23:56:21 +01:00
Jussi Pakkanen 8a6c0aa13d Better error message for rpath test. 2018-12-30 00:51:40 +02:00
Jussi Pakkanen da5da5977a Default libdir is "lib" when cross compiling. Closes #2535. 2018-12-30 00:51:19 +02:00
Jussi Pakkanen 1fca654055 Add a clang-format target. 2018-12-30 00:50:00 +02:00
Jussi Pakkanen c220816350
Merge pull request #4573 from jon-turney/msys2-clang
More clang for Windows support
2018-12-21 00:01:31 +02:00
Daniel Mensinger 6864ed60dd mintro: Bug fix for determine_installed_path for multiple target outputs 2018-12-20 23:03:55 +02:00
Dylan Baker f9a35e08ac msetup: Fix callig meson --wipe inside a build directory
This seems to be related to deleting the current working directory.
Simply deleting all of the trees inside the build directory instead
seems to fix it. This only appears with some combination of generated
targets, running the test case against say "1 trivial" doesn't show the
bug.

See this mesa bug: https://bugs.freedesktop.org/show_bug.cgi?id=109071
2018-12-20 13:30:30 -05:00
Daniel Mensinger b321c32952 Added unit test 2018-12-19 18:04:49 -05:00
Niklas Haas 261ab9b214 pkgconfig: Fix link order of library dependencies
Since `_process_libs` appends the lib's dependencies this list already,
the final return value of `_process_libs` will end up after its
dependencies, which is the wrong way around. (The lib must come first,
then its dependencies)

The easiest solution is to simply pre-pend the return value of
`_process_libs` rather than appending it, so that its dependencies come
after the library itself.

Closes #4091.
2018-12-12 10:42:32 -05:00
Jon Turney 468c4411e1
Skip test_config_tool_dep on MSYS2
llvm-config --libfiles --link-shared wants to link to a bunch of shared
libraries which don't exist, so we end up at dev.py:308, but the guess
that makes ('libLLVM*.dll') doesn't take into account the existence of
implibs (which is fixable), but even if it did 'libLLVM-7.0.dll.a'
doesn't seem to exist... so not sure how to fix this...)

Also some steps towards making that work:

Adjust helper_create_binary_wrapper for MSYS2. The .bat wrapper should
run msys2 python, not try to invoke the 'py' python launcher (which may
not be present)

Suppress echoing of the command in helper_create_binary_wrapper
(otherwise the echoed command can interfere in interpreting the output
of the wrapped command, which seems to be the case when it's
llvm-config)
2018-12-09 20:40:31 +00:00
Jon Turney aff5b3f416
Skip LTO test with Windows clang
This doesn't seem to be working in clang, at the moment.
2018-12-09 20:40:30 +00:00
Jon Turney 65160a969e
Don't rely on -fPIC being ignored where it's meaningless
clang considers it an error to try to use -fPIC for a windows target

v2:
'' isn't consistently elided, use []
2018-12-09 20:40:27 +00:00
Jussi Pakkanen 03311e6d8c Skip if a suitable D alternative is not found. 2018-12-09 19:55:18 +02:00
Jussi Pakkanen c44a5a1aec Deduplicate export-dynamic and pthread. Closes #4567. 2018-12-06 16:20:54 +02:00
John Ericson 0fd548e16f Combine `run_tests` import lines in `run_unittests` 2018-12-03 22:33:20 +02:00
Jussi Pakkanen b0611bdd9a
Merge pull request #3061 from jon-turney/introspect-custom-target-files
Fix 'meson introspect --target-files' for a custom target
2018-11-28 21:58:11 +02:00
Jussi Pakkanen 270f2395d6
Merge pull request #4191 from trilader/feature/projectinfo-from-source
mintro: Allow introspect --projectinfo without build directory
2018-11-27 22:18:13 +02:00
Daniel Mensinger 22fca7589f Fixed unit test (see #4549) 2018-11-27 19:56:40 +02:00
Daniel Schulte f954eee906 Remove name property from introspect --projectinfo as it is not used 2018-11-26 23:12:00 +01:00
Daniel Schulte 0e62193730 mintro: Allow introspect --projectinfo without build directory.
This variant was added to allow introspection before configuring a build
directory. This is useful for IDE integration to allow displaying and/or
setting options for the initial configuration of the build directory.

It also allows showing basic information about the project even if it's
not yet configured or configuring failed.

The project 'name' field in --projectinfo is used inconsistently:
For the top level project it always shows the name configured in
the top level meson.build file. For subprojects it's referring to the
name of the directory the subproject's meson.build is contained in.

To have a consistent output and preserve the existing behavior this adds
the 'descriptive_name' field which always shows the name set in the
project.

To be consistent the 'descriptive_name' field was also added to the
--projectfiles variant that uses an already configured build.

It also extends the information shown with the list of buildsystem-files.
This is currently only implemented in the variant for unconfigured
projects.
2018-11-26 23:12:00 +01:00
Daniel Mensinger 1f48aa595d
Added 'section' key to buildoptions introspection 2018-11-24 09:49:33 +01:00
Aleksey Filippov 1c8c888854 Use first 7 letters of sha256 for subdirectory part of target id
Fixed-size hash makes paths shorter and prevents doubling of path length
because of subdir usage in target id: "subdir/id" would generate
"subdir/{subdir-without-slashes}@@id" target otherwise.

Export construct_id_from_path() to aid tests.
Add a separate unit test for this function to make sure it is not broken unexpectedly.

Closes #4226.
2018-11-22 23:38:40 +02:00
Marcel Hollerbach 443a4a8c78 pkgconfig: add support for pkgconfig generation for c#
this adds support for generating pkgconfig files for c#.

The difference to c and cpp is that the -I flag is not known to the c#
compiler, but rather the -r flag which is used to link a .dll file into
the compiled library.

However this opens the question of validating which pkgconfig files can
be generated (depending on the language).

This implements 4409.
2018-11-21 21:36:39 +02: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 80f8c9930c unittests: don't override LD_LIBRARY_PATH
part of using ICC is configuring LD_LIBRARY_PATH so that you can link
with several Intel specific .so's. Currently meson blanket overrides the
LD_LIBRARARY_PATH in several tests which breaks them. Instead prepend
the test dir td LD_LIBRARY_PATH. Fixes 6 tests with ICC.
2018-11-15 18:42:25 -08:00
Dylan Baker f2d503ca34 unittests: don't run sanitizer tests for on compilers without sanitizer support
This commit adds a nice decorator helper for skipping tests when they
require the compiler to implement a specific base option, and uses it to
turn off b_sanitize tests, which fixes some tests on ICC.
2018-11-15 18:42:25 -08:00
Dylan Baker e338e9ad2f environment: detect compilers from native files 2018-11-14 15:57:37 -08:00
Dylan Baker 71a5f990d0 modules/python: Allow use of the native file
Currently this just allows setting a "python" variable that always
overrides, probably we want to have the option for "python2" and
"python3" as well.
2018-11-14 15:57:37 -08:00
Dylan Baker 091452f8cd modules/python3: allow specifying in the native file 2018-11-14 15:57:37 -08:00
Dylan Baker caf1066cd1 dependencies: Allow config tool dependencies to use native files
This allows tools like llvm-config to be selected from the config file

Fixes: #3327
2018-11-14 15:57:37 -08:00
Dylan Baker 42ddc30cfe interpreter: allow find_program to use the native file 2018-11-14 15:57:37 -08:00
Dylan Baker cb2a66cdef unittests: Add framework for testing native config files 2018-11-14 15:57:37 -08:00
Stian Selnes 0821462ce3 Add kwarg is_default to add_test_setup()
is_default may be used to set the name of the test setup that will be
used by default whenever the option --setup is not given.

Fixes #4430
2018-11-12 16:23:59 +05:30
Michael Forney 50b2ef7354 Consider 'samu' when looking for ninja command
samu prints a different message when the build is a no-op, so make
assertBuildIsNoop consider that as well.

Also, if compile_commands.json cannot be found, just skip the test. This
seems reasonable since meson just produces a warning if `ninja -t compdb`
fails.

Finally, only capture stdout in run_meson_command_tests.py, since the
backend may print messages the tests don't recognize to stderr.

Fixes #3405.
2018-11-11 00:21:47 +02:00
Xavier Claessens a173dbf772 Add reconfigure/wipe unit test 2018-11-06 16:37:50 -05:00