Commit Graph

264 Commits

Author SHA1 Message Date
Jussi Pakkanen 65f78a722a
Merge pull request #2856 from jon-turney/warning-location
Consolidate warning location formatting
2018-01-03 22:32:40 +02:00
Jussi Pakkanen ad54bc3726
Merge pull request #2838 from mesonbuild/nirbheek/consolidate-subproject-dep-checking
intrp: Consolidate subproject dep checking and logging
2018-01-02 20:35:19 +02:00
Jon Turney bcc95d7dd7 Use location formatting in mlog.warning() for invalid kwarg warning
This already reports the location (in a slightly different format), but
using mlog.warning() will make it easier if we want to change the location
format in future.
2018-01-01 13:21:01 +00:00
Jon Turney f85fde743a Wire up locations in a couple more warnings
These are the remaining warnings in the parser, where we have the location
to hand.
2018-01-01 13:21:00 +00:00
Jussi Pakkanen d4985d981f Merged init branch. 2018-01-01 02:12:13 +02:00
Jussi Pakkanen f2b33b8dcb
Merge pull request #2852 from jon-turney/warning-location
Add filename and lineno to duplicate kwargs warning
2018-01-01 02:09:45 +02:00
Jussi Pakkanen 4a189cf8c5 Add unit test that checks that the sample projects compile. 2017-12-31 23:24:29 +02:00
Nirbheek Chauhan 851475db9b intrp: Consolidate subproject dep checking and logging
If a dep is not found on the system and a fallback is specified, we
have two cases:

1. Look for the dependency in a pre-initialized subproject
2. Initialize the subproject and look for the dependency

Both these require version comparing, ensuring the fetched variable
is a dependency, and printing a success message, erroring out, etc.

Now we share the relevant code instead of duplicating it. It already
diverged, so this is a good thing.

As a side-effect, we now log fallback dependencies in the same format
as system dependencies:

    Dependency libva found: YES
    Dependency libva found: YES (cached)

    Dependency glib-2.0 from subproject subprojects/glib found: YES
    Dependency glib-2.0 from subproject subprojects/glib found: YES (cached)
2018-01-01 01:14:03 +05:30
Jussi Pakkanen dd3f49af0d
Merge pull request #2757 from xclaesse/pkgconfig
pkgconfig: Allow passing Dependency objects to library(_private)
2017-12-31 19:11:57 +02:00
Jon Turney ad5cc2ce55 Append warning location to warning output by warning() 2017-12-30 20:10:15 +00:00
Jon Turney dd1de073f4 Add a test case for location in duplicate kwarg warning 2017-12-30 20:08:35 +00:00
Nirbheek Chauhan ae0f4ef055 compilers: Fix error when objc/objc++ compilers are not found
Earlier it would exit with a traceback:

UnboundLocalError: local variable 'out' referenced before assignment
2017-12-30 18:02:28 +02:00
Jussi Pakkanen ac8d6087bf
Merge pull request #2334 from mesonbuild/promotedep
Add functionality to promote nested dependencies to top level.
2017-12-26 13:24:30 +02:00
Jussi Pakkanen 1806aac376
Merge pull request #2817 from jon-turney/master
Update prefix-dependent defaults when project(default_options:) changes prefix
2017-12-26 13:22:03 +02:00
Nirbheek Chauhan 55abe16d5a unit tests: Test that relative install_rpath works correctly
We weren't testing this with C++, so the breakage was missed.

