diff options
| author | take_cheeze <[email protected]> | 2014-02-25 18:47:28 +0900 |
|---|---|---|
| committer | take_cheeze <[email protected]> | 2014-03-01 20:05:29 +0900 |
| commit | 78915f96017a12e8c3c40a4a2714543c10d0d070 (patch) | |
| tree | 9db022c63ebd09aec5d1164141a0bdb85cc93d3f /tasks | |
| parent | 5ff9c1d2861609fc98f03ec2d768e0b4f1559a09 (diff) | |
| download | mruby-78915f96017a12e8c3c40a4a2714543c10d0d070.tar.gz mruby-78915f96017a12e8c3c40a4a2714543c10d0d070.zip | |
support c++ exception
Diffstat (limited to 'tasks')
| -rw-r--r-- | tasks/mrbgem_spec.rake | 7 | ||||
| -rw-r--r-- | tasks/mruby_build.rake | 11 | ||||
| -rw-r--r-- | tasks/mruby_build_gem.rake | 2 |
3 files changed, 20 insertions, 0 deletions
diff --git a/tasks/mrbgem_spec.rake b/tasks/mrbgem_spec.rake index 6af28694e..8cde1c12d 100644 --- a/tasks/mrbgem_spec.rake +++ b/tasks/mrbgem_spec.rake @@ -39,9 +39,14 @@ module MRuby @name = name @initializer = block @version = "0.0.0" + @cxx_abi_enabled = false MRuby::Gem.current = self end + def cxx_abi_enabled? + @cxx_abi_enabled + end + def setup MRuby::Gem.current = self @build.compilers.each do |compiler| @@ -54,12 +59,14 @@ module MRuby @rbfiles = Dir.glob("#{dir}/mrblib/*.rb").sort @objs = Dir.glob("#{dir}/src/*.{c,cpp,cxx,m,asm,S}").map do |f| + @cxx_abi_enabled = true if f =~ /(cxx|cpp)$/ objfile(f.relative_path_from(@dir).to_s.pathmap("#{build_dir}/%X")) end @objs << objfile("#{build_dir}/gem_init") @test_rbfiles = Dir.glob("#{dir}/test/*.rb") @test_objs = Dir.glob("#{dir}/test/*.{c,cpp,cxx,m,asm,S}").map do |f| + @cxx_abi_enabled = true if f =~ /(cxx|cpp)$/ objfile(f.relative_path_from(dir).to_s.pathmap("#{build_dir}/%X")) end @test_preload = nil # 'test/assert.rb' diff --git a/tasks/mruby_build.rake b/tasks/mruby_build.rake index b7efa96b9..3c0a67179 100644 --- a/tasks/mruby_build.rake +++ b/tasks/mruby_build.rake @@ -81,6 +81,7 @@ module MRuby @bins = %w(mrbc) @gems, @libmruby = MRuby::Gem::List.new, [] @build_mrbtest_lib_only = false + @cxx_abi_enabled = false MRuby.targets[@name] = self end @@ -94,6 +95,16 @@ module MRuby @mrbc.compile_options += ' -g' end + def cxx_abi_enabled? + @cxx_abi_enabled + end + + def enable_cxx_abi + return if @cxx_abi_enabled + compilers.each { |c| c.defines += %w(MRB_ENABLE_CXX_EXCEPTION) } + @cxx_abi_enabled = true + end + def toolchain(name) tc = Toolchain.toolchains[name.to_s] fail "Unknown #{name} toolchain" unless tc diff --git a/tasks/mruby_build_gem.rake b/tasks/mruby_build_gem.rake index 0f920dbc8..c9bf794e3 100644 --- a/tasks/mruby_build_gem.rake +++ b/tasks/mruby_build_gem.rake @@ -30,6 +30,8 @@ module MRuby load gemrake return nil unless Gem.current + enable_cxx_abi if Gem.current.cxx_abi_enabled? + Gem.current.dir = gemdir Gem.current.build = MRuby::Build.current Gem.current.build_config_initializer = block |
