Commit Graph

411 Commits

Author SHA1 Message Date
Jon Turney e7bed74ae2
Fix a bug in test_compiler_detection
AR wasn't reset in the environment, so this test could fail if more than one
language compiler was specified in the environment and the linker wasn't
'ar'
2018-11-04 15:42:06 +00:00
Jon Turney c789efb8c8
Use lld-link with clang-cl
Use lld-link dynamic linker with clang-cl
Don't hardcode dynamic linker name in tests
2018-11-04 15:42:06 +00:00
Jon Turney bb0bbfc2ab
Adjust more tests which need to know compiler type 2018-11-04 15:42:06 +00:00
Jon Turney d35034b21b
Use 'rc' resource compiler with clang-cl toolchain
The LLVM toolchain doesn't come with a Windows resource compiler at
the moment. Use 'rc' from the Windows SDK.
2018-11-04 15:42:06 +00:00
Jon Turney 198e869162
Make use of get_argument_syntax() in test cases 2018-11-04 15:42:06 +00:00
Jon Turney 152ea1a91a
Teach unit test test_compiler_detection about clang-cl
v2:
Update for ClangClCcompiler class
v3:
Reorder compilers to simplify
2018-11-04 15:42:06 +00: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
Jussi Pakkanen c4a9f59dc4 Move VS C++17 test to a unit test since it requires env setup. 2018-10-24 17:19:36 +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
David Seifert 87d85c7fcb Add macOS test for duplicate `-delete_rpath` handling
* Without commit 3a8911a07f
  the newly added test `test_duplicate_rpath` in
  `DarwinTests` would fail.

  Example:
    https://travis-ci.org/mesonbuild/meson/jobs/441412556
