From c957b27d275ebd575b5d49599c14e7252765f3ce Mon Sep 17 00:00:00 2001 From: LKedward Date: Thu, 8 Apr 2021 15:27:07 +0100 Subject: Select c compiler based on fortran compiler id --- src/fpm_compiler.f90 | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/fpm_compiler.f90') diff --git a/src/fpm_compiler.f90 b/src/fpm_compiler.f90 index 36041bf..76aedcc 100644 --- a/src/fpm_compiler.f90 +++ b/src/fpm_compiler.f90 @@ -336,6 +336,33 @@ subroutine get_module_flags(compiler, modpath, flags) end subroutine get_module_flags +subroutine get_default_c_compiler(f_compiler, c_compiler) + character(len=*), intent(in) :: f_compiler + character(len=:), allocatable, intent(out) :: c_compiler + integer(compiler_enum) :: id + + id = get_compiler_id(f_compiler) + + select case(id) + case default + c_compiler = 'gcc' + + case(id_intel_classic) + c_compiler = 'icc' + + case(id_intel_llvm) + c_compiler = 'icx' + + case(id_flang) + c_compiler='clang' + + case(id_ibmxl) + c_compiler='xlc' + + end select + +end subroutine get_default_c_compiler + function get_compiler_id(compiler) result(id) character(len=*), intent(in) :: compiler integer(kind=compiler_enum) :: id -- cgit v1.2.3 From 836a652f85b505493673ef2b3adc4703060ef10b Mon Sep 17 00:00:00 2001 From: LKedward Date: Fri, 9 Apr 2021 14:30:46 +0100 Subject: Change fallback C compiler equal to Fortran compiler --- src/fpm_compiler.f90 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/fpm_compiler.f90') diff --git a/src/fpm_compiler.f90 b/src/fpm_compiler.f90 index 76aedcc..dcfd101 100644 --- a/src/fpm_compiler.f90 +++ b/src/fpm_compiler.f90 @@ -344,8 +344,6 @@ subroutine get_default_c_compiler(f_compiler, c_compiler) id = get_compiler_id(f_compiler) select case(id) - case default - c_compiler = 'gcc' case(id_intel_classic) c_compiler = 'icc' @@ -359,6 +357,9 @@ subroutine get_default_c_compiler(f_compiler, c_compiler) case(id_ibmxl) c_compiler='xlc' + case default + ! Fall-back to using Fortran compiler + c_compiler = f_compiler end select end subroutine get_default_c_compiler -- cgit v1.2.3 From 079e7da06181a6dc9cee6f8f3b1b1c4ebde9e573 Mon Sep 17 00:00:00 2001 From: Laurence Kedward Date: Fri, 9 Apr 2021 14:48:03 +0100 Subject: Update compiler ids from rebase. --- src/fpm_compiler.f90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/fpm_compiler.f90') diff --git a/src/fpm_compiler.f90 b/src/fpm_compiler.f90 index dcfd101..75bd3be 100644 --- a/src/fpm_compiler.f90 +++ b/src/fpm_compiler.f90 @@ -345,10 +345,10 @@ subroutine get_default_c_compiler(f_compiler, c_compiler) select case(id) - case(id_intel_classic) + case(id_intel_classic_nix, id_intel_classic_mac, id_intel_classic_windows, id_intel_classic_unknown) c_compiler = 'icc' - case(id_intel_llvm) + case(id_intel_llvm_nix,id_intel_llvm_windows, id_intel_llvm_unknown) c_compiler = 'icx' case(id_flang) -- cgit v1.2.3