Commit Graph

45 Commits

Author SHA1 Message Date
Michael Hirsch, Ph.D a4827650fa BUGFIX: match submodule output names by compiler 2019-03-25 08:28:32 -04: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
Niklas Claesson dd2c44cdf6 Add static as keyword to find_library 2019-03-11 20:56:52 +02:00
jml1795 a9e63568fe Add warning level zero 2019-02-19 00:06:27 +02:00
John Ericson d451a4bd97 Remove get_cross_extra_flags
This is no longer needed, we just remove conditionals around it.
2019-02-15 09:17:24 -08:00
Michael Hirsch, Ph.D 6b874339cc BUGFIX: Fortran openmp 2019-02-13 21:06:15 +02:00
Michael Hirsch, Ph.D 70e6f4198c Fortran 2008 submodule (#4874) 2019-02-05 22:41:44 +01:00
Michael Hirsch, Ph.D 8821c0aadc better handle variable HDF5 setups, update Fortran compiler def 2019-02-01 07:26:32 +00:00
Michael Hirsch, Ph.D cccffaa29d BUGFIX: allow fc.run(code) to work, pick only Fortran module 2019-01-29 23:25:23 +02:00
Michael Hirsch, Ph.D 8636f31d9c BUGFIX: broken/missing Fortran code/unit tests 2019-01-27 20:57:21 +02:00
Michael Hirsch, Ph.D 72486afd08 Add PGI C and C++ compilers (#4803) 2019-01-21 20:09:36 +02:00
Michael Hirsch, Ph.D 9bb21be59b
FlangFortranCompiler inherit ClangCompiler 2019-01-16 17:06:44 -05:00
Michael Hirsch, Ph.D 9a318d3d5a
better handle link args: PGI and Flang
correct flang, pgi options
2019-01-16 17:06:44 -05:00
Michael Hirsch, Ph.D b40c1af900
Flang Fortran compiler added. 2019-01-16 17:06:43 -05:00
Michael Hirsch, Ph.D fff88b354a restore PGI compile functioning 2019-01-15 20:27:31 +02:00
Daniel Mensinger 9eca2e46a0
Added more compiler option support 2019-01-06 12:19:33 +01:00
Daniel Mensinger 9742927903
Absolute path generation refactoring 2019-01-06 12:19:32 +01:00
Dylan Baker b17ab09eaf compilers/fortran: pass -module ${path} instead of -module${path}
ifort doesn't like the latter, and gfortran seems happy with the former.
I don't have any of the other supported fortran compilers to test with.
2018-11-15 18:42:25 -08:00
Dylan Baker a7845d91aa ifort: ifort needs to have -lifcore like gfotran needs -lgfortran 2018-11-15 18:42:25 -08:00
Dylan Baker 9f9cfd2139 compilers: Move get_allow_undefined_link_args to Compiler
This allows each implementation (gnu-like) and msvc to be implemented in
their respective classes rather than through an if tree in the CCompiler
class. This is cleaner abstraction and allows us to clean up the Fortran
compiler, which was calling CCompiler bound methods without an instance.
2018-11-15 18:42:25 -08:00
Dylan Baker 7329ae3ce6 fortran: ifort doesn't have -pipe 2018-11-15 18:42:25 -08:00
Dylan Baker de175aac00 compilers: Use keyword only arguments for compiler interfaces
Because we need to inherit them in some cases, and python's
keyword-or-positional arguments make this really painful, especially
with inheritance. They do this in two ways:

1) If you want to intercept the arguments you need to check for both a
   keyword and a positional argument, because you could get either. Then
   you need to make sure that you only pass one of those down to the
   next layer.

2) After you do that, if the layer below you decides to do the same
   thing, but uses the other form (you used keyword by the lower level
   uses positional or vice versa), then you'll get a TypeError since two
   layers down got the argument as both a positional and a keyword.

All of this is bad. Fortunately python 3.x provides a mechanism to solve
this, keyword only arguments. These arguments cannot be based
positionally, the interpreter will give us an error in that case.

I have made a best effort to do this correctly, and I've verified it
with GCC, Clang, ICC, and MSVC, but there are other compilers like Arm
and Elbrus that I don't have access to.
2018-11-13 00:40:13 +02:00
David Seifert 69ec001b06 Use enum instead of `int` for compiler variants
* Enums are strongly typed and make the whole
  `gcc_type`/`clang_type`/`icc_type` distinction
  redundant.
* Enums also allow extending via member functions,
  which makes the code more generalisable.
