Merge pull request #5226 from shuujii/guess-toolchain-when-MRubyBuild-toolchain-argument-is-omitted

Guess toolchain when `MRuby::Build#toolchain` argument is omitted
This commit is contained in:
Yukihiro "Matz" Matsumoto
2020-12-16 20:25:35 +09:00
committed by GitHub
6 changed files with 25 additions and 25 deletions
+1 -7
View File
@@ -1,12 +1,6 @@
MRuby::Build.new do |conf|
# load specific toolchain settings
# Gets set by the VS command prompts.
if ENV['VisualStudioVersion'] || ENV['VSINSTALLDIR']
toolchain :visualcpp
else
toolchain :gcc
end
conf.toolchain
# Use mrbgems
# conf.gem 'examples/mrbgems/ruby_extension_example'
+1 -1
View File
@@ -1,5 +1,5 @@
MRuby::Build.new do |conf|
toolchain :gcc
conf.toolchain
# include the default GEMs
conf.gembox 'default'
+3 -9
View File
@@ -1,12 +1,6 @@
MRuby::Build.new('host') do |conf|
# load specific toolchain settings
# Gets set by the VS command prompts.
if ENV['VisualStudioVersion'] || ENV['VSINSTALLDIR']
toolchain :visualcpp
else
toolchain :gcc
end
conf.toolchain
conf.enable_debug
@@ -20,7 +14,7 @@ MRuby::Build.new('host') do |conf|
conf.gem :core => "mruby-bin-debugger"
# test
enable_test
conf.enable_test
# bintest
enable_bintest
conf.enable_bintest
end
+1 -1
View File
@@ -1,6 +1,6 @@
# Define cross build settings
MRuby::CrossBuild.new('no-float') do |conf|
toolchain :gcc
conf.toolchain
# include the GEM box
conf.compilers.each do |c|
+5 -5
View File
@@ -1,5 +1,5 @@
MRuby::Build.new('full-debug') do |conf|
toolchain :gcc
conf.toolchain
conf.enable_debug
# include all core GEMs
@@ -10,7 +10,7 @@ MRuby::Build.new('full-debug') do |conf|
end
MRuby::Build.new do |conf|
toolchain :gcc
conf.toolchain
# include all core GEMs
conf.gembox 'full-core'
@@ -22,7 +22,7 @@ MRuby::Build.new do |conf|
end
MRuby::Build.new('cxx_abi') do |conf|
toolchain :gcc
conf.toolchain
conf.gembox 'full-core'
conf.cc.flags += %w(-fpermissive)
@@ -31,7 +31,7 @@ MRuby::Build.new('cxx_abi') do |conf|
end
conf.enable_test
enable_cxx_abi
conf.enable_cxx_abi
build_mrbc_exec
conf.build_mrbc_exec
end
+14 -2
View File
@@ -22,6 +22,18 @@ module MRuby
class Toolchain
class << self
attr_accessor :toolchains
def guess
if cc = ENV["CC"] || ENV["CXX"]
return "clang" if cc.include?("clang")
else
return "clang" if RUBY_PLATFORM =~ /darwin|(?:free|open)bsd/
return "gcc" if RUBY_PLATFORM.include?("cygwin")
return "visualcpp" if ENV.include?("VisualStudioVersion")
return "visualcpp" if ENV.include?("VSINSTALLDIR")
end
"gcc"
end
end
def initialize(name, &block)
@@ -29,7 +41,7 @@ module MRuby
MRuby::Toolchain.toolchains[@name] = self
end
def setup(conf,params={})
def setup(conf, params={})
conf.instance_exec(conf, params, &@initializer)
end
@@ -221,7 +233,7 @@ EOS
@enable_bintest
end
def toolchain(name, params={})
def toolchain(name=Toolchain.guess, params={})
name = name.to_s
tc = Toolchain.toolchains[name] || begin
path = "#{MRUBY_ROOT}/tasks/toolchains/#{name}.rake"