Commit Graph

905 Commits

Author SHA1 Message Date
Marcel Hollerbach 468d1a05ec meson: cache get_target_generated_dir
This reduces the build time about 2 sec. The result itself is not hard
to calculate. However, persistent join calls with the same 2 strings are
not that usefull. This also caused about 600'000 calls to
get_target_dir, we are now down to 60'000 calls form this function to
get_target_dir.
2018-11-02 21:04:13 +02:00
Jon Turney 99b0a7acda Fix flake8 whitespace reports
$ flake8 | grep -E '(E128|E203|E221|E226|E303|W291|W293)'
./mesonbuild/backend/backends.py:32:1: E303 too many blank lines (3)
./mesonbuild/modules/i18n.py:90:56: E128 continuation line under-indented for visual indent
2018-10-24 19:11:46 +03:00
Jon Turney 93f7b83bf5 Fix flake8 'imported but unused' reports
$ flake8 | grep F401
./mesonbuild/minstall.py:15:1: F401 'gzip' imported but unused
./mesonbuild/backend/backends.py:26:1: F401 '..compilers.get_macos_dylib_install_name' imported but unused
./mesonbuild/backend/backends.py:29:1: F401 'functools.lru_cache' imported but unused
./mesonbuild/scripts/dist.py:27:1: F401 'mesonbuild.dependencies.ExternalProgram' imported but unused
2018-10-24 19:11:46 +03:00
Martin Storsjö ef14681fa0 Skip creating a PDB file if a debug build hasn't been requested
When running MSVC on linux via wine, the PDB output doesn't work;
this allows skipping that part.
2018-10-20 23:53:29 +03:00
Michał Górny e8232c7825 Remove implicit compression of man pages
Remove the code responsible for implicitly compressing manpages as .gz
files.  It has been established that manpage compression is a distro
packager's task, with existing distros already having their own
implementations of compression.

Fixes #4330
2018-10-20 13:16:28 +03:00
Xavier Claessens c453400d59 Add 'b_pie' compiler option
On Android executables must be position independent, many
distributions enable it by default too for security reasons.
2018-10-20 00:47:27 +03:00
Matthias Klumpp aa27dd7928 Regression fix: Don't try to import empty-string custom target include dirs (#4342)
* Don't try to import empty-string custom target include dirs

* Import current directory if custom target dir is empty

This restores the previous behavior and fixes test failures caused by
the previous commit.
2018-10-15 19:27:55 +03:00
Jon Turney a0a0c244e2 os.path.relpath() can fail on Windows
If builddir and sourcedir have different drive letters, a relative path
doesn't exist, and os.path.relpath fails with a ValueError exception.

This just fixes the places which are hit by test cases in a simple-minded
way.  There are several other uses of os.path.relpath(), which might be
suspect.
2018-10-10 19:43:24 +03:00
Guillermo Ignacio Enriquez Gutierrez fd86b0c619 Pass arguments from in xcode projects 2018-10-08 21:31:15 +03:00
Guillermo Ignacio Enriquez Gutierrez 47edf72cad Xcode project now supports assembly files 2018-10-08 21:31:15 +03:00
Dylan Baker a0e4548c41 backends: allow running host arch binaries on compatible build machines
Meson 0.48.0 some validation for using compiled binaries in custom
targets and generators, which is nice. It didn't take into account
though that as long as the OS is the same, some architectures support
running a related architecture natively (x86_64 can run x86 natively,
for example).

Fortunately we already have a method for covering this case available
through the Environment class.

Fixes #4254
2018-10-04 23:50:31 +03:00
Jussi Pakkanen 88054c48a6
Merge pull request #4293 from marcelhollerbach/master
Performance optimize the install part generation
2018-10-04 22:10:09 +03:00
Marcel Hollerbach c53d35aa72 build: generate the mappings in the Targets
Before, the mappings has been created over all the links, while it
actaully only used the Shared or Static Targets. This structure now is
tree like structured and cached, thus the results can be computed a lot
faster.
The generator step generate_install is now for EFL from 6 sec. down to
0.3s. Which improves the overall build time from ~20 sec. to ~14 sec.
2018-10-01 23:47:19 +02:00
Marcel Hollerbach c38544a6ec build: move default_install_dir to the Target classes
there is a huge amount of isinstance calls, this reduces the amount of
these calls while splitting up a rather big function. It also assosiates
every target type with theire default install directory.
2018-10-01 23:47:19 +02:00
Guillermo Ignacio Enriquez Gutierrez aff3930464 Fix Xcode backend: Add build dir to SYSTEM_HEADER_SEARCH_PATHS so generated headers can be included/imported in sources 2018-10-01 19:22:52 +09:00
Thibault Saunier 533997891e backend: Make sure to normalize paths before checking if it is a system dir
Otherwise if we for some reason get '/usr/lib/../lib' in there
we end up saying it is not a system path.

And for some reason here I got:

