diff options
-rw-r--r-- | docs/markdown/Compiler-properties.md | 5 | ||||
-rw-r--r-- | docs/markdown/Reference-manual.md | 12 | ||||
-rw-r--r-- | mesonbuild/mintro.py | 6 | ||||
-rw-r--r-- | mesonbuild/modules/pkgconfig.py | 4 | ||||
-rwxr-xr-x | run_unittests.py | 22 |
5 files changed, 39 insertions, 10 deletions
diff --git a/docs/markdown/Compiler-properties.md b/docs/markdown/Compiler-properties.md index 83fc0d9..1765bef 100644 --- a/docs/markdown/Compiler-properties.md +++ b/docs/markdown/Compiler-properties.md @@ -27,6 +27,11 @@ The compiler object has a method called `get_id`, which returns a lower case str | clang | The Clang compiler | | msvc | Microsoft Visual Studio | | intel | Intel compiler | +| llvm | LLVM-based compiler (Swift, D) | +| mono | Xamarin C# compiler | +| dmd | D lang reference compiler | +| rustc | Rust compiler | +| valac | Vala compiler | | pathscale | The Pathscale Fortran compiler | | pgi | The Portland Fortran compiler | | sun | Sun Fortran compiler | diff --git a/docs/markdown/Reference-manual.md b/docs/markdown/Reference-manual.md index 4989cef..2bbe843 100644 --- a/docs/markdown/Reference-manual.md +++ b/docs/markdown/Reference-manual.md @@ -632,13 +632,15 @@ Takes the project specified in the positional argument and brings that in the cu - `version` keyword argument that works just like the one in `dependency`. It specifies what version the subproject should be, as an example `>=1.0.1` - `default_options`, *(added 0.37.0)* an array of default option values that override those set in the project's `default_options` invocation (like `default_options` in `project`, they only have effect when Meson is run for the first time, and command line arguments override any default options in build files) +Note that you can use the returned [subproject object](#subproject-object) to access any variable in the subproject. However, if you want to use a dependency object from inside a subproject, an easier way is to use the `fallback:` keyword argument to [`dependency()`](#dependency). + ### test() ``` meson void test(name, executable, ...) ``` -Defines an unit test. Takes two positional arguments, the first is the name of this test and the second is the executable to run. Keyword arguments are the following. +Defines a unit test. Takes two positional arguments, the first is the name of this test and the second is the executable to run. Keyword arguments are the following. - `args` arguments to pass to the executable - `env` environment variables to set, such as `['NAME1=value1', 'NAME2=value2']`, or an [`environment()` object](#environment-object) which allows more sophisticated environment juggling @@ -675,7 +677,7 @@ The `meson` object allows you to introspect various properties of the system. Th - `get_compiler(language)` returns [an object describing a compiler](#compiler-object), takes one positional argument which is the language to use. It also accepts one keyword argument, `native` which when set to true makes Meson return the compiler for the build machine (the "native" compiler) and when false it returns the host compiler (the "cross" compiler). If `native` is omitted, Meson returns the "cross" compiler if we're currently cross-compiling and the "native" compiler if we're not. -- `backend()` *(added 0.37.0)* returns a string representing the current backend: `ninja`, `vs2010`, `vs2015`, or `xcode`. +- `backend()` *(added 0.37.0)* returns a string representing the current backend: `ninja`, `vs2010`, `vs2015`, `vs2017`, or `xcode`. - `is_cross_build()` returns `true` if the current build is a [cross build](Cross-compilation.md) and `false` otherwise. @@ -717,10 +719,10 @@ Provides information about the build machine — the machine that is doing the a - `cpu_family()` returns the CPU family name. Guaranteed to return `x86` for 32-bit userland on x86 CPUs, `x86_64` for 64-bit userland on x86 CPUs, `arm` for 32-bit userland on all ARM CPUs, etc. - `cpu()` returns a more specific CPU name, such as `i686`, `amd64`, etc. -- `system()` returns the operating system name, such as `windows` (all versions of Windows), `linux` (all Linux distros), `darwin` (all versions of OS X), etc. +- `system()` returns the operating system name, such as `windows` (all versions of Windows), `linux` (all Linux distros), `darwin` (all versions of OS X/macOS), `cygwin` (for Cygwin), and `bsd` (all *BSD OSes). - `endian()` returns `big` on big-endian systems and `little` on little-endian systems. -Currently, these values are populated using the [`platform.system()`](https://docs.python.org/3.4/library/platform.html#platform.system) and [`platform.machine()`](https://docs.python.org/3.4/library/platform.html#platform.machine). If you think the returned values for any of these are incorrect for your system or CPU, please file [a bug report](https://github.com/mesonbuild/meson/issues/new). +Currently, these values are populated using [`platform.system()`](https://docs.python.org/3.4/library/platform.html#platform.system) and [`platform.machine()`](https://docs.python.org/3.4/library/platform.html#platform.machine). If you think the returned values for any of these are incorrect for your system or CPU, or if your OS is not in the above list, please file [a bug report](https://github.com/mesonbuild/meson/issues/new) with details and we'll look into it. ### `host_machine` object @@ -746,7 +748,7 @@ Note that while cross-compiling, it simply returns the values defined in the cro This object is returned by [`meson.get_compiler(lang)`](#meson-object). It represents a compiler for a given language and allows you to query its properties. It has the following methods: -- `get_id()` returns a string identifying the compiler (e.g. `'gcc'`). +- `get_id()` returns a string identifying the compiler. For example, `gcc`, `msvc`, [and more](Compiler-properties.md#compiler-id). - `version()` returns the compiler's version number as a string. - `find_library(lib_name, ...)` tries to find the library specified in the positional argument. The [result object](#external-library-object) can be used just like the return value of `dependency`. If the keyword argument `required` is false, Meson will proceed even if the library is not found. By default the library is searched for in the system library directory (e.g. /usr/lib). This can be overridden with the `dirs` keyword argument, which can be either a string or a list of strings. - `sizeof(typename, ...)` returns the size of the given type (e.g. `'int'`) or -1 if the type is unknown, to add includes set them in the `prefix` keyword argument, you can specify external dependencies to use with `dependencies` keyword argument. diff --git a/mesonbuild/mintro.py b/mesonbuild/mintro.py index 5e672bb..7356175 100644 --- a/mesonbuild/mintro.py +++ b/mesonbuild/mintro.py @@ -160,9 +160,9 @@ def list_deps(coredata): result = [] for d in coredata.deps.values(): if d.found(): - args = {'compile_args': d.get_compile_args(), - 'link_args': d.get_link_args()} - result += [d.name, args] + result += [{'name': d.name, + 'compile_args': d.get_compile_args(), + 'link_args': d.get_link_args()}] print(json.dumps(result)) def list_tests(testdata): diff --git a/mesonbuild/modules/pkgconfig.py b/mesonbuild/modules/pkgconfig.py index 75a6ad2..5d98167 100644 --- a/mesonbuild/modules/pkgconfig.py +++ b/mesonbuild/modules/pkgconfig.py @@ -155,11 +155,11 @@ class PkgConfigModule(ExtensionModule): # foo=bar=baz is ('foo', 'bar=baz') l = var.split('=', 1) if len(l) < 2: - raise mesonlib.MesonException('Variables must be in \'name=value\' format') + raise mesonlib.MesonException('Invalid variable "{}". Variables must be in \'name=value\' format'.format(var)) name, value = l[0].strip(), l[1].strip() if not name or not value: - raise mesonlib.MesonException('Variables must be in \'name=value\' format') + raise mesonlib.MesonException('Invalid variable "{}". Variables must be in \'name=value\' format'.format(var)) # Variable names must not contain whitespaces if any(c.isspace() for c in name): diff --git a/run_unittests.py b/run_unittests.py index cc034c3..664fdef 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -1828,6 +1828,28 @@ class LinuxlikeTests(BasePlatformTests): return raise RuntimeError('Linker entries not found in the Ninja file.') + def test_introspect_dependencies(self): + ''' + Tests that mesonintrospect --dependencies returns expected output. + ''' + testdir = os.path.join(self.framework_test_dir, '7 gnome') + self.init(testdir) + glib_found = False + gobject_found = False + deps = self.introspect('--dependencies') + self.assertIsInstance(deps, list) + for dep in deps: + self.assertIsInstance(dep, dict) + self.assertIn('name', dep) + self.assertIn('compile_args', dep) + self.assertIn('link_args', dep) + if dep['name'] == 'glib-2.0': + glib_found = True + elif dep['name'] == 'gobject-2.0': + gobject_found = True + self.assertTrue(glib_found) + self.assertTrue(gobject_found) + class LinuxArmCrossCompileTests(BasePlatformTests): ''' Tests that verify cross-compilation to Linux/ARM |