Commit Graph

753 Commits

Author SHA1 Message Date
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
Adam C. Foltzer 35fae9d019 fix failing Rust test cases 2017-06-14 11:50:35 -07:00
Adam C. Foltzer 69b18cf7e9 rename `crate_type` to `rust_crate_type` per @TingPing 2017-06-14 08:39:41 -07:00
Nirbheek Chauhan d23e6b34c7 Preserve -L -l pairings fetched from external deps
While adding link args for external deps, sometimes different
libraries come from different prefixes, and an older version of the
same library might be present in other prefixes and we don't want to
accidentally pick that up.

For example:

/usr/local/lib/libglib-2.0.so
/usr/local/lib/pkgconfig/glib-2.0.pc
/usr/local/lib/libz.so
/usr/local/lib/pkgconfig/zlib.pc
/home/mesonuser/.local/lib/libglib-2.0.so
/home/mesonuser/.local/lib/pkgconfig/glib-2.0.pc

PKG_CONFIG_PATH="/home/mesonuser/.local/lib/pkgconfig/:/usr/local/lib/pkgconfig/"

If a target uses `dependencies : [glib_dep, zlib_dep]`, it will end up
using /usr/local/lib/libglib-2.0.so instead of
/home/mesonuser/.local/lib/libglib-2.0.so despite using the pkg-config
file in /home/mesonuser/.local/lib/pkgconfig because we reorder the -L
flag and separate it from the -l flag.

With this change, external link arguments will be added to the
compiler list without de-dup or reordering.

Closes https://github.com/mesonbuild/meson/issues/1718
2017-06-12 20:55:19 +05:30
Jussi Pakkanen f792641b34 Merge pull request #1927 from centricular/gir-rpath-link
Work around GNU ld bug with -rpath,$ORIGIN
2017-06-11 14:54:10 +03:00
Nirbheek Chauhan d38f3deaed gnome: Work around GNU ld bug with -rpath,$ORIGIN
g-ir-scanner doesn't understand -rpath, so we use -L instead which
has the same effect.

Closes https://github.com/mesonbuild/meson/issues/1911
2017-06-11 14:32:39 +05:30
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 b6b3905325 vs: Sometimes WindowsSDKVersion is unset
https://ci.appveyor.com/project/jpakkane/meson/build/2871/job/ti4qpoptd5tk19sn
2017-06-09 20:25:27 +05:30
Nirbheek Chauhan 1300766429 vs: Always check VSINSTALLDIR in case VisualStudioVersion is unset
This happened on the CI, so it could happen on people's machines too:

