Commit Graph

72 Commits

Author SHA1 Message Date
Jussi Pakkanen c76dcdb62b Fix the rest of them. 2017-02-19 21:56:33 +02:00
Jussi Pakkanen 4dfd9701e3 Fix compiler detection + cross when envvar not set. 2017-02-19 21:04:46 +02:00
Jussi Pakkanen aba099a491 Merge pull request #1396 from fabio-porcedda/cross-ccache
cross_file: add support for "ccache"
2017-02-19 11:42:27 -05:00
Fabio Porcedda 16d4c466fc detect_c_compiler(): support extra commands and arguments in the string
- Hanlde correctly a multi command string in evironment variable, e.g.:
  CC="ccache gcc" meson
- Handle correctly a list for the cross-file option, e.g:
  [binaries]
  c = ['ccache', '/usr/local/bin/mips-linuc-gcc']

This commit fixes #1392.
2017-02-17 17:11:17 +01:00
Fabio Porcedda aa7f496144 detect_c_compiler(): use shlex.split() instead of str.split() for env
Use shlex.split() for splitting the env var instead of str.split() to
handle quoting and spaces in paths.
2017-02-17 17:11:02 +01:00
Jussi Pakkanen 5973dcc25b Detect x86/amd64 from the compilers because system info may be incorrect. 2017-02-12 14:55:32 +02:00
Mike Sinkovsky 969be1f679 cleanup: Remove redundant parentheses 2017-01-18 21:22:47 +02:00
Mike Sinkovsky 1d177fb127 cleanup: Unused local variables 2017-01-18 21:22:47 +02:00
Mike Sinkovsky 5b626ab4cb style: [E1**] Indentation 2017-01-11 12:33:27 -05:00
Mike Sinkovsky 84902cb93a style: [E301] expected 1 blank line, found 0 2017-01-11 12:33:27 -05:00
Jussi Pakkanen 24221d71cc Created a Python 3 module for simpler building of Python extension modules. 2017-01-09 21:07:23 +02:00
Nirbheek Chauhan 747d4f2b03 We only need Ninja 1.5.x for the core code
This change helps us run on older distros such as Ubuntu LTS which is
very lazy in updating even non-core and stable packages such as Ninja.

Ninja 1.6.x is only needed for running the tests.
2017-01-09 14:03:03 -05:00
Philipp Geier 54697b4130 ICC 17.0.0 working for Linux and Ninja Backend.
Added IntelCompiler, IntelCCompiler and IntelCCompiler.
environments.py has been changed to detect icc and icpc.
ninjabackend changed for proper pch generation.

