Commit Graph

119 Commits

Author SHA1 Message Date
Jussi Pakkanen 36a0d162cb Merge pull request #895 from mesonbuild/wip/tingping/gnome-vapi
gnome: Add generate_vapi function
2016-11-02 11:41:58 -07:00
Nirbheek Chauhan 3df75d696d Directly pass the compiler to get_args_from_envvars
Seems better to do this since the behaviour is compiler-specific. Would
be easier to extend this later too in case we want to do more
compiler-specific things.
2016-10-26 23:16:05 +05:30
Nirbheek Chauhan 70265c3782 Improve error when using the dependencies kwarg
The error message is misleading (talks about external dependencies), and
doesn't tell you what you need to do (use the output of
declare_dependency, dependency, or find_library). At the same time
rename add_external_deps to add_deps since it adds internal deps too.

Plus many more error message improvements all over the place.
2016-10-23 18:02:19 +05:30
Patrick Griffis bae7d7b3d7 gnome: Add generate_vapi() function
This allows C projects to generate vapi bindings from
gir files and returns a dependency that can be used by
Vala.
2016-10-21 02:23:54 -04:00
Nirbheek Chauhan 57ce7d4618 Add support for extracting objects in unity builds
Not only does extract_all_objects() now work properly again,
extract_objects() also works if you specify a subset of sources all of
which have been compiled into a single unified object.

So, for instance, this allows you to extract all the objects
corresponding to the C sources compiled into a target consisting of
C and C++ sources.
2016-10-21 08:00:39 +05:30
Jussi Pakkanen e908910187 Can query pkg-config variables from the system. Closes #726. 2016-10-19 22:36:34 +03:00
Jussi Pakkanen 24552819b4 Force dep versions into the version kwarg. 2016-10-19 01:03:29 +03:00
Scott D Phillips 08aeac22a9 Don't raise exception when a fallback dependency is not found
If a fallback dependency is not found just return None.  The
caller can then raise the exception it already has if
required=True, or just continue on if required=False.
2016-10-17 19:32:09 +03:00
Thibault Saunier 77b379f5cf Try using already setup fallback subprojects before using native dependency
In the case the main project set a subproject for a dependency another
subprojects uses, that other subproject should rather use the first
subproject rather that using native dependency.

For example in gst-all we set all GStreamer modules as subprojects
and, gst-plugins-base is set after gstreamer core, and
we want gst-plugins-base to always use GStreamer core from the subproject
and not the possibly avalaible native one.
2016-10-14 11:25:16 +02:00
Thibault Saunier fcaf319e49 interpreter: Add a way to copy and environment object
It is really usefull when you have common variables defined
for all tests and then need to set some extra ones for each test
2016-10-14 11:25:16 +02:00
Thibault Saunier 7e2390f355 interpreter: Add a type_name method to DependencyHolder
And remove the InternalDependencyHolder class.

In some cases we need to know the type of dependency we are
dealing with. For example in GStreamer if the dependency
is not an internal one, then we need to get some env var
from pkg-config to know where to find some plugins necessary
to run some tests.
2016-10-14 11:25:15 +02:00
Jussi Pakkanen 1efcea9617 Renamed path_join to join_paths. 2016-10-13 20:53:45 +03:00
Nirbheek Chauhan c3db008d82 custom_target: Clarify error message 2016-10-13 00:21:33 +03:00
Jussi Pakkanen 95a99682b0 Merge branch 'QuLogic-compiler-file-checks' 2016-10-12 23:26:30 +03:00
Jussi Pakkanen 60119753d6 Check contents of arguments inside project(). Closes #857. 2016-10-10 23:26:40 +03:00
Jussi Pakkanen 28df8b800e Add an option to select if static libraries are built with -fPIC. 2016-10-10 21:28:28 +03:00
Jussi Pakkanen c2b852c9b3 Created path_join function. 2016-10-10 19:44:28 +03:00
Nirbheek Chauhan 411d6c8bc4 intrp: Don't do custom AST parsing for project()
Reuse the standard evaluate_codeblock() parsing since it does proper
error handling, and also handles, for instance, lists in string
arguments (flatten), etc. properly.