https://ci.appveyor.com/project/jpakkane/meson/build/2870/job/p2n70hg01vp3dkgl
https://ci.appveyor.com/project/jpakkane/meson/build/2870/job/7ifh64mi1999guxt
2017-06-09 20:21:01 +05:30
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
Bug 1cc0dc1540 fix WarningLevel in vcxproj #1913
- VS 2010-2015 expect <WarningLevel> to be inside <ClCompile>
- WarningLevel now correctly reflects VisualStudioCCompiler.get_warn_args
2017-06-08 20:18:21 +03:00
Jussi Pakkanen 62051626a5 Merge pull request #1545 from centricular/dont-link-recursively
Don't add dependencies recursively while linking
2017-06-04 14:07:27 +03:00
Jussi Pakkanen 4828b46b73 Use relative rpath so builds are reproducible. 2017-06-03 16:03:53 +03:00
Nirbheek Chauhan 4b428053f4 ninja: Use shlex.quote for quoting on non-Windows
This is more reliable, and more accurate. For instance, this means
arguments in commands aren't surrounded by `'` on Linux unless that
is actually needed by that specific argument.

There is no equivalent helper for Windows, so we keep the old
behaviour for that.
2017-06-02 10:41:13 +05:30
Nirbheek Chauhan d2dc38abd4 ninja: Use a set for target deps and ordered deps
This significantly reduces the size of build.ninja for GStreamer.
2017-06-02 05:32:16 +05:30
Nirbheek Chauhan 6963da616b Don't add dependencies recursively while linking
We were doing this on the basis of an old comment, but there was no
test for it and I couldn't reproduce the issue with clang on Linux
at all.

Let's add a (somewhat comprehensive) test and see if it breaks
anywhere if we stop doing this.

Halves the size of gstreamer's build.ninja from 20M to 8.7M

Closes https://github.com/mesonbuild/meson/issues/1057
2017-06-02 05:32:16 +05:30
Alistair Thomas a195b78c8d Whitespace tweaks to reduce Flake8 warnings 2017-05-29 19:32:47 +03:00
Bálint Aradi 809a5938ff Fix case sensitivity in Fortran module names 2017-05-26 23:21:27 +03:00
Rob Doolittle 56b41d1c79 mesontest: use unbuffered IO
This helps when running mesontest as part of CI.
2017-05-24 20:00:47 +03:00
blackbox db176c85db xcode-backend framework fixes
- frameworks-per-target ( each needs its own uid )
2017-05-23 12:54:33 +02:00
blackbox dd443ad0eb codestyle 2017-05-23 12:54:33 +02:00
blackbox 03ebe2f56f remove debug-marker 2017-05-23 12:54:33 +02:00
blackbox ea5eb2a80d XCode frameworks support
- supported as "Link with Libraries".
- Frameworks added as a group to the project
- no need to specify custom linker flags anymore, xcodeproj works just like ninja

example mason.build file :
dep_main += [dependency('appleframeworks', modules : ['Foundation', 'AppKit', 'IOKIT', 'QuartzCore', 'OpenGL', 'GLUT', 'OpenAL'], required : true)]
2017-05-23 12:54:33 +02:00
Ole André Vadla Ravnås b595cda4ed Fix cross environment pollution.
Environment variables like CFLAGS and LDFLAGS should not affect the
cross environment.

Fixes #1772
2017-05-21 23:04:19 +03:00
Elliott Sales de Andrade ea636fcd51 Remove unused variables. 2017-05-17 04:41:54 -04:00
Elliott Sales de Andrade e66465369d Use more direct dictionary literals. 2017-05-17 04:24:18 -04:00
Elliott Sales de Andrade 65b1d33931 Remove unused imports. 2017-05-17 03:42:16 -04:00
Jussi Pakkanen 18b11489cf Merge pull request #1775 from mesonbuild/covupdate
Better coverage report
2017-05-14 11:55:02 +03:00
Ole André Vadla Ravnås 9b5df6e442 ninja: Deduplicate dependent vapis
The Vala compiler does not like being fed the same .vapi multiple times.
2017-05-14 11:54:42 +03:00
Jussi Pakkanen 08bd92a6ae Merge pull request #1788 from aradi/fix-fortran-scan
Fix scanning of Fortran sources created during configuration
2017-05-13 23:24:14 +03:00
Ole André Vadla Ravnås 97339d3be4 ninja: Also include Vala headers in generated headers 2017-05-13 22:59:06 +03:00
Jon Turney 61a145fcb5 Implement executable(gui_app:) for gcc on Windows
Note that gui_app: is currently ignored when using the ninja backend with VS
compilers, so I guess you get the default linker behaviour, which the
documentation says is guessing the subsystem depending on if a main or
WinMain symbol exists...
2017-05-13 22:58:06 +03:00
Jussi Pakkanen 111e3df45d Moved coverage commands to a standalone script. 2017-05-13 22:54:08 +03:00
Jussi Pakkanen c2282f9382 Merged rust_args branch. 2017-05-13 22:51:43 +03:00
Jussi Pakkanen 84012a5099 Merge pull request #1669 from mesonbuild/dist
Create a dist target
2017-05-12 19:37:31 +03:00
Jon Turney e99cfdfbc7 Make vs_module_defs: do something for gcc on Windows as well
Module definition files may be useful when building with gcc on Windows also
(e.g. if the existing build uses them, if exports are aliased, if we were
retro enough to export by ordinal, etc.)

Add the .def file to the link command line when using gcc on Windows

Run the appropriate windows tests irrespective of compiler.
2017-05-12 18:56:43 +03:00
Bálint Aradi 540fd2f0e0 Fix scanning of Fortran sources created during configuration 2017-05-12 14:34:19 +02:00
Jussi Pakkanen a91aed8854 Test created tarball by doing a full build + test + install cycle. 2017-05-11 19:34:16 +03:00
Jussi Pakkanen 255be79e22 Created a dist target. Closes #877. 2017-05-11 19:34:16 +03:00
Jussi Pakkanen 1aa68cf6e3 Merge pull request #1610 from valum-framework/vala-use-generate-basic-compiler-args
Use 'generate_basic_compiler_args' for Vala targets
2017-05-09 18:45:06 +03:00
Nicolas Schneider 39520d5688 vs: surround project guid with '{}'
Closes #1672.
2017-05-09 18:43:11 +03: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
Guillaume Poirier-Morency 904ed5a599 Use 'generate_basic_compiler_args' for Vala targets
Move '-C' option into 'get_always_args' as we always generate C sources.

Add a branch in the dependency management to perform Vala-specific work
of adding '--pkg' and '--target-glib'.
2017-05-08 14:58:52 -04:00
Alberto Aguirre ccab7d64f4 Add support for @CURRENT_SOURCE_DIR@ in generator arguments
Allow users to specify @CURRENT_SOURCE_DIR@ in generator arguments
to specify the current target source directory.
This is useful when creating protobuf generator objects in sub-directories
because protoc will then generate files in the expected location.

Fixes #1622.

Remove stray semicolon

Update documentation
2017-05-08 20:53:57 +02:00
Elliott Sales de Andrade bbcf0c0550 Serialize CustomTargets with newlines in command. 2017-05-05 17:23:36 -04:00
Elliott Sales de Andrade 7d6c6fe166 Remove extra quoting in swiftc invocation. 2017-05-05 16:27:01 -04:00
Patrick Griffis 60d560b5a7 ninja: Fix quoting newlines and $ 2017-05-05 16:27:01 -04:00
Peter Hutterer a576791064 Use American English - 'ise' -> 'ize' where applicable 2017-05-04 22:09:27 +03:00
Peter Hutterer ca924451ac Use American English: behaviour -> behavior 2017-05-04 22:09:27 +03:00
Jussi Pakkanen 108dac5c16 Store extra_files as file objects. Helps with #1686. 2017-05-04 00:17:33 +03:00
Jussi Pakkanen 8f49764896 Merge pull request #1717 from valum-framework/fix-descriptions-for-ninja-backend
ninjabackend: Use more consistent descriptions
2017-05-03 18:52:46 +03:00
Jussi Pakkanen 33b79dcf25 Kill RawFile dead! 2017-05-03 18:27:04 +03:00