Commit Graph

973 Commits

Author SHA1 Message Date
Dylan Baker fdde948ca1 environment: don't load project options from a native file in a cross build 2021-04-06 16:09:13 -07:00
Jussi Pakkanen 7ec9e81e6f
Merge pull request #8606 from dcbaker/submit/fix-for-build-env-variables
Fix _FOR_BUILD env variables
2021-04-03 20:42:21 +03:00
Xavier Claessens 558a7bc6ff interpreter: Move to its own folder and split it 2021-04-01 14:26:33 -04:00
Dylan Baker d569d0bb3c tests: Add a test for the _FOR_BUILD env vars 2021-04-01 09:54:43 -07:00
Dylan Baker 848cacc38c unittests: extend machine file override tests for CFLAGS (and friends)
They behave slightly differently than other env vars, so have a test for
them as well.
2021-04-01 09:22:11 -07:00
Dylan Baker 2cd0723c42 Split environment variable and command line cflags
They are supposed to have different behavior. The environment variables
apply to both the compiler and linker when the compiler acts as a
linker, but the command line ones do not.

Fixes #8345
2021-03-30 18:52:17 +03:00
Jussi Pakkanen e80ff985fb Do not add custom target dir automatically when implicit false. 2021-03-29 18:57:34 +03:00
Xavier Claessens 47633330da pkgconfig: Allow setting prefix in dataonly pc file
Some variables are reserved because meson set them automatically. But we
are not setting them for dataonly pc files, so there is no reason to
reserve them.

Fixes: #8583.
2021-03-26 23:41:03 +02:00
Jussi Pakkanen 54767ab482
Merge pull request #8568 from dcbaker/submit/qt-dependency-factory
QT: use a proper dependency factory
2021-03-24 22:52:15 +02:00
Dylan Baker c211fea513 Refactor Qt Dependency into proper split classes with factories
Currently the Qt Dependencies still use the old "combined" method for
dependencies with multiple ways to be found. This is problematic as it
means that `get_variable()` and friends don't work, as the dependency
can't implement any of those methods. The correct solution is to make
use of multiple Dependency instances, and a factory to tie them
together. This does that.

To handle QMake, I've leveraged the existing config-tool mechanism,
which allows us to save a good deal of code, and use well tested code
instead of rolling more of our own code.

The one thing this doesn't do, but we probably should, is expose the
macOS ExtraFrameworks directly, instead of forcing them to be found
through QMake. That is a problem for another series, and someone who
cares more about macOS than I do.
2021-03-23 15:28:08 -07:00
Xavier Claessens 1be13710ad
environment(): Allow stacking append() and prepend() (#8547)
* environment(): Allow stacking append() and prepend()

* Update docs/markdown/Reference-manual.md

Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>

Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
2021-03-23 17:48:17 +02:00
Xavier Claessens b33e7bca73 mlog: Add a space after 'subproject|' 2021-03-22 21:29:14 -04: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
Eli Schwartz f7b0238ed6
add test case for installed targets uninstalling a single directory 2021-03-18 21:50:38 -04:00
Xavier Claessens 3990754bf5 Allow add_dist_script() in subprojects
Fixes: #8440.
2021-03-18 08:41:21 -04:00
Xavier Claessens 0638e38bfc clangformat: Add clang-format-check target 2021-03-16 21:01:54 -04:00
Xavier Claessens f558689277 clangformat: Add include and ignore files 2021-03-16 21:01:54 -04:00
Jussi Pakkanen ecd8c7e4af Update VS module version check. 2021-03-16 21:06:51 +02:00
Jussi Pakkanen 3ac3e125e4 Delete leftover files from some tests. 2021-03-16 16:37:02 +02:00
Paolo Bonzini 5cd7f5f8c5 msetup: do not print bogus "Option ... is:" messages
get_non_matching_default_options is checking a string from
project_default_options against a validated value from
coredata.options.

Passing the string to validate_value ensures that the comparison
is sound; otherwise, "false" might be compared against False
and a bogus difference is printed.
2021-03-16 09:35:48 -04:00
Xavier Claessens 598e968993 Add `meson devenv` command and meson.add_devenv() 2021-03-16 09:00:50 -04:00
Jussi Pakkanen be86199221 Fix run_targets running scripts from different subdirs. 2021-03-14 13:17:19 +02:00
Tristan Partin 8801381563 Fix duplicate pkg_config_path entries
Previously builds would *potentially* get sammed with messaging at
configure time that duplicate entries in an array would be an error in
the future, and the cause was because the same entries were getting
added over and over to pkg_config_path.p
2021-03-12 12:32:41 -05: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
Eli Schwartz 76df995ba6
raw string literals are next to godliness
Invalid escape sequences are deprecated and will be removed from a
future version of python. Use r"" to define them so they remain
readable.
2021-03-04 17:09:00 -05:00
Paolo Bonzini be0a05e777 mintro: include the correct target filenames for flat layout
Fixes: #8408
2021-03-04 17:36:41 +01:00
Paolo Bonzini 0c663d056a mtest: create separate runners for multiple repeats
Reusing the runners for multiple repeats of the test run gets in the
way of the progress report, which stores runners in an OrderedSet.
Instead, create a separate SingleTestRunner object for each repeat.

While at it, fix the "duplicate suite" assertion as it can fire
with TAP tests and --repeat=N.

Fixes: #8405
2021-03-02 00:57:57 +02:00
Dylan Baker e079553959 interpreter: correctly track whether a subproject is initialized
The way the tracking is currently done it works if no new subprojects
are added to a configured build directory. For cases where we want to
add a new subproject, it fails because we don't initialize builtins for
that subproject. This corrects that by checking to see if the subproject
already exists, and if it doesn't initializes the bultins for it.

Fixes: #8421
2021-02-26 09:05:30 -08:00
Stephen Gregoratto ec5fe58e6d Allow printing UserOptions in the summary 2021-02-26 10:28:00 -05:00
Xavier Claessens cef5cab23c Support multiple args in error()
Seems it got forgotten when that was added to warnings() and message().

Fixes: #8414.
2021-02-25 22:58:45 +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
Dylan Baker b03039ec9d allow build.b_* options
These continue to be ignored as they always have, but no longer raise an
error.

Fixes: #8354
2021-02-18 10:57:20 -08:00
Jussi Pakkanen add502c648 Disable failing Cygwin GIR test. 2021-02-18 02:14:07 +02:00
Xavier Claessens a5b33db558 ci: Fix failure in unit tests with vs backend 2021-02-17 22:59:54 +02:00
Paolo Bonzini 92134bac8d unittests: expect mtest logs to be utf-8 2021-02-17 21:14:05 +02:00
Dylan Baker 6c1467db27 compilers: Only insert -flto-jobs in clang's link arguments
Clang has a hand `-Wunused-command-line-argument` switch, which when
turned to an error, gets very grump about `-flto-jobs=0` being set in
the compiler arguments (although `-flto=` belongs there). We'll refactor
a bit to put that only in the link arguments.

GCC doesn't have this probably because, a) it doesn't have an equivalent
warning, and b) it uses `-flto=<$numthreads.

Fixes: #8347
2021-02-17 18:06:52 +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
Dylan Baker 10d94a12b8 Environment: Fix passing envrionment variables CPPFLAGS and CFLAGS
Or other language flags that use CPPFLAGS (like CXXFLAGS). The problem
here is actually rather simple, `dict.setdefault()` doesn't work like I
thought it did, I thought it created a weak entry, but it actually is
equivalent to:
```python
if k not in dict:
    dict[k] = v
