Commit Graph

539 Commits

Author SHA1 Message Date
Jussi Pakkanen 2e6df380f1
Merge pull request #5644 from bonzini/meson-exe-cmdline
Show command line in `ninja -v` for `capture: true` custom targets and generators
2019-08-03 01:28:27 +03:00
Jussi Pakkanen 7ce2a24f42 Made dist a top level command. 2019-07-23 23:26:46 +03:00
Dylan Baker 24c4c079e7 linkers: Add get_base_link_args method to static linkers
MSVC needs an argument to static linkers for doing LTO, so we need a way
for the static linker to tell us that.
2019-07-23 09:58:24 +00:00
Nirbheek Chauhan 9c2724bce5 Add optional progress bar when generating build.ninja 2019-07-20 17:02:15 +03:00
Paolo Bonzini f95c965043 backends: choose whether to serialize in as_meson_exe_cmdline
This removes more duplicate code between custom targets and generators.
In addition, generators can now have arguments with newlines in them.
2019-07-19 00:17:29 +02:00
Paolo Bonzini 3ef7b23178 backends: hide meson --internal exe cmdline from backends
Return the command line from serialize_executable, which is then
renamed to as_meson_exe_cmdline.  This avoids repeating code that
is common to custom targets and generators.
2019-07-19 00:17:29 +02:00
Xavier Claessens 12d4031f52 Add alias_target() function 2019-07-10 15:01:18 -04:00
James Westman 77c3e6a4aa Fix two errors when cross-compiling with Vala
- AttributeError: 'ValaCompiler' object has no attribute 'get_program_dirs'

  Fixed by adding a `get_program_dirs()` function to the base Compiler
  class, to match `get_library_dirs()`

- KeyError: 'vala_COMPILER'

  Fixed by creating the Vala compile rules for all machines, not just
  the build machine.
2019-06-27 21:28:54 +03:00
Michael Hirsch, Ph.D 5b109c9ad2 correct missing argument for IntelClFortranCompiler
ifort passes all tests

cleanup logic
2019-06-24 14:06:32 -04:00
Michael Hirsch, Ph.D ef53107f14 BUGFIX: Fortran module regex handle more edge cases 2019-06-23 17:27:46 +03:00
Jussi Pakkanen 49e9e0179c Do not quote targetdep, Ninja fails if it contains double quotes. 2019-06-21 17:07:21 +03:00
Michael Hirsch, Ph.D 927ce94d99 fortran depscan: ignore module procedure 2019-06-20 18:31:07 -04:00
Michael Hirsch, Ph.D 2a7ef98aff BUGFIX syntax 2019-06-20 12:31:32 -04:00
John Ericson 07777e15d4 Purge `is_cross` and friends without changing user interfaces
In most cases instead pass `for_machine`, the name of the relevant
machines (what compilers target, what targets run on, etc). This allows
us to use the cross code path in the native case, deduplicating the
code.

As one can see, environment got bigger as more information is kept
structured there, while ninjabackend got a smaller. Overall a few amount
of lines were added, but the hope is what's added is a lot simpler than
what's removed.
2019-06-09 13:13:25 -04:00
John Ericson 32e827dcdc Use `env.machines.*` to avoid some `is_cross`
This is a small example of the `is_cross` removal the that abstraction
enables.
2019-06-09 13:13:20 -04:00
Marcel Hollerbach 5465fc5e28 ninjabackend: refactor _generate_single_compile
when we are generating the include directories for a build target, then
we are iterating over all include directories, check if they are . or ..
and if not, generate a compile args object for it. However, the join
calls and the generation of the compile object is quite expensive, if we
cache the results of this, then we can _generate_single_compile from 60%
to roughly 50%.
2019-06-03 20:37:27 +03:00
Jussi Pakkanen 79d530e325 Generators can have extra target dependencies. Closes #4131. 2019-05-20 23:38:13 +03:00
Jon Turney 3ff758f22d Switch from build.compiler to environment.coredata.compiler in backends
Switch from build.compiler to environment.coredata.compiler and likewise
from build.cross_compiler to environment.coredata.cross_compiler in
backends. (Only seems to be actually used in ninja backend).
2019-05-20 11:29:17 -07:00
Jon Turney 6d6f6ad5fa Remove a pointless conditional
After #4445, the code in both branches of this conditional is the same.
2019-05-20 11:29:17 -07:00
Dylan Baker b935359978 backends/ninja: Ifort is msvc-like but doesn't have showincludes 2019-05-13 11:22:31 -07:00
Dylan Baker 541523eeba compilers: Split C-Like functionality into a mixin classes
Currently C++ inherits C, which can lead to diamond problems. By pulling
the code out into a standalone mixin class that the C, C++, ObjC, and
Objc++ compilers can inherit and override as necessary we remove one
source of diamonding. I've chosen to split this out into it's own file
as the CLikeCompiler class is over 1000 lines by itself. This also
breaks the VisualStudio derived classes inheriting from each other, to
avoid the same C -> CPP inheritance problems. This is all one giant
patch because there just isn't a clean way to separate this.

