summaryrefslogtreecommitdiff
path: root/mesonbuild/compilers.py
Commit message (Collapse)AuthorAgeFilesLines
* Converted compilers.py to a sub-packageAlistair Thomas2017-06-221-3213/+0
|
* Split linkers out from compilers.pyAlistair Thomas2017-06-221-104/+6
|
* Merge pull request #1922 from acfoltzer/rust-improvementsJussi Pakkanen2017-06-221-2/+10
|\ | | | | Enhance Rust support
| * fix failing Rust test casesAdam C. Foltzer2017-06-141-4/+4
| |
| * Enhance Rust supportAdam C. Foltzer2017-06-091-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - Adds a `crate_type` kwarg to library targets, allowing the different types of Rust [linkage][1]. - Shared libraries use the `dylib` crate type by default, but can also be `cdylib` - Static libraries use the `rlib` crate type by default, but can also be `staticlib` - If any Rust target has shared library dependencies, add the appropriate linker arguments, including rpath for the sysroot of the Rust compiler [1]: https://doc.rust-lang.org/reference/linkage.html
* | Only call to_native once per invocation.Jussi Pakkanen2017-06-191-1/+1
| |
* | Preserve standalone -D arguments always.Jussi Pakkanen2017-06-181-0/+11
| |
* | Preserve -L -l pairings fetched from external depsNirbheek Chauhan2017-06-121-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While adding link args for external deps, sometimes different libraries come from different prefixes, and an older version of the same library might be present in other prefixes and we don't want to accidentally pick that up. For example: /usr/local/lib/libglib-2.0.so /usr/local/lib/pkgconfig/glib-2.0.pc /usr/local/lib/libz.so /usr/local/lib/pkgconfig/zlib.pc /home/mesonuser/.local/lib/libglib-2.0.so /home/mesonuser/.local/lib/pkgconfig/glib-2.0.pc PKG_CONFIG_PATH="/home/mesonuser/.local/lib/pkgconfig/:/usr/local/lib/pkgconfig/" If a target uses `dependencies : [glib_dep, zlib_dep]`, it will end up using /usr/local/lib/libglib-2.0.so instead of /home/mesonuser/.local/lib/libglib-2.0.so despite using the pkg-config file in /home/mesonuser/.local/lib/pkgconfig because we reorder the -L flag and separate it from the -l flag. With this change, external link arguments will be added to the compiler list without de-dup or reordering. Closes https://github.com/mesonbuild/meson/issues/1718
* | Merge pull request #1927 from centricular/gir-rpath-linkJussi Pakkanen2017-06-111-29/+29
|\ \ | | | | | | Work around GNU ld bug with -rpath,$ORIGIN
| * | compilers: Fix build_unix_rpath_args indentationNirbheek Chauhan2017-06-101-29/+29
| |/ | | | | | | No code changes
* | find_library: link_args is always a listNirbheek Chauhan2017-06-091-1/+1
|/
* compilers: Only set -rpath-link on GNU ld and linuxlikeNirbheek Chauhan2017-06-051-32/+35
| | | | It's an invalid option with Apple ld and leads to a build error.
* Use absolute RPATHs while linking due to a binutils bugNirbheek Chauhan2017-06-051-1/+6
| | | | | | | | | | | | | Use -rpath-link with the absolute paths to the respective build dirs to work around a binutils bug that causes $ORIGIN to not be used while linking. Includes a unit test that manually checks the RPATH value written out to ensure that it uses $ORIGIN. See: https://sourceware.org/bugzilla/show_bug.cgi?id=16936 Closes https://github.com/mesonbuild/meson/issues/1897
* Merge pull request #1545 from centricular/dont-link-recursivelyJussi Pakkanen2017-06-041-5/+45
|\ | | | | Don't add dependencies recursively while linking
| * ninja: De-dup libraries and use --start/end-groupNirbheek Chauhan2017-06-021-5/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now we aggressively de-dup the list of libraries used while linking, and when linking with GNU ld we have to enclose all static libraries with -Wl,--start-group and -Wl,--end-group to force the linker to resolve all symbols recursively. This is needed when static libraries have circular deps on each other (see included test). The --start/end-group change is also needed for circular dependencies between static libraries because we no longer recursively list out all library dependencies. The size of build.ninja for GStreamer is now down to 6.1M from 20M, and yields a net reduction in configuration time of 10%
* | compilers: Make CCompiler.find_library return value consistentPaulo Antonio Alvarez2017-06-031-2/+2
| | | | | | | | | | | | | | | | When the CCompiler.links method call in CCompiler.find_library fails, find_library resorts to finding the library file itself. In this second case, the return value is not a list, whereas if links suceeds, the return value is a list. Make it so that find_library returns a list in either case.
* | Use relative rpath so builds are reproducible.Jussi Pakkanen2017-06-031-12/+22
|/
* Merge pull request #1828 from MikeWey/dlang-compilesJussi Pakkanen2017-05-221-0/+37
|\ | | | | Add 'compiles' and 'has_multi_arguments' for dlang.
| * Add 'compiles' and 'has_multi_arguments' for dlang.Mike Wey2017-05-201-0/+37
| |
* | Fix cross environment pollution.Ole André Vadla Ravnås2017-05-211-9/+10
|/ | | | | | | Environment variables like CFLAGS and LDFLAGS should not affect the cross environment. Fixes #1772
* Avoid shadowing outer variables.Elliott Sales de Andrade2017-05-171-11/+11
| | | | Though actually, just rename them into something clearer.
* Remove unnecessary __init__ methods.Elliott Sales de Andrade2017-05-171-2/+1
|
* Implement executable(gui_app:) for gcc on WindowsJon Turney2017-05-131-0/+4
| | | | | | | Note that gui_app: is currently ignored when using the ninja backend with VS compilers, so I guess you get the default linker behaviour, which the documentation says is guessing the subsystem depending on if a main or WinMain symbol exists...
* Merged rust_args branch.Jussi Pakkanen2017-05-131-4/+4
|\
| * rust: Use -C to specify build typePatrick Griffis2017-05-081-4/+4
| |
* | Make vs_module_defs: do something for gcc on Windows as wellJon Turney2017-05-121-0/+10
| | | | | | | | | | | | | | | | | | | | Module definition files may be useful when building with gcc on Windows also (e.g. if the existing build uses them, if exports are aliased, if we were retro enough to export by ordinal, etc.) Add the .def file to the link command line when using gcc on Windows Run the appropriate windows tests irrespective of compiler.
* | vala: Add 'no_warn_args' with '--disable-warnings'Guillaume Poirier-Morency2017-05-081-0/+3
| |
* | Use 'generate_basic_compiler_args' for Vala targetsGuillaume Poirier-Morency2017-05-081-0/+9
|/ | | | | | | 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'.
* compilers: Don't add line comments to pre-processed outputNirbheek Chauhan2017-05-051-2/+2
| | | | | | | | We never use preprocessed output anywhere except compiler checks, so we don't care about the debugging information that it adds. Just always disable it. Closes https://github.com/mesonbuild/meson/issues/1726
* get_define: Add prefix before ifndef blockNirbheek Chauhan2017-05-051-1/+1
| | | | Otherwise the compiler will warn about macros being redefined.
* Use American English: behaviour -> behaviorPeter Hutterer2017-05-041-1/+1
|
* Don't use len() to test emptiness vs not emptinessDylan Baker2017-05-021-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Always pass cross-file {lang}_args to compiler checksNirbheek Chauhan2017-04-271-16/+15
| | | | | | Includes a test for this that will only run on the CI. Closes https://github.com/mesonbuild/meson/issues/1665
* Make link whole work on OSX.Jussi Pakkanen2017-04-081-0/+5
|
* Fix link whole on VS backend.Jussi Pakkanen2017-04-081-0/+2
|
* Add option to link the entire contents of a static library to a target.Jussi Pakkanen2017-04-081-0/+19
|
* Don't use -fPIC on Cygwin, eitherJon Turney2017-04-061-3/+4
| | | | | | | Identify Cygwin-targetted gcc as sui generis (don't use -fPIC, but don't link with standard Windows libraries, either) Update tests appropriately
* Use CPPFLAGS for pre-processor compiler checksNirbheek Chauhan2017-04-041-6/+8
| | | | | | Also don't add CFLAGS twice for links() checks Includes a test for this.
* New compiler function: cc.get_define()Nirbheek Chauhan2017-04-041-32/+38
| | | | | | Runs the pre-processor and fetches the value of the define. Can find any arbitrary value and returns it as a string.
* compilers: Rename 'get_define' to 'get_builtin_define'Nirbheek Chauhan2017-04-041-8/+8
| | | | | We will use `get_define` to implement a function that fetches the values of defines from headers.
* Merge pull request #1505 from centricular/dont-use-c++-for-assemblyJussi Pakkanen2017-04-021-0/+16
|\ | | | | Try harder to use the C compiler for compiling asm
| * Try even harder to use the C compiler for assemblyNirbheek Chauhan2017-03-271-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now as long as you have a C compiler available in the project, it will be used to compile assembly even if the target contains a C++ compiler and even if the target contains only assembly and C++ sources. Earlier, the order in which sources appeared in a target would decide which compiler would be used. However, if the project only provides a C++ compiler, that will be used for compiling assembly sources. If this breaks your use-case, please tell us. Includes a test that ensures that all of the above is adhered to.
| * compilers: Implement __repr__ for easier debuggingNirbheek Chauhan2017-03-271-0/+5
| |
* | Fix warning making static libs on msvc/ninjaPeter Harris2017-03-281-3/+2
|/ | | | | | The MSVC static library tool, lib.exe, does not understand the same set of arguments as the linker. Avoid a warning by not adding /DEBUG or /PDB to the command line when invoking lib.exe
* Thank you git for silently discarding unrelated changes on conflicts. It is ↵Jussi Pakkanen2017-03-271-1/+1
| | | | very helpful.
* Merge pull request #1496 from centricular/fix-internal-dep-orderJussi Pakkanen2017-03-251-2/+2
|\ | | | | Preserve internal-dep include order in build target dependencies
| * compiler args: Also dedup -pthread since it can't be undoneNirbheek Chauhan2017-03-231-2/+2
| |
* | Merge pull request #1456 from ieei/compute_intJussi Pakkanen2017-03-231-29/+62
|\ \ | |/ |/| Add compute_int, fixes #435
| * compiler: Rename element argument of sizeof to typename.Haakon Sporsheim2017-03-101-8/+8
| |
| * compiler: Ensure prefix and dependencies are used for alignment.Haakon Sporsheim2017-03-101-5/+8
| | | | | | | | | | This is now similar to how prefix and dependencies are used in all the other similar checks performed by the compiler.