| Age | Commit message (Collapse) | Author |
|
1. Generate OMF objs with `-Zomf' compiler flags
2. Generate OMF libs with `.lib' suffix using `emxomfar' as a librarian
|
|
|
|
cmd_line.txt is not related to serialized data, in fact it's a fallback
for when serialized data cannot be used and is also related to setting
up argparse for command line parsing. Since there is no code in common
with the rest of coredata, move it to a new module.
Fixes: #15081
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Defining public API in a cross platform library is painful, especially
on Windows. Since every library have to define pretty much the same
macros, better do it in Meson.
|
|
Changes from Dylan:
- Don't use Path
- merge the lint fixes
- Fix some typing issues
- Handle non-meson projects
- Remove some code duplication by putting `get_subproject_dir` in
utils
|
|
|
|
backends.py has an interesting idiom for keeping the unique
elements of a list. This is much faster than OrderedSet:
* dict.fromkeys() vs. OrderedSet.__init__(): 35% faster on Python
3.13, 50-60% faster on Python 3.10
* list(d) (d is a dict) vs. list(os) (os is an OrderedSet): up to
25% faster on Python 3.13, up to 15% faster on Python 3.10
though it tapers out after a few hundred elements.
Add a function to mesonlib to encapsulate this idiom.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
`meson.py introspect build --targets` should show
`/path/to/project/hello.c` instead of
`/path/to/project/subdir/../hello.c` if
/path/to/project/meson.build contains subdir('subdir') and
/path/to/project/subdir/meson.build contains
executable('hello', '../hello.c').
|
|
cmake does preprocessing in a linear pass through the entire file
this allows recursive variable lookups which cannot be supported
by a basic regex implementation.
|
|
in cmake variables are pure strings with no minimal required length so
an empty string is a valid key and ${} needs to be handled accordingly.
|
|
just as with C defines cmakedefine supports a variable amount of
whitespace between the # symbol and the actual token.
|
|
When git is used with worktrees, `.git` will be a file containing a link
to the original repo. Currently, we say that this is not git because
`.git` isn't a directory.
|
|
only the real arguments to response file
|
|
Since opt.deprecated is a dictionary with string keys, the lookup must use
str() around the user-provided value; with some care because booleans
will be the meson-ic 'true' and 'false' instead of Python's 'True' and
'False'.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Because we will need to call it from a module in a followup commit.
|
|
Introduce an alternative to os.path.commonpath(name, path) == path,
which is a common idiom throughout Meson. Call it is_parent_path
just like the existing static method in Generator.
It is a bit faster and handles drives on Windows without the need
for an exception handler.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
These are given a name that is different from __func.__name__, so
store the name when the descriptor is placed in the class.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Trying to chmod a symlink results in trying to chmod the file or
directory it points to, not the symlink itself which has no
permissions. Either a symlink points to within the tree we're making
writable in which case it'll be handled eventually by os.walk() or
it points outside of the tree we're making writable in which case
we don't want to touch it. Let's avoid touching files outside of the
tree by simply skipping symlinks in _make_tree_writable().
|
|
This allows us to simplify the initializers, as well as remove our
custom repr methods.
|
|
A Defaultable PerMachine has a type of `None | T`, in other words,
they have a base type of `PerMachine[None | T]`, but the purpose of
`PerMachine.default_missing()` is to get a `PerMachine[T]` from that
`PerMachine[None | T]`, therefore we should ensure that and annotate
that.
|
|
On Windows, if you accidently add a space at the end of a file name, like
`files('myfile.txt ')`, the file is not reported as missing, because of
the normalization performed by the OS. However, ninja will reference it
with the trailing space, and will fail because the file does not exist.
See https://github.com/python/cpython/issues/115104 for reference.
|
|
|
|
Version objects are created thousands of times by the check_version method of
decorators. Creation is inefficient, resulting in five calls to re.match()
that do not even use precompiled regex. The use of re.match() however is
fully redundant, as finditer() can provide the same information with a better
use of groupings. Do that and precompile the tokenization regex.
This saves about 3% in the "meson setup" run of QEMU.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
|
get_target_generated_sources often calls File.from_built_relative on
the same file, if it is used by many sources. This is a somewhat
expensive call both CPU- and memory-wise, so cache the creation
of build-directory files as well.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Eli Schwartz <eschwartz93@gmail.com>
|
|
the upstream behavior of configure_file in cmake parses both @VAR@ and ${VAR} and only supports disabling the bracket variables through the `@ONLY` argument, meson needs to follow this behavior for compatibility
|
|
It is useful to apply a limit to the number of processes even outside "meson test",
and specifically for clang tools. In preparation for this, generalize
determine_worker_count() to accept a variable MESON_NUM_PROCESSES instead of
MESON_TESTTHREADS, and use it throughout instead of multiprocessing.cpu_count().
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
There is no need to create and look up a dictionary when MachineChoice is
an enum, and there is no need to create a PerMachine object on every
__setitem__ of another PerMachine object.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
|
When projects do not specify a minimum meson version, we used to avoid
giving them the benefit of the Feature checks framework. Instead:
- warn for features that were added after the most recent semver bump,
since they aren't portable to the range of versions people might use
these days
- warn for features that were deprecated before the upcoming semver
bump, i.e. all deprecated features, since they aren't portable to
upcoming semver-compatible versions people might be imminently upgrading
to
|
|
This function is no longer used since shutil.which() is used instead.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The documentation for subprocess.run at https://docs.python.org/3/library/subprocess.html#popen-constructor has a warning,
pointing to using shutil.which() instead of subprocess.run for detecting if exe files exists on the path.
shutil.which() is used in many places already.
|
|
|
|
When configuring a 'meson' or 'cmake@' style file,
add a case for escaped variables using matched pairs of
`\@` i.e. `\@foo\@ -> @foo@`.
The match for @var@ has been amended with a negative lookbehind
to ensure that any occurrances of `\@foo@` are not evaluated to
`\bar`.
The previous behaviour, matching `\@` and escaping only that character,
had undesirable side effects including mangling valid perl when
configuring files.
Closes: https://github.com/mesonbuild/meson/issues/7165
|
|
@PLAINNAME@ and @BASENAME@ cannot be used in custom_target()
with multiple inputs. For those, similar macros are needed
with an index.
Fixes #13164
|
|
Any code that needs to know mesonlib.python_command currently assumes
the PyInstaller bundle reference is added to the sys module, which means
that it assumes the only freeze tool used is PyInstaller. Really, all we
need to check is sys.frozen as it's never normally set, but always set
for a freeze. We don't care if it was PyInstaller specifically, and we
don't need its bundle directory.
See https://github.com/mesonbuild/meson/discussions/13007
|
|
Popen_safe_logged has a small inefficiency. It evaluates the stripped
version of stdout/stderr before checking if it exists, for logging
purposes. This would sometimes crash, if it was None instead of ''.
Fixes #12979
|
|
|
|
This function is used at 3 different places and it does not justify it
as being a staticmethod instead of being a free function.
|
|
The standard library accepts None defaults for some kwargs and we should
too.
|
|
This replaces all of the Apache blurbs at the start of each file with an
`# SPDX-License-Identifier: Apache-2.0` string. It also fixes existing
uses to be consistent in capitalization, and to be placed above any
copyright notices.
This removes nearly 3000 lines of boilerplate from the project (only
python files), which no developer cares to look at.
SPDX is in common use, particularly in the Linux kernel, and is the
recommended format for Meson's own `project(license: )` field
|
|
This caused a regression with mesondefine where
`conf_data.set("FOO", true)`
turned into
`#define FOO 1`
instead of
`#define FOO`
|
|
Old:
```
OrderedSet("'foo'", "'bar'", "'baz'")
```
New:
```
OrderedSet(['foo', 'bar', 'baz'])
```
The old one looked nasty *and* was totally non-functional.
|
|
|