Top Level Namespace

Defined Under Namespace

Modules: TG

Constant Summary collapse

MINIMUM_RUBY_VERSION =
Gem::Version.new("3.0.0")
VENDOR_DIR =
File.expand_path("vendor", __dir__)
VENDORED_TG_DIR =
File.join(VENDOR_DIR, "tg")
VENDORED_RTREE_DIR =
File.join(VENDOR_DIR, "rtree")
VENDORED_JSON_DIR =
File.join(VENDOR_DIR, "json")

Instance Method Summary collapse

Instance Method Details

#tg_geometry_clang_compiler?Boolean

Returns:

  • (Boolean)


35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'ext/tg_geometry/extconf.rb', line 35

def tg_geometry_clang_compiler?
  cc = RbConfig::CONFIG["CC"].to_s
  return true if cc.include?("clang")

  # Some build environments use cc as an alias. Detect __clang__ by compiling
  # a tiny program rather than trusting the command name.
  try_compile(<<~C)
    #ifndef __clang__
    #error not clang
    #endif
    int main(void) { return 0; }
  C
end

#tg_geometry_sanitize_warnflags!Object



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'ext/tg_geometry/extconf.rb', line 49

def tg_geometry_sanitize_warnflags!
  return if tg_geometry_clang_compiler?

  # Ruby builds produced with clang may leak clang-only warning flags into
  # RbConfig::CONFIG["warnflags"]. GCC prints noisy "unrecognized command-line
  # option" notes once any real diagnostic is emitted. Keep our Linux CI logs
  # focused on tg_geometry diagnostics.
  clang_only_warning_flags = %w[
    -Wno-constant-logical-operand
    -Wno-parentheses-equality
    -Wno-self-assign
  ]

  $warnflags = $warnflags.to_s.split.reject do |flag|
    clang_only_warning_flags.include?(flag)
  end.join(" ")
end