28
28
module fpm_compiler
29
29
use fpm_model, only: fpm_model_t
30
30
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
31
39
implicit none
32
40
public :: is_unknown_compiler
33
41
public :: get_module_flags
@@ -41,8 +49,13 @@ module fpm_compiler
41
49
id_gcc, &
42
50
id_f95, &
43
51
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, &
46
59
id_pgi, &
47
60
id_nvhpc, &
48
61
id_nag, &
@@ -78,7 +91,6 @@ subroutine get_release_compile_flags(id, flags)
78
91
select case (id)
79
92
case default
80
93
flags = " "
81
-
82
94
case (id_caf)
83
95
flags= ' &
84
96
& -O3&
@@ -109,15 +121,57 @@ subroutine get_release_compile_flags(id, flags)
109
121
flags = ' &
110
122
& -Mbackslash&
111
123
&'
112
- case (id_intel_classic )
124
+ case (id_intel_classic_nix, id_intel_classic_unknown )
113
125
flags = ' &
114
126
& -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&
116
159
& -align all&
117
160
& -error-limit 1&
118
161
& -reentrancy threaded&
119
162
& -nogen-interfaces&
120
163
& -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&
121
175
&'
122
176
case (id_nag)
123
177
flags = ' &
@@ -135,7 +189,6 @@ subroutine get_debug_compile_flags(id, flags)
135
189
select case (id)
136
190
case default
137
191
flags = " "
138
-
139
192
case (id_caf)
140
193
flags = ' &
141
194
& -Wall&
@@ -147,7 +200,6 @@ subroutine get_debug_compile_flags(id, flags)
147
200
& -fcheck=array-temps&
148
201
& -fbacktrace&
149
202
&'
150
-
151
203
case (id_gcc)
152
204
flags = ' &
153
205
& -Wall&
@@ -160,7 +212,6 @@ subroutine get_debug_compile_flags(id, flags)
160
212
& -fbacktrace&
161
213
& -fcoarray=single&
162
214
&'
163
-
164
215
case (id_f95)
165
216
flags = ' &
166
217
& -Wall&
@@ -173,7 +224,6 @@ subroutine get_debug_compile_flags(id, flags)
173
224
& -Wno-maybe-uninitialized -Wno-uninitialized&
174
225
& -fbacktrace&
175
226
&'
176
-
177
227
case (id_nvhpc)
178
228
flags = ' &
179
229
& -Minform=inform&
@@ -184,18 +234,59 @@ subroutine get_debug_compile_flags(id, flags)
184
234
& -Mchkstk&
185
235
& -traceback&
186
236
&'
187
-
188
- case (id_intel_classic)
237
+ case (id_intel_classic_nix, id_intel_classic_unknown)
189
238
flags = ' &
190
239
& -warn all&
191
- & -check: all:noarg_temp_created &
240
+ & -check all&
192
241
& -error-limit 1&
193
242
& -O0&
194
243
& -g&
195
244
& -assume byterecl&
196
245
& -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&
197
289
&'
198
-
199
290
case (id_nag)
200
291
flags = ' &
201
292
& -g&
@@ -223,9 +314,15 @@ subroutine get_module_flags(compiler, modpath, flags)
223
314
case (id_caf, id_gcc, id_f95, id_cray)
224
315
flags= ' -J ' // modpath// ' -I ' // modpath
225
316
226
- case (id_intel_classic, id_intel_llvm, id_nvhpc, id_pgi, id_flang)
317
+ case (id_nvhpc, id_pgi, id_flang)
227
318
flags= ' -module ' // modpath// ' -I ' // modpath
228
319
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
+
229
326
case (id_lahey)
230
327
flags= ' -M ' // modpath// ' -I ' // modpath
231
328
@@ -259,12 +356,28 @@ function get_compiler_id(compiler) result(id)
259
356
end if
260
357
261
358
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
263
369
return
264
370
end if
265
371
266
372
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
268
381
return
269
382
end if
270
383
0 commit comments