I've done the same for Fortran since it effectively inherits the
CCompiler (I say effectively because was it actually did was gross
beyond explanation), it's probably not correct, but it seems to work for
now. There really is a lot of layering violation going on in the
Compilers, and a really good scrubbing would do this code a lot of good.
2019-05-03 10:36:50 -07:00
Daniel Mensinger 236221061a
Fixed unnecessary .items() 2019-04-29 12:23:13 +02:00
Daniel Mensinger 3581839f4c
Fix unused variables warnings 2019-04-29 12:22:50 +02:00
Daniel Mensinger e75211d321
Fix builtin variable names 2019-04-29 12:17:40 +02:00
Jon Turney 0debaab8d1
ninja: Suppress unused rules in output
Don't bother outputting any rules which aren't referenced by any build
statement.
2019-04-27 15:57:01 +01:00
Jon Turney 091459cbdf
ninja: Expand comment on shell-unquoted ninja variables 2019-04-27 15:57:01 +01:00
Jon Turney e4d4ac773a
ninja: Push concatenation of command down into NinjaRule
Pass the command line to NinjaRule() as a list of strings, not already
concatenated as a string.
2019-04-27 15:57:01 +01:00
Jon Turney 798cacd30a
ninja: Remove unneeded outfile args (build statements)
After the previous commit, outfile is now passed down to lots of things
which don't use it, as they only create built statements, rather than
writing them out.  Remove these unnecessary args.
2019-04-27 15:56:51 +01:00
Jon Turney c4304d25f9
ninja: Store build statements
Store the build statements and then write them all out, rather than
writing them out as we go.

Construct a NinjaBuildElement for the 'PHONY' target, rather than
writing it literally to the build.ninja file.
2019-04-27 15:54:17 +01:00
Jon Turney 45d1dff592
ninja: Remove unneeded outfile args (rules)
After the previous commit, outfile is now passed down to lots of things
which don't use it, as they only create rules, rather than writing them
out.  Remove these unnecessary args.
2019-04-27 15:42:14 +01:00
Jon Turney 1303389700
ninja: Store rules
Store the rules and then write them all out, rather than writing them
out as we go.

Store the rule broken down into parts which do and don't go into
rspfile, so we can construct either a rsp or non-rsp version of the
rule.
2019-04-27 15:39:32 +01:00
Jon Turney 7bc1db2d7b
ninja: Move things which aren't rules or build statements up to generate() 2019-04-23 11:22:51 +01:00
Jon Turney 42e9028868
ninja: Remove use of unset ninja variable 'aliasing'
Setting this variable to contain additional commands to symlink shlib
aliases was removed in commit c0bf3e8d, so it's always unset now, and
thus does nothing.
2019-04-23 11:22:49 +01:00
Dylan Baker add821db64 Don't use mutable types as default arguments
This isn't safe given the way python implements default arguments.
Basically python store a reference to the instance it was passed, and
then if that argument is not provided it uses the default. That means
that two calls to the same function get the same instance, if one of
them mutates that instance every subsequent call that gets the default
will receive the mutated instance. The idiom to this in python is to use
None and replace the None,

def in(value: str, container: Optional[List[str]]) -> boolean:
   return src in (container or [])

if there is no chance of mutation it's less code to use or and take
advantage of None being falsy. If you may want to mutate the value
passed in you need a ternary (this example is stupid):

def add(value: str, container: Optional[List[str]]) -> None:
    container = container if container is not None else []
    container.append(value)