2018-10-15 00:17:49 -07:00
Jussi Pakkanen 252bf6c52e
Merge pull request #4340 from jon-turney/azure-pipelines
Add Azure pipelines CI
2018-10-14 23:16:46 +03:00
Jon Turney 459b81de46
Use 'CI' environment variable to detect CI environment
Use the 'CI' environment variable to detect CI environment, rather than a
collection of CI-specific ones.
2018-10-14 16:01:36 +01:00
gsobala 0ea626b89d Added .so to list possible darwin dynamic library suffixes (#4364)
Occasionally Darwin libraries can be .so rather than .dylib e.g. tensorflow_cc.so
tensorflow_cc is a c++ API for Tensorflow (https://github.com/FloopCZ/tensorflow_cc)
which was primarily written for Linux but is also compilable on Darwin. Possibly
through laziness, possibly just to have consistent filenames, the developers did not
opt to change the suffix from the Linux default when this is compiled on Darwin.

Also, the Darwin linker will find libraries with a .so suffix if they are
in its path. find_library() needs to match the linker behaviour.
2018-10-13 07:00:06 -07:00
Niklas Claesson 4ef4edee2f tests runners: Refactor out global variables and add argparse 2018-10-10 21:19:06 +02:00
Christoph Behle c0236e10f3 Substitute output file then check for conflict.
Fixes Issue #4323.
The check to see if a call to configure_file() overwrites the output of
a preceding call should perform the substitution for the output file
before doing the check.

Added tests to ensure the proper behaviour.
2018-10-07 19:06:01 +03:00
Dylan Baker 6cf7d2492b compilers/c: don't return -pthread for MacOS with any compiler
With GCC, Clang, or ICC, and for C++

Fixes #2628
2018-10-01 12:34:46 -07:00
Jussi Pakkanen 8d77da839e Use only basename part in test. Closes #4237. 2018-09-22 20:19:01 +03:00
Jan Niklas Hasse d0648ee077 Also check wx-config-gtk3 when looking for wxWidgets
On Arch Linux the wxgtk3 package doesn't provide wx-config.
2018-09-17 21:43:50 +03:00
Alexis Jeandet 32111746ba Fix broken unit test qt5dependency_pkgconfig_detection
-It tests both Qt4 and Qt5 detection -> qtdependency_pkgconfig_detection

-It doesn't need to skip test if Qt4 isn't found and if Qt5 isn't, the
meson.build file already skips the test.

-The regex was outdated and since skipped because of Qt4 it is silently
broken for a long time.

Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>
2018-09-17 21:27:49 +03:00
David Seifert 8f16d0f3c9 Fix ICC on macOS 2018-09-16 18:27:19 +03:00
David Seifert 2b9fb36267 Fix GCC on macOS
* `common/40 has function` still fails due
  to alloca being a GCC builtin.
2018-09-16 18:27:19 +03:00
David Seifert 69ec001b06 Use enum instead of `int` for compiler variants
* Enums are strongly typed and make the whole
  `gcc_type`/`clang_type`/`icc_type` distinction
  redundant.
* Enums also allow extending via member functions,
  which makes the code more generalisable.
2018-09-16 00:47:32 +03:00
Jon Turney 73b47e0025 Fix incorrect feature check warning
Fix the special handling of '>=0.nn' constraints in project(meson_version:)
for feature checks when the constraint version contains spaces
2018-09-16 00:46:50 +03:00
Jussi Pakkanen f2041405fb
Merge pull request #4017 from jon-turney/version-comparison-rewrite
Use rpmvercmp version comparison
2018-09-13 22:19:35 +03:00
Jon Turney 1394cb9263 Correct version_compare_condition_with_min()
Correct version_compare_condition_with_min() for the case where no minimum
version is established by the version constraint.  Add a simple test.

Also fix test_feature_check_usage_subprojects by escaping regex
metacharacters.

if |condition| is '<', '<=' or '!=', the minimum version satisfying the
condition is 0, so the minimum version for a feature is never met.

if |condition| is '>=' or '==', the minimum version satisfying the condition
is the version compared with, so the minimum version for a feature must be
less than or equal to that.

if |condition| is '>', the minimum version satisfying the condition is
greater than the version compared with, so the minimum version for a feature
must be less than that

(it's this last condition that makes this function necessary, as in all
other cases we could establish a definite minimum version which we could
compare to see if it's less than or equal to the current version)
2018-09-12 15:38:00 +01:00
Jon Turney 8d3881a042 Add more tests of version comparison 2018-09-12 15:38:00 +01:00
Jon Turney da2c4ad3a8 Use the exact current version in obtainMesonOutput
Currently this trims '0.48.0.dev1' to '0.48.0', and then requires exactly
that version in the generated meson.build for the test.

Just use the exact version.

Also only use a 'project(meson_version:)' constraint in the generated
project if a version is specified

Also remove unused grab_leading_numbers
2018-09-12 15:37:52 +01: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
Jon Turney 1768b09a12 Improve formatting of dependency details
Also use a more consistent format for qmake details, and adjust a test case
which relies on the specific output
2018-09-10 21:02:18 +03:00
Jon Turney 9a02340afd
Add test case for version_compare_many 2018-09-10 14:27:19 +01:00
Jussi Pakkanen 68f669bd2b Condense test dirs. 2018-09-06 19:09:35 +03:00
Rafael Ávila de Espíndola 07d2d88fa9 Allow override_find_program to use an executable.
With this it is now possible to do

foobar = executable('foobar', ...)
meson.override_find_program('foobar', foobar)

Which is convenient for a project like protobuf which produces both a
dependency and a tool. If protobuf is updated to use
override_find_program, it can be used as

protobuf_dep = dependency('protobuf', version : '>=3.3.1',
                          fallback : ['protobuf', 'protobuf_dep'])
protoc_prog = find_program('protoc')
2018-09-03 21:24:01 +03:00
Mathieu Duponchelle b2f92ea689 gnome: fix generate_gir when linking with libasan
The regression was introduced in my recent refactoring of
that method (8377ea4).

This commit simply restores the ordering of the generated
scan_command, ensuring `-lasan` and other internal linker
flags come before `--library` or `--program`
2018-08-31 08:09:28 -07:00
Nirbheek Chauhan bead8287a5 Improve support for macOS dylib versioning
We now use the soversion to set compatibility_version and
current_version by default. This is the only sane thing we can do by
default because of the restrictions on the values that can be used for
compatibility and current version.

Users can override this value with the `darwin_versions:` kwarg, which
can be a single value or a two-element list of values. The first one
is the compatibility version and the second is the current version.

Fixes https://github.com/mesonbuild/meson/issues/3555
Fixes https://github.com/mesonbuild/meson/issues/1451
2018-08-29 15:51:23 -07:00
Nirbheek Chauhan 8dd2e42de3 CompilerArgs: -Wl,-lfoo is also a valid way to pass a library
Treat it the same as -lfoo by deduping and adding to --start/end-group

Reported at https://gitlab.gnome.org/GNOME/glib/issues/1496

We don't do any advanced transformation for MSVC or de-dup because
this is a very rare syntax.
2018-08-28 19:10:30 +03:00
Jussi Pakkanen fb770e1e3d Add support for custom dist scripts. 2018-08-27 23:35:29 +03:00
Thibault Saunier 731906504e Add a `required` argument to `subproject`
Allowing to use the new "feature" option type and allowing not to fail
on subproject if it is not necessary to fail.

By default subprojects are "required" so previous behaviour is not
changed.

Fixes #3880
2018-08-27 21:37:18 +03:00
Nirbheek Chauhan 79aec5f342 CompilerArgs: Allow calling to_native() multiple times
Add a keyword argument to to_native() to operate on a copy so that we
can call it multiple times instead of modifying the original compiler
args while iterating.

This is used in the unit test, and might be used in Meson at some
point too.
2018-08-23 19:16:02 -07:00
Jussi Pakkanen 54aed1a92c Added "native" kwarg to add_XXX_args. Closes #3669. 2018-08-22 23:22:48 +03:00
Nirbheek Chauhan 5e93393cd9 Test that system shlibs with undefined symbols can be found 2018-08-22 12:24:43 -07:00
Nirbheek Chauhan 05b54b4767 PkgConfigDependency: Parse library paths in a separate step
pkg-config and pkgconf treat additional search paths in
PKG_CONFIG_PATH and PKG_CONFIG_LIBDIR differently when
PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 is set.

pkg-config always outputs -L flags for the additional paths first, and
pkgconf always outputs -L flags for the default paths first.

To account for this inconsistency, we now sort the library paths into
two separate sets: system (default) and prefix (additional) paths. We
can do this because we always query pkg-config twice: once with
PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 set and once without it.

Then, we ensure that the prefix paths are searched before the system
paths.

Closes https://github.com/mesonbuild/meson/issues/4023
Closes https://github.com/mesonbuild/meson/issues/3951
2018-08-21 13:22:29 -07:00
Nirbheek Chauhan 38648bbb9f Fix various small test failures on macOS
These weren't caught by the CI because we have pkg-config on it, and
these were testing non-pkg-config codepaths. The unity build on macOS
now doesn't have pkg-config to ensure that the codepath is tested.
2018-08-19 16:03:22 -07:00
Jussi Pakkanen 972535a6ac Condense test dirs. 2018-08-19 12:39:46 +03:00
Jussi Pakkanen 15243e0acc
Merge pull request #4030 from 3v1n0/broken-symlink-install-with-mode-fix
Fix broken symlinks install when using install_umask or install_mode
2018-08-18 23:39:06 +03:00
Jussi Pakkanen d83f77109a
Convert buildtype to optimization and debug options (#3489) 2018-08-18 20:39:47 +03:00
Marco Trevisan (Treviño) 9f87d5d955 unittests: test_install_subdir_symlinks_with_default_umask
Add test to verify the installation of broken symlinks when a default_umask
is set.

Reusing the same code of other test, thus sharing the actual test code
in a single function.
2018-08-17 16:41:09 +02:00
Daniel Pirch 6ecd31af19 wraptool: fix manual selection of wrap file to promote
Fixed manually promoting wrap files with a full path, e.g.
`meson wrap promote subprojects/s1/subprojects/projname.wrap`,
which resulted in an error before (new test added:
`./run_unittests.py AllPlatformTests.test_subproject_promotion_wrap`).

Additionally, running promote with an invalid subproject path now fails
properly. Before, it just silently did nothing (added to test:
`./run_unittests.py AllPlatformTests.test_subproject_promotion`).
2018-08-17 00:33:38 +03:00
Nirbheek Chauhan d03cf04598 install_subdir: Also copy dangling symlinks
Fixes https://github.com/mesonbuild/meson/issues/3914
2018-08-15 04:57:23 -07:00
Jussi Pakkanen d742e2e891
Merge pull request #4001 from mikezackles/cpp2a
Add support for c++2a and gnu++2a (closes #3997)
2018-08-11 21:25:51 +03:00
Nirbheek Chauhan ecede89b5d Fix FeatureNew false positive in vcs_tag
Fixes https://github.com/mesonbuild/meson/issues/3904
2018-08-11 09:15:05 -07:00