aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers
AgeCommit message (Collapse)AuthorFilesLines
2018-06-18Add missing stubs to Compiler.Christoph Behle1-0/+12
Added missing stubs to class Compiler for the methods: * compute_int * has_members * has_type * symbols_have_underscore_prefix
2018-06-18Use stub to report misuse of get_defineChristoph Behle1-0/+3
Instead of checking on the call site add a stub to Compiler which raises an exception.
2018-06-18macos: Rewrite install_name for dependent built libraries on installNirbheek Chauhan7-22/+30
On macOS, we set the install_name for built libraries to @rpath/libfoo.dylib, and when linking to the library, we set the RPATH to its path in the build directory. This allows all built binaries to be run as-is from the build directory (uninstalled). However, on install, we have to strip all the RPATHs because they point to the build directory, and we change the install_name of all built libraries to the absolute path to the library. This causes the install name in binaries to be out of date. We now change that install name to point to the absolute path to each built library after installation. Fixes https://github.com/mesonbuild/meson/issues/3038 Fixes https://github.com/mesonbuild/meson/issues/3077 With this, the default workflow on macOS matches what everyone seems to do, including Autotools and CMake. The next step is providing a way for build files to override the install_name that is used after installation for use with, f.ex., private libraries when combined with the install_rpath: kwarg on targets.
2018-06-18pkgconfig deps: Also resolve paths to shared librariesNirbheek Chauhan1-1/+2
This allows us to more aggressively de-dup them, and also sets RPATHs to all libraries that are not in the system linker paths so that binaries can be run uninstalled without any special steps. These RPATHs will be wiped on install, so they do not affect reproducible builds. De-duping: Fixes https://github.com/mesonbuild/meson/issues/2150 Fixes https://github.com/mesonbuild/meson/issues/2118 Fixes https://github.com/mesonbuild/meson/issues/3071 RPATHs: Fixes https://github.com/mesonbuild/meson/issues/314 Fixes https://github.com/mesonbuild/meson/issues/2881 Also fixes the uninstalled usage portions of: https://github.com/mesonbuild/meson/issues/3038 https://github.com/mesonbuild/meson/issues/3077
2018-06-12Always apply concatenate_string_literal.Christoph Behle1-1/+1
get_define always applies concatenate_string_literal to its result. Remove kwarg concatenate_string_literal from get_define.
2018-06-12Make concatenate_string_literals staticChristoph Behle1-1/+2
2018-06-12get_define can concatenate string literals.Christoph Behle1-1/+10
Added method concatenate_string_literals to CCompiler. Will concatenate string literals. Added keyword argument 'concatenate_string_literals' to Compiler.get_define. If used will apply concatenate_string_literals to its return value.
2018-06-12Revert changeChristoph Behle1-2/+2
2018-06-12Concatenate string literals in get_defineChristoph Behle1-3/+4
If get_define returns a list of string_literals concatenate them into one string.
2018-06-10vala: fix extract_all_objects() resultPaolo Bonzini1-2/+2
Because vala is not listed in clike_langs, is_source(fname) is returning False for Vala source files. Therefore, extract_all_objects() is completely empty for Vala programs. Fixes #791
2018-06-07find_library: Add a cache for library searchingNirbheek Chauhan2-7/+27
Otherwise we can end up searching for the same library tens of times, because pkg-config does not de-duplicate -lfoo args before returning them. We use -Wl,--start-group/end-group, so we do not need to worry about ordering issues in static libraries.
2018-06-06compilers: Use RUSTFLAGS from the env as default rust_args valueXavier Claessens1-1/+2
2018-06-06optinterpreter: Remove duplicated list of languagesXavier Claessens2-0/+3
It is important to keep the list of languages up to date in optinterpreter, otherwise we could have conflicting options when adding new languages.
2018-06-06Fix issues found by flake8Xavier Claessens5-5/+3
2018-06-06Move <lang>_args to coredata.compiler_optionsXavier Claessens3-11/+30
2018-06-06Move get_args_from_envvars() from environment to compilersXavier Claessens1-1/+52
2018-06-06Compilers: Chain-up to parent class in get_options()Xavier Claessens2-52/+65
Parent class could have common options for all compilers, and we'll soon add some.
2018-06-06Add a new option for building with Apple bitcode supportNirbheek Chauhan1-15/+34
Normally, people would just pass -fembed-bitcode in CFLAGS, but this conflicts with -Wl,-dead_strip_dylibs and -bundle, so we need it as an option so that those can be quietly disabled.
2018-06-05Add prog/lib dirs from the mingw cross-compiler to PATHNirbheek Chauhan2-4/+41
These directories contain DLLs that the executable may need, such as libstdc++-6.dll, libwinpthread, etc.
2018-05-30New compiler method: check_headerNirbheek Chauhan2-0/+9
This checks not only for existence, but also for usability of the header, which means it does a full compilation and not just pre-processing or __has_include. Fixes https://github.com/mesonbuild/meson/issues/2246
2018-05-29Don't raise StopIteration in generators, no longer allowed with Python 3.7. ↵Christoph Reiter1-1/+1
Fixes #3622 Raising StopIteration from a generator has been deprecated with Python 3.5 and is now an error with Python 3.7: https://docs.python.org/3.8/library/exceptions.html#StopIteration Just use return instead.
2018-05-21Add support for finding libraries in Fortran projectsMatthew Krupcale2-170/+184
* mesonbuild/compilers/c.py: Make the `find_library` method more generic by allowing the user to supply the `code` for compiling and linking. * mesonbuild/compilers/fortran.py: Use the methods inherited from `Compiler` base class where appropriate. Also reuse `CComiler` methods where applicable. This should be sufficient to get various compiler/linker arguments as well as to compile and link Fortran programs. This was tested with `gfortran` compiler, and while the other compilers ought to work for simple cases, their methods are primarily inherited from the base `FortranCompiler` class. * test cases/fortran/10 find library/gzip.f90: Fortran module with some basic Fortran wrapper interfaces to `gzopen`, `gzwrite`, and `gzclose` C `zlib` functions. * test cases/fortran/10 find library/main.f90: Fortran program using the `gzip` Fortran interface module to write some data to a gzip file. * test cases/fortran/10 find library/meson.build: Meson build file for this test case. This demonstrates the ability to link the Fortran program against an external library.
2018-05-09Revert "Add macOS linker versioning information"Nirbheek Chauhan6-23/+15
This reverts commit fa6ca160548d7e8df9c4c724e6c96f5e004e5316. Closes https://github.com/mesonbuild/meson/issues/3550
2018-05-04add linker flag to handle $ORIGIN on OpenBSDJasper Lievisse Adriaanse1-2/+2
2018-05-02Can use C++ and FORTRAN in a single target. Closes #2685.Jussi Pakkanen1-1/+3
2018-05-02Can combine D and C++ in a single target. Closes #3125.Jussi Pakkanen2-0/+12
2018-04-30has_multi_link_arguments: Some compilers needs -Wl,--fatal-warningsXavier Claessens1-0/+14
ld does not treat wrong -z options as fatal by default.
2018-04-27CCompiler: Cache result of get_library_dirs().Martin Hostettler1-1/+9
It is repeatedly used by e.g. guess_external_link_dependencies.
2018-04-19CCompiler: Do not call to_native() twiceXavier Claessens1-1/+1
compile() method already does it so links() and compiles() shouldn't do it too. This fix regression introduced in 3d91a08b. Closes #3431
2018-04-17Merge pull request #3353 from xclaesse/has-link-argumentJussi Pakkanen3-59/+48
Add has_link_argument() and friends
2018-04-17Merge pull request #1852 from QuLogic/openmpJussi Pakkanen3-0/+45
Add an OpenMP dependency.
2018-04-17cc.has_multi_arguments: Convert all -Wno argsNirbheek Chauhan1-6/+6
Also add a test for it.
2018-04-17fix checks for gcc disable warning flagsBruce Richardson1-0/+5
GCC does not print a warning or error for unknown options if the options are to disable warnings. Therefore, when checking for options starting '-Wno-', also check the opposite enabling option. This fixes the case where e.g. -Wno-implicit-fallthrough is incorrectly reported as supported by gcc 5.4. To avoid missed warnings when using combinations of flags, such as in test case "112 has arg", we limit the checking of for the positive option to where the negative option is checked alone.
2018-04-17Explicitly check for OpenMP headers.Elliott Sales de Andrade1-1/+2
2018-04-17Add an OpenMP dependency.Elliott Sales de Andrade3-0/+44
This works similarly to the thread dependency which stores the various inconsistent flags in each compiler.
2018-04-16Add has_link_argument() and friendsXavier Claessens3-23/+37
Closes: #3335.
2018-04-16VisualStudioCPPCompiler: Fix -fpermissive still being addedXavier Claessens1-2/+2
super(VisualStudioCCompiler, self) calls CPPCompiler and that's what we want to avoid.
2018-04-16Compilers: Reduce code duplication between compiles and linksXavier Claessens1-26/+11
This also fix links() not calling args.to_native() unlike compiles()
2018-04-16has_argument(): reduce code duplicationXavier Claessens1-10/+0
2018-04-16Merged Arm CC support.Jussi Pakkanen4-0/+140
2018-04-16Add macOS linker versioning informationTom Schoonjans6-15/+23
This patch exploits the information residing in ltversion to set the -compatibility_version and -current_version flags that are passed to the linker on macOS.
2018-04-16Do not use -soname when linking with GCC for mingw/cygwinMarvin Scholz1-2/+4
GNU LD does not use soname when linking a PE/COFF binary, so it makes no difference, but it breaks when using the llvm linker (lld), which does not support the soname flag when building PE/COFF binaries for Windows. Fix #3179
2018-04-15Merge pull request #3115 from makise-homura/e2k-lcc-supportJussi Pakkanen5-1/+85
Support lcc compiler for e2k (Elbrus) architecture
2018-04-15ninjabackend: Try to guess library dependencies for linker invocation.Martin Hostettler1-2/+5
The linkers currently do not support ninja compatible output of dependencies used while linking. Try to guess which files will be used while linking in python code and generate conservative dependencies to ensure changes in linked libraries are detected. This generates dependencies on the best match for static and shared linking, but this should not be a problem, except for spurious rebuilding when only one of them changes, which should not be a problem. Also makes sure to ignore any libraries generated inside the build, to keep the optimisation working where changes in a shared library only cause relink if the symbols have changed as well.
2018-04-15compilers: is_library: Also detect .so files with version (using soregex)Martin Hostettler1-1/+4
2018-04-14compilers: Cache compiler checks where we don't want the outputNirbheek Chauhan2-8/+28
This caching is only for a single run, so it doesn't help reconfigure. However, it is useful for subproject setups where different subprojects will run the same compiler checks. The cache is also per compiler instance and is not used for functions that want to read or run the outputted object file or binary. For gst-build, this halves the number of compiler checks that are run and reduces configuration time by 20%.
2018-04-13Deduplicate dependencies resolved to absolute pathsDaniel Schulte1-3/+10
If paths are absolute the order of search directories is not relevant as the path is already resolved.
2018-04-11vala: Don't pass -o and -C at the same timeRico Tzschichholz1-2/+2
Fixes "warning: --output and -o have no effect when -C or --ccode is set" get_always_args() adds -C which is already disabling the direct compilation ability of valac for which -o is used.
2018-04-08Remove arbitrary [-1024,1024] limit in cross_compute_int()Xavier Claessens1-13/+41
Copy the algorithm used by autoconf. It computes the upper and lower limits by starting at [-1,1] and multiply by 2 at each iteration. This is even faster for small numbers (the common case), for example it finds value 0 in just 2 compilations where old algorithm would check for 1024, 512, ..., 0.
2018-03-31Fix for issue in cpp.pySomasekhar Penugonda1-2/+2
Change-Id: Iad9623d20eb5086528dacefce5d2f4f9bb9d0312