We need to declare more variables in advance now, but that should be ok.
2016-10-07 23:32:46 +05:30
Jussi Pakkanen 295b67df51 Merge pull request #814 from centricular/heavy-cleanup-compilers-buildtargets
Heavy cleanup in compilers and BuildTarget
2016-09-30 15:30:57 -04:00
Elliott Sales de Andrade f2fed5052d Allow passing files to compile/link/run queries. 2016-09-29 04:44:01 -04:00
Matthew Waters 13e91ab499 Add dependency support to the checks using the compiler
It is extremely common to need to know within a given dependency if
a given header, symbol, member, function, etc exists that cannot be
determined from the version number alone.

Without passing dependency objects to the various compiler/linker
checks and with many libraries headers/libraries being located in
their own subdirs of the standard prefix, the check for the library
would not find the header/function/symbol/etc.

This commit allows passing dependency objects to the compiler checks so
that the test program can be compiled/linked/run with the necessary
compilation and/or linking flags for that library.
2016-09-26 20:25:17 +03:00
Nirbheek Chauhan ac8c8c2ba8 Treat 32-bit compiles on 64-bit Windows as native
It's a terrible user experience to force people building 32-bit
applications on 64-bit Windows to use a cross-info file when every other
tool treats it as a 'native' compilation -- it satisfies all the
requirements for a native compile.

This commit also fixes the platform detection on Windows which would
cause the 'native cpu' to be detected as 32-bit if you installed 32-bit
Python on 64-bit Windows, or if you were building with a 32-bit
toolchain on 64-bit Windows.

