aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/backend/backends.py
AgeCommit message (Collapse)AuthorFilesLines
2017-07-20Support implibs for executables on WindowsJon Turney1-5/+11
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-20Allow test to depend on executable target in cross build. (#2007)FredericHamel1-0/+2
* Add a crossbuild case in 'test case/common/1 trivial/meson.build' * Add native flags for crossbuild tests.
2017-06-27Merged Genie support.Jussi Pakkanen1-1/+1
2017-06-26Recognise .gs extension as a Vala sourceAlistair Thomas1-1/+1
2017-06-22Skip handling non-available dependenciesJens Georg1-0/+3
This way, an optional dependency can always be added on Vala targets without meson adding --pkg
2017-06-11Merge pull request #1927 from centricular/gir-rpath-linkJussi Pakkanen1-0/+9
Work around GNU ld bug with -rpath,$ORIGIN
2017-06-11gnome: Work around GNU ld bug with -rpath,$ORIGINNirbheek Chauhan1-0/+9
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-09dependencies: Add a new class ExternalDependencyNirbheek Chauhan1-1/+1
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-02Don't add dependencies recursively while linkingNirbheek Chauhan1-8/+4
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-05-29Whitespace tweaks to reduce Flake8 warningsAlistair Thomas1-1/+0
2017-05-21Fix cross environment pollution.Ole André Vadla Ravnås1-3/+4
Environment variables like CFLAGS and LDFLAGS should not affect the cross environment. Fixes #1772
2017-05-17Use more direct dictionary literals.Elliott Sales de Andrade1-3/+1
2017-05-08Use 'generate_basic_compiler_args' for Vala targetsGuillaume Poirier-Morency1-1/+12
Move '-C' option into 'get_always_args' as we always generate C sources. Add a branch in the dependency management to perform Vala-specific work of adding '--pkg' and '--target-glib'.
2017-05-08Add support for @CURRENT_SOURCE_DIR@ in generator argumentsAlberto Aguirre1-0/+4
Allow users to specify @CURRENT_SOURCE_DIR@ in generator arguments to specify the current target source directory. This is useful when creating protobuf generator objects in sub-directories because protoc will then generate files in the expected location. Fixes #1622. Remove stray semicolon Update documentation
2017-05-04Use American English - 'ise' -> 'ize' where applicablePeter Hutterer1-2/+2
2017-05-03Kill RawFile dead!Jussi Pakkanen1-0/+2
2017-05-02Don't use len() to test emptiness vs not emptinessDylan Baker1-1/+1
Meson has a common pattern of using 'if len(foo) == 0:' or 'if len(foo) != 0:', however, this is a common anti-pattern in python. Instead tests for emptiness/non-emptiness should be done with a simple 'if foo:' or 'if not foo:' Consider the following: >>> import timeit >>> timeit.timeit('if len([]) == 0: pass') 0.10730923599840025 >>> timeit.timeit('if not []: pass') 0.030033907998586074 >>> timeit.timeit('if len(['a', 'b', 'c', 'd']) == 0: pass') 0.1154778649979562 >>> timeit.timeit("if not ['a', 'b', 'c', 'd']: pass") 0.08259823200205574 >>> timeit.timeit('if len("") == 0: pass') 0.089759664999292 >>> timeit.timeit('if not "": pass') 0.02340641999762738 >>> timeit.timeit('if len("foo") == 0: pass') 0.08848102600313723 >>> timeit.timeit('if not "foo": pass') 0.04032287199879647 And for the one additional case of 'if len(foo.strip()) == 0', which can be replaced with 'if not foo.isspace()' >>> timeit.timeit('if len(" ".strip()) == 0: pass') 0.15294511600222904 >>> timeit.timeit('if " ".isspace(): pass') 0.09413968399894657 >>> timeit.timeit('if len(" abc".strip()) == 0: pass') 0.2023209120015963 >>> timeit.timeit('if " abc".isspace(): pass') 0.09571301700270851 In other words, it's always a win to not use len(), when you don't actually want to check the length.
2017-04-17Merge pull request #1628 from ximion/dfixJussi Pakkanen1-1/+1
d: Fix linking shared libraries with DMD
2017-04-15d: Fix linking shared libraries with DMDMatthias Klumpp1-1/+1
2017-04-15Make it possible to only do unity builds on subprojects.Jussi Pakkanen1-1/+8
2017-04-13Merge pull request #1548 from ssssam/sam/stable-orderingJussi Pakkanen1-1/+2
Stable ordering of some commandlines generated by 'gnome' module
2017-04-10vs: Fix depend_files support in custom targetsNirbheek Chauhan1-0/+16
This was totally broken and we didn't notice because we had no tests for it at all.
2017-04-09Merge pull request #1469 from centricular/install-secondary-outputsJussi Pakkanen1-2/+2
Support multiple install dirs for built/custom targets
2017-04-08Merge pull request #1518 from centricular/mesonintrospect-evarJussi Pakkanen1-3/+5
Export MESONINTROSPECT to postconf/install/run_command scripts
2017-04-06Use extra_paths on CygwinJon Turney1-2/+2
Cygwin executables are still loaded by the Windows PE loader, so PATH needs to include any extra directories where required DLLs can be found. Cygwin uses a unix style ':'-separated PATH. os.pathsep is used correctly on extra_paths in meson_exe.py, but not in mesontest.py
2017-04-04Support multiple install dirs for built/custom targetsNirbheek Chauhan1-2/+2
You can now pass a list of strings to the install_dir: kwarg to build_target and custom_target. Custom Targets: =============== Allows you to specify the installation directory for each corresponding output. For example: custom_target('different-install-dirs', output : ['first.file', 'second.file'], ... install : true, install_dir : ['somedir', 'otherdir]) This would install first.file to somedir and second.file to otherdir. If only one install_dir is provided, all outputs are installed there (same behaviour as before). To only install some outputs, pass `false` for the outputs that you don't want installed. For example: custom_target('only-install-second', output : ['first.file', 'second.file'], ... install : true, install_dir : [false, 'otherdir]) This would install second.file to otherdir and not install first.file. Build Targets: ============== With build_target() (which includes executable(), library(), etc), usually there is only one primary output. However some types of targets have multiple outputs. For example, while generating Vala libraries, valac also generates a header and a .vapi file both of which often need to be installed. This allows you to specify installation directories for those too. # This will only install the library (same as before) shared_library('somevalalib', 'somesource.vala', ... install : true) # This will install the library, the header, and the vapi into the # respective directories shared_library('somevalalib', 'somesource.vala', ... install : true, install_dir : ['libdir', 'incdir', 'vapidir']) # This will install the library into the default libdir and # everything else into the specified directories shared_library('somevalalib', 'somesource.vala', ... install : true, install_dir : [true, 'incdir', 'vapidir']) # This will NOT install the library, and will install everything # else into the specified directories shared_library('somevalalib', 'somesource.vala', ... install : true, install_dir : [false, 'incdir', 'vapidir']) true/false can also be used for secondary outputs in the same way. Valac can also generate a GIR file for libraries when the `vala_gir:` keyword argument is passed to library(). In that case, `install_dir:` must be given a list with four elements, one for each output. Includes tests for all these. Closes https://github.com/mesonbuild/meson/issues/705 Closes https://github.com/mesonbuild/meson/issues/891 Closes https://github.com/mesonbuild/meson/issues/892 Closes https://github.com/mesonbuild/meson/issues/1178 Closes https://github.com/mesonbuild/meson/issues/1193
2017-04-03Ensure rules in the generated build.ninja file are in a stable orderSam Thursfield1-1/+2
Previously, two functionally identical builds could produce different build.ninja files. The ordering of the rules themselves doesn't affect behaviour, but unnecessary changes in commandline arguments can cause spurious rebuilds and if the ordering of the overall file is stable than it's easy to use `diff` to compare different build.ninja files and spot the differences in ordering that are triggering the unnecessary rebuilds.
2017-04-02Review fixes.Jussi Pakkanen1-1/+1
2017-04-02Proxy object for overriding options transparently.Jussi Pakkanen1-1/+21
2017-04-02Use get_option_for_target for builtins where sensible.Jussi Pakkanen1-8/+8
2017-04-02Use relative object file name for unity files everywhere.Jussi Pakkanen1-7/+9
2017-04-02Create unity files with the VS backend.Jussi Pakkanen1-3/+11
2017-03-28modules: Start using @SOURCE_ROOT@ and @BUILD_ROOT@Nirbheek Chauhan1-0/+9
First step in fixing https://github.com/mesonbuild/meson/issues/1419 Also works around an issue in the MinGW windres.exe that causes it to fail if any of the arguments passed to it contain a space. There seems to be no way to quote or escape the spaces in the path to make windres parse the path correctly, so we just warn about it instead. https://sourceware.org/bugzilla/show_bug.cgi?id=4933 https://github.com/mesonbuild/meson/pull/1346
2017-03-28Export MESONINTROSPECT to postconf/install/run_command scriptsNirbheek Chauhan1-3/+5
Points to the `mesonintrospect.py` script corresponding to the currently-running version of Meson. Includes a test for all three methods of running scripts/commands. Closes https://github.com/mesonbuild/meson/issues/1385
2017-03-23Preserve the order of internal deps in a targetNirbheek Chauhan1-3/+5
We were adding them to the CompilerArgs instance in the order in which they are specified, which is wrong because later dependencies would override previous ones. Add them in the reverse order instead. Closes https://github.com/mesonbuild/meson/issues/1495
2017-03-03Nuke dead code which was used for installing PDB filesNirbheek Chauhan1-6/+0
We check for the existence of PDB files in the install script, so we don't need to do all this mucking about here. That's more robust too because we don't need to parse build arguments in buildtype=plain and decide if the PDB file would be generated.
2017-02-27Use cross stripper when cross compiling and allow overriding native strip ↵Jussi Pakkanen1-1/+2
executable. Closes #1414.
2017-02-20Merge pull request #1403 from centricular/compile_resourcesJussi Pakkanen1-43/+13
Make configure_file() great again
2017-02-20Rewrite custom_target template string substitutionNirbheek Chauhan1-43/+13
Factor it out into a function in mesonlib.py. This will allow us to reuse it for generators and for configure_file(). The latter doesn't implement this at all right now. Also includes unit tests.
2017-02-19find_program: Fix implementation of .path()Nirbheek Chauhan1-7/+7
And actually test that prog.path() works. The earlier test was just running the command without checking if it succeeded. Also make everything use prog.get_command() or get_path() instead of accessing the internal member prog.fullpath directly.
2017-01-28Merge pull request #1335 from tp-m/test-custom-target-used-in-test-cmdJussi Pakkanen1-0/+23
tests: check custom target output is created before being used in a t…
2017-01-28Use CompilerArgs for generation of link commandsNirbheek Chauhan1-20/+0
Also, now the linker options are added from various sources in the same order as compiler arguments for compile commands. As a result, all libraries and library paths from external and internal sources are added after all the linker options have been added. As a result option_link_args() are added when libraries are added to the list since currently the only thing they add are the libraries specific in cpp_winlibs/c_winlibs. This fixes an issue where compilation with the MinGW toolchain (which uses static libraries for winlibs) would result in undefined symbol errors because the static libraries would be added in the very beginning and hence would not be scanned for symbols. Detailed comments have been added that explain where each option is coming from and why it's been added at that specific point. More improvements are necessary here because we currently still unnecessarily repeat libraries from dependencies over and over, which is a major problem in gst-build because inter-subproject dependencies cause linker command-lines to almost exceed the argument list length limit imposed by the kernel. It is also causing us to unnecessarily add static libraries which have already been linked into a shared library. See: self.build_target_link_arguments()
2017-01-28Use CompilerArgs for generation of compile commandsNirbheek Chauhan1-11/+39
At the same time, also fix the order in which compile arguments are added. Detailed comments have been added concerning the priority and order of the arguments. Also adds a unit test and an integration test for the same.
2017-01-28backends: Add support for build_by_default to vs2010 backendNirbheek Chauhan1-0/+23
Always generate the vcxproj file, but only add it to the build configuration if it's either supposed to be built by default, or is a dependency of another target that is built by default.
2017-01-27compilers: New class CompilerArgs derived from list()Nirbheek Chauhan1-1/+1
The purpose of this class is to make it possible to sanely generate compiler command-lines by ensuring that new arguments appended or added to a list of arguments properly override previous arguments. For instance: >>> a = CompilerArgs(['-Lfoo', '-DBAR']) >>> a += ['-Lgah', '-DTAZ'] >>> print(a) ['-Lgah', '-Lfoo', '-DBAR', '-DTAZ'] Arguments will be de-duped if it is safe to do so. Currently, this is only done for -I and -L arguments (previous occurances are removed when a new one is added) and arguments that once added cannot be overriden such as -pipe are removed completely.
2017-01-24Support file perms for install_data and install_subdirNirbheek Chauhan1-1/+2
With the 'install_mode' kwarg, you can now specify the file and directory permissions and the owner and the group to be used while installing. You can pass either: * A single string specifying just the permissions * A list of strings with: - The first argument a string of permissions - The second argument a string specifying the owner or an int specifying the uid - The third argument a string specifying the group or an int specifying the gid Specifying `false` as any of the arguments skips setting that one. The format of the permissions kwarg is the same as the symbolic notation used by ls -l with the first character that specifies 'd', '-', 'c', etc for the file type omitted since that is always obvious from the context. Includes unit tests for the same. Sadly these only run on Linux right now, but we want them to run on all platforms. We do set the mode in the integration tests for all platforms but we don't check if they were actually set correctly.
2017-01-18cleanup: Remove redundant parenthesesMike Sinkovsky1-6/+6
2017-01-18cleanup: Redundant character escapeMike Sinkovsky1-1/+1
2017-01-15Can use targets directly in test arguments.Jussi Pakkanen1-1/+9
2017-01-11style: [E303] too many blank lines (2)Mike Sinkovsky1-1/+0