https://github.com/mesonbuild/meson/issues/2814
2017-12-26 03:23:26 +05:30
Jon Turney 198251395a Add a test of prefix-dependent defaults for project(default_options:)
See #2811
2017-12-21 19:10:18 +00:00
Xavier Claessens 2881db7379 pkgconfig: Move pc file checks to run_unittests.py 2017-12-20 19:09:08 -05:00
Dylan Baker e245e57865 Warn on unknown command line arguments
I have a tendency to typo things. Humans in general are bad at spotting
spelling mistakes, computers are not. This patches prints the bad
options and provides the generic meson "This will be a hard error
someday" message.
2017-12-19 10:10:40 -08:00
Jussi Pakkanen 164fb9a150 Also promote wrap files. 2017-12-17 21:19:22 +02:00
Jussi Pakkanen 46c071ea5c Add functionality to promote nested dependencies to top level. 2017-12-17 21:17:13 +02:00
Dylan Baker 7cd41ee8fb Use consistent mlog formatting with the ConfigTool dependency helpers
This just adds more consistent use of mlog.bold and mlog.red/green for
ConfigTool based dependencies.
2017-12-15 14:20:16 -08:00
Nirbheek Chauhan 2c4e7ebb9b dependencies: Don't use NotImplementedError for invalid methods
Using NotImplementedError throws an ugly traceback to the user which
does not print the line number and other information making it
impossible to figure out what's causing it.

Also override it for internal dependencies because self.name is "null"
for them.
2017-12-09 22:05:05 +02:00
Eric Engestrom 3d63f21b60 Fix `array` type name
c9351ce30c introduced the type as `array`,
so mintro should expose it under the same name.

(while at it, rename test 169 to be coherent)
2017-12-07 21:31:50 +02:00
Jussi Pakkanen c2d23dd678 Add C++17 flags to GCC and Clang. 2017-12-06 23:59:56 +02:00
Jussi Pakkanen de99b9d5b9 Silence git stdout messages. 2017-12-06 16:14:51 +02:00
Jussi Pakkanen 018deb48fe
Merge pull request #2663 from inigomartinez/pkg-config-define-variable
dependencies: Allow pkg-config to define variables
2017-12-03 22:53:44 +02:00
Jussi Pakkanen cf76ffad14
Merge pull request #2703 from mesonbuild/msvc-library-search-fixes
Various MSVC library search fixes
2017-12-03 22:48:56 +02:00
Jussi Pakkanen 2cf1e8da15 Merged array option branch. 2017-12-03 22:35:44 +02:00
Jussi Pakkanen f8a419b27d String arguments can permit arbitrary string values
by leaving out the choices keyword.
2017-12-03 22:27:55 +02:00
Nirbheek Chauhan bccb7a8eb8 unit tests: Skip coverage properly with clang 2017-12-03 20:20:31 +05:30
Nirbheek Chauhan 4e637a6910 unit tests: Fix test_compiler_detection on MinGW
The compiler is x86_64-foo-bar-gcc/g++, so also check for that.
2017-12-03 10:06:11 +05:30
Nirbheek Chauhan d932cd9fb4 tests: Fix static library linking on MSYS2-MinGW
The .a library was being built with `ar` which is not the right
static archiver, it's supposed to be something like
x86_64-w64-mingw32-ar or whatever the target-triple is.

Try using the built-in static linker detection instead of doing it
manually.
2017-12-03 10:06:11 +05:30
Nirbheek Chauhan b2feae9833 unit tests: Remove all instances of FakeEnvironment
We don't need to use that, and it causes build failures when code
actually uses the environment.
2017-12-03 10:06:11 +05:30
Jussi Pakkanen 554b484468
Merge pull request #2618 from mesonbuild/osxlinkerfixes
Fix many things have have been slightly broken in OSX
2017-12-03 02:25:44 +02:00
Jussi Pakkanen 793fc002fa
Merge pull request #2390 from dcbaker/submit/options-list
Add an array type to user options
2017-12-02 19:54:27 +02:00
Iñigo Martínez 44dd429ee5 dependencies: Fix pkg-config variable definition
In a previous commit variable definition was added in pkg-config.
However, this commit was not complete.

This fixes the missing parts of that commit.
2017-12-01 13:49:01 +01:00
Dylan Baker 6f25e93b52 cross: Implement support for loading cross files from system paths
One thing that makes cross compiling with meson a pain is the need for
cross files. The problem is not with cross files themselves (they're
actually rather brilliant in that they allow for a much greater deal of
flexibility than autotools hardcoded paths approach) but that each user
needs to reimplement them themselves, when for most people what they
really want is a cross file that could be provided by their distro, all
they really want is the correct toolchain.