Doesn't support MinGW yet -- the next commits will add that since the
changes required for that are more involved.
2016-09-26 19:48:46 +05:30
Nirbheek Chauhan 6590b7221e intrp: Parse project() before the rest of the AST
We need the compiler and language information stored in it for
populating the BuildMachine() properties accurately. The next commits
add this.
2016-09-26 19:48:46 +05:30
Nirbheek Chauhan 9c6369c759 interpreter: Print an error if the fallback dependency variable is not found (#804) 2016-09-25 19:03:18 +03:00
Tim-Philipp Müller 3aebdb717a configuration_data: can pass descriptions to setters (#783)
Add support for passing a description to configuration data
setter methods via a 'description' kwarg. The description
string will be used when meson generates the entire configure
file without a template, autoconf-style.
2016-09-25 18:56:49 +03:00
Sam Thursfield 8784c35dde Give a helpful exception when target has no name (#816) 2016-09-25 18:50:55 +03:00
Thibault Saunier 89d3a18f65 Add a meson.version() method returning the version of meson in use (#792)
So user can activate/deactivate features based on it.
2016-09-25 18:49:36 +03:00
Thibault Saunier a2e7ebc575 Add a new 'environment' object to be used to build test environment (#781)
Allowing user to fine tune tests environment variables
2016-09-14 23:11:27 +03:00
Tim-Philipp Müller 09fdc7f815 configuration_data: add .set_quoted() convenience method to set quoted string
Quotes in the string will be escaped C-string style with \", but
nothing else will be escaped.
2016-09-13 23:44:33 +01:00
Jussi Pakkanen c970d656b1 All_args should always be a list. Closes #778. 2016-09-11 15:02:48 +03:00
Jussi Pakkanen 6f2b29e0f7 Can use files() in run_command. 2016-09-08 21:51:48 +03:00
Jussi Pakkanen 9235fd4ec1 Permit use of file objects in run targets. 2016-09-07 23:04:11 +03:00
Elliott Sales de Andrade b6ee5725c2 Fix option initialization for win32 cross-compile. (#762) 2016-09-07 21:42:16 +03:00
Jussi Pakkanen 165f8a913d Better error message when trying to use subprojects as dependencies. 2016-09-07 21:25:34 +03:00
Elliott Sales de Andrade a7cf241334 Fix validation of man page extension. (#749)
If the extension does not exist or is not a number, the error message is
not raised because the assumptions cause a different exception.
2016-09-03 00:00:58 +03:00
Emmanuele Bassi 2dd1ec6f8c Add is_even() and is_odd() integer methods
Convenience methods for modulo operations involving even and odd
numbers.
2016-09-02 18:52:45 +01:00
Emmanuele Bassi 00e5962aaa Add support to integer modulo operator
Having support for the '%' operator makes it easier to implement
even/odd version checks, like:

    enable_debug = get_option('enable-debug')
    if enable_debug == 'auto'
      if minor_version % 2 == 0
        enable_debug = 'minimum'
      else
        enable_debug = 'yes'
      endif
    endif

which would be impossible without resorting to less obvious long-hand
forms like:

  a - (b * (a / b))
2016-09-02 18:52:45 +01:00
Jussi Pakkanen cdf0c4f1a9 Merge branch 'QuLogic-context-managers' 2016-09-01 23:12:06 +03:00
Saunier Thibault e411c0b930 Honor dependency `fallback` argument even if the dependency is not required (#735)
You can potentially have a fallback subproject and if that subproject
fails, you can continue without that dependency
2016-08-29 22:31:10 +03:00
Elliott Sales de Andrade 4c71695e41 Use context manager for file I/O.
There are a few cases where a context manager cannot be used, such as
the logger.
2016-08-27 18:29:55 -04:00
Nirbheek Chauhan 7830cb61c3 Add a new compiler object method: has_members (#723)
* Add a new compiler object method: has_members

Identical to 'cc.has_member', except that this takes multiple members
and all of them must exist else it returns false.

This is useful when you want to verify that a structure has all of
a given set of fields. Individually checking each member is horrifying.

* Fix typo in exceptions for has_member(s)
2016-08-27 17:26:23 +03:00
Elliott Sales de Andrade a2321b24f6 Flatten isinstance calls. (#715)
That is, isinstance(x, y) or isinstance(x, z) can be flattened with a
tuple to isinstance(x, (y, z)).
2016-08-27 15:47:29 +03:00
Matthias Klumpp 309f7a1b4a interpreter: Rename get_unittest_flag() to unittest_args() 2016-08-21 01:41:14 +02:00
Matthias Klumpp 57c54a678c Allow build definitions to retrieve the unittest flag of a D compiler
D allows programmers to define their tests alongside the actual code in
a unittest scope[1].
When compiled with a special flag, the compiler will build a binary
containing the tests instead of the actual application.

This is a strightforward and easy way to run tests and works well with
Mesons test() command.

Since using just one flag name to enable unittest mode would be too
boring, compiler developers invented multiple ones.

Adding this helper method makes it easy for people writing Meson build
descriptions for D projects to enable unittestmode.

[1]: https://dlang.org/spec/unittest.html
2016-08-20 18:48:28 +02:00
Matthias Klumpp 56823272ab Implement D support
This patch adds support for the D programming language[1] to Meson.

The following compilers are supported:
* LDC
* GDC
* DMD

[1]: http://dlang.org/
2016-08-19 03:02:51 +02:00
Nirbheek Chauhan a5e01fa155 Only append compile flags to the link flags when appropriate
We should only append the compiler flags to the link flags when the
compiler is used as a wrapper around the linker during the link process
2016-08-12 15:34:59 +05:30
Jussi Pakkanen 657f357fc6 Merge pull request #605 from mesonbuild/ternary
Added ternary operator support
2016-08-01 21:08:04 +03:00
Jussi Pakkanen d90fcb4048 Created ternary operator. Closes #538. 2016-08-01 20:46:40 +03:00
Nirbheek Chauhan 58ad092ff3 interpreter: Print what subproject dir could not be found
Fixes #655
2016-08-01 09:34:30 +05:30
Jussi Pakkanen 4a92b78e6e A few error message fixes. 2016-07-28 20:45:38 +03:00