```
$ pkg-config --libs libffi                                                                                                             148  ST 117   hotdoc
-L/usr/lib/../lib -lffi
```
2018-09-28 12:58:16 -07:00
Guillermo Ignacio Enriquez Gutierrez 6f4ba8b2f4 Fix Xcode backend: support for precompiled headers. Only one header per target is supported 2018-09-25 01:11:46 +09:00
Guillermo Ignacio Enriquez Gutierrez 9b7bb4aa92 Partially fix targets that use precompiled header with --backend=xcode. Various compiled headers are not working yet [skip ci] 2018-09-24 02:17:57 +09:00
Guillermo Ignacio Enriquez Gutierrez f482b82a43 Sort some objects before writing as Xcode expects [skip ci] 2018-09-24 02:17:47 +09:00
Guillermo Ignacio Enriquez Gutierrez 05d1577e87 Fix `build --backend=xcode` (#4220)
* Fix exception when running

* Fix xcode project typos, indentation and other minor aesthetics diffs

* Use tab code \t instead of real tab
2018-09-19 08:05:24 -07:00
Nirbheek Chauhan 1af704a509 Sprinkle functools.lru_cache() in a few more places
This improves the backend generation time for gst-build from 7.4s to
6.6s. This is probably all the low-hanging fruit we can get, further
improvements will probably require refactoring, moving to pathlib.Path
or reimplementing CompilerArgs:

   222045    0.551    0.000    1.324    0.000 compilers.py:666(__iadd__)
     3691    0.230    0.000    0.885    0.000 ninjabackend.py:99(write)
   233560    0.441    0.000    0.701    0.000 posixpath.py:75(join)
      882    0.141    0.000    0.636    0.001 backends.py:509(generate_basic_compiler_args)
   256301    0.248    0.000    0.576    0.000 compilers.py:562(_can_dedup)
    37369    0.035    0.000    0.466    0.000 compilers.py:652(extend_direct)
    74650    0.067    0.000    0.431    0.000 compilers.py:641(append_direct)
   158153    0.089    0.000    0.405    0.000 ninjabackend.py:129(<lambda>)
      845    0.064    0.000    0.391    0.000 ninjabackend.py:279(get_target_generated_sources)
    58161    0.070    0.000    0.317    0.000 backends.py:217(get_target_generated_dir)
   216825    0.175    0.000    0.275    0.000 ninjabackend.py:48(ninja_quote)
      845    0.058    0.000    0.255    0.000 ninjabackend.py:2289(guess_external_link_dependencies)
      845    0.068    0.000    0.239    0.000 backends.py:793(get_custom_target_provided_libraries)
    52101    0.030    0.000    0.237    0.000 compilers.py:716(append)
  1319326    0.231    0.000    0.231    0.000 {built-in method builtins.isinstance}
  1189117    0.229    0.000    0.229    0.000 {method 'startswith' of 'str' objects}
     3235    0.102    0.000    0.228    0.000 compilers.py:614(to_native)

Note: there are 845 build targets.
2018-09-11 10:19:42 -07:00
Marcel Hollerbach 7ae3fbf88d mesonbuild: move subdir generation along link dep generation
The problem with the earlier position of the generation code was, that
the results could not be cached, because the list of all link_deps was
overall different. However, it shared a special kind of subsets with
other build build targets.

Generating the set of subdirs that are required for linking, alongside
with the link dependencies brings the possibility of caching this.
This reduces the buildting from 1 min. in efl down to 20 sec. And
reduces the amount of 30872534 calls down.

this saves ~40 sec.
2018-09-11 03:03:30 -07:00
Marcel Hollerbach c68460e2ee backends: save up the dylib generated names
this saves about 6 sec.
2018-09-11 03:03:30 -07:00
GoaLitiuM 6e160995b0 Improve D link argument handling 2018-09-06 03:57:45 +03:00
Nirbheek Chauhan bead8287a5 Improve support for macOS dylib versioning
We now use the soversion to set compatibility_version and
current_version by default. This is the only sane thing we can do by
default because of the restrictions on the values that can be used for
compatibility and current version.

Users can override this value with the `darwin_versions:` kwarg, which
can be a single value or a two-element list of values. The first one
is the compatibility version and the second is the current version.

Fixes https://github.com/mesonbuild/meson/issues/3555
Fixes https://github.com/mesonbuild/meson/issues/1451
2018-08-29 15:51:23 -07:00
Jussi Pakkanen 1ffc8de5e8
Merge pull request #3981 from GoaLitiuM/d-win-fixes
Fix D support on Windows
2018-08-27 22:30:23 +03:00
Jussi Pakkanen 54aed1a92c Added "native" kwarg to add_XXX_args. Closes #3669. 2018-08-22 23:22:48 +03:00
Bruce Richardson 8c9296e8e6 find_library: Use _build_wrapper to get library dirs
This means that we will take into account all the flags set in the
cross file when fetching the list of library dirs, which means we
won't incorrectly look for 64-bit libraries when building for 32-bit.

Signed-off-by: Nirbheek Chauhan <nirbheek@centricular.com>

Closes https://github.com/mesonbuild/meson/issues/3881
2018-08-22 12:24:43 -07:00
GoaLitiuM fd2c3b4c77 Handle proper linking of MSVC runtime libraries
DMD expects mscrtlib arguments while compiling, whereas LDC2 expects these while linking.
2018-08-20 22:27:31 +03:00
Jussi Pakkanen d83f77109a
Convert buildtype to optimization and debug options (#3489) 2018-08-18 20:39:47 +03:00
Jon Turney d57498a4fd Unconditionally use get_gui_app_args()
Add get_gui_app_args() to the Compiler class so it can be unconditionally
used
2018-08-15 06:17:58 -07:00
Jon Turney 94f09a8454 Explicitly set the Windows subsystem for ninja/VisualC 2018-08-15 06:17:58 -07:00
Jussi Pakkanen fb2cdd0fe2 Call it gnu_symbol_visibility instead. 2018-08-09 19:46:49 +03:00
Jussi Pakkanen 6a0e674043 Add kwarg for specifying symbol visibility. 2018-08-09 19:46:49 +03:00
Nirbheek Chauhan c69030c123 Don't require an import library for shared modules
Shared modules may be resource-only DLLs, or might automatically
self-initialize using C constructors or WinMain at DLL load time.

When an import library is not found for a shared module, just print
a message about it instead of erroring out.

Fixes #3965
2018-08-09 18:39:19 +03:00
Emil Styrke 2e3e2abceb Fix @CURRENT_SOURCE_DIR@ in generator()
Fix @CURRENT_SOURCE_DIR@ pointing to the wrong directory if generator() is called from a subdir.
2018-08-07 04:57:34 -07:00
Nirbheek Chauhan a2dab5439c custom targets: Add a 'console' kwarg for long-running commands
Ninja buffers all commands and prints them only after they are
complete. Because of this, long-running commands such as `cargo
build` show no output at all and it's impossible to know if the
command is merely taking too long or is stuck somewhere.

To cater to such use-cases, Ninja has a 'pool' with depth 1 called
'console', and all processes in this pool have the following
properties:

1. stdout is connected to the program, so output can be seen in
   real-time
2. The output of all other commands is buffered and displayed after
   a command in this pool finishes running
3. Commands in this pool are executed serially (normal commands
   continue to run in the background)

This feature is available since Ninja v1.5

https://ninja-build.org/manual.html#_the_literal_console_literal_pool
2018-07-31 19:38:54 +03:00
Jussi Pakkanen e75f6e4305
Merge pull request #3850 from mesonbuild/nirbheek/exe-wrapper-compiler-fallbacks
Be more permissive about not-found exe_wrapper
2018-07-31 19:33:06 +03:00
Jussi Pakkanen 8c735069b3
Merge pull request #3898 from mesonbuild/vsinstall
Add install target to VS
2018-07-27 14:38:50 +03:00
Rafael Ávila de Espíndola c7360dd426 Make the rpath order deterministic. (#3932) 2018-07-25 19:40:54 +03:00
Rafael Ávila de Espíndola 1a27714f97 Make the dependency order deterministic. (#3927)
We were using sets to store the dependencies. Just switch to
OrderedSet.

Fixes #3922.
2018-07-22 22:24:42 -07:00
Jussi Pakkanen 7bb5f82736 Added install target to VS. Closes #3841. 2018-07-22 16:05:09 +03:00
Rafael Ávila de Espíndola aee9f58939 Handle transitive links to 'threads' dependencies. (#3895)
Meson already had code to propagate link dependencies from static
libraries to programs that use those static libraries.

Unfortunately, it was not handling the special cases of 'threads' and
'openmp' dependencies.
2018-07-19 01:24:59 +03:00
Jussi Pakkanen 808d229c37 Moved install data file generation to base class. 2018-07-17 13:04:07 +03:00
Nirbheek Chauhan 8cfb8fd02c
Fix searching of shared libraries on OpenBSD (#3851)
* get_library_naming: Use templates instead of suffix/prefix pairs

This commit does not change functionality, and merely sets the
groundwork for a more flexibly naming implementation.

* find_library: Fix manual searching on OpenBSD

On OpenBSD, shared libraries are called libfoo.so.X.Y where X is the
major version and Y is the minor version. We were assuming that it's
libfoo.so and not finding shared libraries at all while doing manual
searching, which meant we'd link statically instead.

See: https://www.openbsd.org/faq/ports/specialtopics.html#SharedLibs

Now we use file globbing to do searching, and pick the first one
that's a real file.

Closes https://github.com/mesonbuild/meson/issues/3844

* find_library: Fix priority of library search in OpenBSD

Also add unit tests for the library naming function so that it's
absolutely clear what the priority list of naming is.

Testing is done with mocking on Linux to ensure that local testing
is easy
2018-07-09 09:45:02 -07:00
Nirbheek Chauhan e8dae2b966 cross: Be more permissive about not-found exe_wrapper
We used to immediately try to use whatever exe_wrapper was defined in
the cross file, but some people generate the cross file once and use
it for several projects, most of which do not even need an exe wrapper
to build.

Now we're a bit more resilient. We quietly fall back to using
non-exe-wrapper paths for compiler checks and skip the sanity check.
However, if some code needs the exe wrapper, f.ex., if you run a built
executable using custom_target() or run_target(), we will error out
during setup.

Tests will, of course, continue to error out when you run them if the
exe wrapper was not found. We don't want people's tests to silently
"pass" (aka skip) because of a bad CI setup.

Closes https://github.com/mesonbuild/meson/issues/3562

This commit also adds a test for the behaviour of exe_wrapper in these
cases, and refactors the unit tests a bit for it.
2018-07-09 05:39:40 +05:30
Nirbheek Chauhan 416a00308f cross: Use ExternalProgram for cross-file exe_wrapper
We already have code to fetch and find binaries specified in a cross
file, so use the same code for exe_wrapper. This allows us to handle
the same corner-cases that were fixed for other cross binaries.
2018-07-09 04:09:46 +05:30
Niclas Moeslund Overby 62a46a9b6e java: prevent creation of manifest duplicate in jar 2018-07-03 22:12:17 +02:00
Niclas Moeslund Overby bc8239ded0 java: add jar linking test 2018-07-03 21:33:54 +02:00
Niclas Moeslund Overby 60b9c8300c java: implement java linking 2018-07-03 21:33:54 +02:00
Mathieu Duponchelle d784b5772a ArLinker: Use response files on Windows
ninja chokes when building FFmpeg's static libraries, as the
command line can be larger than 32000.

This was disabled on purpose in #1649, but the rsp syntax was
different: this commit makes it so the options and output file
are still passed on the command line, gcc-ar didn't work
otherwise.
2018-06-25 16:12:35 +00:00
Jussi Pakkanen f3c01a3c4f
Merge pull request #3590 from mesonbuild/testcommand
Made install a top level Meson command.
2018-06-21 00:53:54 +03:00
Nirbheek Chauhan 58ae2c9a8c Rename clike_langs to clink_langs for clarity
D is not a 'c-like' language, but it can link to C libraries. The same
might be true of Rust in the future and Go when we add support for it.

This contains no functionality changes.
2018-06-20 11:27:08 +00:00
Nirbheek Chauhan ebda6ef9c8 ninjabackend: Obvious typo, missing space
I checked the original commit, and that space should not be there.
2018-06-20 04:20:50 +00:00
Jussi Pakkanen 6cf79f86ee Made install a top level Meson command. 2018-06-18 22:02:56 +03:00
Jon Turney d17ce4ffd0 Correctly substitute the internal @BUILD_ROOT@ token with MSVC backend
To me, this looks like a mistake in 976c9abc, but perhaps there's something
I don't understand going on here.
2018-06-18 10:52:21 +00:00
Alex Hirsch cbe18e01e4 Deprecate `build_always`, add `build_always_stale`
Since `build_always` also adds a target to the set of default targets,
this option is marked deprecated in favour of the new option
`build_always_stale`.

`build_always_stale` *only* marks the target to be always considered out
of date, but does *not* add it to the set of default targets.

The old behaviour can still be achieved by combining
`build_always_stale` with `build_by_default`.

fixes #1942
2018-06-18 10:49:40 +00:00
Nirbheek Chauhan 96b7fdb723 macos: Rewrite install_name for dependent built libraries on install
On macOS, we set the install_name for built libraries to
@rpath/libfoo.dylib, and when linking to the library, we set the RPATH
to its path in the build directory. This allows all built binaries to
be run as-is from the build directory (uninstalled).

However, on install, we have to strip all the RPATHs because they
point to the build directory, and we change the install_name of all
built libraries to the absolute path to the library. This causes the
install name in binaries to be out of date.

We now change that install name to point to the absolute path to each
built library after installation.

Fixes https://github.com/mesonbuild/meson/issues/3038
Fixes https://github.com/mesonbuild/meson/issues/3077

With this, the default workflow on macOS matches what everyone seems
to do, including Autotools and CMake. The next step is providing a way
for build files to override the install_name that is used after
installation for use with, f.ex., private libraries when combined with
the install_rpath: kwarg on targets.
2018-06-18 06:33:23 +00:00
Jussi Pakkanen cd63ca9c19 Support Rust targets with more than one source file. Closes #3632. 2018-06-17 15:39:59 +03:00
Niklas Claesson 14716ea90c Visual Studio: Implement startup project 2018-06-10 23:36:54 +03:00
Nirbheek Chauhan 61c6f589f3 backends: Don't exclude system libraries for PATH
We reuse the same function for generating PATH, and we don't want to
exclude system paths there for obvious reasons.
2018-06-07 12:57:56 +00:00
Nirbheek Chauhan 6b7dba7f06 backends: Don't hardcode system library paths
Lookup the library paths using the available compilers instead.

This makes the code work on non-Linux platforms too.
2018-06-07 12:57:56 +00:00
Jon Turney e9462ce206 Install shared_module implibs
On Windows, if we are going to link with a shared module, we need the
implib.

Use case: The Xorg server builds some X protocol extensions as modules.  The
implibs for these modules need to be shipped as part of the SDK, to enable
building of 3rd party extensions which reference symbols in (and hence on
Windows, need to be linked with) these modules.
2018-06-07 12:57:39 +00:00
Xavier Claessens aa879b7f0c Fix issues found by flake8 2018-06-06 20:02:37 +00:00
Xavier Claessens b7d442150d Move <lang>_args to coredata.compiler_options 2018-06-06 20:02:37 +00:00
Nirbheek Chauhan 3e1a610702 Add a new option for building with Apple bitcode support
Normally, people would just pass -fembed-bitcode in CFLAGS, but this
conflicts with -Wl,-dead_strip_dylibs and -bundle, so we need it as
an option so that those can be quietly disabled.
2018-06-06 07:53:10 +00:00
Nirbheek Chauhan ad0121d259 Add prog/lib dirs from the mingw cross-compiler to PATH
These directories contain DLLs that the executable may need, such as
libstdc++-6.dll, libwinpthread, etc.
2018-06-05 10:50:22 +00:00
Nirbheek Chauhan eb383ef4a2 Automatically add cross-mingw root and sysroot bindir to WINEPATH
This ensures that all the system DLLs required by executables such as
libstdc++-6.dll can be found out of the box and tests can run
2018-06-05 10:50:22 +00:00
Nirbheek Chauhan efa9b75d5d Set WINEPATH when running serialized executables
When the exe runner is `wine` or `wine32` or `wine64`, etc.
This allows people to run tests with wine.

Note that you also have to set WINEPATH to point to your custom
prefix(es) if your tests use external dependencies.

Closes https://github.com/mesonbuild/meson/issues/3620
2018-06-05 10:50:22 +00:00
Jon Turney 7e08e958c0 Allow substitutions in custom_target() depfile:
Allow substitutions in custom_target() depfile: as well as in command:
2018-06-03 21:06:23 +00:00
Jon Turney d78fa6ffe3 Install implib where expected if default install_dir: is explicitly given
Install the implib into the default import lib directory if an explicit
install_dir: is given, but the value happens to be the same as the default.
2018-06-03 20:57:03 +00:00
Mathieu Duponchelle b3feff3032 test extra paths: add extra paths for all build targets 2018-06-02 11:42:48 +00:00
Mathieu Duponchelle 35ab34d6cd test serialisation: determine windows extra paths ..
..  for executable arguments too.

This makes it possible to pass an executable to a test, which
can then run it in an appropriate environment.
2018-06-02 11:42:48 +00:00
Filipe Brandenburger 05c43cdcd1 Add 'install_mode' to all installable targets
This makes it possible to customize permissions of all installable
targets, such as executable(), libraries, man pages, header files and
custom or generated targets.

This is useful, for instance, to install setuid/setgid binaries, which
was hard to accomplish without access to this attribute.
2018-06-02 04:50:32 +00:00
Nirbheek Chauhan 1ffbddc31a backends: Also accept dylibs while finding RPATHs 2018-05-24 14:38:28 +00:00
Nirbheek Chauhan fecd580687 backends: Simplify loop getting rpaths for bundled libs
No functionality changes
2018-05-24 14:38:28 +00:00
Nirbheek Chauhan 165da6fb65 backends: Use a set while gathering RPATHs 2018-05-24 14:38:28 +00:00
Robert Bragg ec7b834b6e ninja: add build dir to javac -sourcepath
To allow the javac -implicit:class behaviour to know where to find
generated .java files then the build directory for the target is also
added to the -sourcefile path.
2018-05-16 14:53:30 +02:00
Robert Bragg 61dd46811b ninja: avoid needing include_directory('.') with jar()
Although only one file is passed to javac at a time, if your code has
any inter-file dependencies javac still needs to know how to find other
source files for its -implicit:class feature to work whereby it will
automatically also compile files that the given file depends on.

-implicit:class is the default, practical, behaviour of javac since
otherwise it would be necessary to declare the class dependencies
for parallel java builds to be feasible.

Passing "include_directory: include_directory('.')" to jar() causes
-souredir <path/to/top/of/java/src> to be passed to javac which then
enables your source code to have inter-file class dependencies -
assuming none of your source code is generated.

This ensures that '.' is included by default.
2018-05-16 14:53:30 +02:00
Robert Bragg 65b730bd59 ninja: pass separated paths to javac -sourcepath
The -sourcepath option can't be passed multiple times to javac, since it
simply overrides prior arguments. Instead -sourcepath takes a colon (or
semi-colon on windows) separated list of paths.
2018-05-16 14:53:30 +02:00
Nirbheek Chauhan 8a9f7cf133 vala: Fix shared_module linking with export_dynamic executable
Need to generate a vapi and a header, and then use that in the shared
module. Needed for GNOME games.

Closes https://github.com/mesonbuild/meson/issues/3538
2018-05-10 12:31:04 +02:00
Nirbheek Chauhan ed701b5cb0 Revert "Add macOS linker versioning information"
This reverts commit fa6ca16054.

Closes https://github.com/mesonbuild/meson/issues/3550
2018-05-09 23:11:15 +02:00
Jussi Pakkanen 1918c0d231 Can combine D and C++ in a single target. Closes #3125. 2018-05-02 22:50:15 +03:00
Niklas Claesson 4f4cdee687 Allow custom_target do depend on indexed output of custom_target
Fixes: #3494
2018-05-01 11:51:55 +00:00
Martin Hostettler ab17476355 guess_external_link_dependencies: deduplicate search dirs and libraries.
Reduce speed impact of duplicated libs and pathes in the link command
line. (fixes #3465)
2018-04-27 02:10:21 +00:00
Jussi Pakkanen 9b0453d3e9
Merge pull request #3225 from filbranden/fixperms3
Introduce install_umask to determine permissions of files in install tree. Default it to 022
2018-04-26 23:14:00 +03:00
Jussi Pakkanen 9c073620aa
Merge pull request #3372 from NickeZ/vs-sol-folders
Use visual studio solution directories
2018-04-26 00:47:11 +03:00
Nirbheek Chauhan a015804049 ninja backend: Fix shared library symbols path
The entire subdirectory was getting duplicated, which was exceeding the
max path limit in Python on Windows and causing build failures.

Example:

subprojects/gst-plugins-bad/gst-libs/gst/uridownloader/subprojects@gst-plugins-bad@gst-libs@gst@uridownloader@@gsturidownloader-1.0@sha/subprojects/gst-plugins-bad/gst-libs/gst/uridownloader/gsturidownloader-1.0-0.dll.symbols

This path is too long and opening it will cause a FileNotFoundError on
Windows.
2018-04-21 16:59:33 +03:00
Elliott Sales de Andrade 78495b21e7 Fix Fortran dep hack when cross-compiling. 2018-04-21 16:58:01 +03:00
Jussi Pakkanen 2b3562cc3a
Merge pull request #3404 from xclaesse/extract-recursive
extract_all_objects(): Recursively extract objects
2018-04-20 00:58:08 +03:00
Bruce Richardson 11ebe0bfee cache the generated headers for each target
Once we calculate the generated headers for a target we can cache them to
speed up future calls for that target.
2018-04-19 11:41:14 +00:00
Xavier Claessens 9a82b0136a extract_all_objects: Add 'recursive' keyword argument
To maintain backward compatibility we cannot add recursive objects by
default. Print a warning when there are recursive objects to be pulled
and the argument is not set. After a while we'll do pull recursive
objects by default.
2018-04-18 14:54:52 -04:00
Xavier Claessens 60aaee55d4 extract_all_objects(): Recursively extract objects
Fixes #3401
2018-04-18 14:54:52 -04:00
Xavier Claessens b0e4d4047b Fix using object extracted from a unity build
- determine_ext_objs: What matters is if extobj.target is a unity build,
  not if the target using those objects is a unity build.
- determine_ext_objs: Return one object file per compiler, taking into
  account generated sources.
- object_filename_from_source: No need to special-case unity build, it
  does the same thing in both code paths.
- check_unity_compatible: For each compiler we must extract either none
  or all its sources, taking into account generated sources.
2018-04-18 14:49:52 -04:00
Filipe Brandenburger 8651d55c6a Add new builtin option --install-umask
This option controls the permissions of installed files (except for
those specified explicitly using install_mode option, e.g. in
install_data rules.)

An install-umask of 022 will install all binaries, directories and
executable files with mode rwxr-xr-x, while all data and non-executable
files will be installed with mode rw-r--r--.

Setting install-umask to the string 'preserve' will disable this
feature, keeping the permissions of installed files same as the files in
the build tree (or source tree for install_data and install_subdir.)
Note that, in this case, the umask used when building and that used when
checking out the source tree will leak into the install tree.

Keep the default as 'preserve', to show that no behavior is changed and
all tests keep passing unchanged.

Tested: ./run_tests.py
2018-04-18 11:44:54 -07:00
Niklas Claesson c6e03b9535 Use visual studio solution directories
This implements support for visual studio solution directories.
Projects will by default be put into directories that map their sub-directory
name in the source folder. No directories are created if `--layout=flat` is used.

Fixes: #2524
2018-04-17 23:41:03 +02:00
Niklas Claesson e50a5c1311 Fix vs flat layout bug 2018-04-17 23:41:03 +02:00
Jussi Pakkanen 628f910760
Merge pull request #3314 from sarum9in/test_depends
Add test(depends) keyword parameter
2018-04-18 00:40:52 +03:00
Jussi Pakkanen 88ca3805e7
Merge pull request #1852 from QuLogic/openmp
Add an OpenMP dependency.
2018-04-17 21:39:13 +03:00
Nirbheek Chauhan 6089631a1b Open build files with utf-8 2018-04-17 09:55:34 +00:00
Elliott Sales de Andrade dbb025a175 Add an OpenMP dependency.
This works similarly to the thread dependency which stores the various
inconsistent flags in each compiler.
2018-04-17 02:04:37 -04:00
Jussi Pakkanen c58dd64f8e Merged Arm CC support. 2018-04-16 23:02:09 +03:00
Tom Schoonjans fa6ca16054 Add macOS linker versioning information
This patch exploits the information residing in ltversion to set the
-compatibility_version and -current_version flags that are passed to the
linker on macOS.
2018-04-16 22:26:16 +03:00
Nirbheek Chauhan ef81a013a5 cross: Add compiler cross_args after normal args
This way they override all other arguments. This matches the order of
link arguments too.

Note that this means -I flags will come in afterwards and not override
anything else, but this is correct since that's how toolchain paths
work normally too -- they are searched last.

Closes https://github.com/mesonbuild/meson/issues/3089
2018-04-15 22:29:49 +03:00
Jussi Pakkanen 86f725c1e5
Merge pull request #3115 from makise-homura/e2k-lcc-support
Support lcc compiler for e2k (Elbrus) architecture
2018-04-15 17:18:44 +03:00
Martin Hostettler aff597fb99 ninjabackend: Try to guess library dependencies for linker invocation.
The linkers currently do not support ninja compatible output of
dependencies used while linking. Try to guess which files will be used
while linking in python code and generate conservative dependencies to
ensure changes in linked libraries are detected.

This generates dependencies on the best match for static and shared
linking, but this should not be a problem, except for spurious
rebuilding when only one of them changes, which should not be a problem.

Also makes sure to ignore any libraries generated inside the build, to
keep the optimisation working where changes in a shared library only
cause relink if the symbols have changed as well.
2018-04-15 07:29:21 +00:00
Paul I 09dd9e20df VS backend: dedup AdditionalDependencies 2018-04-08 01:05:19 +03:00
Xavier Claessens 809f018333 extract_all_objects: Also extract generated sources 2018-04-03 15:20:19 -04:00
Jussi Pakkanen 98267e104e
Merge pull request #3242 from thejk/coverage_targets
Use standalone coverage script for legacy targets
2018-04-02 20:08:30 +03:00
Matthias Klumpp 2dc1e87cae Ensure D feature flags get applied to all D files
This resolves issue #3337
2018-03-31 20:53:27 +02:00
Jussi Pakkanen f6f0784038
Merge pull request #2976 from dzabraev/fix-reversed-order
Fix bug include_directories(['p1','p2']) add -Ip2 -Ip1 (reversed order)
2018-03-25 20:26:02 +03:00
Aleksey Filippov c18ceac040 Add depends keyword to test() function 2018-03-25 01:33:33 +00:00
Aleksey Filippov 8b1e9a6f6a Enable b_ndebug on VisualStudioCCompiler 2018-03-23 21:10:04 +02:00
Aleksey Filippov 2febb99eee Fix b_ndebug=if-release option
Provide get_{type}_options_for_target() methods that unite {type} and builtin options.
2018-03-21 17:30:06 +00:00
makise-homura 942e34241f Fixed compatibility issue regarding Python 3.5
In Python 3.5 os.path.join accepts str or bytes, not path-like
objects as in Python 3.6.
2018-03-20 17:26:04 +03: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
Joel Klinghed 8bad2d9827 Exclude subprojects when doing coverage
Restore subproject exclusion for the html coverage report that existed
in the ninja backend legacy target.

Also exclude subprojects for the gcovr generated reports.
2018-03-19 21:52:34 +01:00
Joel Klinghed 79bb1df04f Use standalone coverage script for legacy targets
ninja coverage -> generate all possible reports (text, xml, html)
                  depending on gcovr and/or lcov/genhtml availability.
ninja coverage-html -> generate only html report
ninja coverage-xml -> generate only xml report
ninja coverage-text -> generate only text report

Make all targets phony, the old legacy rules where just annoying as
you would have to remove the old report before being able to generate
a new one.

ninja coverage succeeds if it can generate at least one report.
ninja coverage-* only succeeds if it can generate the requested report
2018-03-19 21:52:34 +01:00
Aleksey Filippov f720efa2f4 Add rename parameter to install_data() 2018-03-17 20:40:50 +00:00
Aleksey Filippov 7f042b5fe2 Use target.get_id() instead of basename and type_suffix concatenation at call site
Fixes the bug with flat layout and identical target names in subprojects.
Without this change directories are not created with subproject prefix
and they can collide.

Remove dead makedirs code in Backend.__init__(), during initialization
of backend build.targets is empty. Create output directories in
Vs2010Backend.generate_projects() instead.

Also use double blank line in run_unittests.py according to
https://www.python.org/dev/peps/pep-0008/#blank-lines.
2018-03-15 21:14:58 +02:00
Jussi Pakkanen ae0e469b06
Merge pull request #3145 from thejk/gcovr
Support gcovr >= 3.1 and add gcovr html report as fallback
2018-03-13 21:12:16 +02:00
Joel Klinghed 4e1b229b37 fixup! Allow gcovr >= 3.1 to be used to generate html coverage report
Rename gcovr_3_1 to gcovr_new_rootdir
2018-03-12 22:19:53 +01:00
Joel Klinghed ed8197207e fixup! Fix coverage-xml and coverage-text targets for gcovr >= 3.1
Rename gcovr_3_1 to gcovr_new_rootdir
2018-03-12 22:18:26 +01:00
Jussi Pakkanen 8d8caef636
Merge pull request #3205 from sarum9in/use-itertools 2018-03-12 23:09:46 +02:00
Jukka Laurila 1d0169f4e7 Fix shared library building on xcode. 2018-03-12 23:05:07 +02: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
Jukka Laurila 58ce5fe62d Fix xcode backend to run "meson test" instead of the nonexistent meson_test.py. 2018-03-09 00:26:14 +02:00
Aleksey Filippov bf0e01d779 Get generated headers from link_whole_targets as meson does for link_targets 2018-03-07 12:48:35 +00:00
Bedarkar, Malhar a2ee76228e First cut of ARMCC support for MESON.
Change-Id: I15d8258e84d392baaccb8f670e33eefcfe8cd49a
2018-03-05 18:26:39 -06:00
Jon Turney cd5dba5358 Fix flake8 'imported but unused' reports
$ flake8 | grep F401
./meson.py:17:1: F401 'mesonbuild.mesonlib' imported but unused
./meson.py:18:1: F401 'locale' imported but unused
./run_unittests.py:24:1: F401 'sys' imported but unused
./mesonbuild/minit.py:2:1: F401 'pyclbr.Function' imported but unused
./mesonbuild/minit.py:18:1: F401 'os' imported but unused
./mesonbuild/backend/vs2010backend.py:15:1: F401 'sys' imported but unused
./mesonbuild/backend/xcodebackend.py:19:1: F401 'sys' imported but unused
./mesonbuild/dependencies/ui.py:20:1: F401 'shutil' imported but unused
./mesonbuild/modules/python3.py:15:1: F401 'sys' imported but unused
./mesonbuild/modules/unstable_icestorm.py:15:1: F401 '..compilers' imported but unused
./mesonbuild/modules/unstable_icestorm.py:15:1: F401 '..mlog' imported but unused
./test cases/common/98 gen extra/srcgen3.py:3:1: F401 'os' imported but unused
2018-03-03 21:06:45 +00: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
Hemmo Nieminen b0446075ec Remove some unused variables. 2018-03-01 01:06:51 +02:00
Joel Klinghed 6266089866 Allow gcovr >= 3.1 to be used to generate html coverage report
Modern gcovr includes html generation support so if lcov and
genhtml are not available fallback to gcovr.

Kept lcov and genhtml as default so to not surprise existing
users of coverage-html with the different output of gcovr.

gcovr added html support in 3.0 but as there already is a test
for 3.1 because of the changes to -r/--rootdir I opted to only
allow html generation for >= 3.1 to keep things simple.
2018-02-27 21:58:05 +01:00
Joel Klinghed da01770261 Fix coverage-xml and coverage-text targets for gcovr >= 3.1
In gcovr 3.1 the -r/--rootdir argument changed meaning causing
reports generated with gcovr 3.1 to not find the source files
and look for *.gcda in the whole source tree rather than the
build dir.

So, detect gcovr version and if 3.1 give build_root to -r instead
of source_root.
2018-02-27 21:48:42 +01:00
Hemmo Nieminen 4611097654 Include project name in a test object. 2018-02-25 21:44:59 +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
Thibault Saunier c48b9594ff Add support for Visual Studio csc c# compiler 2018-02-25 01:10:52 +02:00
Adam C. Foltzer 3332f33649 Fix Rust compiler-private library ambiguity
When building a Rust target with Rust library dependencies, an
`--extern` argument is now specified to avoid ambiguity between the
dependency library, and any crates of the same name in `rustc`'s
private sysroot.

Includes an illustrative test case.
2018-02-22 22:16:58 +02:00
Peter Hutterer 6b550ae91f Allow for missing install_dir in install_data()
The documentation doesn't require it and the interpreter code works around the
possibility of it being None. The ninja backend code however fails with

File "/home/whot/code/meson/mesonbuild/backend/ninjabackend.py", line 796, in generate_data_install
    dstabs = os.path.join(subdir or None, plain_f)
File "/usr/lib64/python3.6/posixpath.py", line 78, in join
    a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not NoneType

If install_dir is missing, default to datadir/projectname
2018-02-22 20:26:16 +02:00
Martin Hostettler 1e82416a93 Generate build rpath for pkg-config dependencies consisting of a one absolute path 2018-02-21 19:10:16 +02:00
Nirbheek Chauhan b2007217e0 vala: Fix path of C file with generated Vala files
We missed one particular edge-case in #2413: when the generated vala
file is inside --basedir, the path is not just the basename.c

Since this case can never happen in a project test, this includes a unit
test for the same.

Closes https://github.com/mesonbuild/meson/issues/815
2018-02-20 00:19:11 +02:00
Jussi Pakkanen d2445a15a1
Merge pull request #3069 from dcbaker/pch_one_arg
Fix targets with C and C++ code that use pre compiled headers
2018-02-16 00:08:06 +02:00
Niklas Claesson e88887be4a Only remove substring if it is part of string
Fixes #2661
2018-02-15 22:45:54 +02:00
Dylan Baker b11035693c backends: Only add pch args that are appropriate for the compiler
Currently we try both C and C++ when determining which PCH files to
include. The problem with this approach is that if there are no C or C++
files (only headers) and the target has both C and C++ sources then the
PCHs will be passed to the wrong compiler.

The solution is less code, we already have the compiler, the compiler
knows what language it is, so we don't need to walk both C and C++.

Fixes #3068
2018-02-14 11:34:07 -08:00
Maxim Dzabraev ea6e9298fa keep include paths order 2018-02-11 20:25:25 +03:00
Maxim Dzabraev d10b7687ab Fix bug include_directories([p1,p2]) produces -Ip2 -Ip1 (reversed order) 2018-02-11 20:25:25 +03:00
Aleksey Filippov 549f9a41e5 Rename install_subdir() option elide_directory to strip_directory 2018-02-05 01:28:07 +00:00
Aleksey Filippov 8ca3cc0c3d Add elide_directory keyword for install_subdir() function
If elide_directory=true install_subdir() installs directory contents
instead of directory itself, eliding name of the source directory.

Closes #2869.
2018-02-05 01:28:07 +00:00
Jussi Pakkanen bfa6c8d074
Merge pull request #2938 from acfoltzer/rust-cross-merge
Add cross-compilation support for `rustc`
2018-02-04 00:44:09 +02:00
Aleksey Filippov 8fe8161014 Refactor and simplify install_subdir()
- Pass exclude_files and exclude_directories relative to src_dir,
  same as specified by user and documented in public install_subdir().
- Make do_copydir() interface similar to do_copyfile():
  install src_dir contents to dst_dir.
- Remove src_prefix/src_dir code, it adds confusion and duplicates arguments.
  Use single src_dir parameter instead.
- Make callers specify that src_dir contents should be installed
  under dst_dir/basename(src_dir) if necessary.
- Use os.path.relpath() instead of string manipulations on paths.
- Add documentation to do_copydir(): specify types and add usage example.
2018-02-04 00:43:00 +02:00
Jussi Pakkanen 20ae08eb1b Only quote colons on build lines. Closes #2961. 2018-02-02 10:37:32 +02:00
Adam C. Foltzer 1d81efb03d Add cross-compilation support for `rustc`
This patch is largely modeled on the relatively-straightforward code
for Fortran cross-compilation, so there might be some intricacies
missing.
2018-01-29 15:47:05 -08: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
Jussi Pakkanen 4f948ccf45
Merge pull request #2885 from BeChris/fix_vs_pch
Fix MSVC backend crashes when `c_pch` or `cpp_pch` is not an array
2018-01-08 20:34:53 +02:00
Christophe Gouiran 412315f8ae Modify exception raised when msvc pch is badly specified 2018-01-07 19:09:53 +01:00
Jussi Pakkanen 17c435869c Print problem text in error message. Closes #2882. 2018-01-07 19:21:21 +02:00
Christophe Gouiran 40e92c82ab Fix MSVC backend crashes when `c_pch` or `cpp_pch` is not an array 2018-01-06 22:03:02 +01:00
Gabríel Arthúr Pétursson c8355c9ffa Fail Visual Studio version detection if VSINSTALLDIR is not set
The Visual Studio Developer Command Prompt always sets the VSINSTALLDIR
environment variable. If not, we probably have a broken environment and
won't get very far anyway.
2017-12-30 13:58:38 +00:00
Jussi Pakkanen 27d4a611a5 Fix Windows. 2017-12-21 23:06:14 +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
Xavier Claessens 63d2f0bf07 Do not extract object for header sources
Closes #2716
2017-12-16 12:51:08 +02:00
Jussi Pakkanen cbefb57ffe
Merge pull request #2745 from dcbaker/submit/haiku
small fixes for haiku
2017-12-10 14:42:53 +02:00
Jussi Pakkanen 5ff9e05c8b
Merge pull request #2697 from mesonbuild/custom-target-depends-serialize
custom target: Consider all build depends while serializing
2017-12-10 14:23:31 +02:00
Dylan Baker fc547ad05e haiku: do not add pthread arguments
Haiku has pthreads, but they are part of the standard C library, and do
not need either special compiler or linker flags.
2017-12-07 09:35:12 -08:00
Joergen Ibsen 521933357d Fix path for str arguments to depend_files
Fixes #2633
2017-12-03 23:24:30 +02:00
Jussi Pakkanen 554b484468
Merge pull request #2618 from mesonbuild/osxlinkerfixes
Fix many things have have been slightly broken in OSX
2017-12-03 02:25:44 +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
Niklas Claesson e0274441fc VS: Add /DEBUG to linker to generate debug information 2017-11-30 22:36:28 +02:00
Josh Soref eb2a148218 spelling: verifier 2017-11-26 17:28:09 +00:00
Jussi Pakkanen fa6f01d096 Use absolute paths for rpaths on OSX. 2017-11-26 17:34:01 +02:00
Josh Soref 05f684b4fc spelling: overwrite 2017-11-26 05:56:25 +00:00
Josh Soref 49f8d28ef5 spelling: overridden 2017-11-26 05:55:40 +00:00
Josh Soref 791494e143 spelling: dependency 2017-11-26 05:23:23 +00:00
Jussi Pakkanen 22adda1617 Review fixes. 2017-11-21 23:29:06 +02:00
Jussi Pakkanen 5d51bc79c7 Replaced sys.executable use with the mesonlib equivalent. 2017-11-20 23:08:17 +02:00
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
Alistair Thomas d551dbff9a Use long form of valac options and make --basedir use relative path 2017-10-03 20:43:11 +02:00
Corentin Noël 1320a98a33 Merge github.com:mesonbuild/meson into vala-target-dirs 2017-10-03 20:26:16 +02:00
Corentin Noël f13887b64a Reduce code complexity, fix nested array in files instruction 2017-10-03 18:25:07 +02:00
Jussi Pakkanen 9483875798 Merge pull request #2397 from mesonbuild/prebuilt
Better support for prebuilt shared libs
2017-10-02 19:09:08 +03:00
Corentin Noël ac8d5f2156 Allow different directories for Vala files 2017-10-02 01:59:41 +02:00
Jussi Pakkanen ec45c29c9d Add rpath entries for all found libraries outside of system libraries. 2017-10-02 01:30:30 +03:00
Liam Staskawicz ae532c807c backends: avoid extraneous trailing os.path.sep when joining paths
resolves #2336
2017-10-01 15:39:04 +03:00
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
Jussi Pakkanen cb64a3f07a Fix MSVC builds. 2017-10-01 01:11:02 +03:00
Jussi Pakkanen a655b64989 Add an rpath entry to shared libraries that are linked from the source tree. 2017-09-30 18:21:02 +03:00
Nirbheek Chauhan 8cc52b5d4f vs: Fix link_whole usage with the vs backend
/WHOLEARCHIVE must go to AdditionalOptions, not AdditionalDependencies
and we must add a project reference to trick msbuild/visual studio into
building a target that is built from only libraries linked in via
/WHOLEARCHIVE.
2017-09-30 04:11:22 +05:30
Nirbheek Chauhan 560f4b6fc7 vs: Fix detection of options vs libraries in link args 2017-09-30 03:58:54 +05:30
Nirbheek Chauhan b866cf0804 vs: Add a helper for adding a project reference 2017-09-30 03:57:51 +05:30
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
Jussi Pakkanen be0aa7fd74 Merge pull request #2357 from LukeShu/flake8
Bring into compliance with flake8
2017-09-22 21:33:34 +03:00
Luke Shumaker 4dbbb4884c flake8: Clean up complained-about unused imports
This also adds a "# noqa: F401" comment on an unused "import lzma",
which we are using it in a try/except block that is being used to
check if the lzma module is importable; of course it is unused.

v2: This turned out to be a little tricky.

    mesonbuild/modules/__init__.py had the "unused" import:

        from ..interpreterbase import permittedKwargs, noKwargs

    However, that meant that the various modules could do things like:

        from . import noKwargs # "." is "mesonbuild.modules"

    Which breaks when you remove __init__.py's "unused" import.  I
    could have tagged that import with "# noqa: F401", but instead I
    chose to have each of the module import directly from
    "..interpreterbase" instead of ".".
2017-09-21 13:41:03 -04: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
Luke Shumaker bb25260f00 flake8: Perform suggested whitespace/formatting changes
This only touches newlines, spaces, and (occaisionally) commas.  Anything
else is left for another commit.
2017-09-21 11:59:03 -04:00
Florian Zwoch 7e1caaf1cd ninja: Generator is more informative on what it is doing. 2017-09-20 18:53:46 +03:00
Niklas Claesson 07dde545d9 Add @PLAINNAME@ and @BASENAME@ to arguments argument for Generator
Fixes #1282
2017-09-20 13:00:34 +02:00
Guillaume Poirier-Morency 02ad00b982 ninja: Fix the dependency on the VAPI when 'vala_vapi' is used 2017-09-18 20:40:53 +03:00
Nirbheek Chauhan 7c2ae55fab Revert "Revert "Merge pull request #1931 from centricular/use-patched-ninja""
This reverts commit 5eb64a6f3e.

Let's try again, with a fixed Ninja by QuLogic.
2017-09-18 18:40:24 +03:00
Jussi Pakkanen 75208604da Merge pull request #1943 from QuLogic/duplicate-names
Fix creation of objects with duplicate names
2017-09-12 20:37:43 +03:00
Jussi Pakkanen b63710863b Renamed test serialisation from is_cross to is_cross_built for clarity. 2017-09-12 20:32:07 +03:00
Jussi Pakkanen 9b50a4aac1 An external program is never a "cross test". 2017-09-12 20:32:07 +03:00
Nirbheek Chauhan 5b1babd611 backends: Add custom target inc dirs before target inc dirs
Custom target include dirs must be overridable by target-specific
include dirs otherwise in case of header name collisions, the user has
no way to override this behaviour.
2017-09-11 14:50:35 +05:30
Thibault Saunier 0968991394 csharp: Take into account project and global args 2017-08-24 20:48:13 -03:00
Thibault Saunier 52b7f1a096 c#: Handle external dependencies from .pc files 2017-08-24 16:09:07 -03:00
Thibault Saunier a83eb4ddb2 ninjabackend: Add support for generated csharp sources. 2017-08-23 15:00:19 -03:00
Jussi Pakkanen a1326581a5 Fix coverage target breakage and add a test for it. 2017-08-20 20:32:30 +03:00
Jussi Pakkanen 50fb7d37ab Make all functionality invokable via the main Meson binary,
which can be a Windows .exe file.
2017-08-18 12:08:20 +03:00
Jussi Pakkanen aa49c3cebd Ignore encoding when scanning Fortran sources. 2017-08-17 00:20:34 +03:00
Elliott Sales de Andrade cf1242655f Remove VS implementation of object name resolver.
The upstream one should work properly now, one hopes.
2017-08-14 22:47:36 -04:00
Elliott Sales de Andrade 320862991a Fix object extraction in unity builds. 2017-08-14 22:47:36 -04:00
Elliott Sales de Andrade bf0164ff6e Use full relative paths to generate object names.
This prevents files with the same name from different directories from
producing object files with the same name and breaking ninja.

Fixes #1494.
2017-08-14 22:47:36 -04:00
Elliott Sales de Andrade b68cb3c713 Use object_filename_from_source when creating objects.
This will ensure a consistent path between generated object names and
names expected of extracted objects.
2017-08-14 22:47:35 -04:00
Elliott Sales de Andrade 879770ccf0 Only calculate absolute source path when necessary. 2017-08-14 22:47:35 -04:00
Elliott Sales de Andrade ba6fdb996a Simplify path-determination in compile-generation. 2017-08-14 22:47:35 -04:00
Nirbheek Chauhan 7d36776307 ninja: Fix detection of vs compiler usage
Just because cl.exe exists in PATH doesn't mean we are using it right
now. Instead, check the list of compilers that were configured.
2017-08-15 01:38:01 +05:30
Nirbheek Chauhan be4428005d ninja: Fix cleaning in various edge cases
We need to use target aliases for reserved target names and run
targets to workaround a ninja bug:

https://github.com/ninja-build/ninja/issues/828

Closes https://github.com/mesonbuild/meson/issues/1644
2017-08-15 01:38:01 +05:30
Jussi Pakkanen 5c8328d27f Use "meson test" in test invocations so it will not print the deprecation warning. 2017-08-14 15:54:57 +03:00
Elliott Sales de Andrade 5cb1d00537 Allow excluding files from `install_subdir`
The install_subdir command now accepts a new `exclude` keyword argument
that allows specified files to be excluded from the installed
subdirectory.
2017-08-06 03:58:35 -04:00
Jussi Pakkanen 61a05f26e3 Add option to disable implicit include directories. Closes #2139. 2017-08-05 00:26:13 +03:00
Jussi Pakkanen a800c96f99 Add option to limit maximum number of concurrent link processes. 2017-08-05 00:24:59 +03:00
nyorain 0a9170bbbe Fix #1993 2017-08-04 19:50:39 +03:00
Ben 0ed0bcce49 Vala: enable colored warning and error output (#2142) 2017-08-01 06:22:17 -04:00
Jussi Pakkanen a572ebd2a1 Convert man inputs to Files so you can install_man the output of configure_file. Closes #2135. 2017-07-31 18:47:09 -04:00
Gabríel Arthúr Pétursson 3ddf9bf6dd Ensure same compiler flags are used for compiling PCH as normal sources
Precompiled headers should generally be compiled with the same flags as
the sources that will include the header. Some deviations are safe,
however, most will cause the compiler to reject the precompiled header
or possibly lead to compiler crashes.
2017-07-24 00:11:27 +03:00
Sam Thursfield 094c8dc250 Consider `link_whole` as well as `link_with` for Vala deps
Otherwise, when you have a static helper library written in Vala
that you want to `link_whole` into a shared library you have to
manually add the .vapi file as a source.
2017-07-23 19:34:42 +03:00
Adam C. Foltzer 4eda3ca0fc add `crate-name` to Rust target args
This is required for downstream Rust dependencies to properly import
libraries using `extern crate`.
2017-07-22 03:49:39 +03:00
Jussi Pakkanen bff37a90fc Merged buildrpath branch. 2017-07-21 22:19:07 +03:00
Patrick Griffis 67f0a1a44d Fix run_target() accepting ConfigureFile for command 2017-07-21 20:16:08 +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 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
FredericHamel 6f4e5e96d8 Allow test to depend on executable target in cross build. (#2007)
* Add a crossbuild case in 'test case/common/1 trivial/meson.build'

* Add native flags for crossbuild tests.
2017-07-20 12:25:59 +03:00
Jussi Pakkanen 5eb64a6f3e Revert "Merge pull request #1931 from centricular/use-patched-ninja"
This reverts commit aab7ada356, reversing
changes made to e1b24765af.
2017-07-18 00:30:52 +02:00
Nirbheek Chauhan e307865596 ninja backend: Detect ninja only once and log it
Needed for the CI, but good to have in general too.
2017-07-17 17:26:21 +05:30
Jussi Pakkanen 5cec8fc43a Removed consecutive identical variable assignments. 2017-07-16 12:04:24 +03:00
Goncalo Carvalho bcb2556c69 add project/global args and include_dirs (useful for module maps) to swift targets 2017-06-29 11:04:57 -04:00
Jussi Pakkanen dfb0414d9c Merged Genie support. 2017-06-27 19:01:00 +03:00
Jussi Pakkanen 4a4322064e Merge pull request #1986 from phako/master
Skip handling non-available dependencies
2017-06-27 04:13:25 -04:00
Guillaume Poirier-Morency fab5634916 Add 'Compiler.get_display_language'
Use this when we print language-related information to the console and
via the Ninja backend.
2017-06-26 14:15:44 -04:00
Alistair Thomas cca0fa8154 Recognise .gs extension as a Vala source 2017-06-26 13:57:52 +01:00
Alistair Thomas e5559903b3 Split linkers out from compilers.py 2017-06-22 20:09:58 +01:00
Jussi Pakkanen 65d5ec5f18 Merge pull request #1922 from acfoltzer/rust-improvements
Enhance Rust support
2017-06-22 06:12:27 -04:00
Nirbheek Chauhan 185808bf16 vala: Only add --use-header for unity builds
Closes https://github.com/mesonbuild/meson/issues/1969
2017-06-22 06:07:45 -04:00
Jens Georg ce3cec40da Skip handling non-available dependencies
This way, an optional dependency can always be added on Vala targets without
meson adding --pkg
2017-06-22 10:59:55 +02:00
Adam C. Foltzer 6165612f6b fix indentation per @ignatenkobrain 2017-06-19 16:52:31 -07:00
Jussi Pakkanen cccb932f8f Expand magic markers on custom and run targets too. Closes #1681. 2017-06-19 14:09:57 -04:00