From bd2394e8724a7a95f8beeb3839707e495be41fc0 Mon Sep 17 00:00:00 2001 From: Jonas Lundholm Bertelsen Date: Wed, 20 Jan 2021 18:11:02 +0100 Subject: Use case-insensitive suffix check for fortran In Fortran it is common to use capital F in the suffix (eg. '.F90') if the source file makes use of preprocessor statements. Such files should probably be treated like all other fortran files by meson. Case insensitivity for suffixes was already implemented several places in meson before this. So most likely, the few places changed here were oversights anyway. --- mesonbuild/backend/ninjabackend.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mesonbuild/backend/ninjabackend.py') diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index d66708c..a008795 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -637,7 +637,7 @@ int dummy; if self.environment.is_llvm_ir(source) or \ self.environment.is_assembly(source): return False - suffix = os.path.splitext(source)[1][1:] + suffix = os.path.splitext(source)[1][1:].lower() for lang in self.langs_cant_unity: if lang not in target.compilers: continue @@ -925,7 +925,7 @@ int dummy; all_suffixes = set(compilers.lang_suffixes['cpp']) | set(compilers.lang_suffixes['fortran']) selected_sources = [] for source in compiled_sources: - ext = os.path.splitext(source)[1][1:] + ext = os.path.splitext(source)[1][1:].lower() if ext in all_suffixes: selected_sources.append(source) return selected_sources -- cgit v1.1 From ea34a92632a0622bd140ec8160dd721e1f6ba040 Mon Sep 17 00:00:00 2001 From: Jonas Lundholm Bertelsen Date: Wed, 20 Jan 2021 18:18:54 +0100 Subject: When iterating link_targets, include link_whole_targets too (fortran) This fixes fortran includes and fortran orderdeps for libraries that were under link_whole_targets. --- mesonbuild/backend/ninjabackend.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'mesonbuild/backend/ninjabackend.py') diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index a008795..6a80299 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -2595,7 +2595,10 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485''')) def get_fortran_orderdeps(self, target, compiler): if compiler.language != 'fortran': return [] - return [os.path.join(self.get_target_dir(lt), lt.get_filename()) for lt in target.link_targets] + return [ + os.path.join(self.get_target_dir(lt), lt.get_filename()) + for lt in itertools.chain(target.link_targets, target.link_whole_targets) + ] def generate_msvc_pch_command(self, target, compiler, pch): header = pch[0] -- cgit v1.1 From 2636eebd64221909157d93509ac72a5990f85060 Mon Sep 17 00:00:00 2001 From: Jonas Lundholm Bertelsen Date: Wed, 20 Jan 2021 21:51:56 +0100 Subject: Unity build reverts to normal for fortran fix The `determine_ext_objs` function did not take into account that fortran (and d) does not support unity builds. This caused failures in some cases. --- mesonbuild/backend/ninjabackend.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'mesonbuild/backend/ninjabackend.py') diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 6a80299..b121d42 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -626,11 +626,6 @@ int dummy; srcs[f] = s return srcs - # Languages that can mix with C or C++ but don't support unity builds yet - # because the syntax we use for unity builds is specific to C/++/ObjC/++. - # Assembly files cannot be unitified and neither can LLVM IR files - langs_cant_unity = ('d', 'fortran') - def get_target_source_can_unity(self, target, source): if isinstance(source, File): source = source.fname @@ -638,7 +633,7 @@ int dummy; self.environment.is_assembly(source): return False suffix = os.path.splitext(source)[1][1:].lower() - for lang in self.langs_cant_unity: + for lang in backends.LANGS_CANT_UNITY: if lang not in target.compilers: continue if suffix in target.compilers[lang].file_suffixes: @@ -769,7 +764,7 @@ int dummy; if is_unity: # Warn about incompatible sources if a unity build is enabled langs = set(target.compilers.keys()) - langs_cant = langs.intersection(self.langs_cant_unity) + langs_cant = langs.intersection(backends.LANGS_CANT_UNITY) if langs_cant: langs_are = langs = ', '.join(langs_cant).upper() langs_are += ' are' if len(langs_cant) > 1 else ' is' -- cgit v1.1