snow-math 1.3.0pre0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e00066f49ddedf7f84e2d892e7231b9d23ee2f47
4
- data.tar.gz: cac62d08c53fcfa26e412b12dc53f5d1d87fa0b4
3
+ metadata.gz: 5d529480a1cb3aefeacfab64857c085ab0f05b80
4
+ data.tar.gz: 9e7974ca6e60e232cc50c671f9c48d0c4f734169
5
5
  SHA512:
6
- metadata.gz: 12a03e8858753075b0fa744ce6a76c8d69467e5c3d5f6043b69a84ee5cba6b64090804a86dd4e2bb27f8fce2c6e29501fb8a2cbe0802ebd5190c33e98d767ee7
7
- data.tar.gz: bacebc0520dbebcac508fae8ebcdd8811970fb4ebf6395d30c44c47a988ddba832cc025abc892deb0a84f0356f9e46319e868402b71710e22d18de222acf1190
6
+ metadata.gz: 30885e517d2e2cbc49203ce3fd49aa751c8af241e4fe8a448d40584482d74b4217c406b9b93e84ca21b98387f6d54994879bbf9516c66eb43f5db542f2d31ffe
7
+ data.tar.gz: dee730d74dd0a7a046d4f98359867a806db9086cba0d7b25d38c13e16d32e30068976e03b63d963e86bef5eae14763ee76d68ddf76341f68773a5f0a5e171f3c
data/ext/extconf.rb CHANGED
@@ -6,21 +6,63 @@
6
6
  require 'mkmf'
7
7
 
8
8
  # Compile as C99
9
- $CFLAGS += " -std=c99"
9
+ $CFLAGS += " -std=c99 -march=native"
10
10
 
11
- if ARGV.include?("--debug") || ARGV.include?("-D")
11
+ OptKVPair = Struct.new(:key, :value)
12
+
13
+ option_mappings = {
14
+ '-F' => OptKVPair[:build_float, true],
15
+ '--use-float' => OptKVPair[:build_float, true],
16
+ '-NF' => OptKVPair[:build_float, false],
17
+ '--use-double' => OptKVPair[:build_float, false],
18
+
19
+ '-FM' => OptKVPair[:build_fast_math, true],
20
+ '--use-fast-math' => OptKVPair[:build_fast_math, true],
21
+ '-NFM' => OptKVPair[:build_fast_math, false],
22
+ '--no-fast-math' => OptKVPair[:build_fast_math, false],
23
+
24
+ '-D' => OptKVPair[:build_debug, true],
25
+ '--debug' => OptKVPair[:build_debug, true],
26
+ '-ND' => OptKVPair[:build_debug, false],
27
+ '--release' => OptKVPair[:build_debug, false]
28
+ }
29
+
30
+ options = {
31
+ :build_float => false,
32
+ :build_fast_math => false,
33
+ :build_debug => false
34
+ }
35
+
36
+ ARGV.each {
37
+ |arg|
38
+ pair = option_mappings[arg]
39
+ if pair
40
+ options[pair.key] = pair.value
41
+ else
42
+ $stderr.puts "Unrecognized install option: #{arg}"
43
+ end
44
+ }
45
+
46
+ if options[:build_debug]
12
47
  $CFLAGS += " -g"
13
- puts "Building extension source in debug mode"
48
+ $stdout.puts "Building extension in debug mode"
49
+ else
50
+ # mfpmath is ignored on clang, FYI
51
+ $CFLAGS += " -O3 -fno-strict-aliasing -mfpmath=sse"
52
+ $stdout.puts "Building extension in release mode"
53
+ end
54
+
55
+ if options[:build_fast_math] && !options[:build_debug]
56
+ $stdout.puts "Building with -ffast-math enabled"
14
57
  else
15
- $CFLAGS += " -O3 -fno-fast-math -fno-strict-aliasing"
16
- puts "Building extension source in release mode"
58
+ $CFLAGS += " -fno-fast-math"
17
59
  end
18
60
 
19
- if ARGV.include?("--use-float") || ARGV.include?("-F")
61
+ if options[:build_float]
20
62
  $CFLAGS += " -DUSE_FLOAT"
21
- puts "Using float as base type"
63
+ $stdout.puts "Using float as base type"
22
64
  else
23
- puts "Using double as base type"
65
+ $stdout.puts "Using double as base type"
24
66
  end
25
67
 
26
68
  have_library('m', 'cos')