ICC 17.0.0 does not support C++13 (that's why default arguments tests fails).
Test 25 object extraction fails due to some unescaped whitespaces.
Some test with vala fail because of successful build, although they
should fail, as warning do not exit with failure.
2017-01-04 00:40:54 +05:30
Mike Sinkovsky 2d2e3b943c fix for cross-builds targeting macosx 2017-01-02 11:08:30 -05:00
Igor Gnatenko 116da33cdd style: fix E128 violations
E128: continuation line under-indented for visual indent

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2017-01-01 12:02:05 -05:00
Igor Gnatenko f0b30baa39 style: fix E225 violations
E225: missing whitespace around operator

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2017-01-01 12:02:05 -05:00
Jussi Pakkanen b55235dfbd Fix space before :. 2016-12-31 16:28:15 +02:00
Jussi Pakkanen a2528a8816 Merge pull request #1233 from mesonbuild/wip/ignatenko/code-style
Trivial cleanups in code
2016-12-21 00:09:44 +02:00
Nirbheek Chauhan 9bc07a0941 Fix several more lint errors
Found by Igor Gnatenko

************* Module mesonbuild.interpreter
E:1232,33: No value for argument 'interp' in constructor call (no-value-for-parameter)
************* Module mesonbuild.dependencies
E: 68, 4: An attribute defined in mesonbuild.dependencies line 39 hides this method (method-hidden)
************* Module mesonbuild.environment
E: 26, 0: class already defined line 19 (function-redefined)
E: 68,18: Undefined variable 'InterpreterException' (undefined-variable)
E:641,39: Undefined variable 'want_cross' (undefined-variable)
E:850,94: Undefined variable 'varname' (undefined-variable)
E:854,94: Undefined variable 'varname' (undefined-variable)
E:860,102: Undefined variable 'varname' (undefined-variable)
E:863,94: Undefined variable 'varname' (undefined-variable)
************* Module mesonbuild.modules.gnome
E:438,26: Undefined variable 'compilers' (undefined-variable)
2016-12-20 00:07:00 +02:00
Igor Gnatenko 139e020ede tree-wide: use proper 'not in' notation
Let's be more pythonic and 'not is' seems really weird.

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-12-19 21:48:35 +01:00
Jussi Pakkanen 411e88a5ab Fix PGI Fortran compiler detection. 2016-12-18 18:51:09 +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
Nirbheek Chauhan 09fd24ea78 Always catch PermissionError while looking for Ninja
Also convert a few other generic `except Exception`s to be more specific

Closes #1088
2016-11-26 12:56:08 -05:00
Jussi Pakkanen 951262d759 Removed Valgrind from core. 2016-11-18 22:04:29 +02:00
Paulo Antonio Alvarez 1e54a5e73c environment: Use GNU defines to get version of c, c++, objc and fortran
According to
https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html,
the macros used to get the version are always defined for those
languages, so use them to get the version.
2016-11-11 08:11:43 -02:00
Paulo Antonio Alvarez 582e1ede80 environment: Static method to get gcc version from compiler defines
The method takes a dictionary with defines names as keys and the defines
values as values. From it, we assemble the gcc version, using 0 as a
default value if the define we want is not defined.
2016-11-11 07:26:51 -02:00
Jussi Pakkanen 69aa0091b1 The regex to detect version numbers needs to be a bit more complex. Closes #967. 2016-11-02 13:47:38 -07:00
Nirbheek Chauhan 3df75d696d Directly pass the compiler to get_args_from_envvars
Seems better to do this since the behaviour is compiler-specific. Would
be easier to extend this later too in case we want to do more
compiler-specific things.
2016-10-26 23:16:05 +05:30
Emanuele Aina 6c50253645 Use argv[0] to internally relaunch meson.py
When installing Meson, distutils may choose to put shim scripts in the
`PATH` that only set up the egg requirements before launching the real
`meson.py` contained in the egg.

This means that `__file__` points to the real `meson.py` file, but
launching it directly is doomed to fail as it's missing the metadata
contained in the shim to set up the path egg, resulting in errors when
trying to import the `mesonbuild` module.

A similar issue affects Meson when installed as a zipapp, with the
current code going great lengths to figure out how to relaunch itself.

Using `argv[0]` avoids these issues as it gives us the way the current
executable has been launched, so we are pretty much guaranteed that
using it will create another instance of the same executable. We only
need to resolve relative paths as the current working directory may
get changed before re-launching the script, and using `realpath()` for
that saves us the trouble of manually resolving links and getting caught
in endless loops.

This also mean that `meson_script_file` no longer necessarily point to a
absolute file, so rename it to `_launcher` which hopefully would be less
prone to inducing false assumptions.
2016-10-08 15:41:31 +02:00
Nirbheek Chauhan bcf20af62e environment: Add support for MinGW/GCC to detect_windows_arch() 2016-09-27 00:27:38 +05:30
Nirbheek Chauhan a001fa0fb6 compilers: Make GCC detection more robust on all platforms
Fixes https://github.com/mesonbuild/meson/issues/650

Also adds new has_define and get_define internal API for querying
pre-processor defines provided by GNU compilers.
2016-09-27 00:27:38 +05:30
Nirbheek Chauhan ac8c8c2ba8 Treat 32-bit compiles on 64-bit Windows as native
It's a terrible user experience to force people building 32-bit
applications on 64-bit Windows to use a cross-info file when every other
tool treats it as a 'native' compilation -- it satisfies all the
requirements for a native compile.

This commit also fixes the platform detection on Windows which would
cause the 'native cpu' to be detected as 32-bit if you installed 32-bit
Python on 64-bit Windows, or if you were building with a 32-bit
toolchain on 64-bit Windows.

Doesn't support MinGW yet -- the next commits will add that since the
changes required for that are more involved.
2016-09-26 19:48:46 +05:30
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
Matthias Klumpp b80bdf65df Simplify D compiler argument translation 2016-08-21 01:39:48 +02:00
Matthias Klumpp 56823272ab Implement D support
This patch adds support for the D programming language[1] to Meson.

The following compilers are supported:
* LDC
* GDC
* DMD

[1]: http://dlang.org/
2016-08-19 03:02:51 +02:00
Nirbheek Chauhan a5e01fa155 Only append compile flags to the link flags when appropriate
We should only append the compiler flags to the link flags when the
compiler is used as a wrapper around the linker during the link process
2016-08-12 15:34:59 +05:30
Nirbheek Chauhan 01b43e5f0a Print the CFLAGS/LDFLAGS/etc inherited from the environment
People can forget it and then wonder what's wrong. Just explicitly print
it.
2016-08-11 16:09:48 +05:30
Jussi Pakkanen 1d36f68629 Merge pull request #660 from mesonbuild/libdirfix
Fix library directory handling
2016-07-30 20:09:49 +03:00
Jussi Pakkanen 10ab88710b Determine lib paths on demand rather than up front because they might change during build file parsing. 2016-07-30 19:42:01 +03:00
Nirbheek Chauhan 018fa4b90f vs: Fix regen_checker by using the correct coredata mtime
After c01b183e5, the mtime of coredata.dat is always newer than all the
other build files, which made regen_checker think that they always had
to be regenerated. Now we set the mtime of the file to a value before
the build files are generated and that makes everything behave as it did
earlier.
2016-07-29 08:18:59 +05:30
Jussi Pakkanen b072d72f94 Properties is no longer mandatory in cross files so do not require it. 2016-07-20 22:53:26 +03:00
Nirbheek Chauhan 88aafd363e Normalize the path of a configured file to avoid dupes (#640) 2016-07-19 20:10:57 +03:00
Nirbheek Chauhan 69d9c2228d vs: Fix Meson invocation while doing regen (#646)
The Meson script is not always in $scriptdir/../../ -- for instance if
installed with pip on Windows, the scriptdir is in:

C:/Python35/Lib/site-packages/meson-0.33.0.dev1-py3.5.egg/mesonbuild/scripts

and the meson.py script is in:

C:/Python35/Scripts

So, let's save the path available as Environment().meson_script_file
into the coredata.dat private file and use that to invoke Meson when
doing regen.

Also, let's fetch the backend that was used from the coredata too
instead of hard-coding vs2010.

Both these were causing a hard failure while doing regen with msbuild or
visual studio.
2016-07-19 00:00:17 +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 c0057da133 Can get arbitrary data from cross file properties. 2016-07-02 00:00:03 +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
Noam Meltzer 3a2334be1b be more resilient for identifying gcc compilers 2016-06-16 20:52:03 +03:00
Jussi Pakkanen 8e734a8c9f Set Gnu fortran type based on platform. 2016-05-30 22:42:11 +03:00