diff options
| -rw-r--r-- | .github/workflows/build.yml | 14 | ||||
| -rw-r--r-- | .travis.yml | 2 | ||||
| -rw-r--r-- | appveyor.yml | 2 | ||||
| -rw-r--r-- | build_config/ci/gcc-clang.rb (renamed from build_config/travis.rb) | 10 | ||||
| -rw-r--r-- | build_config/ci/msvc.rb (renamed from build_config/appveyor.rb) | 0 | ||||
| -rw-r--r-- | build_config/default.rb | 8 | ||||
| -rw-r--r-- | build_config/host-cxx.rb | 2 | ||||
| -rw-r--r-- | build_config/host-debug.rb | 12 | ||||
| -rw-r--r-- | build_config/no-float.rb | 2 | ||||
| -rw-r--r-- | lib/mruby/build.rb | 16 |
10 files changed, 34 insertions, 34 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bbb6c1d29..2a3b8d18c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,7 +6,7 @@ jobs: Ubuntu-1604: runs-on: ubuntu-16.04 env: - MRUBY_CONFIG: travis + MRUBY_CONFIG: ci/gcc-clang steps: - uses: actions/checkout@v1 - name: apt @@ -17,7 +17,7 @@ jobs: Ubuntu-1804-gcc: runs-on: ubuntu-18.04 env: - MRUBY_CONFIG: travis + MRUBY_CONFIG: ci/gcc-clang CC: gcc CXX: g++ steps: @@ -30,7 +30,7 @@ jobs: Ubuntu-1804-clang: runs-on: ubuntu-18.04 env: - MRUBY_CONFIG: travis + MRUBY_CONFIG: ci/gcc-clang CC: clang CXX: clang++ steps: @@ -43,7 +43,7 @@ jobs: macOS: runs-on: macos-latest env: - MRUBY_CONFIG: travis + MRUBY_CONFIG: ci/gcc-clang steps: - uses: actions/checkout@v1 - name: brew @@ -54,7 +54,7 @@ jobs: Windows-MinGW: runs-on: windows-latest env: - MRUBY_CONFIG: travis + MRUBY_CONFIG: ci/gcc-clang CFLAGS: -g -O1 -Wall -Wundef steps: - uses: actions/checkout@v1 @@ -66,7 +66,7 @@ jobs: Windows-Cygwin: runs-on: windows-latest env: - MRUBY_CONFIG: travis + MRUBY_CONFIG: ci/gcc-clang ACTIONS_ALLOW_UNSECURE_COMMANDS: true steps: - uses: actions/checkout@v1 @@ -92,7 +92,7 @@ jobs: Windows-VC: runs-on: windows-latest env: - MRUBY_CONFIG: appveyor + MRUBY_CONFIG: ci/msvc # TODO(take-cheeze): Re-enable /O2 CFLAGS: "/c /nologo /W3 /we4013 /Zi /MD /D_CRT_SECURE_NO_WARNINGS" CXXFLAGS: "/c /nologo /W3 /Zi /MD /EHs /D_CRT_SECURE_NO_WARNINGS" diff --git a/.travis.yml b/.travis.yml index 7da3d40a9..f3ed6a73e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,7 @@ jobs: - export PATH="/usr/local/opt/bison/bin:$PATH" env: - - MRUBY_CONFIG=travis + - MRUBY_CONFIG=ci/gcc-clang script: - rake gensym && rake -m && rake test diff --git a/appveyor.yml b/appveyor.yml index e2a79f20d..d05696e69 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -40,7 +40,7 @@ init: build_script: - - set MRUBY_CONFIG=appveyor + - set MRUBY_CONFIG=ci/msvc - rake gensym - rake -m all - rake -E $stdout.sync=true test diff --git a/build_config/travis.rb b/build_config/ci/gcc-clang.rb index 3c6647b45..7da8c1bf4 100644 --- a/build_config/travis.rb +++ b/build_config/ci/gcc-clang.rb @@ -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 diff --git a/build_config/appveyor.rb b/build_config/ci/msvc.rb index e084a6a36..e084a6a36 100644 --- a/build_config/appveyor.rb +++ b/build_config/ci/msvc.rb diff --git a/build_config/default.rb b/build_config/default.rb index 04bc60540..894f1055b 100644 --- a/build_config/default.rb +++ b/build_config/default.rb @@ -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' diff --git a/build_config/host-cxx.rb b/build_config/host-cxx.rb index ae313e45d..15cb0c347 100644 --- a/build_config/host-cxx.rb +++ b/build_config/host-cxx.rb @@ -1,5 +1,5 @@ MRuby::Build.new do |conf| - toolchain :gcc + conf.toolchain # include the default GEMs conf.gembox 'default' diff --git a/build_config/host-debug.rb b/build_config/host-debug.rb index 9be1f6574..600a4d78f 100644 --- a/build_config/host-debug.rb +++ b/build_config/host-debug.rb @@ -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 diff --git a/build_config/no-float.rb b/build_config/no-float.rb index 1138188e3..7df7c2e46 100644 --- a/build_config/no-float.rb +++ b/build_config/no-float.rb @@ -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| diff --git a/lib/mruby/build.rb b/lib/mruby/build.rb index 2e67fe5a6..83722a0e8 100644 --- a/lib/mruby/build.rb +++ b/lib/mruby/build.rb @@ -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" |
