Commit Graph

187 Commits

Author SHA1 Message Date
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
Guillaume Poirier-Morency ff6b3c7a2d vala: Custom header and vapi name (fix #892) 2016-10-24 18:01:27 -04:00
Nirbheek Chauhan 7e9203fac9 Fix Unity builds for Fortran and D targets
Also warn if we're trying to use a unity build on a target with fortran
or D sources.
2016-10-21 08:39:12 +05:30
Nirbheek Chauhan 57ce7d4618 Add support for extracting objects in unity builds
Not only does extract_all_objects() now work properly again,
extract_objects() also works if you specify a subset of sources all of
which have been compiled into a single unified object.

So, for instance, this allows you to extract all the objects
corresponding to the C sources compiled into a target consisting of
C and C++ sources.
2016-10-21 08:00:39 +05:30
Nirbheek Chauhan b070f505d3 ninja: Generate Vala compile rules after all header_deps are found
Same reason as generated C sources
2016-10-21 08:00:39 +05:30
Nirbheek Chauhan 8bee336e2a ninja: Always use RawFilename for unity sources and deps
The use of has_dir_part is a terrible back that we need to move away
from. This will eventually be fixed by always using File() objects
everywhere. For now, this is needed for unity builds to work.
2016-10-21 07:30:02 +05:30
Nirbheek Chauhan 65e9761cb1 Support all kinds of generated vala and vapi sources
This is the first step in making Vala support have feature-parity with
C/C++ support. Vala and Vapi sources generated with Generators and
CustomTargets are no longer ignored. Dependencies are setup properly and
they are added to the commandline.
2016-10-19 20:46:04 +05:30
Nirbheek Chauhan 23b060f0aa Ninja: Consolidate generated sources handling
Pre-calculate the output directory for GeneratedList and CustomTarget so
we can directly use the same code for both while compiling C/C++ files
and headers.

There is no reason to have separate branches for GeneratedList and
CustomTarget since both can be used in almost exactly the same way for
generating sources.

This is going to used next for adding generated sources support to Vala.
2016-10-19 20:46:04 +05:30
Nirbheek Chauhan 092c593acd Process dependencies for all targets not just C/C++
This isn't useful yet because we currently only have dependencies for
C/C++ targets (the rest all use link deps), but we will need this for
Vala, Rust, and more.
2016-10-19 20:42:11 +05:30
Nirbheek Chauhan 419b84784f CustomTarget: Use get_outputs() instead of get_filename()
get_filename() made no sense for CustomTarget since it can have multiple
outputs. Also use get_outputs() for GeneratedList since it has the same
meaning and remove unused set_generated().

As a side-effect, we now install all the outputs of a CustomTarget.
2016-10-19 20:42:11 +05:30
Nirbheek Chauhan 4332df01b8 Add no-warning args while building Vala C code
This is done by adding a new compiler method called 'no_warn_args' which
returns the argument(s) required for the compiler to emit no warnings
for that compilation.

This take care of not disabling warnings for C code compiled into the
BuildTarget. Also includes tests for ensuring all this.

https://github.com/mesonbuild/meson/issues/864
2016-10-14 19:13:21 +05:30
Jussi Pakkanen f0fee2e542 Fix soname to work on OSX. 2016-10-08 14:34:24 +02:00
Jussi Pakkanen 4dc798dc7e Check that soname matches the filename. Closes #785. 2016-10-08 07:34:39 -04:00
Jussi Pakkanen 6ec1e99043 Merge pull request #803 from centricular/generated-sources-header-deps
ninja backend: Fix header deps of generated source compiles
2016-10-01 15:41:46 -04:00
Nirbheek Chauhan 1e3d03cc09 ninja: Fix C file name for generated Vala sources
The Vala compiler preserves the path components of a Vala source file if
the source file is in a subdir.

Fixes https://github.com/mesonbuild/meson/issues/815
2016-10-02 00:50:45 +05:30
Nirbheek Chauhan 9d1aeebc27 ninja: Don't add every CustomTarget to 'all'
Otherwise they are built regardless of whether they are actually used by
anything else. Only build them if they're going to be installed or
always-built.

Ideally, we should also do this with all BuildTargets, and provide
a mechanism for people to specify which targets they want built with
'all', and a way for people to add them to custom targets.. Without
this, things like tests and examples are *always* built with no way to
turn that off.

For now, we just do this because it also with tests that check for
dependency issues. Including all CustomTargets in `all` results in
dangling targets to also be built, which hides the problem and makes it
racy.
2016-10-02 00:48:12 +05:30
Nirbheek Chauhan e713aca1d1 backends: Remove self.dep_rules dead code
self.dep_rules is not set anywhere by anything, so this code always
results in a no-op. If it didn't result in a no-op, it would need to be
seriously rewritten because it has bitrotten and makes no sense anymore.
2016-10-02 00:48:12 +05:30
Jussi Pakkanen 295b67df51 Merge pull request #814 from centricular/heavy-cleanup-compilers-buildtargets
Heavy cleanup in compilers and BuildTarget
2016-09-30 15:30:57 -04:00
Jussi Pakkanen 154763f81b Deduplicate command line arguments. Slight improvement to #671. 2016-09-28 16:18:08 -04:00
Nirbheek Chauhan 89753ecc27 Use per-target compilers while generating targets
This is definitely more correct since it takes into account the
cross-compilation status. We also now do the Java and CSharp sanity
checks on the BuildTarget level instead of in the Ninja backend.
2016-09-27 00:27:38 +05:30
Nirbheek Chauhan f85415f0d4 ninjabackend: Remove duplicate vala compiler usage 2016-09-27 00:27:38 +05:30
Nirbheek Chauhan f5caf40f66 ninja: Also add generated sources to the source list
The generated sources should also be used for determining the linker
2016-09-26 23:48:11 +05:30
Nirbheek Chauhan cfbffc6ba1 ninja: Fix header deps of generated source compiles
Because we were iterating over all generated sources of a target in one
go, we weren't adding the correct header_deps for generated source
compiles. We need to aggregate the header_deps first before generating
source compile targets for generated source files.
2016-09-26 23:48:11 +05:30
Nirbheek Chauhan ca507cdcdf ninja: Add a str and repr methods for RawFilename
This aids debugging immensely
2016-09-26 23:44:38 +05:30
Jussi Pakkanen e23e5c48d7 Use custom target outputs to determine linker. Closes #786. 2016-09-25 19:20:26 +03:00
Jussi Pakkanen c334eeda76 Merge pull request #684 from mesonbuild/pdb
Create pdb files with MSVC
2016-09-11 13:04:55 +03:00
Nirbheek Chauhan 0840a908f2 ninjabackend: Add support for installing .pdb files
.pdb files are files created by MSVC which have debug symbols. These are
created when /ZI or /Zi is passed to the compiler and /DEBUG to the
linker.
2016-09-11 10:10:47 +05:30
Jussi Pakkanen c7e5e558f9 More PDB explanation. 2016-09-10 13:26:37 +03:00
Jussi Pakkanen 19ecad5b24 Mark all dependencies for run targets. 2016-09-09 02:02:23 +03:00
Jussi Pakkanen d26ab47072 Can use custom targets as executables to run in a run_target. 2016-09-07 23:14:14 +03:00
Jussi Pakkanen 9235fd4ec1 Permit use of file objects in run targets. 2016-09-07 23:04:11 +03:00
Jussi Pakkanen a9da6c5132 Moved targets with same name into subdirs to make all tests pass. 2016-09-02 22:52:37 +03:00
Elliott Sales de Andrade 4c71695e41 Use context manager for file I/O.
There are a few cases where a context manager cannot be used, such as
the logger.
2016-08-27 18:29:55 -04:00
Jussi Pakkanen b7392bb290 Merge pull request #696 from mesonbuild/depfile
Add support for dependency files in custom targets.
2016-08-27 16:43:14 +03:00
Elliott Sales de Andrade a2321b24f6 Flatten isinstance calls. (#715)
That is, isinstance(x, y) or isinstance(x, z) can be flattened with a
tuple to isinstance(x, (y, z)).
2016-08-27 15:47:29 +03:00
Elliott Sales de Andrade 70d94a5550 Allow capturing command output of a custom target.
For commands that always output to stdout and don't have a "-o" or
"--output" or some other similar option, this 'capture' setting allows
the build to capture the result and place it in the output file.
2016-08-26 20:46:42 -04:00
Jussi Pakkanen c02a175d52 Add depfile support to generators. 2016-08-21 00:12:56 +03:00
Jussi Pakkanen 3ae918a463 Add support for dependency files in custom targets. 2016-08-20 21:01:49 +03:00
Jussi Pakkanen 36870ace0f Document pdb insanity a bit. 2016-08-18 23:15:54 +03:00
Jussi Pakkanen 1bed33fba2 Create pdbs that work when using pch or doing extract object (sadly not both). 2016-08-18 22:56:14 +03:00
Jussi Pakkanen ccda29794b Make pdb work with pch. 2016-08-18 00:12:54 +03:00
Jussi Pakkanen b08581d394 Generate pdb files during linking. 2016-08-17 23:50:50 +03:00
Jussi Pakkanen 5e047d9c91 Write pdb info to a specific file. 2016-08-17 23:28:35 +03:00
Nirbheek Chauhan 6d7b020aa2 ninja: Fix static library installation dir
Trivially correct typo fix. Didn't actually break anything because the
fallback is libdir anyway, and we always install static libraries to
libdir.

Pointed out by Zhe Wang (0x1997).
2016-07-27 14:39:32 +05:30
Nirbheek Chauhan 88aafd363e Normalize the path of a configured file to avoid dupes (#640) 2016-07-19 20:10:57 +03:00
Nirbheek Chauhan 5351b091a8 ninja: Remove duplicated if check (#637)
Trivially correct
2016-07-15 17:52:14 +03:00
Jussi Pakkanen 64919b1c74 Merge pull request #417 from nirbheek/dll-paths
Fix filenames and paths used in DLL shared library generation
2016-07-13 22:18:50 +03:00
Jussi Pakkanen a0666ebf9c Gcc versions older than 4.9 do not support color output. 2016-07-01 23:38:25 +03:00
Jussi Pakkanen 4f2b663928 Unify common code in run_target and custom_target. 2016-07-01 22:12:15 +03:00
Nirbheek Chauhan 0143c32c7c Overhaul versioning and naming of libraries
This commit contains several changes to the naming and versioning of
shared and static libraries. The details are documented at:
https://github.com/mesonbuild/meson/pull/417

Here's a brief summary:

* The results of binary and compiler detection via environment functions
  are now cached so that they can be called repeatedly without
  performance penalty. This is necessary because every
  build.SharedLibrary object has to know whether the compiler is MSVC or
  not (output filenames depend on that), and so the compiler detection
  has to be called for each object instantiation.

* Linux shared libraries don't always have a library version. Sometimes
  only soversions are specified (and vice-versa), so support both.

* Don't use versioned filenames when generating DLLs, DLLs are never
  versioned using the suffix in the way that .so libraries are. Hence,
  they don't use "aliases". Only Linux shared libraries use those.

* OS X dylibs do not use filename aliases at all. They only use the
  soversion in the dylib name (libfoo.X.dylib), and that's it. If
  there's no soversion specified, the dylib is called libfoo.dylib.
  Further versioning in dylibs is supposed to be done with the
  -current_version argument to clang, but this is TBD.

  https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/DynamicLibraryDesignGuidelines.html#//apple_ref/doc/uid/TP40002013-SW23

* Install DLLs into bindir and import libraries into libdir

* Static libraries are now always called libfoo.a, even with MSVC

* .lib import libraries are always generated when building with MSVC

* .dll.a import libraries are always generated when building with
  MinGW/GCC or MinGW/clang

* TODO: Use dlltool if available to generate .dll.a when .lib is
  generated and vice-versa.

* Library and executable suffix/prefixes are now always correctly
  overriden by the values of the 'name_prefix' and 'name_suffix' keyword
  arguments.
2016-07-01 20:50:47 +05:30
Jussi Pakkanen 0733c0f9a1 Changed run_target to take command as kwarg and add depends. This makes it behave the same as custom_target. 2016-06-24 23:07:57 +03:00
Jussi Pakkanen ea4fe8e417 Run_target can run binaries obtained with find_program. 2016-06-24 15:02:43 +03:00
Nirbheek Chauhan 50fef89218 ninjabackend: Add subdir includes before external dep includes
Fixes https://github.com/mesonbuild/meson/issues/604
2016-06-21 01:53:26 +05:30
Jussi Pakkanen 68dbbeb78f Octopus merged cross fixes and genetor custom because why not. 2016-06-16 21:03:57 +03:00
Sam Thursfield a661708b54 Use target name to decide generated Vala .h & .vapi filenames
Previously Meson would use the name of the first .vala source file. This
doesn't work for some projects. Tracker is one example: it has
several libraries that mix Vala and C code. In such cases, none of the
.vala files tend to bear the name of the library we actually want to
generate.
2016-06-15 15:15:58 +01:00
Jussi Pakkanen 475175f4b5 Can use generator outputs in custom targets. Closes #587. 2016-06-13 21:17:13 +03:00
Martin Hostettler 7bd424fea6 ninjabackend: Add missing ninja_quote for cross compilation rule. 2016-06-13 00:12:15 +02:00
Hemmo Nieminen 1f76b76a84 Add support for running specific test suites with valgrind. 2016-06-06 10:28:00 +03:00
Hemmo Nieminen fac6f869e0 Change test suite separator character from '-' to ':'.
This allows defining test suites for test-valgrind target without the risk
of e.g. being unable to differentiate the targets test-valgrind (testing
with valgrind) from test-valgrind (testing the valgrind subproject).
2016-06-06 10:28:00 +03:00
Jussi Pakkanen 0482635c12 Handle case of install_subdirring a subdir. 2016-05-30 23:08:24 +03:00
Jussi Pakkanen 8e734a8c9f Set Gnu fortran type based on platform. 2016-05-30 22:42:11 +03:00
Jussi Pakkanen beb6827413 Installing subdirs now merges with existing files in the target dir. 2016-05-30 21:48:03 +03:00
Jussi Pakkanen 16e032c289 Fix installing manpages from subdirs. 2016-05-30 20:26:31 +03:00
Jussi Pakkanen c2082146ab Merge branch 'nioncode-vs-generator' 2016-05-28 23:09:59 +03:00
Jussi Pakkanen 4377f773e0 Can set global linker arguments. Closes #536. 2016-05-28 21:31:59 +03:00
Nicolas Schneider a29d9c2c33 vs: fix generators that use indexed output replacements (like @OUTPUT0@) 2016-05-26 13:08:33 +02:00
Nirbheek Chauhan eb181485d0 ninja: Fix cross-build when using the compiler's stdlib
Logic was reversed. We want to pass -nostdinc when there's no c_stdlib specified
in the cross-info file.
2016-05-26 06:21:08 +05:30
Jussi Pakkanen df03f849a8 Merge pull request #542 from mesonbuild/ownstdlib
Build transparently with a custom standard library
2016-05-25 23:44:24 +03:00
Jussi Pakkanen babdb27570 Merge pull request #479 from mesonbuild/i18n
Moved gettext into i18n module.
2016-05-25 17:53:35 +03:00
Jussi Pakkanen 1a0938cc25 Automagic scan-build support. 2016-05-22 19:24:59 +03:00
Jussi Pakkanen afe7252476 Can specify a stdlib subproject that is used implicitly on all targets with said language. 2016-05-21 21:46:03 +03:00
Jussi Pakkanen dc148e0702 Remove all special casing for gettext and use elementary operations instead. 2016-05-21 18:21:23 +03:00
Jussi Pakkanen 8d73d3023a Better error message when compdb generation fails. 2016-05-03 21:53:36 +03:00