Skip to content

Commit 6652c86

Browse files
Merge pull request #431 from everythingfunctional/fix-intel-on-windows
Use different compiler flags on different platforms for Intel
2 parents b15db3c + a30df88 commit 6652c86

File tree

1 file changed

+129
-16
lines changed

1 file changed

+129
-16
lines changed

src/fpm_compiler.f90

Lines changed: 129 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@
2828
module fpm_compiler
2929
use fpm_model, only: fpm_model_t
3030
use fpm_filesystem, only: join_path, basename
31+
use fpm_environment, only: &
32+
get_os_type, &
33+
OS_LINUX, &
34+
OS_MACOS, &
35+
OS_WINDOWS, &
36+
OS_CYGWIN, &
37+
OS_SOLARIS, &
38+
OS_FREEBSD
3139
implicit none
3240
public :: is_unknown_compiler
3341
public :: get_module_flags
@@ -41,8 +49,13 @@ module fpm_compiler
4149
id_gcc, &
4250
id_f95, &
4351
id_caf, &
44-
id_intel_classic, &
45-
id_intel_llvm, &
52+
id_intel_classic_nix, &
53+
id_intel_classic_mac, &
54+
id_intel_classic_windows, &
55+
id_intel_classic_unknown, &
56+
id_intel_llvm_nix, &
57+
id_intel_llvm_windows, &
58+
id_intel_llvm_unknown, &
4659
id_pgi, &
4760
id_nvhpc, &
4861
id_nag, &
@@ -78,7 +91,6 @@ subroutine get_release_compile_flags(id, flags)
7891
select case(id)
7992
case default
8093
flags = ""
81-
8294
case(id_caf)
8395
flags='&
8496
& -O3&
@@ -109,15 +121,57 @@ subroutine get_release_compile_flags(id, flags)
109121
flags = '&
110122
& -Mbackslash&
111123
&'
112-
case(id_intel_classic)
124+
case(id_intel_classic_nix, id_intel_classic_unknown)
113125
flags = '&
114126
& -fp-model precise&
115-
& -pc 64&
127+
& -pc64&
128+
& -align all&
129+
& -error-limit 1&
130+
& -reentrancy threaded&
131+
& -nogen-interfaces&
132+
& -assume byterecl&
133+
& -coarray=single&
134+
&'
135+
case(id_intel_classic_mac)
136+
flags = '&
137+
& -fp-model precise&
138+
& -pc64&
139+
& -align all&
140+
& -error-limit 1&
141+
& -reentrancy threaded&
142+
& -nogen-interfaces&
143+
& -assume byterecl&
144+
&'
145+
case(id_intel_classic_windows)
146+
flags = '&
147+
& /fp:precise&
148+
& /align:all&
149+
& /error-limit:1&
150+
& /reentrancy:threaded&
151+
& /nogen-interfaces&
152+
& /assume:byterecl&
153+
& /Qcoarray:single&
154+
&'
155+
case(id_intel_llvm_nix, id_intel_llvm_unknown)
156+
flags = '&
157+
& -fp-model=precise&
158+
& -pc64&
116159
& -align all&
117160
& -error-limit 1&
118161
& -reentrancy threaded&
119162
& -nogen-interfaces&
120163
& -assume byterecl&
164+
& -coarray=single&
165+
&'
166+
case(id_intel_llvm_windows)
167+
flags = '&
168+
& /fp:precise&
169+
& /align:all&
170+
& /error-limit:1&
171+
& /reentrancy:threaded&
172+
& /nogen-interfaces&
173+
& /assume:byterecl&
174+
& /Qcoarray:single&
121175
&'
122176
case(id_nag)
123177
flags = ' &
@@ -135,7 +189,6 @@ subroutine get_debug_compile_flags(id, flags)
135189
select case(id)
136190
case default
137191
flags = ""
138-
139192
case(id_caf)
140193
flags = '&
141194
& -Wall&
@@ -147,7 +200,6 @@ subroutine get_debug_compile_flags(id, flags)
147200
& -fcheck=array-temps&
148201
& -fbacktrace&
149202
&'
150-
151203
case(id_gcc)
152204
flags = '&
153205
& -Wall&
@@ -160,7 +212,6 @@ subroutine get_debug_compile_flags(id, flags)
160212
& -fbacktrace&
161213
& -fcoarray=single&
162214
&'
163-
164215
case(id_f95)
165216
flags = '&
166217
& -Wall&
@@ -173,7 +224,6 @@ subroutine get_debug_compile_flags(id, flags)
173224
& -Wno-maybe-uninitialized -Wno-uninitialized&
174225
& -fbacktrace&
175226
&'
176-
177227
case(id_nvhpc)
178228
flags = '&
179229
& -Minform=inform&
@@ -184,18 +234,59 @@ subroutine get_debug_compile_flags(id, flags)
184234
& -Mchkstk&
185235
& -traceback&
186236
&'
187-
188-
case(id_intel_classic)
237+
case(id_intel_classic_nix, id_intel_classic_unknown)
189238
flags = '&
190239
& -warn all&
191-
& -check:all:noarg_temp_created&
240+
& -check all&
192241
& -error-limit 1&
193242
& -O0&
194243
& -g&
195244
& -assume byterecl&
196245
& -traceback&
246+
& -coarray=single&
247+
&'
248+
case(id_intel_classic_mac)
249+
flags = '&
250+
& -warn all&
251+
& -check all&
252+
& -error-limit 1&
253+
& -O0&
254+
& -g&
255+
& -assume byterecl&
256+
& -traceback&
257+
&'
258+
case(id_intel_classic_windows)
259+
flags = '&
260+
& /warn:all&
261+
& /check:all&
262+
& /error-limit:1&
263+
& /Od&
264+
& /Z7&
265+
& /assume:byterecl&
266+
& /traceback&
267+
& /Qcoarray:single&
268+
&'
269+
case(id_intel_llvm_nix, id_intel_llvm_unknown)
270+
flags = '&
271+
& -warn all&
272+
& -check all&
273+
& -error-limit 1&
274+
& -O0&
275+
& -g&
276+
& -assume byterecl&
277+
& -traceback&
278+
& -coarray=single&
279+
&'
280+
case(id_intel_llvm_windows)
281+
flags = '&
282+
& /warn:all&
283+
& /check:all&
284+
& /error-limit:1&
285+
& /Od&
286+
& /Z7&
287+
& /assume:byterecl&
288+
& /Qcoarray:single&
197289
&'
198-
199290
case(id_nag)
200291
flags = '&
201292
& -g&
@@ -223,9 +314,15 @@ subroutine get_module_flags(compiler, modpath, flags)
223314
case(id_caf, id_gcc, id_f95, id_cray)
224315
flags=' -J '//modpath//' -I '//modpath
225316

