Commit Graph

51 Commits

Author SHA1 Message Date
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