2018-09-16 00:47:32 +03:00
Jussi Pakkanen 3d86a24b55 Remove unnecessary -lquadmath from FORTRAN flags. 2018-09-02 18:25:09 +03:00
Nirbheek Chauhan bb5f2ca3da find_library: Allow undefined symbols while linking
Shared libraries may not always be linkable without the use of other
libraries, so don't make it a linker error.
2018-08-22 12:24:43 -07:00
Bruce Richardson 8c9296e8e6 find_library: Use _build_wrapper to get library dirs
This means that we will take into account all the flags set in the
cross file when fetching the list of library dirs, which means we
won't incorrectly look for 64-bit libraries when building for 32-bit.

Signed-off-by: Nirbheek Chauhan <nirbheek@centricular.com>

Closes https://github.com/mesonbuild/meson/issues/3881
2018-08-22 12:24:43 -07:00
Jussi Pakkanen d83f77109a
Convert buildtype to optimization and debug options (#3489) 2018-08-18 20:39:47 +03:00
Nirbheek Chauhan 8cfb8fd02c
Fix searching of shared libraries on OpenBSD (#3851)
* get_library_naming: Use templates instead of suffix/prefix pairs

This commit does not change functionality, and merely sets the
groundwork for a more flexibly naming implementation.

* find_library: Fix manual searching on OpenBSD

On OpenBSD, shared libraries are called libfoo.so.X.Y where X is the
major version and Y is the minor version. We were assuming that it's
libfoo.so and not finding shared libraries at all while doing manual
searching, which meant we'd link statically instead.

See: https://www.openbsd.org/faq/ports/specialtopics.html#SharedLibs

Now we use file globbing to do searching, and pick the first one
that's a real file.

Closes https://github.com/mesonbuild/meson/issues/3844

* find_library: Fix priority of library search in OpenBSD

Also add unit tests for the library naming function so that it's
absolutely clear what the priority list of naming is.

Testing is done with mocking on Linux to ensure that local testing
is easy
2018-07-09 09:45:02 -07:00
Nirbheek Chauhan 96b7fdb723 macos: Rewrite install_name for dependent built libraries on install
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-18 06:33:23 +00:00
Nirbheek Chauhan 186eed2dc6 find_library: Add a cache for library searching
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-07 12:57:56 +00:00
Xavier Claessens aa879b7f0c Fix issues found by flake8 2018-06-06 20:02:37 +00:00
Matthew Krupcale 45cc001a40 Add support for finding libraries in Fortran projects
* 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-21 23:17:02 +03:00
Nirbheek Chauhan ed701b5cb0 Revert "Add macOS linker versioning information"
This reverts commit fa6ca16054.

Closes https://github.com/mesonbuild/meson/issues/3550
2018-05-09 23:11:15 +02:00
Jussi Pakkanen a2fdaa9ea0 Can use C++ and FORTRAN in a single target. Closes #2685. 2018-05-02 22:58:07 +03:00
Elliott Sales de Andrade dbb025a175 Add an OpenMP dependency.
This works similarly to the thread dependency which stores the various
inconsistent flags in each compiler.
2018-04-17 02:04:37 -04:00
Tom Schoonjans fa6ca16054 Add macOS linker versioning information
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-16 22:26:16 +03:00
makise-homura 7cc41baa98 Added Elbrus lcc compilers support as inheritance from gcc ones 2018-03-19 23:30:00 +03:00
Aleksey Filippov 2cf85ae16f Use os.path: basename() and dirname() instead of split()
According to Python documentation[1] dirname and basename
are defined as follows:
    os.path.dirname() = os.path.split()[0]
    os.path.basename() = os.path.split()[1]
For the purpose of better readability split() is replaced
by appropriate function if only one part of returned tuple
is used.

[1]: https://docs.python.org/3/library/os.path.html#os.path.split
2018-01-30 07:08:22 +11:00
Jussi Pakkanen b6dd50db31
Merge pull request #2791 from behlec/compiler-version
Add more version information to compiler
2017-12-20 20:42:01 +02:00
Jussi Pakkanen 8eaa0a2732 Use -MD instead of -MMD for reliability. 2017-12-18 21:19:18 +02:00
Christoph Behle 1f3b41021d More version information for Fortran. 2017-12-16 15:38:31 +01:00
Nirbheek Chauhan 5764a26a4c gfortran: Add coverage arguments 2017-08-15 01:38:01 +05:30
Elliott Sales de Andrade 17b051c8b1 Add info on module include flag for Fortran compilers. 2017-08-04 20:07:08 -04:00
Jussi Pakkanen 2269b7f60b Add build_rpath as new property allowing people to specify rpath entries that are used in the build tree but will be removed on install. 2017-07-21 19:40:54 +03:00
Alistair Thomas 117f4ab8b5 Split out languages from compilers.py 2017-06-23 00:42:41 +01:00