This patch is the first stop to making it easier for distros to ship
their own cross files (and for users to put their's somewhere safe so
they don't get `git clean`ed. It allows the cross files (on Linux and
*BSD) to be stored in home and system paths (~/.config/meson/cross,
/usr/share/meson/cross, and /usr/local/share/meson/cross), and to be
loaded by simply by specificying --cross-file.

With this patch meson will check the locations its always checked first,
(is cross file absolute, or is it relative to $PWD), then will check
~/.config/meson/cross, /usr/local/share/meson/cross,
/usr/share/meson/cross, (or $XDG_CONFIG_PATH and $XDG_DATA_DIRS) for the
files, raising an exception if it cannot find the specified cross file.

Fixes #2283
2017-11-30 22:34:27 +02:00
Dylan Baker c9351ce30c Add new array type option
This exposes the already existing UserStringArrayOption class through
the meson_options.txt. The intention is to provide a way for projects to
take list/array type arguments and validate that all of the elements in
that array are valid without using complex looping constructrs.
2017-11-29 14:14:41 -08:00
Dylan Baker 7c779a76df run_unittests.py: remove newline at top of file
So that the shbang is ther rist line and ./run_unittests.py works.
2017-11-29 14:13:26 -08:00
Jussi Pakkanen 746e70c0da
Merge pull request #2512 from dcbaker/wip/config-tool-variables
Add method to get values from config tool based dependency
2017-11-28 22:01:00 +02:00
Jussi Pakkanen fdca526c23 Fix rpath tests on Linux. 2017-11-26 19:07:31 +02:00
Josh Soref 49f8d28ef5 spelling: overridden 2017-11-26 05:55:40 +00:00
Dylan Baker 061cf99cd6 Make WxDependency a ConfigToolDependency 2017-11-23 19:54:48 -08:00
Jussi Pakkanen 105ea1e597 Make the full test suite runnable with an external command. 2017-11-20 23:14:45 +02:00
Jussi Pakkanen 5d51bc79c7 Replaced sys.executable use with the mesonlib equivalent. 2017-11-20 23:08:17 +02:00
Jussi Pakkanen b3dfb80c15 Tests can be run with an external Meson command. 2017-11-20 23:08:17 +02:00
Jussi Pakkanen e51da1a34d
Merge pull request #2611 from mesonbuild/nirbheek/pkgconfig-msvc-static
Several fixes to pkg-config dependencies and the pkg-config module (try 3)
2017-11-15 22:51:34 +02:00
Jon Turney c4069a95c2 unit tests: Teach detect_prebuild_env about Cygwin
This is enough to fix things.

Note that build_shared_lib doesn't use the implib name for mingw or cygwin
gcc, only msvc, so I'm not quite sure how this is working, I guess we are
using the gcc facility to link directly with a dll...
2017-11-14 02:56:59 +05:30
Nirbheek Chauhan d32c672990 unit tests: Attempt to fix failure on Cygwin
This was always broken, but was missed because we ran MSVC on Cygwin
instead.
2017-11-11 23:06:49 +05:30
Nirbheek Chauhan e0b56942a0 unit tests: Properly skip if pkg-config wasn't found 2017-11-11 23:06:49 +05:30
Nirbheek Chauhan 4fb978e1f7 pkgconfig module: Escape all paths while generating
Without this, we produce unusable pkg-config files when
prefix/libdir/etc contain spaces, which is very common on Windows.
2017-11-11 23:06:49 +05:30
Nirbheek Chauhan 4405a1297b dependencies: Add a test for static libs with pkg-config
Demonstrates that pkg-config does not prefer static libs over shared
libs even if we use the `static: true` kwarg.
2017-11-11 22:39:58 +05:30
Jon Turney 3e0069f65e Add unittest of prefix dependent default directories
Also, make BasePlatformTests.tearDown() tolerate wipe() already having been
called, rather than AllPlatformTests.test_prefix_dependent_defaults() having
to avoid wipe() on the final iteration.
2017-10-28 23:28:52 +01:00
Jussi Pakkanen 9483875798 Merge pull request #2397 from mesonbuild/prebuilt
Better support for prebuilt shared libs
2017-10-02 19:09:08 +03:00
Nirbheek Chauhan bb0e18b738 Use listify and extract_as_list everywhere
They now flatten by default and unhold objects if required

