Commit Graph

492 Commits

Author SHA1 Message Date
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 2e986ae30d backend: Raise a RuntimeError if an unknown object is added to the command list
This allows us to catch these errors early and print a useful message
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 68dbbeb78f Octopus merged cross fixes and genetor custom because why not. 2016-06-16 21:03:57 +03:00
Noam Meltzer 038e575d78 determine_linker(): choose static cross linker for cross compiling
somewhere after 0.29.0 a bug was introduced where the LINK_ARGS of the
native static linker were used instead of the cross static linker
2016-06-16 20:52:03 +03:00
Jussi Pakkanen 475175f4b5 Can use generator outputs in custom targets. Closes #587. 2016-06-13 21:17:13 +03:00
Nicolas Schneider a29d9c2c33 vs: fix generators that use indexed output replacements (like @OUTPUT0@) 2016-05-26 13:08:33 +02: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 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 46ce7a9d4b Merge pull request #516 from centricular/cross-compile_32bit-x86_on_64bit-x86_exe-wrapper
Special-case the 32-bit executable on 64-bit x86 case while cross-compiling
2016-05-01 18:56:07 +03:00
Jussi Pakkanen 2e2df70dd0 Merge branch 'centricular-customtarget-path-windows' 2016-05-01 18:39:45 +03:00
Nicolas Schneider 060f195fe0 vs2010: add generated libs as link dependencies 2016-04-19 23:25:45 +02:00
Nirbheek Chauhan 86aa51232e backends: Don't duplicate test setup data file name
Instead, return the values of the test and benchmark setup data files so
that the ninja/osx/vs backends can use those filenames instead of
hard-coding them.
2016-04-15 05:49:42 +05:30
Nirbheek Chauhan e3bc2e5c68 ninja: Set PATH for CustomTargets with built EXEs on Windows
When a CustomTarget is run with a command that is an executable built
by the project which also has a DLL built in the same project as a
dependency, the EXE can't run on Windows because the DLL can't be found.
On UNIX-like systems, we set the RPATH using the linker so these
dependencies can be found, but on Windows the only way is to set the
PATH environment variable.

The same problem exists for tests, so we reuse that infrastructure by
creating a new meson_exe.py script that can be used as a wrapper to run
CustomTarget commands on Windows. This can later also be extended to add
support for setting an environment while calling the command needed to
generate a CustomTarget: https://github.com/mesonbuild/meson/issues/266
2016-04-15 05:49:42 +05:30
Nirbheek Chauhan c0765b0e8d Don't require an exe_wrapper when cross-compiling 32-bit on 64-bit
Almost all 64-bit x86 OSes can run 32-bit x86 binaries natively. Detect
that case and don't require an exe wrapper.
2016-04-15 00:25:34 +05:30
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 16b3e22016 Removed lingering coverage flags. 2016-04-04 01:41:56 +03:00
Hemmo Nieminen 336904b553 Move MesonException from coredata to mesonlib. 2016-04-01 00:52:45 +03:00
Jussi Pakkanen 67377e69b5 Invoke depfixer in-process to make it faster. Closes #480. 2016-03-30 22:09:36 +03:00
Jussi Pakkanen 1d89d091f8 Merge branch 'vs-extraargs' 2016-03-29 22:32:48 +03:00
Nicolas Schneider a33d9d56cf vs2010: support EXTRA_ARGS for generators 2016-03-29 12:08:34 +02:00
Nicolas Schneider 8787ec3ea2 vs2010: fix object extraction with same source file name
This also refactors determine_ext_objs() to use inheritance instead of a
method flag for determining the object output name.
2016-03-25 09:49:30 +01:00
Jussi Pakkanen d87eb7d290 Merge branch 'base_options'. 2016-03-20 22:04:24 +02:00
Jussi Pakkanen 9071c8fc45 Merge branch 'Custom target absolute paths'. 2016-03-20 21:39:49 +02:00
Jussi Pakkanen 0c63f75aaf Converted coverage into a base option. 2016-03-20 19:16:49 +02:00
Jussi Pakkanen b5c7cca0dc Works when mixing Java and C. 2016-03-17 21:24:13 +02:00
Nicolas Schneider d72cc6e6f8 vs2010: fix object extraction
1. Dependencies must be set up with the target's id instead of its
basename.
2. Extracted object output file names must not include the directory
prefix, because MSBuild puts all object files into the same directory
and names them srcfilename.obj instead of dir/filename.obj or
dir_filename.obj.
2016-03-17 12:37:38 +01:00
Nicolas Schneider e067c4a79d fix eval_custom_target_command() to use absolute paths for output files 2016-03-15 23:26:12 +01:00
Nicolas Schneider 749aeefe0c pass meson source and build dirs as env variables for postconf scripts 2016-03-03 22:28:56 +01:00
Nicolas Schneider 9f9f73fa52 add args support for add_postconf_script 2016-03-01 14:31:37 +01:00
Nicolas Schneider 92187501ed Can add postconfigure script. 2016-03-01 14:07:38 +01:00
Jussi Pakkanen 2d32c39471 Handle built targets in custom rules. Closes #411. 2016-02-29 20:51:25 +02:00
Minijackson 3b688c6114 Create directories of unity temporary files 2016-02-24 15:07:43 +01:00
Martin Ejdestig 47db4e3d53 Pass warning arguments to compiler even if buildtype is plain
Noticed when trying to pass custom optimization flags, and hence setting
buildtype to plain, that warnings for different levels were not passed to
compiler.

This was a bit confusing since mesonconf still displayed "warning_level=3"
and -Werror was passed correctly due to "werror=true". So this change
aligns warning_level behavior with werror. That is, heed what is in
project() in meson.build but user can still override if necessary.
2016-02-22 18:57:07 +01:00
Jussi Pakkanen 560d9d7375 Merge pull request #398 from nirbheek/target-link-implib
Re-introduce patch to fix linking with MSVC by linking with import library.
2016-02-21 13:25:51 +02:00
Nirbheek Chauhan 81544feffe Explicitly use the import library while generating link args for a target 2016-02-20 02:17:51 +05:30
Jussi Pakkanen aaf6075c89 Reverted implib patch as it broke mingw completely. 2016-02-17 23:09:39 +02:00
Nirbheek Chauhan deff35eef6 Filter out UNIX flags from external deps when using the MSVC compiler
This is very useful to prevent compiler noise about invalid cflags; particularly
for the -mms-bitfields cflag which most libraries send to the mingw-gcc
compiler. More can be added later.
2016-02-17 20:22:34 +02:00
Nirbheek Chauhan 440d73902d Explicitly use the import library while generating link args for a target 2016-02-17 20:13:24 +02:00
Nirbheek Chauhan 8bd0f432a0 backends: Clarify the reason behind a grotesque hack 2016-02-17 15:03:54 +05:30
Jussi Pakkanen 7435df8399 Moved backends to their own module. 2016-01-23 20:02:52 +02:00