Commit Graph

159 Commits

Author SHA1 Message Date
Igor Gnatenko 7d71e9f8b2 backend/ninja: pass language name instead of compiler
Traceback (most recent call last):
  File "F:\avian\meson\mesonbuild\mesonmain.py", line 289, in run
    app.generate()
  File "F:\avian\meson\mesonbuild\mesonmain.py", line 179, in generate
    g.generate(intr)
  File "F:\avian\meson\mesonbuild\backend\ninjabackend.py", line 185, in generate
    self.generate_rules(outfile)
  File "F:\avian\meson\mesonbuild\backend\ninjabackend.py", line 745, in generate_rules
    self.generate_compile_rules(outfile)
  File "F:\avian\meson\mesonbuild\backend\ninjabackend.py", line 1530, in generate_compile_rules
    self.generate_llvm_ir_compile_rule(compiler, True, outfile)
  File "F:\avian\meson\mesonbuild\backend\ninjabackend.py", line 1386, in generate_llvm_ir_compile_rule
    ' '.join(self.get_cross_info_lang_args(compiler, is_cross)),
  File "F:\avian\meson\mesonbuild\backend\ninjabackend.py", line 1406, in get_cross_info_lang_args
    return self.environment.cross_info.config['properties'][lang + '_args']
TypeError: unsupported operand type(s) for +: 'ClangCCompiler' and 'str'

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-12-19 17:09:35 +02:00
Igor Gnatenko d5ccd20aac fix some of pylint's undefined-variable
************* Module mesonbuild.modules.rpm
E:106,29: Unsupported format character '{' (0x7b) at index 16 (bad-format-character)
************* Module mesonbuild.modules
E: 12,14: Undefined variable 'MesonException' (undefined-variable)
************* Module mesonbuild.modules.gnome
E:699,69: Undefined variable 'sargs' (undefined-variable)
************* Module mesonbuild.wrap.wrap
E:103,25: Undefined variable 'checkoutdir' (undefined-variable)
************* Module mesonbuild.backend.backends
E: 83,16: Undefined variable 'mlog' (undefined-variable)
************* Module mesonbuild.backend.ninjabackend
E:254,105: Undefined variable 't' (undefined-variable)

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-12-19 17:09:35 +02:00
Jussi Pakkanen 21e475b64b Merge pull request #1194 from centricular/critical-bugfixes-vala
A bunch of bugfixes for Vala
2016-12-15 22:20:03 +02:00
Nirbheek Chauhan e6f48a03fc Allow all code to access module target classes
It is often useful to be able to check if a specific object is of a type
defined in a module. To that end, define all such targets in
modules/__init__.py so that everyone can refer to them without poking
into module-specific code.
2016-12-15 04:12:23 +05:30
Nirbheek Chauhan 79f6626867 Pass --gresources to valac for each compiled gresource
Without this, the user has to both compile the resource with
gnome.compile_resources, pass that to the target sources, and also
pass --gresources=/path/to/gres.xml to vala_args in the target.

With this, we will do that automatically.
2016-12-15 04:12:23 +05:30
Nirbheek Chauhan fc540b72a6 vala: Fix duplicate output detection
The same vapi or vala might be added multiple times. Don't freak out if
that happens. Only freak out if a vapi or vala generated source by the
same name and the output same path is added twice.

This should never happen anyway since we would refuse to create the
target in the first place in theory, but it might happen because of bugs
in generators and custom targets.

Closes #1084
2016-12-15 04:12:23 +05:30
Jussi Pakkanen b01d2c35b7 Only add build dir inlude directives if the corresponding dir exists. Closes #1185. 2016-12-13 14:19:34 +02:00
Nirbheek Chauhan 038b15a7b2 Add __repr__ for ExtractedObjects and better error for Vala libraries 2016-12-13 09:37:47 +05:30
Nirbheek Chauhan 82a77609e8 Query the target itself for the dynamic linker
This greatly improves the logic for determining the linker. Previously,
we would completely break if a target contained only extracted objects
and we were using more than one compiler in our project.

