Commit Graph

424 Commits

Author SHA1 Message Date
Sam H 3e48d47674 Squash target_type warning for jar targets 2018-03-24 01:31:48 +02:00
Jussi Pakkanen 657836b555
Merge pull request #3223 from sarum9in/rename
Add install_data() rename parameter
2018-03-20 00:15:01 +02:00
Nirbheek Chauhan d012b5b997 Create a helper for checking if a string has a path component
This is used in a number of places, and in some places it is incomplete.
Use a helper to ensure it's used properly.
2018-03-19 23:45:43 +02:00
Aleksey Filippov f720efa2f4 Add rename parameter to install_data() 2018-03-17 20:40:50 +00:00
Aleksey Filippov d977b78f1b Use itertools.chain() instead of list concatenation 2018-03-11 23:36:04 +00:00
Niklas Claesson 7074bcb88a Exclude subprojects when doing coverage 2018-03-10 18:05:35 +02:00
Aleksey Filippov 077d59daa4 Add link_whole argument to declare_dependency() 2018-03-06 01:44:26 +00:00
Bedarkar, Malhar a2ee76228e First cut of ARMCC support for MESON.
Change-Id: I15d8258e84d392baaccb8f670e33eefcfe8cd49a
2018-03-05 18:26:39 -06:00
Hemmo Nieminen 7fb8e518b2 Harmonize data pickling.
Try to be more consistent on using save() and load() methods to pickle
data.
2018-03-01 01:06:51 +02:00
Aleksey Filippov 8c3a1afde0 Do not unpack link_whole target, BuildTarget.link_whole() does listify() anyway 2018-02-27 20:43:02 +02:00
Jussi Pakkanen cb176e9303 Look up compilers based on sources from deps, too. Closes #2768. 2018-02-27 20:40:41 +02:00
Jussi Pakkanen ea3b54d402 Use include_directories for D impdirs.
Change the code to store D properties as plain data. Only convert them
to compiler flags in the backend. This also means we can fully parse D
arguments without needing to know the compiler being used.
2018-02-25 19:42:15 +02:00
Robert Bragg 6f510ca695 Don't version shared libraries for Android
Android's loader doesn't handle shared library versioning so this avoids
adding a suffix to the filename or soname for Android hosts.
2018-02-04 00:49:16 +02:00
Jussi Pakkanen af2067b670 Make checks a bit more robust against empty entries. 2018-01-31 21:01:28 +02:00
Aleksey Filippov 2cf85ae16f Use os.path: basename() and dirname() instead of split()
According to Python documentation[1] dirname and basename
are defined as follows:
    os.path.dirname() = os.path.split()[0]
    os.path.basename() = os.path.split()[1]
For the purpose of better readability split() is replaced
by appropriate function if only one part of returned tuple
is used.