Includes unit tests.
2017-10-01 22:27:48 +05:30
Jussi Pakkanen 4e42861467 Fix tests on OSX. 2017-10-01 01:59:09 +03:00
Jussi Pakkanen cb64a3f07a Fix MSVC builds. 2017-10-01 01:11:02 +03:00
Jussi Pakkanen a655b64989 Add an rpath entry to shared libraries that are linked from the source tree. 2017-09-30 18:21:02 +03:00
Jussi Pakkanen ac79eebc2f Moved prebuilt static library under unit tests. 2017-09-30 16:34:30 +03:00
Jussi Pakkanen b9c4fc728c Moved prebuilt object test under unittests. 2017-09-30 16:08:41 +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
Hristo Venev f2fc32069b Add test for get_option(b_xxx) on reconfigure. 2017-09-15 18:24:26 +01:00
Nirbheek Chauhan db199b06e6 Add a test for the custom target incdirs change
https://github.com/mesonbuild/meson/pull/2291
2017-09-11 14:50:35 +05:30
Jussi Pakkanen 9361666bd8 Merge pull request #2236 from trhd/env
Fix a stack trace caused by environment variables in test setups.
2017-09-06 23:13:55 +03:00
Jussi Pakkanen 72a6683c6f Permit overriding find_program from the cross file. 2017-09-04 22:47:12 +03:00
Hemmo Nieminen 64950bd318 Add a regression test for test suites.
Ensure test setup environment variables can from now on be given also as
strings.
2017-09-01 01:47:41 +03:00
Jussi Pakkanen a1326581a5 Fix coverage target breakage and add a test for it. 2017-08-20 20:32:30 +03:00
Jussi Pakkanen e02f1dc809 Remove PHONY because Windows and OSX file systems are crap. Closes #2199. 2017-08-20 18:10:34 +03:00
Nirbheek Chauhan 0c518a8077 Add a test for dirs with reserved target names
And for dirs with the same name as run_target()s

Reproduces https://github.com/mesonbuild/meson/issues/1644
2017-08-15 00:01:33 +05:30
Nirbheek Chauhan cae5caa7f1 run_unittests: Add a helper for asserting path existence
It is useful to have a message displayed if the assert is fired.
2017-08-15 00:01:33 +05:30
Jussi Pakkanen 5c8328d27f Use "meson test" in test invocations so it will not print the deprecation warning. 2017-08-14 15:54:57 +03:00
Nirbheek Chauhan 192d0dd0a7 unit tests: Select test cases inside run_unittests.py
This allows people to directly run ./run_unittests.py without having
to worry about selecting the right test cases for the platform they
are on.
2017-08-13 21:16:22 +03:00
Jussi Pakkanen 59a35c4c53 Print deprecation warnings on old style commands. 2017-08-02 22:01:13 +03:00
Gabríel Arthúr Pétursson 3ddf9bf6dd Ensure same compiler flags are used for compiling PCH as normal sources
Precompiled headers should generally be compiled with the same flags as
the sources that will include the header. Some deviations are safe,
however, most will cause the compiler to reject the precompiled header
or possibly lead to compiler crashes.
2017-07-24 00:11:27 +03: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
Martin Ejdestig 4c8c83c967 Add a mesonintrospect --dependencies test 2017-07-20 12:44:28 +02:00
Nirbheek Chauhan a27b4c4640 unittests: Don't pass /nologo to `cl` during detection
This causes it to not output the version information to stderr, which
we need to extract the version and the architecture.