This also fixes determination of the linker if our target only contains
generated objc++ sources, and other funky combinations.
2016-12-13 09:37:47 +05:30
Nirbheek Chauhan 7b3d00fee4 Use dict for self.build.compilers instead of list
Everywhere we use this object, we end up iterating over it and comparing
compiler.get_language() with something. Using a dict is the obvious
choice and simplifies a lot of code.
2016-12-13 09:20:34 +05:30
Jussi Pakkanen 5787a4b4fb Make Java compilation work with inner classes. Closes #1157. 2016-12-12 21:01:10 +02:00
Nirbheek Chauhan 70f39ee21e unity builds: Assembly and LLVM IR are incompatible
Can't just #include them and use them directly in unity builds. Inline
assembly is a thing, but it's not trivial and is deprecated with some
compilers. Just build them separately and link them in. Ideally the user
would then use LTO to ensure the same result.
2016-12-11 14:54:30 +05:30
Nirbheek Chauhan 04c1909a4d compilers: Implement support for LLVM IR compilation
Also C++ compilers can build .S assembly files. This wasn't noticed
earlier because most people were also using C compilers in their C++
projects and we would fall back to using the C compiler for building the
assembly files. Now we have a test for this.

This was trivial to add; except that we needed a new LLVM IR rule
because the compiler emits warnings if you pass any special arguments to
it such as include arguments or dependency arguments.

Closes #1089
2016-12-11 14:54:30 +05:30
Nirbheek Chauhan 60716fcd6d Use universal_newlines=True for all Popen calls
Instead of adding it everywhere manually, create a wrapper called
mesonlib.Popen_safe and use that everywhere that we call an executable
and extract its output.

This will also allow us to tweak it to do more/different things if
needed for some locales and/or systems.

