forked from mortele/FRUIT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrake_base_openmp.rb
executable file
·120 lines (104 loc) · 3.39 KB
/
rake_base_openmp.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# Copyright (c) 2005-2010, 2012-2013, Andrew Hang Chen and contributors,
# All rights reserved.
# Licensed under the 3-clause BSD license.
module RakeBase
puts "RUBY_PLATFORM=" + RUBY_PLATFORM if $show_info
if RUBY_PLATFORM =~ /(darwin|linux)/i
# Intel FORTRAN compiler tested on Linux
$compiler = 'ifort'
$option = "-check all -warn all -fpp -openmp"
$ext_obj = "o"
$dosish_path = false
$gcov = false
$prof_genx = "-prof-genx"
$mpiexec = nil
else
# Intel FORTRAN on Windows
$compiler = 'ifort'
$option = "/check:all /warn:all /fpp /Qopenmp"
$ext_obj = "obj"
$dosish_path = true
$gcov = false
$prof_genx = "/Qprof-genx"
$mpiexec = nil
end
# GCC FORTRAN compiler tested on MacOs (10.6.8 Snow Leopard) and Windows Vista + cygwin
#$compiler = "gfortran"
#$option = "-Wall -Wextra -pedantic -fbounds-check " +
# "-Wuninitialized -O -g -Wno-unused-parameter -cpp"
#$ext_obj = "o"
#$dosish_path = false
# # With " -std=f95",
# # subroutines whose name is longer than 31 characters cause error.
# #G95 FORTRAN compiler tested on Linux and Windows Vista + cygwin
#$compiler = "g95"
#$ext_obj = "o"
#$dosish_path = false
#$option = "-Wall -Wobsolescent -Wunused-module-vars " +
# "-Wunused-internal-procs -Wunused-parameter -Wunused-types " +
# "-Wmissing-intent -Wimplicit-interface -pedantic -fbounds-check -Wuninitialized"
# #FTN95 Fortran compiler
# $compiler = "ftn95"
# $linker = "slink"
# $option = "/CFPP /DEFINE FTN95 1 /SILENT "
# $linker_option = ""
# $option_obj = "/binary"
# $ext_obj = "obj"
# $option_exe = "-out:"
# $dosish_path = true
#---------------------------------------------------
#`where ...` works on windows vista, 7 and 8. Not works on Windows XP.
test_where = `where where 2>&1`
if $?.to_i == 0
where_or_which = "where"
else
where_or_which = "which"
end
#----- if absent try gfortran
result = `#{where_or_which} #{$compiler} 2>&1`
if $?.to_i != 0
puts "Fortran compiler " + $compiler + " not exists. Trying gfortran."
$compiler = "gfortran"
$option = "-Wall -Wextra -pedantic -fbounds-check " +
"-Wuninitialized -O -g -Wno-unused-parameter -cpp -fopenmp"
$ext_obj = "o"
$dosish_path = false
$gcov = "-coverage"
$prof_genx = false
end
# # ----- if absent try FTN95
# result = `#{where_or_which} #{$compiler} 2>&1`
# if $?.to_i != 0
# puts "Fortran compiler " + $compiler + " not exists. Trying ftn95."
# $compiler = "ftn95"
# result = `where #{$compiler} 2>&1`
# if $?.to_i == 0
# # $compiler = "ftn95"
# $linker = "slink"
# $option = "/CFPP /DEFINE FTN95 1 /SILENT "
# $linker_option = ""
# $option_obj = "/binary"
# $ext_obj = "obj"
# $option_exe = "-out:"
# $dosish_path = true
# $gcov = false
# $prof_genx = false
# end
# end
# #---------------------------------------------------
$mpiexec_exist = false
result_mpi = `#{where_or_which} mpiexec 2>&1`
if $?.to_i == 0
$mpiexec = "mpiexec"
$mpiexec_exist = true
end
$linker = $compiler if !$linker
$linker_option = $option if !$linker_option
$option_obj = " -c -o " if !$option_obj
$ext_obj = "o" if !$ext_obj
$option_exe = " -o " if !$option_exe
result_which = `which ar 2>&1`
$ar_ok = false
$ar_ok = true if $?.to_i == 0
$ar_ok = false if $compiler == "ftn95"
end