I've used or everywhere I'm sure that the value will not be mutated by
the function and erred toward caution by using ternaries for the rest.
2019-04-23 02:03:19 +03:00
makise-homura 54f9ec4510 Fix concatenation of library dirs 2019-04-19 18:02:01 +03:00
Paolo Bonzini b9774b4485 generator: add dependency on generator in source tree
If find_program() returns a file from the source directory, anything
that uses it should add the file to the dependencies, so that they are
rebuilt whenever the script changes.  Generator is not doing that.

While at it, I am doing two related fixes:

- Generator is not checking whther the generator actually was found,
resulting in a Python error involving NoneType if it isn't.  To minimize
backwards compatibility issues, I am only raising the error when
g.process() is acutally called.

- the error message for custom_target with a nonexisting program
erroneously mention a not-found external program "nonexistingprogram".
The new error is similar to the one I am adding for generators.
2019-04-16 01:46:31 +00:00
Dylan Baker 6ad7fbf950 dependencies/misc: don't special case threads
Instad of having special casing of threads in the backends and
everywehre else, do what we did for openmp, create a real
dependency. Then make use of the fact that dependencies can now have
sub dependencies to add threads.
2019-04-05 16:41:08 -07:00
Michael Hirsch, Ph.D 8763d1a584 cleanup rebase of fortraninclude..submod 2019-03-25 08:28:33 -04:00
Michael Hirsch, Ph.D cc4e0b5027 DRY Fortran submodule regex 2019-03-25 08:28:33 -04:00
Michael Hirsch, Ph.D c8342b794b no \b for no-gap non-stantard submodule declaration 2019-03-25 08:28:33 -04:00
Michael Hirsch, Ph.D 41edb6d68f tolerate no-space submodule (non-standard syntax) 2019-03-25 08:28:33 -04:00
Michael Hirsch, Ph.D 434599cc12 Squashed commit of the following:
commit b02b2d6d0d462310b313588ca7705d391e830eeb
Author: Michael Hirsch, Ph.D <scivision@users.noreply.github.com>
Date:   Sun Mar 10 03:51:09 2019 -0400

    cleanup

commit 3311ff5fb12577c78671bf2ff2787d28b86ba5fa
Author: Michael Hirsch, Ph.D <scivision@users.noreply.github.com>
Date:   Sun Mar 10 03:50:30 2019 -0400

    more robust

commit 8030dcb76698b148ee47ecded1f33b6d3821cca2
Author: Michael Hirsch, Ph.D <scivision@users.noreply.github.com>
Date:   Sun Mar 10 03:30:05 2019 -0400

    inwork compiles OK but needs smod filenames
2019-03-25 08:28:32 -04:00
Michael Hirsch, Ph.D 2a830743cc allow fortran submodule to have same name as module 2019-03-25 08:28:32 -04:00
Jussi Pakkanen 8361da5c52 Fix setup so test suite runs with rustc + MSVC. Closes: 5099 2019-03-24 20:56:06 +02:00
Jussi Pakkanen 4e5edff60f Fix Rust global and local args. Closes #5101. 2019-03-22 20:59:33 +02:00
Jussi Pakkanen 3a613564d3
Merge pull request #5116 from dcbaker/openmp-de-specialize
dependencies/openmp: Don't special case OpenMP
2019-03-21 01:21:37 +02:00
Dylan Baker ac627bcea7 replace library type strings with an enum
This patch creates an enum for selecting libtype as static, shared,
prefer-static, or prefer-shared. This also renames 'static-shared'
with 'prefer_static' and 'shared-static' with 'prefer_shared'. This is
just a refactor with no behavioral changes or user facing changes.
2019-03-20 18:45:56 +02:00
Dylan Baker 1f342a2081 dependencies/openmp: Don't special case OpenMP
Currently we specialcase OpenMP like we do threads, with a special
`need_openmp` method. This seems like a great idea, but doesn't work
out in practice, as well as it complicates the opemp
implementation. If GCC is built without opemp support for example, we
still add -fopenmp to the the command line, which results in
compilation errors.

This patch discards that and treats it like a normal dependency,
removes the need_openmp() method, and sets the compile_args attributes
from the compiler.

Fixes #5115
2019-03-19 12:48:22 -07:00
Michael Hirsch, Ph.D 6d215476c0
functionalize per-file Fortran dep scan
allow recursion for Fortran include

qualify include by file extension

correct suffix
2019-03-14 01:43:25 -04:00
Niklas Claesson dd2c44cdf6 Add static as keyword to find_library 2019-03-11 20:56:52 +02:00