Commit Graph

477 Commits

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