Found by Jussi.
2017-07-17 19:20:00 +03:00
Nirbheek Chauhan 37057abfef unittests: Check value of cc.is_64 with MSVC 2017-07-17 19:20:00 +03:00
Nirbheek Chauhan 5660c766ab unittests: Ensure that the compiler version is not blank 2017-07-17 19:20:00 +03:00
Alistair Thomas 117f4ab8b5 Split out languages from compilers.py 2017-06-23 00:42:41 +01:00
Alistair Thomas e5559903b3 Split linkers out from compilers.py 2017-06-22 20:09:58 +01:00
Jussi Pakkanen 624709bfc1 Merge pull request #1920 from QuLogic/hg-dist
Add Mercurial dist support
2017-06-21 04:48:29 -04:00
Jussi Pakkanen c3591e5303 Handle both pkg-config and pkgconf argument order. Closes #1934. 2017-06-18 23:46:37 +03:00
Jussi Pakkanen 3bc7651907 Merge pull request #1951 from mesonbuild/dedupfix
Preserve standalone -D arguments
2017-06-18 03:49:48 +03:00
Jussi Pakkanen 1c34707aee Preserve standalone -D arguments always. 2017-06-18 00:16:45 +03:00
Jussi Pakkanen 85a263a670 Failing test for -D dedupping. 2017-06-17 13:29:13 +03:00
Jussi Pakkanen f1996f7291 Use the Windows proof dir deleter consistently. 2017-06-17 12:33:49 +03:00
Elliott Sales de Andrade eff273aa43 Add test for Mercurial dist'ing. 2017-06-13 00:32:44 -04:00
Nirbheek Chauhan 1865425b4b tests/unit/8: Rename to 9 and add -l flags 2017-06-12 22:39:33 +05:30
Jussi Pakkanen 8244f4c6a6 Created unit test to ensure linker arguments from consecutive dependencies are kept in order. 2017-06-12 22:26:10 +05:30
Nirbheek Chauhan d23e6b34c7 Preserve -L -l pairings fetched from external deps
While adding link args for external deps, sometimes different
libraries come from different prefixes, and an older version of the
same library might be present in other prefixes and we don't want to
accidentally pick that up.

For example:

/usr/local/lib/libglib-2.0.so
/usr/local/lib/pkgconfig/glib-2.0.pc
/usr/local/lib/libz.so
/usr/local/lib/pkgconfig/zlib.pc
/home/mesonuser/.local/lib/libglib-2.0.so
/home/mesonuser/.local/lib/pkgconfig/glib-2.0.pc

PKG_CONFIG_PATH="/home/mesonuser/.local/lib/pkgconfig/:/usr/local/lib/pkgconfig/"

If a target uses `dependencies : [glib_dep, zlib_dep]`, it will end up
using /usr/local/lib/libglib-2.0.so instead of
/home/mesonuser/.local/lib/libglib-2.0.so despite using the pkg-config
file in /home/mesonuser/.local/lib/pkgconfig because we reorder the -L
flag and separate it from the -l flag.

With this change, external link arguments will be added to the
compiler list without de-dup or reordering.

Closes https://github.com/mesonbuild/meson/issues/1718
2017-06-12 20:55:19 +05:30
Nirbheek Chauhan 9308a6d923 tests: Add Boost unit tests and project tests on Windows
Boost tests are disabled on Windows for now because the detection
is actually completely broken. Once that's fixed (after the release)
we can enable it again.
2017-06-10 18:55:50 +05:30
Nirbheek Chauhan c1e9c757eb tests: Increase dependencies coverage a bit more 2017-06-10 00:20:03 +05:30
Nirbheek Chauhan 38716f0fcb tests: Improve llvm dependency test coverage 2017-06-09 20:21:01 +05:30
Nirbheek Chauhan 3a33a8ef49 unit tests: Add class to generate failing tests
It is not feasible to test all failure modes by creating projects in
`test cases/failing` that would be an explosion of files, and that
mechanism is too coarse anyway. We have no way to ensure that the
expected error is being raised.

See FailureTests.test_dependency for an example.
2017-06-09 20:21:01 +05:30
Jussi Pakkanen de1305c9e8 Do not use context managers. Because Windows. 2017-06-08 16:17:20 +03:00
Jussi Pakkanen 7c03bfb463 Merged needs_exe_wrapper branch. 2017-06-07 20:09:43 +03:00
Nirbheek Chauhan 198c2f2d55 unit tests: Skip tests if no readelf found 2017-06-05 13:20:04 +05:30
Nirbheek Chauhan 41f8f1a53b unit tests: Also check RUNPATH when fetching RPATH 2017-06-05 03:09:17 +05:30