226-
case(id_intel_classic, id_intel_llvm, id_nvhpc, id_pgi, id_flang)
317+
case(id_nvhpc, id_pgi, id_flang)
227318
flags=' -module '//modpath//' -I '//modpath
228319

320+
case(id_intel_classic_nix, id_intel_classic_mac, id_intel_classic_unknown, id_intel_llvm_nix, id_intel_llvm_unknown)
321+
flags=' -module '//modpath//' -I'//modpath
322+
323+
case(id_intel_classic_windows, id_intel_llvm_windows)
324+
flags=' /module:'//modpath//' /I'//modpath
325+
229326
case(id_lahey)
230327
flags=' -M '//modpath//' -I '//modpath
231328

@@ -259,12 +356,28 @@ function get_compiler_id(compiler) result(id)
259356
end if
260357

261358
if (check_compiler(compiler, "ifort")) then
262-
id = id_intel_classic
359+
select case (get_os_type())
360+
case (OS_LINUX, OS_SOLARIS, OS_FREEBSD)
361+
id = id_intel_classic_nix
362+
case (OS_MACOS)
363+
id = id_intel_classic_mac
364+
case (OS_WINDOWS, OS_CYGWIN)
365+
id = id_intel_classic_windows
366+
case default
367+
id = id_intel_classic_unknown
368+
end select
263369
return
264370
end if
265371

266372
if (check_compiler(compiler, "ifx")) then
267-
id = id_intel_llvm
373+
select case (get_os_type())
374+
case (OS_LINUX, OS_SOLARIS, OS_FREEBSD)
375+
id = id_intel_llvm_nix
376+
case (OS_WINDOWS, OS_CYGWIN)
377+
id = id_intel_llvm_windows
378+
case default
379+
id = id_intel_llvm_unknown
380+
end select
268381
return
269382
end if
270383

0 commit comments

Comments
 (0)