aboutsummaryrefslogtreecommitdiff
path: root/src/fpm_compiler.f90
diff options
context:
space:
mode:
authorLaurence Kedward <laurence.kedward@bristol.ac.uk>2021-04-17 17:18:50 +0100
committerGitHub <noreply@github.com>2021-04-17 17:18:50 +0100
commitfbbfb2c1c316674a83acd666754a3fd18b643d84 (patch)
treefc38bd0d71a615dac4e847e891771b292cfb1e75 /src/fpm_compiler.f90
parent4cbf9194e47991a208cd61b1f3a0a55f0ae16573 (diff)
parent079e7da06181a6dc9cee6f8f3b1b1c4ebde9e573 (diff)
downloadfpm-fbbfb2c1c316674a83acd666754a3fd18b643d84.tar.gz
fpm-fbbfb2c1c316674a83acd666754a3fd18b643d84.zip
Merge pull request #433 from LKedward/intel-c
Fix to allow compiling C with Intel CC
Diffstat (limited to 'src/fpm_compiler.f90')
-rw-r--r--src/fpm_compiler.f9028
1 files changed, 28 insertions, 0 deletions
diff --git a/src/fpm_compiler.f90 b/src/fpm_compiler.f90
index a499bb9..ca0f4d7 100644
--- a/src/fpm_compiler.f90
+++ b/src/fpm_compiler.f90
@@ -332,6 +332,34 @@ 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(id_intel_classic_nix, id_intel_classic_mac, id_intel_classic_windows, id_intel_classic_unknown)
+ c_compiler = 'icc'
+
+ case(id_intel_llvm_nix,id_intel_llvm_windows, id_intel_llvm_unknown)
+ c_compiler = 'icx'
+
+ case(id_flang)
+ c_compiler='clang'
+
+ 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
+
function get_compiler_id(compiler) result(id)
character(len=*), intent(in) :: compiler
integer(kind=compiler_enum) :: id