[1]: https://docs.python.org/3/library/os.path.html#os.path.split
2018-01-30 07:08:22 +11:00
Jussi Pakkanen d6bed2a77d
Merge pull request #2764 from mesonbuild/generatorpath
Generator outputs can have path segments
2018-01-13 19:00:38 +02:00
Nikita Churaev de8018a17d Add `export_dynamic` argument to `executable`. (#2662) 2018-01-09 21:36:13 +02:00
Jon Turney fd66692f73 Fix a problem when anyone actually tries to use a non-found dependency
Fix BuildTarget.add_deps() to handle class Dependency
Extend test case to cover uses of the not-found dependency object
2018-01-06 19:20:32 +02:00
Andrei Alexeyev 84e47ab654 fix AttributeError in CustomTargetIndex.__repr__ 2017-12-26 13:12:32 +02:00
Jussi Pakkanen 658442bef4 Can declare file generation in one dir and use the output in another. 2017-12-18 20:58:43 +02:00
Jussi Pakkanen b949c4792d Preserve_path_from should be a kwarg of process(), not generator(). 2017-12-17 22:42:20 +02:00
Jussi Pakkanen 4af4145d09 Files created with generator can have path segments.
This is OK, because they are written in the private directory
of each target and its layout can be anything.
2017-12-12 00:02:37 +02:00
Nirbheek Chauhan 62ba5ca1ec custom target: Consider all build depends while serializing
Currently, we only consider the build depends of the Executable being
run when serializing custom targets. However, this is not always
sufficient, for example if the executable loads modules at runtime or if
the executable is actually a python script that loads a built module.

For these cases, we need to set PATH on Windows correctly or the custom
target will fail to run at build time complaining about missing DLLs.
2017-12-02 02:07:19 +05:30
Josh Soref 72ba9302aa spelling: target 2017-11-26 06:14:41 +00:00
Josh Soref 49f8d28ef5 spelling: overridden 2017-11-26 05:55:40 +00:00
Nirbheek Chauhan d2a250412c compilers: Improve manual library searching
We can now specify the library type we want to search for, and whether
we want to prefer static libraries over shared ones or the other way
around. This functionality is not exposed to build files yet.
2017-11-11 23:06:48 +05:30
Martin Kelly 02bea7d5bf namespace run_targets by subproject
Currently, run_target does not get namespaced for each subproject,
unlike executable and others. This means that two subprojects sharing
the same run_target name cause meson to crash.

Fix this by moving the subproject namespacing logic from the BuildTarget
class to the Target class.
2017-10-31 01:04:38 +02:00
Lyude Paul 1a159db8e9 Raise InvalidArguments when trying to link against strings
With executable(), if the link_with argument has a string as one of it's
elements, meson ends up throwing an AttributeError exception:

...
  File "/home/lyudess/Projects/meson/mesonbuild/build.py", line 868, in link
    if not t.is_linkable_target():
AttributeError: 'str' object has no attribute 'is_linkable_target'

Which is not very helpful in figuring out where exactly the project is
trying to link against a string instead of an actual link target. So,
fix this by verifying in BuildTarget.link() that each given target is
actually a Target object and not something else.

Additionally, add a simple test case for this in failing tests. At the
moment, this test case just passes unconditionally due to meson throwing
the AttributeError exception and failing as expected. However, this test
case will be useful eventually if we ever end up making failing tests
more strict about failing gracefully (per advice of QuLogic).
2017-10-29 01:56:57 +03:00
Jussi Pakkanen 2fbc857ff4 Better error message when using external libraries incorrectly. Closes #2447. 2017-10-08 17:25:08 +03:00
Nirbheek Chauhan bb0e18b738 Use listify and extract_as_list everywhere
They now flatten by default and unhold objects if required

Includes unit tests.
2017-10-01 22:27:48 +05:30
Jussi Pakkanen ea5ae8ef27 Merge pull request #2313 from dcbaker/fix-2180
link_whole should be considered a source for targets
2017-10-01 01:19:05 +03:00
Niklas Claesson 68275b32e8 Implement capture for generators 2017-09-29 23:29:44 +03:00
Dylan Baker dda5e8cadb Allow CustomTarget's to be indexed
This allows a CustomTarget to be indexed, and the resulting indexed
value (a CustomTargetIndex type), to be used as a source in other
targets. This will confer a dependency on the original target, but only
inserts the source file returning by index the original target's
outputs. This can allow a CustomTarget that creates both a header and a
code file to have it's outputs split, for example.

Fixes #1470
2017-09-27 22:01:24 +03:00
Dylan Baker d070100c8c link_whole should be considered a source for targets
Currently sources, generated sources, or objects are considered to be
sources for a target, but link_whole should also fulfill the sources
requirement.

Fixes #2180
2017-09-21 12:10:59 -07:00
Jussi Pakkanen 2f6702839e Merge pull request #2340 from NickeZ/generator-fix
Add @PLAINNAME@ and @BASENAME@ to arguments argument for Generator
2017-09-21 20:02:21 +03:00
Dylan Baker d5003c2190 Consider compilers used in static_library parents
Currently meson only considers what compiler/linker were used by a
Target's immediate sources or objects, not the sources of libraries it's
linked with by the link_with and link_while keywords. This means that if
given 3 libraries: libA which is C++, libB which is C, and libC which is
also C, and libC links with libB which links with libA then linking libC
will be attempted with the C linker, and will fail.

This patch corrects that by adding the compilers used by sub libraries
to the collection of compilers considered by meson when picking a
linker.

This adds a new process_compilers_late method to the BuildTarget class,
which is evaluated after process_kwargs is called. This is needed
because some D options need to be evaluated after compilers are
selected, while for C-like languages we need to check the link* targets
for language requirements, and link* targets are passed by kwargs.

This implementation is recursive, since each Target adds it's parent's
dependencies.
2017-09-20 08:59:26 -07:00
Niklas Claesson 07dde545d9 Add @PLAINNAME@ and @BASENAME@ to arguments argument for Generator
Fixes #1282
2017-09-20 13:00:34 +02:00
Alexis Jeandet e553d0807b Last round with listify function refactoring.
Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>
2017-09-18 22:25:34 +02:00
Alexis Jeandet 55975f852e Introduced extract_as_list.
Corrected code style and typo.

Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>
2017-09-18 22:21:22 +02:00
Alexis Jeandet 7549a39a17 Introduction of listify method. Test on build.py module to see benefits.
Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>
2017-09-18 22:21:22 +02:00
Matthias Klumpp 61db415d7f d: Make feature names less verbose 2017-09-17 21:36:13 +02:00
Matthias Klumpp 6cd3f066b4 d: Implement specific properties for D features 2017-09-12 17:32:03 +02:00
Jussi Pakkanen 61a05f26e3 Add option to disable implicit include directories. Closes #2139. 2017-08-05 00:26:13 +03:00
Dylan Baker 6d939c6737 Consider link_whole_targets when determining linker
Currently if a target uses link_whole, and one of those archives is a
C++, but the files for the target are C linking will fail when the C
linker attempts to link the C++ files. This patches add
link_whole_targets to the list of languages in the target so the correct
linker will be selected.
2017-08-03 00:52:18 +03:00
Jussi Pakkanen bff37a90fc Merged buildrpath branch. 2017-07-21 22:19:07 +03:00
Hagai 035b2525ac build.py: fixed a small issue where hasattr was passed only a name argument. 2017-07-21 20:15:14 +03:00
Jussi Pakkanen e82edc179f Check for manual attempts to set rpath and update docs. 2017-07-21 19:40:54 +03:00
Jussi Pakkanen 2269b7f60b Add build_rpath as new property allowing people to specify rpath entries that are used in the build tree but will be removed on install. 2017-07-21 19:40:54 +03:00
Jon Turney 8f859a5105 Make the name of the executable implib configurable 2017-07-20 21:11:56 +01:00
Jon Turney 3fa3922cea Support implibs for executables on Windows
Add a boolean 'implib' kwarg to executable().  If true, it is permitted to
use the returned build target object in link_with:

On platforms where this makes sense (e.g. Windows), an implib is generated
for the executable and used when linking.  Otherwise, it has no effect.

(Rather than checking if it is a StaticLibrary or SharedLibary, BuildTarget
subclasses gain the is_linkable_target method to test if they can appear in
link_with:)

Also install any executable implib in a similar way to a shared library
implib, i.e. placing the implib in the appropriate place

Add tests of:
- a shared_module containing a reference to a symbol which is known (at link
time) to be provided by the executable
- trying to link with non-implib executables (should fail)
- installing the implib

(This last one needs a little enhancement of the installed file checking as
this is the first install test we have which needs to work with either
MSVC-style or GCC-style implib filenames)
2017-07-20 21:11:56 +01:00
Jussi Pakkanen 917e12e4e7 Merge pull request #2017 from mesonbuild/fix2012
Do not pickle interpreter objects by accident
2017-07-02 16:33:49 -04:00
Hemmo Nieminen 3a59379ec1 Update args_frozen attribute check.
Attribute args_frozen doesn't exist anymore. Check against
project_args_frozen/global_args_frozen instead.
2017-07-02 10:52:24 -04:00
Jussi Pakkanen ad3dc937f1 Fix remaining Interpreter object leaks. 2017-07-01 02:10:02 +03:00
Jussi Pakkanen ecde592b86 Fix custom target sources 2017-07-01 01:13:45 +03:00
Jussi Pakkanen 65d5ec5f18 Merge pull request #1922 from acfoltzer/rust-improvements
Enhance Rust support
2017-06-22 06:12:27 -04:00
Adam C. Foltzer 69b18cf7e9 rename `crate_type` to `rust_crate_type` per @TingPing 2017-06-14 08:39:41 -07:00
Adam C. Foltzer bdd4c45b17 Enhance Rust support
- Adds a `crate_type` kwarg to library targets, allowing the different
  types of Rust [linkage][1].
- Shared libraries use the `dylib` crate type by default, but can also
  be `cdylib`
- Static libraries use the `rlib` crate type by default, but can also
  be `staticlib`
- If any Rust target has shared library dependencies, add the
  appropriate linker arguments, including rpath for the sysroot of the
  Rust compiler

[1]: https://doc.rust-lang.org/reference/linkage.html
2017-06-09 15:14:02 -07:00
Nirbheek Chauhan 0c83f8352d dependencies: Add a new class ExternalDependency
This class now consolidates a lot of the logic that each external
dependency was duplicating in its class definition.

All external dependencies now set:

* self.version
* self.compile_args and self.link_args
* self.is_found (if found)
* self.sources
* etc

And the abstract ExternalDependency class defines the methods that
will fetch those properties. Some classes still override that for
various reasons, but those should also be migrated to properties as
far as possible.

Next step is to consolidate and standardize the way in which we call
'configuration binaries' such as sdl2-config, llvm-config, pkg-config,
etc. Currently each class has to duplicate code involved with that
even though the format is very similar.

Currently only pkg-config supports multiple version requirements, and
some classes don't even properly check the version requirement. That
will also become easier now.
2017-06-09 20:21:01 +05:30
Jussi Pakkanen 506fbafed5 Revert slashes in filenames being a hard error to give downstream projects time to transition. 2017-06-02 11:56:27 +03:00
Alistair Thomas a195b78c8d Whitespace tweaks to reduce Flake8 warnings 2017-05-29 19:32:47 +03:00
Jussi Pakkanen 7882549f86 Target file name must not contain a path separator as that breaks things. 2017-05-26 23:27:49 +03:00
Paulo Antonio Alvarez 50c81d267b objc++: Add support for objcpp_args keyword
This allows the user to pass additional flags for the objective-c++
compiler.
2017-05-22 21:21:15 -03:00
Paulo Antonio Alvarez 18d2e7b91c objc: Add support for objc_args keyword
This allows the user to pass additional flags for the objective-c
compiler.
2017-05-22 21:16:10 -03:00
Jussi Pakkanen 189784b474 Merge pull request #1792 from jon-turney/custom_target_vs_module_defs
Allow vs_module_defs to use a custom_target
2017-05-21 21:31:14 +03:00
Elliott Sales de Andrade ea636fcd51 Remove unused variables. 2017-05-17 04:41:54 -04:00
Jon Turney 66a6ea984b Allow vs_module_defs to use a custom_target
Allow vs_module_defs to use a custom_target
Add a test and update documentation
2017-05-16 19:56:32 +01:00
Jussi Pakkanen c2282f9382 Merged rust_args branch. 2017-05-13 22:51:43 +03:00
Dylan Baker 410937c08e Flatten SharedLibary link_args. 2017-05-11 16:59:59 -07:00
Dylan Baker c03744cccb Allow passing a list of Files to CustomTarget. Closes #1720 2017-05-11 09:57:38 -07:00
Dylan Baker e2567386f1 Use flatten for link targets. Fixes #1764 2017-05-11 09:57:38 -07:00
Patrick Griffis b520a4f030 rust: Support rust_args 2017-05-08 15:25:52 -04:00
Dylan Baker 7053d9abfd Allow link_depends to take strings, Files or generated objects. Closes #1172
Currently only strings can be passed to the link_depends argument of
executable and *library, which solves many cases, but not every one.
This patch allows generated sources and Files to be passed as well.

On the implementation side, it uses a helper method to keep the more
complex logic separated from the __init__ method. This also requires
that Targets set their link_depends paths as Files, and the backend is
responsible for converting to strings when it wants them.

This adds tests for the following cases:
- Using a file in a subdir
- Using a configure_file as an input
- Using a custom_target as an input

It does not support using a generator as an input, since currently that
would require calling the generator twice, once for the -Wl argument,
and once for the link_depends.

Also updates the docs.
2017-05-08 20:59:46 +02:00
Niclas Moeslund Overby 1882548f05 Make name_suffix keyword known to binaries
Fixes #1728
2017-05-08 20:50:25 +02:00
Jussi Pakkanen 11968382a3 Merge pull request #1621 from dcbaker/llvm-dep
RFC: Add dependency for LLVM. Fixes #1611
2017-05-04 23:21:40 +02:00
Dylan Baker 4334c96062 Provide a helpful message when a language is required but not included
This happens when building a C project with LLVM, which requires the C++
linker.
2017-05-03 14:33:44 -07:00
Jussi Pakkanen 108dac5c16 Store extra_files as file objects. Helps with #1686. 2017-05-04 00:17:33 +03:00
Dylan Baker a8173630ea Don't use len() to test emptiness vs not emptiness
Meson has a common pattern of using 'if len(foo) == 0:' or
'if len(foo) != 0:', however, this is a common anti-pattern in python.
Instead tests for emptiness/non-emptiness should be done with a simple
'if foo:' or 'if not foo:'

Consider the following:
>>> import timeit
>>> timeit.timeit('if len([]) == 0: pass')
0.10730923599840025
>>> timeit.timeit('if not []: pass')
0.030033907998586074
>>> timeit.timeit('if len(['a', 'b', 'c', 'd']) == 0: pass')
0.1154778649979562
>>> timeit.timeit("if not ['a', 'b', 'c', 'd']: pass")
0.08259823200205574
>>> timeit.timeit('if len("") == 0: pass')
0.089759664999292
>>> timeit.timeit('if not "": pass')
0.02340641999762738
>>> timeit.timeit('if len("foo") == 0: pass')
0.08848102600313723
>>> timeit.timeit('if not "foo": pass')
0.04032287199879647

And for the one additional case of 'if len(foo.strip()) == 0', which can
be replaced with 'if not foo.isspace()'
>>> timeit.timeit('if len("   ".strip()) == 0: pass')
0.15294511600222904
>>> timeit.timeit('if "   ".isspace(): pass')
0.09413968399894657
>>> timeit.timeit('if len("   abc".strip()) == 0: pass')
0.2023209120015963
>>> timeit.timeit('if "   abc".isspace(): pass')
0.09571301700270851

In other words, it's always a win to not use len(), when you don't
actually want to check the length.
2017-05-02 21:57:26 +03:00
Nirbheek Chauhan 22c4cd6e25 Use linked-libraries to decide what linker to use
Sometimes you want to link to a C++ library that exports C API, which
means the linker must link in the C++ stdlib, and we must use a C++
compiler for linking. The same is also applicable for objc/objc++ etc,
so we can keep using clike_langs for the priority order.

Closes https://github.com/mesonbuild/meson/issues/1653
2017-04-21 10:15:18 -07:00
Jussi Pakkanen b48daeda1a Make it possible to only do unity builds on subprojects. 2017-04-15 18:28:36 +03:00
Jussi Pakkanen 4e1249c920 Merge pull request #1549 from mesonbuild/linkwhole
Add option to link the entire contents of a static library to a target.
2017-04-15 18:16:35 +03:00
Jussi Pakkanen b951e60f06 Merge pull request #1548 from ssssam/sam/stable-ordering
Stable ordering of some commandlines generated by 'gnome' module
2017-04-13 23:59:48 +03:00
Jussi Pakkanen eaaaee6421 Merge pull request #1596 from centricular/test-rebuilds
Test that build and custom targets are rebuilt on changes
2017-04-11 22:58:23 +03:00
Dylan Baker 6402a8193a Provide nice error for invalid types to shared_library vs_module_defs
This just provides a nice error message for passing invalid types.
2017-04-10 16:15:49 -07:00
Dylan Baker c49f5aefd8 Allow using generated files to shared_library vs_module_defs. Closes #1605
This detects and allows passing a generated file as a vs_module_def, it
also adds a testcase that tests using configure_file to generate the
.def file.
2017-04-10 15:43:17 -07:00
Nirbheek Chauhan b603aba3ec Add tests for target and custom_target rebuild
Test that changing src tree headers rebuilds targets, and test that
changing any file used in a custom_target will rebuild it.
2017-04-10 22:32:41 +05:30
Jussi Pakkanen 1652dccea2 Merge pull request #1469 from centricular/install-secondary-outputs
Support multiple install dirs for built/custom targets
2017-04-09 21:57:46 +03:00
Jussi Pakkanen d152c1b5d5 Add option to link the entire contents of a static library to a target. 2017-04-08 22:14:09 +03:00
Jon Turney fd47ef3a27 Use '.exe' extension for executables for Cygwin
Use '.exe' extension for executables for Cygwin when building and installing
2017-04-06 22:47:15 +01:00
Jon Turney 5af98a5ee8 Use correct shared library naming for Cygwin
Use correct shared library naming for Cygwin when building and installing
2017-04-06 22:47:15 +01:00
Nirbheek Chauhan a4255d74f5 Don't generate import library for shared modules
Also add a test for this on all platforms.
2017-04-04 14:59:13 +05:30
Nirbheek Chauhan 57cb1f9aad Support multiple install dirs for built/custom targets
You can now pass a list of strings to the install_dir: kwarg to
build_target and custom_target.

Custom Targets:
===============
Allows you to specify the installation directory for each
corresponding output. For example:

    custom_target('different-install-dirs',
      output : ['first.file', 'second.file'],
      ...
      install : true,
      install_dir : ['somedir', 'otherdir])

This would install first.file to somedir and second.file to otherdir.

If only one install_dir is provided, all outputs are installed there
(same behaviour as before).

To only install some outputs, pass `false` for the outputs that you
don't want installed. For example:

    custom_target('only-install-second',
      output : ['first.file', 'second.file'],
      ...
      install : true,
      install_dir : [false, 'otherdir])

This would install second.file to otherdir and not install first.file.

Build Targets:
==============
With build_target() (which includes executable(), library(), etc),
usually there is only one primary output. However some types of
targets have multiple outputs.

For example, while generating Vala libraries, valac also generates
a header and a .vapi file both of which often need to be installed.
This allows you to specify installation directories for those too.

    # This will only install the library (same as before)
    shared_library('somevalalib', 'somesource.vala',
      ...
      install : true)

    # This will install the library, the header, and the vapi into the
    # respective directories
    shared_library('somevalalib', 'somesource.vala',
      ...
      install : true,
      install_dir : ['libdir', 'incdir', 'vapidir'])

    # This will install the library into the default libdir and
    # everything else into the specified directories
    shared_library('somevalalib', 'somesource.vala',
      ...
      install : true,
      install_dir : [true, 'incdir', 'vapidir'])

    # This will NOT install the library, and will install everything
    # else into the specified directories
    shared_library('somevalalib', 'somesource.vala',
      ...
      install : true,
      install_dir : [false, 'incdir', 'vapidir'])

true/false can also be used for secondary outputs in the same way.

Valac can also generate a GIR file for libraries when the `vala_gir:`
keyword argument is passed to library(). In that case, `install_dir:`
must be given a list with four elements, one for each output.

Includes tests for all these.

Closes https://github.com/mesonbuild/meson/issues/705
Closes https://github.com/mesonbuild/meson/issues/891
Closes https://github.com/mesonbuild/meson/issues/892
Closes https://github.com/mesonbuild/meson/issues/1178
Closes https://github.com/mesonbuild/meson/issues/1193
2017-04-04 14:59:13 +05:30
Jussi Pakkanen 8b73d80792 Merge pull request #1457 from mesonbuild/overrides
Add MVP implementation of overriding options.
2017-04-03 23:31:32 +03:00
Sam Thursfield f5b7cfdbf0 Ensure rules in the generated build.ninja file are in a stable order
Previously, two functionally identical builds could produce different
build.ninja files.  The ordering of the rules themselves doesn't affect
behaviour, but unnecessary changes in commandline arguments can cause
spurious rebuilds and if the ordering of the overall file is stable
than it's easy to use `diff` to compare different build.ninja files
and spot the differences in ordering that are triggering the unnecessary
rebuilds.
2017-04-03 17:02:41 +01:00
Jussi Pakkanen c7f66c3a9e Merge pull request #1505 from centricular/dont-use-c++-for-assembly
Try harder to use the C compiler for compiling asm
2017-04-02 00:15:22 +03:00
Jussi Pakkanen cf97c7af81 Use get_option_for_target for builtins where sensible. 2017-04-02 00:07:23 +03:00
Jussi Pakkanen e5a6283c4c Add MVP implementation of overriding options. 2017-04-02 00:04:45 +03:00
Patrick Griffis 9929e0efac rust: Support executable name differing from source name 2017-03-29 21:09:51 +03:00
Nirbheek Chauhan 001cf52c3a Try even harder to use the C compiler for assembly
Now as long as you have a C compiler available in the project, it will
be used to compile assembly even if the target contains a C++ compiler
and even if the target contains only assembly and C++ sources.

Earlier, the order in which sources appeared in a target would decide
which compiler would be used.

However, if the project only provides a C++ compiler, that will be
used for compiling assembly sources.

If this breaks your use-case, please tell us.

Includes a test that ensures that all of the above is adhered to.
2017-03-27 14:40:34 +05:30
Nirbheek Chauhan 14d0f38158 Try harder to use the C compiler for compiling asm
Use an ordered dict for the compiler dictionary and sort it according
to a priority order: fortran, c, c++, etc.

This also ensures that builds are reproducible because it would be
a toss-up whether a C or a C++ compiler would be used based on the
order in which compilers.items() would return items.

Closes https://github.com/mesonbuild/meson/issues/1370
2017-03-27 11:25:22 +05:30
Nirbheek Chauhan 7f80f81ac9 Preserve the order of internal deps in a target
We were adding them to the CompilerArgs instance in the order in which
they are specified, which is wrong because later dependencies would
override previous ones. Add them in the reverse order instead.

Closes https://github.com/mesonbuild/meson/issues/1495
2017-03-23 10:26:29 +05:30
Nicolas Schneider b434fcd12b vs: support Generator outputs as CustomTarget inputs
This changes how generated files are added to the VS project.
Previously, they were all added as a single CustomBuildStep with all
generator commands, inputs and outputs merged together.
Now, each input file is added separately to the project and is given a
CustomBuild command. This adds all generator input files to the files list
in the VS gui and allows to run only some of the generator commands if
only some of the input files have changed.
2017-03-20 14:33:44 +01:00
Nirbheek Chauhan a24651f33a darwin: Also add the major version in the dylib
And symlink to the unversioned library for build-time linking.

https://developer.apple.com/library/content/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/DynamicLibraryDesignGuidelines.html#//apple_ref/doc/uid/TP40002013-SW2

Unlike Autotools, we do not add the minor or micro version in the
filename because the Apple documentation says you must embed that inside
the library with -current_version.
2017-03-04 09:12:51 -05:00
Nirbheek Chauhan 303b8819ec Nuke dead code which was used for installing PDB files
We check for the existence of PDB files in the install script, so we
don't need to do all this mucking about here. That's more robust too
because we don't need to parse build arguments in buildtype=plain
and decide if the PDB file would be generated.
2017-03-03 15:52:31 +05:30
Jussi Pakkanen b927468137 Use cross stripper when cross compiling and allow overriding native strip executable. Closes #1414. 2017-02-27 16:49:32 -05:00
Jussi Pakkanen d6614ba811 Merge pull request #1402 from centricular/test-setup-fixes
Various fixes to how mesontest handles test setups.
2017-02-20 14:56:45 -05:00
Nirbheek Chauhan f3ff8fe6b7 custom_target: Substitute input into output
This means replacing @PLAINNAME@ and @BASENAME@ in the outputs. This is
the same feature as generator().

This is only allowed when there is only one input file for obvious
reasons + failing test for this.
2017-02-20 23:32:03 +05:30
Nirbheek Chauhan 73b2ee08a8 Rewrite custom_target template string substitution
Factor it out into a function in mesonlib.py. This will allow us to
reuse it for generators and for configure_file(). The latter doesn't
implement this at all right now.

Also includes unit tests.
2017-02-20 23:32:03 +05:30
Nirbheek Chauhan f1fe823763 Add repr() for EnvironmentVariables{,Holder}
Makes it easier to debug issues with it
2017-02-19 23:13:32 +05:30
Nirbheek Chauhan 15b6915954 custom_target: Recursively flatten `command:`
Without this, files() in the arguments give an error because it's a list
of mesonlib.File objects:

  Array as argument 1 contains a non-string.

It also breaks in nested lists. Includes a test for this.
2017-02-17 15:42:12 -05:00
Nirbheek Chauhan bc8c0730f3 Add __repr__ for IncludeDirs
Helps debug issues with include directory handling.
2017-01-28 05:09:58 +05:30
Nirbheek Chauhan 2bb58c909f Use CompilerArgs for generation of compile commands
At the same time, also fix the order in which compile arguments are
added. Detailed comments have been added concerning the priority and
order of the arguments.

Also adds a unit test and an integration test for the same.
2017-01-28 05:09:51 +05:30
Jussi Pakkanen a32e3023f8 Add build_by_default to list of kwargs know by CustomTarget. 2017-01-26 21:57:29 +02:00
Nirbheek Chauhan 7d6f628ed4 Support file perms for install_data and install_subdir
With the 'install_mode' kwarg, you can now specify the file and
directory permissions and the owner and the group to be used while
installing. You can pass either:

* A single string specifying just the permissions
* A list of strings with:
  - The first argument a string of permissions
  - The second argument a string specifying the owner or
    an int specifying the uid
  - The third argument a string specifying the group or
    an int specifying the gid

Specifying `false` as any of the arguments skips setting that one.

The format of the permissions kwarg is the same as the symbolic
notation used by ls -l with the first character that specifies 'd',
'-', 'c', etc for the file type omitted since that is always obvious
from the context.

Includes unit tests for the same. Sadly these only run on Linux right
now, but we want them to run on all platforms. We do set the mode in the
integration tests for all platforms but we don't check if they were
actually set correctly.
2017-01-24 00:20:51 +05:30
Mike Sinkovsky 969be1f679 cleanup: Remove redundant parentheses 2017-01-18 21:22:47 +02:00
Jussi Pakkanen cfc33ac421 Merge pull request #1303 from mesonbuild/buildonall
Add kwarg build_by_default
2017-01-15 21:28:10 +02:00
Jussi Pakkanen 21d8505825 build_by_default it is. 2017-01-15 20:14:46 +02:00
Jussi Pakkanen 58878b998d Get rid of hasattr. 2017-01-15 19:45:23 +02:00
Jussi Pakkanen db8ad2a4bd Add test for build_on_all. 2017-01-15 19:45:23 +02:00
Jussi Pakkanen 7abc7c64b0 Created base class for all targets and moved common functionality there. 2017-01-15 19:45:23 +02:00
Elliott Sales de Andrade 78b030cf19 Add support for Files passed to generators.
I need this for windows.compile_resources to be able to use
configure_file results, but it may have other benefits.
2017-01-12 03:25:08 -05:00
Mike Sinkovsky 5b626ab4cb style: [E1**] Indentation 2017-01-11 12:33:27 -05:00
Mike Sinkovsky c8981bdd1b style: [E711] comparison to None should be 'if cond is None:' 2017-01-11 12:33:27 -05:00
Jussi Pakkanen 00f62d0755 Can get values in ConfigurationData objects. 2017-01-06 14:01:45 -05:00
Jussi Pakkanen fdd0675661 Better error messages. Closes #1284. 2017-01-06 14:00:00 -05:00
Jussi Pakkanen ee8a6e6fc5 Can specify test setups and run them with mesontest. 2017-01-02 23:52:50 +02:00
Igor Gnatenko f0bc5568a7 style: fix E703 violations
E703: statement ends with a semicolon

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2017-01-01 12:02:05 -05:00
Igor Gnatenko 969dc7e995 style: fix E124 violations
E124: closing bracket does not match visual indentation

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2017-01-01 12:02:05 -05:00
Igor Gnatenko 116da33cdd style: fix E128 violations
E128: continuation line under-indented for visual indent

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2017-01-01 12:02:05 -05:00
Igor Gnatenko f19bec34a9 style: fix E271 violations
E271: multiple spaces after keyword

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2017-01-01 12:02:05 -05:00
Igor Gnatenko ef608f217d style: fix E222 violations
E222: multiple spaces after operator

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2017-01-01 12:02:05 -05:00
Jussi Pakkanen b55235dfbd Fix space before :. 2016-12-31 16:28:15 +02:00
Jussi Pakkanen 4b7c39d9d1 Merge pull request #1247 from centricular/fix-installed-soname-aliases
Fix soname symlinking after installation
2016-12-23 00:28:00 +02:00
Elliott Sales de Andrade 18c38df875 Add Generator.process_files to reduce code duplication. 2016-12-22 17:08:32 +02:00
Nirbheek Chauhan 0ac965cc10 Fix shared library symlink aliasing on install
Set the rules for the symlinking on the target itself, and then reuse
that information while generating aliases during the build, and then
pass it to the install script too.
2016-12-22 02:27:01 +05:30
Elliott Sales de Andrade c7f788e184 Fix exception when linking with invalid object.
If you declare_dependency(link_with : 'string'), an exception is
supposed to be raised, but instead of a proper message, it's an
exception about a missing attribute.
2016-12-21 00:10:39 +02:00
Jussi Pakkanen a2528a8816 Merge pull request #1233 from mesonbuild/wip/ignatenko/code-style
Trivial cleanups in code
2016-12-21 00:09:44 +02:00
Jussi Pakkanen 98c4fd2d5d Add per target argument for Fortran. 2016-12-20 22:46:36 +02:00
Nirbheek Chauhan 589a56e78f Cache the scripts used for postconf and install phases
Cache the absolute dir that the script is searched in and the name of
the script. These are the only two things that change.

Update the test to test for both #1235 and the case when a script of the
same name is in a different directory (which also covers the subproject
case).

Closes #1235
2016-12-20 00:09:02 +02:00
Igor Gnatenko 139e020ede tree-wide: use proper 'not in' notation
Let's be more pythonic and 'not is' seems really weird.

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-12-19 21:48:35 +01:00
Igor Gnatenko 8268eb4959 tree-wide: remove unused imports
./setup.py:17:1: F401 'os' imported but unused
import os
^
./setup.py:37:1: F401 'stat.ST_MODE' imported but unused
from stat import ST_MODE
^
./run_tests.py:17:1: F401 'os' imported but unused
import subprocess, sys, os
^
./run_tests.py:18:1: F401 'shutil' imported but unused
import shutil
^
./run_unittests.py:23:1: F401 'mesonbuild.dependencies.Qt5Dependency' imported but unused
from mesonbuild.dependencies import PkgConfigDependency, Qt5Dependency
^
./mesonbuild/build.py:15:1: F401 '.coredata' imported but unused
from . import coredata
^
./mesonbuild/interpreter.py:32:1: F401 'subprocess' imported but unused
import os, sys, subprocess, shutil, uuid, re
^
./mesonbuild/interpreter.py:32:1: F401 're' imported but unused
import os, sys, subprocess, shutil, uuid, re
^
./mesonbuild/dependencies.py:23:1: F401 'subprocess' imported but unused
import os, stat, glob, subprocess, shutil
^
./mesonbuild/mesonlib.py:17:1: F401 'sys' imported but unused
import platform, subprocess, operator, os, shutil, re, sys
^
./mesonbuild/modules/qt5.py:15:1: F401 'subprocess' imported but unused
import os, subprocess
^
./mesonbuild/modules/pkgconfig.py:15:1: F401 '..coredata' imported but unused
from .. import coredata, build
^
./mesonbuild/scripts/scanbuild.py:15:1: F401 'sys' imported but unused
import sys, os
^
./mesonbuild/scripts/meson_exe.py:20:1: F401 'subprocess' imported but unused
import subprocess
^
./mesonbuild/scripts/meson_exe.py:22:1: F401 '..mesonlib.MesonException' imported but unused
from ..mesonlib import MesonException, Popen_safe
^
./mesonbuild/scripts/symbolextractor.py:23:1: F401 'subprocess' imported but unused
import os, sys, subprocess
^
./mesonbuild/scripts/symbolextractor.py:25:1: F401 '..mesonlib.MesonException' imported but unused
from ..mesonlib import MesonException, Popen_safe
^
./mesonbuild/scripts/meson_install.py:19:1: F401 '..mesonlib.MesonException' imported but unused
from ..mesonlib import MesonException, Popen_safe
^
./mesonbuild/scripts/yelphelper.py:15:1: F401 'sys' imported but unused
import sys, os
^
./mesonbuild/scripts/yelphelper.py:20:1: F401 '..mesonlib.MesonException' imported but unused
from ..mesonlib import MesonException
^
./mesonbuild/backend/vs2010backend.py:17:1: F401 're' imported but unused
import re
^
./test cases/vala/8 generated sources/src/copy_file.py:3:1: F401 'os' imported but unused
import os
^
./test cases/common/107 postconf/postconf.py:3:1: F401 'sys' imported but unused
import sys, os
^
./test cases/common/129 object only target/obj_generator.py:5:1: F401 'shutil' imported but unused
import sys, shutil, subprocess
^
./test cases/common/57 custom target chain/usetarget/subcomp.py:3:1: F401 'os' imported but unused
import sys, os
^
./test cases/common/95 dep fallback/subprojects/boblib/genbob.py:3:1: F401 'os' imported but unused
import os
^
./test cases/common/98 gen extra/srcgen.py:4:1: F401 'os' imported but unused
import os
^
./test cases/common/113 generatorcustom/gen.py:3:1: F401 'os' imported but unused
import sys, os
^
./test cases/common/113 generatorcustom/catter.py:3:1: F401 'os' imported but unused
import sys, os
^
./test cases/common/59 object generator/obj_generator.py:5:1: F401 'shutil' imported but unused
import sys, shutil, subprocess
^

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-12-19 18:19:35 +01:00
Nirbheek Chauhan c693bd9bb4 Allow passing arguments to install scripts
Closes #1213
2016-12-18 18:30:47 +02:00
Nirbheek Chauhan d5f7ba862b gnome.mkenums: Use absolute paths for all commandline args
Closes #973

test cases/vala/8 generated sources/ tests this.
2016-12-15 14:58:43 +05:30
Nirbheek Chauhan 2c83bd16fc Test targets with only generated and prebuilt objects 2016-12-13 09:37:48 +05:30
Nirbheek Chauhan 038b15a7b2 Add __repr__ for ExtractedObjects and better error for Vala libraries 2016-12-13 09:37:47 +05:30
Nirbheek Chauhan d766475176 Use the linker to determine if we are using MSVC
This is much more accurate since this is actually what determines what
file naming to use and whether there will be PDB debugging information
or not.

Closes #1169
2016-12-13 09:37:47 +05:30
Nirbheek Chauhan 82a77609e8 Query the target itself for the dynamic linker
This greatly improves the logic for determining the linker. Previously,
we would completely break if a target contained only extracted objects
and we were using more than one compiler in our project.

This also fixes determination of the linker if our target only contains
generated objc++ sources, and other funky combinations.
2016-12-13 09:37:47 +05:30
Nirbheek Chauhan 0fc4ad2a0b Also use objects to populate target compilers
This avoids us having no compilers at all for targets that are composed
entirely of objects with no sources.

Now we will always have a compiler for a target even if it is composed
entirely of objects generated with custom targets unless it has
completely unknown sources.
2016-12-13 09:20:34 +05:30
Nirbheek Chauhan 7b3d00fee4 Use dict for self.build.compilers instead of list
Everywhere we use this object, we end up iterating over it and comparing
compiler.get_language() with something. Using a dict is the obvious
choice and simplifies a lot of code.
2016-12-13 09:20:34 +05:30
Jussi Pakkanen f62f730821 Merge pull request #1126 from mesonbuild/sharedmodule
Support for shared modules
2016-12-07 21:49:16 +02:00
Jussi Pakkanen 3276bdd23d Merge pull request #1102 from mesonbuild/soname
Fix soname symlink generation
2016-12-02 23:57:19 +02:00
Jussi Pakkanen 6d84b9b646 Created new shared module build target type, and make sure -Wl,--no-undefined is not used when linking it. 2016-12-02 21:55:56 +02:00
Jussi Pakkanen 07d7e87411 Allow soname to be an arbitrary string and fix symlink generation. 2016-11-26 22:16:05 +02:00
Nirbheek Chauhan 864b9b1957 Only check for unity compat when doing unity builds
Also don't bother setting self.unity_compatible since it will never be
checked.

Closes #1097
2016-11-24 03:51:11 +05:30
Jussi Pakkanen c9a46fcc93 Can set compiler arguments in Java. 2016-11-20 16:57:58 -05:00
Jussi Pakkanen a01919976e Always specify installed data with a File object. Closes #858. 2016-11-18 17:37:35 -05:00
Guillaume Poirier-Morency b2a39dd06e vala: Generate GIR into the build directory (fix #185)
Add a Vala test generating GIR and typelib files.
2016-11-12 18:03:24 -05:00
Thibault Saunier 85a0cd7635 Add new add_project_[link]_args functions
Fixes 979
2016-11-12 17:34:06 -05:00
Nirbheek Chauhan a2262103fb Implement mlog.warning and use it everywhere for warnings
Prepends the string with 'WARNING:' in ANSI yellow.

Closes https://github.com/mesonbuild/meson/issues/961
2016-11-08 17:43:24 -05:00
Jussi Pakkanen 6762d30c6a Exposes the install names of targets in introspection. Closes #829. 2016-10-30 06:46:08 -07:00
Jussi Pakkanen 2d058bdcff Merge pull request #912 from valum-framework/wip/vala-custom-header-and-vapi
vala: Custom header and vapi name (fix #892)
2016-10-25 10:06:49 -07:00
Guillaume Poirier-Morency 114b5b0637 vala: Use 'vala_header' and 'vala_vapi' directly
Move the fallback logic into 'BuildTarget.process_kwargs' to use the
target name instead.
2016-10-24 18:01:27 -04:00
Guillaume Poirier-Morency ff6b3c7a2d vala: Custom header and vapi name (fix #892) 2016-10-24 18:01:27 -04:00
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
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
Nirbheek Chauhan 6f4406928b BuildTarget: Add compilers needed by generated sources 2016-10-21 07:11:11 +05:30
Nirbheek Chauhan 65e9761cb1 Support all kinds of generated vala and vapi sources
This is the first step in making Vala support have feature-parity with
C/C++ support. Vala and Vapi sources generated with Generators and
CustomTargets are no longer ignored. Dependencies are setup properly and
they are added to the commandline.
2016-10-19 20:46:04 +05:30
Nirbheek Chauhan 419b84784f CustomTarget: Use get_outputs() instead of get_filename()
get_filename() made no sense for CustomTarget since it can have multiple
outputs. Also use get_outputs() for GeneratedList since it has the same
meaning and remove unused set_generated().

As a side-effect, we now install all the outputs of a CustomTarget.
2016-10-19 20:42:11 +05:30
Elliott Sales de Andrade 779788ad82 Split generator @BASENAME@ at the first extension. 2016-10-13 21:28:26 +03:00
Nirbheek Chauhan d819914af0 pkgconfig: Warn if library has name_prefix/suffix set
GCC/Clang won't be able to find it via an -lfoo flag, so the pkg-config
file might be unusable.

Fixes https://github.com/mesonbuild/meson/issues/889
2016-10-12 13:40:08 +05:30
Jussi Pakkanen 3a3db9fc5e Merge pull request #885 from centricular/fix-staticlib-pic-error
Warn if -fPIC is passed instead of pic to static libraries (instead of erroring out)
2016-10-10 21:30:20 +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
Nirbheek Chauhan 2d0eb2cec5 Warn if -fPIC is passed instead of pic to static libraries
Also print the name of the static library that has PIC-related issues,
print more details in exceptions, and test for all this.
2016-10-10 23:28:19 +05:30
Nirbheek Chauhan ce1393609f Error out if shared lib links to static lib without PIC
This is only needed on Linux and BSD. So, we always unconditionally
enable self.pic for Windows and OS X.
2016-10-08 01:02:16 +05:30
Nirbheek Chauhan ee8b3b12a0 Add cross-platform PIC support for static libraries
With C/C++, on Windows you don't need to pass any arguments for a static
library to be PIC. On UNIX platforms you need to pass -fPIC.

Other languages such as D have compiler-specific PIC arguments required
for PIC support in static libraries on UNIX platforms.

This kwarg allows people to specify which static libraries should be
built with PIC support. This is usually used for static libraries that
will be linked into shared libraries.
2016-10-08 01:02:13 +05:30
Nirbheek Chauhan 89753ecc27 Use per-target compilers while generating targets
This is definitely more correct since it takes into account the
cross-compilation status. We also now do the Java and CSharp sanity
checks on the BuildTarget level instead of in the Ninja backend.
2016-09-27 00:27:38 +05:30
Nirbheek Chauhan 98e7625c64 Add a list of compilers used to each BuildTarget
When the BuildTarget (executable, shared-library, static-library, etc)
is created, process the source list and assign compilers to this target.
This allows us to do compiler-specific file-naming without resorting to
ugly hacks.

This is one step towards consolidating all the 'what language does this
target use' checks and the 'this target should only have $lang files as
sources' checks we have all over the codebase. All those checks should
be done only when the target is created.
2016-09-27 00:27:38 +05:30
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
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
Jussi Pakkanen c334eeda76 Merge pull request #684 from mesonbuild/pdb
Create pdb files with MSVC
2016-09-11 13:04:55 +03:00
Nirbheek Chauhan 0840a908f2 ninjabackend: Add support for installing .pdb files
.pdb files are files created by MSVC which have debug symbols. These are
created when /ZI or /Zi is passed to the compiler and /DEBUG to the
linker.
2016-09-11 10:10:47 +05:30
Jussi Pakkanen 165f8a913d Better error message when trying to use subprojects as dependencies. 2016-09-07 21:25:34 +03:00
Jussi Pakkanen b7392bb290 Merge pull request #696 from mesonbuild/depfile
Add support for dependency files in custom targets.
2016-08-27 16:43:14 +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
Jussi Pakkanen 7cd6206d9a Check for embedded @OUTPUT@s in commands. 2016-08-27 14:41:14 +03:00
Elliott Sales de Andrade 3e09aa9f11 Don't allow @OUTPUT@ when capturing output. 2016-08-26 20:46:42 -04:00
Elliott Sales de Andrade 70d94a5550 Allow capturing command output of a custom target.
For commands that always output to stdout and don't have a "-o" or
"--output" or some other similar option, this 'capture' setting allows
the build to capture the result and place it in the output file.
2016-08-26 20:46:42 -04:00
Jussi Pakkanen 6ae40344e0 Merge pull request #680 from centricular/osx-dylib-soversion
Add a test to find libfoo.X.dylib via -lfoo
2016-08-21 14:12:19 +03:00
Jussi Pakkanen 399d653803 Merge pull request #685 from ximion/master
Implement D support
2016-08-21 13:22:19 +03:00
Matthias Klumpp 12a01c26f3 trivial: Use stringlistify 2016-08-21 01:40:29 +02:00
Jussi Pakkanen c02a175d52 Add depfile support to generators. 2016-08-21 00:12:56 +03:00
Jussi Pakkanen 3ae918a463 Add support for dependency files in custom targets. 2016-08-20 21:01:49 +03: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 88037c4385 shared_library: Add vs_module_defs to link_depends
With this, if the module definitions file is edited, the shared library
and all reverse-dependencies will be re-linked.

Fixes #643
2016-08-18 20:53:34 +05:30
Nirbheek Chauhan 5f3097a492 Don't add the soversion to the dylib filename on OS X
Doing so messes up library search with -lfoo.
See: https://github.com/mesonbuild/meson/pull/680
2016-08-16 16:14:10 +05:30
Nirbheek Chauhan e0dcb3160a BuildTarget: Print a better message when passing GeneratedList to 'objects' (#681) 2016-08-15 20:45:37 +02:00
Nirbheek Chauhan d8b9b12adb Ninja now supports backslash in command args, so we can too
At the same time, this also adds a bunch of tests that document and keep
track of how we expect quoting to pass through via Ninja to the
compiler.

We need at least Ninja 1.6.0 for this.

This fixes https://github.com/mesonbuild/meson/issues/489
2016-07-29 19:51:09 +05:30
Jussi Pakkanen 64919b1c74 Merge pull request #417 from nirbheek/dll-paths
Fix filenames and paths used in DLL shared library generation
2016-07-13 22:18:50 +03:00
Nirbheek Chauhan 358598816f build: Fix implementation of sources_are_suffix
The first file might be a header file, in which case this test will
fail, so check all the files till a match is found instead.

Also remove duplicate and incorrect can_compile check. It just checks
the suffix and we already check that above.
2016-07-05 16:24:10 +05:30
Nirbheek Chauhan 4516e8a49f Add repr() implementations for build targets and File
This aids debugging
2016-07-01 20:50:47 +05:30
Nirbheek Chauhan 64cb70441b CustomTarget: Use mesonlib.File objects as-is in the command to be run
This allows us to output either the relative or absolute path as
requested. Fixes usage of configure_file inside CustomTarget commands
with the VS backends.
2016-07-01 20:50:47 +05:30
Nirbheek Chauhan 0143c32c7c Overhaul versioning and naming of libraries
This commit contains several changes to the naming and versioning of
shared and static libraries. The details are documented at:
https://github.com/mesonbuild/meson/pull/417

Here's a brief summary:

* The results of binary and compiler detection via environment functions
  are now cached so that they can be called repeatedly without
  performance penalty. This is necessary because every
  build.SharedLibrary object has to know whether the compiler is MSVC or
  not (output filenames depend on that), and so the compiler detection
  has to be called for each object instantiation.

* Linux shared libraries don't always have a library version. Sometimes
  only soversions are specified (and vice-versa), so support both.

* Don't use versioned filenames when generating DLLs, DLLs are never
  versioned using the suffix in the way that .so libraries are. Hence,
  they don't use "aliases". Only Linux shared libraries use those.

* OS X dylibs do not use filename aliases at all. They only use the
  soversion in the dylib name (libfoo.X.dylib), and that's it. If
  there's no soversion specified, the dylib is called libfoo.dylib.
  Further versioning in dylibs is supposed to be done with the
  -current_version argument to clang, but this is TBD.

  https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/DynamicLibraryDesignGuidelines.html#//apple_ref/doc/uid/TP40002013-SW23

* Install DLLs into bindir and import libraries into libdir

* Static libraries are now always called libfoo.a, even with MSVC

* .lib import libraries are always generated when building with MSVC

* .dll.a import libraries are always generated when building with
  MinGW/GCC or MinGW/clang

* TODO: Use dlltool if available to generate .dll.a when .lib is
  generated and vice-versa.

* Library and executable suffix/prefixes are now always correctly
  overriden by the values of the 'name_prefix' and 'name_suffix' keyword
  arguments.
2016-07-01 20:50:47 +05:30
Jussi Pakkanen 0733c0f9a1 Changed run_target to take command as kwarg and add depends. This makes it behave the same as custom_target. 2016-06-24 23:07:57 +03:00
Jussi Pakkanen 475175f4b5 Can use generator outputs in custom targets. Closes #587. 2016-06-13 21:17:13 +03:00
Jussi Pakkanen cff4e7d299 Can query version strings of dependencies. 2016-05-29 03:15:16 +03:00
Jussi Pakkanen 4377f773e0 Can set global linker arguments. Closes #536. 2016-05-28 21:31:59 +03:00
Jussi Pakkanen df03f849a8 Merge pull request #542 from mesonbuild/ownstdlib
Build transparently with a custom standard library
2016-05-25 23:44:24 +03:00
Jussi Pakkanen babdb27570 Merge pull request #479 from mesonbuild/i18n
Moved gettext into i18n module.
2016-05-25 17:53:35 +03:00
Jussi Pakkanen afe7252476 Can specify a stdlib subproject that is used implicitly on all targets with said language. 2016-05-21 21:46:03 +03:00
Jussi Pakkanen dc148e0702 Remove all special casing for gettext and use elementary operations instead. 2016-05-21 18:21:23 +03:00
Nirbheek Chauhan 35ef1d109a CustomTarget: require install_dir only when install is true (#519) 2016-04-17 22:52:10 +03:00
Jussi Pakkanen cab5ce4fc0 Merge pull request #438 from trhd/testing_options
New options for controlling test output.
2016-04-06 23:10:20 +03:00
Jussi Pakkanen 873ffe782c Merge pull request #390 from nirbheek/msvc-module-defs
Add support for passing a module definitions file for exporting symbols while linking
2016-04-03 18:12:18 +03:00
Hemmo Nieminen 336904b553 Move MesonException from coredata to mesonlib. 2016-04-01 00:52:45 +03:00
Nirbheek Chauhan 1713fa0297 Add shared_library argument for a Visual Studio module definitions file
On MSVC, shared libraries only export symbols that have been explicitly exported
either as part of the symbol prototype or via a module definitions file.

On compilers other than MSVC, all symbols are exported in the shared library by
default and the format for the list of symbols to export is different, so this
is only used with the VisualStudio compiler.

The module defs file path can either be relative to the current source directory
or an absolute path using meson.source_root() + '/some/path'
2016-03-30 16:24:35 +05:30
Jussi Pakkanen 12a4e7d7e7 Moved gettext into i18n module. 2016-03-28 20:15:16 +03:00
Jussi Pakkanen 317a735b07 Error out if using a not found binary in the build. Closes #469. 2016-03-23 21:26:55 +02:00
Nicolas Schneider 4d9db21039 vs2010: fix dependencies of CustomTarget 2016-03-16 00:00:39 +01:00
Nicolas Schneider 92187501ed Can add postconfigure script. 2016-03-01 14:07:38 +01:00
Jussi Pakkanen 52b66edb6c Can specify compile and link args for internal deps. 2016-02-29 21:28:16 +02:00
Jussi Pakkanen 836b121a9c Refix Linux. 2016-02-22 00:09:06 +02:00
Jussi Pakkanen a04c33e125 Can build Python extension on OSX. 2016-02-21 17:12:09 +02:00
Jussi Pakkanen 98d00386b1 Can build a Python extension module. 2016-02-21 14:52:36 +02:00
Nirbheek Chauhan 36c9a165ed build.CustomTarget: Also accept mesonlib.File types as 'command' arguments 2016-02-17 14:45:50 +05:30
Jussi Pakkanen 23b98cd6e6 Renamed meson package to mesonbuild so that we can have a script named meson in the same toplevel dir. 2016-01-16 17:35:29 +02:00