Closes #1079
2016-12-11 01:59:58 +02:00
Jussi Pakkanen f62f730821 Merge pull request #1126 from mesonbuild/sharedmodule
Support for shared modules
2016-12-07 21:49:16 +02:00
Jussi Pakkanen dc1f537fb3 Skip shared module test on VS because it fails for some reason nobody understands. 2016-12-07 00:30:28 +02:00
Nirbheek Chauhan c7a2664cb7 Better error when passing invalid objects to install_header
This will print the object type when you pass a generated file to
install_header instead of printing an assert.
2016-12-06 20:27:33 +02:00
Thibault Saunier 10e2b9bca0 mesontest: Rebuild all before running tests
Only supporting ninja backend for now.
2016-12-03 22:41:31 +02:00
Nirbheek Chauhan e1c9d94708 Allow many version conditions for pkg-config deps
Sometimes we want to restrict the acceptable versions to a list of
versions, or a smallest-version + largest-version, or both. For
instance, GStreamer's opencv plugin is only compatible with
3.1.0 >= opencv >= 2.3.0
2016-12-03 21:46:20 +02:00
Jussi Pakkanen 04a2e6ded3 Do not use -install_name or -shared when building modules on OSX,
but do use -bundle. Closes #1112.
2016-12-02 22:28:18 +02:00
Jussi Pakkanen 6d84b9b646 Created new shared module build target type, and make sure -Wl,--no-undefined is not used when linking it. 2016-12-02 21:55:56 +02:00
Jussi Pakkanen 07d7e87411 Allow soname to be an arbitrary string and fix symlink generation. 2016-11-26 22:16:05 +02:00
Jussi Pakkanen c9a46fcc93 Can set compiler arguments in Java. 2016-11-20 16:57:58 -05:00
Jussi Pakkanen 8f41154827 Can specify headers to install with Files. 2016-11-20 16:52:45 -05:00
Jussi Pakkanen aa9668a2fc Merge pull request #730 from mesonbuild/newtest
New testing tool
2016-11-20 16:07:32 -05:00
Jussi Pakkanen a01919976e Always specify installed data with a File object. Closes #858. 2016-11-18 17:37:35 -05:00
Jussi Pakkanen 1ebc5c1ea0 Can run special tests with the new tool. 2016-11-18 22:10:22 +02:00
Jussi Pakkanen c7ddce163f All testing is now in mesontest.py, which simplifies a lot of stuff. 2016-11-18 22:10:22 +02:00
Jussi Pakkanen 0d619df2f3 Removed subsuite targets. 2016-11-18 22:04:29 +02:00
Jussi Pakkanen 951262d759 Removed Valgrind from core. 2016-11-18 22:04:29 +02:00
Guillaume Poirier-Morency b2a39dd06e vala: Generate GIR into the build directory (fix #185)
Add a Vala test generating GIR and typelib files.
2016-11-12 18:03:24 -05:00
Thibault Saunier 85a0cd7635 Add new add_project_[link]_args functions
Fixes 979
2016-11-12 17:34:06 -05:00
Nirbheek Chauhan 085650a1e3 vala: Implement valac.find_library
Move CCompiler.compile to Compiler.compile so that ValaCompiler can use
it. Also rewrite ValaCompiler.sanity_check to use it since it does
a simple compile check.

At the same time, it enhances ExternalLibrary to support arguments for
languages other than C-like.

Includes a test for this that links against zlib through Vala.

Closes #983
2016-11-12 13:56:17 -05:00
Jussi Pakkanen 1e0ae0a083 Revert "vala: Build with '--nostdpkg'", MR #920
This reverts commit 0f098c37ae.
2016-11-12 18:46:51 +02:00
Guillaume Poirier-Morency 0f098c37ae vala: Build with '--nostdpkg'
Since Vala require 'glib-2.0' and 'gobject-2.0' dependencies, it's
better to fail at 'valac' step with meaningful error.

Add missing 'gobject-2.0' dependency on the mixed source test case.
2016-11-12 10:55:47 -05:00
Jussi Pakkanen e02aaad632 Merge pull request #1011 from centricular/runtarget-files-rel-builddir
ninja: Pass absolute path of files to run targets
2016-11-10 14:47:35 -05:00
Jussi Pakkanen fd425d56a5 Merge pull request #991 from mesonbuild/wip/tingping/gresource-depfile
gnome: Use depfile support of recent glib-compile-resources
2016-11-10 14:08:32 -05:00
Nirbheek Chauhan 88f1d400c0 Fix debug PCH builds with MSVC 2012 and later
With MSVC 2013 and newer, using pre-compiled headers with .pdb debugging
fails with the following error message:

fatal error C1041: cannot open program database '[...]\prog.pdb'; if multiple CL.EXE write to the same .PDB file, please use /FS

So we use /FS when PCH is enabled. When PCH is enabled and debugging is
disabled, this will have no effect since .pdb files will not be written.
2016-11-10 00:40:16 +05:30
Patrick Griffis 573b3afb52 backends: Output depfiles in same directory as target 2016-11-09 17:39:30 +01:00
Nirbheek Chauhan a2262103fb Implement mlog.warning and use it everywhere for warnings
Prepends the string with 'WARNING:' in ANSI yellow.

Closes https://github.com/mesonbuild/meson/issues/961
2016-11-08 17:43:24 -05:00
Nirbheek Chauhan b1898fd139 ninja: Pass absolute path of files to run targets
We already pass everything else (custom targets, build targets, etc) as
absolute paths, and this is the only sane way to handle this till we
rework the codebase to use File objects everywhere (after reworking the
File object itself).

Fixes https://github.com/mesonbuild/meson/issues/957
2016-11-09 03:04:37 +05:30
Jussi Pakkanen 841380acfe Search for headers in build dir before source dir. Closes #984. 2016-11-08 15:00:42 -05:00
Jussi Pakkanen 1cf787f281 Added reconfigure target that always reruns Meson. 2016-11-06 09:10:04 -08:00
Tim-Philipp Müller d37bbef411 ninjabackend: fix error message 2016-11-05 03:10:36 -07:00
Jussi Pakkanen 72995b5800 Do not error out if compdb can not be created. 2016-11-02 13:48:24 -07:00
Jussi Pakkanen 33323bb7e3 Merge pull request #952 from centricular/deterministic-sources-outputs
Ninja: Use OrderedDict in places where order matters
2016-10-26 14:16:18 -07:00
Jussi Pakkanen 2d058bdcff Merge pull request #912 from valum-framework/wip/vala-custom-header-and-vapi
vala: Custom header and vapi name (fix #892)
2016-10-25 10:06:49 -07:00
Guillaume Poirier-Morency 66518d4dad vala: Use a portable path join for the VAPI 2016-10-25 10:57:40 -04:00
Nirbheek Chauhan 706425abd1 Ninja: Use OrderedDict in places where order matters
Specifically, wherever we have sources or outputs, we want to use an
OrderedDict so that the build is always deterministic. It was reported
by Olexa Bilaniuk that `ar D` creates static libraries with different
checksums depending on the order of the object files.

See: https://github.com/mesonbuild/meson/pull/951

We don't actually want to preserve the order in which they are listed.
We just want the order to be deterministic and predictable.
2016-10-25 14:36:16 +05:30
Guillaume Poirier-Morency 114b5b0637 vala: Use 'vala_header' and 'vala_vapi' directly
Move the fallback logic into 'BuildTarget.process_kwargs' to use the
target name instead.
2016-10-24 18:01:27 -04:00