diff --git a/projects/hip/bin/hipcc b/projects/hip/bin/hipcc index c72badcf69..840aaafd41 100755 --- a/projects/hip/bin/hipcc +++ b/projects/hip/bin/hipcc @@ -229,6 +229,7 @@ my $needCXXFLAGS = 0; # need to add CXX flags to compile step my $needCFLAGS = 0; # need to add C flags to compile step my $needLDFLAGS = 1; # need to add LDFLAGS to compile step. my $fileTypeFlag = 0; # to see if -x flag is mentioned +my $hasOMPTargets = 0; # If OMP targets is mentioned my $hasC = 0; # options contain a c-style file my $hasCXX = 0; # options contain a cpp-style file (NVCC must force recognition as GPU file) my $hasCU = 0; # options contain a cu-style file (HCC must force recognition as GPU file) @@ -517,6 +518,8 @@ foreach $arg (@ARGV) $hasC = 0; $hasCXX = 0; $hasHIP = 1; + } elsif ($arg =~ '-fopenmp-targets=') { + $hasOMPTargets = 1; } elsif ($arg =~ m/^-/) { # options start with - if ($arg eq '-fgpu-rdc') { @@ -555,7 +558,7 @@ foreach $arg (@ARGV) $toolArgs .= " -x c"; } elsif (($arg =~ /\.cpp$/) or ($arg =~ /\.cxx$/) or ($arg =~ /\.cc$/) or ($arg =~ /\.C$/)) { $needCXXFLAGS = 1; - if ($HIP_COMPILE_CXX_AS_HIP eq '0' or $HIP_PLATFORM ne "amd") { + if ($HIP_COMPILE_CXX_AS_HIP eq '0' or $HIP_PLATFORM ne "amd" or $hasOMPTargets eq 1) { $hasCXX = 1; } elsif ($HIP_PLATFORM eq "amd") { $hasHIP = 1;