```
Instead we'll use an intermediate dictionary (a default dictionary
actually, since that makes things a little cleaner) and then add the
keys from that dict to self.options as applicable.

Test case written by Jussi, Fix by Dylan

Co-authored-by: Jussi Pakkanen
Fixes: #8361
Fixes: #8345
2021-02-17 14:46:15 +02:00
Olexa Bilaniuk 3410465178 Small patch to unittests to initialize CUDA compiler correctly.
Suggested by Dylan Baker.
2021-02-16 17:01:24 -05:00
Paolo Bonzini 3506d8daf2 mtest: TestSetup can have [] as an exe_wrapper
Fix "meson test --wrapper foo --setup bar", it should work just fine
if the setup does not define a wrapper.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-02-09 18:51:05 +01:00
Jussi Pakkanen d2c39e83ba Condense test directory names in preparation for rc1. 2021-02-09 00:30:20 +02:00
Jussi Pakkanen 71784e1002 Fix exe wrapper detection for run targets. 2021-02-08 23:19:41 +02:00
Luca Weiss 398df56298 Add Qt6 module 2021-02-07 22:43:00 +02:00
Peter Hutterer 3f8585676b Make installing non-existing subdirs a supported feature
install_subdir() with a non-existing subdir creates the directory in the
target directory. This seems like an implementation detail but is quite useful
to create new directories for e.g. configuration or plugins in the installed
locations.

git bisect says this started with 8fe8161014.
Let's add a test for it and document it to make this behavior official.

Limitation: it can only create at the install_dir location, trying to create
nested subdirectories does not work and indeed creates the wrong directory
structure. That is a bug that should be fixed separately:

        install_subdir('blah',
                        install_dir: get_option('prefix'))
        install_subdir('sub/foobar',
                        install_dir: get_option('prefix'))
        install_subdir('foo/baz',
                        install_dir: get_option('prefix'))

        $ tree ../_inst
        ../_inst
        ├── baz
        ├── blah
        └── foobar

Fixes #2904
2021-02-07 12:38:31 +00:00
Jussi Pakkanen 034b81a09f
Merge pull request #8288 from bonzini/test-setup-exclude-suites
introduce add_test_setup(exclude suites: ...) keyword argument
2021-02-07 12:03:10 +00: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 2650977c38 interpreterbase: Add support for optional arguments to typed_pos_args
This allows representing functions like assert(), which take optional
positional arguments, which are not variadic. More importnatly you can
represent a function like (* means optional, but possitional):
```txt
func(str, *int, *str)
```

typed_pos_args will check that all of your types are correct, and if not
provide None, which allow simplifying a number of implementation details
2021-02-06 13:11:25 -05:00
Dylan Baker 978eeddab8 interpreterbase: Add support for variadic arguments to typed_pos_args
This allows functions like `files()` to be decorated.
2021-02-06 13:11:25 -05:00
Dylan Baker 0ead2e10db interpreterbase: Add a helper method for typing positional arguments
We don't do a very good job of type checking in the interpreter,
sometimes we leave it to the mid layers of backends to do that (layering
violations) and sometimes we just don't check them at all. When we do
check them it's a ton of boilerplate and complicates the code. This
should help quite a bit.
2021-02-06 13:11:25 -05:00