diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-06-10 13:15:27 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-06-10 13:15:27 +0900 |
| commit | 2e7de03fe80781e1cf1d291b341602eb04d56649 (patch) | |
| tree | 048e4437f4da4d06e27b7e81952e5b0d2e833e1a /tasks | |
| parent | c2f6c33fef11a634810e4f989677e03f87fe84a5 (diff) | |
| parent | 87038c2c8dd50bf97daf98f94e3d477920b2b716 (diff) | |
| download | mruby-2e7de03fe80781e1cf1d291b341602eb04d56649.tar.gz mruby-2e7de03fe80781e1cf1d291b341602eb04d56649.zip | |
Merge branch 'master' of github.com:mruby/mruby
Diffstat (limited to 'tasks')
| -rw-r--r-- | tasks/mrbgem_spec.rake | 31 | ||||
| -rw-r--r-- | tasks/mruby_build_gem.rake | 5 |
2 files changed, 29 insertions, 7 deletions
diff --git a/tasks/mrbgem_spec.rake b/tasks/mrbgem_spec.rake index 0c4dc85c0..c8868fe9c 100644 --- a/tasks/mrbgem_spec.rake +++ b/tasks/mrbgem_spec.rake @@ -34,6 +34,8 @@ module MRuby attr_accessor :requirements attr_reader :dependencies + attr_accessor :export_include_paths + attr_block MRuby::Build::COMMANDS def initialize(name, &block) @@ -49,22 +51,19 @@ module MRuby def setup MRuby::Gem.current = self - @build.compilers.each do |compiler| - compiler.include_paths << "#{dir}/include" - end if File.directory? "#{dir}/include" MRuby::Build::COMMANDS.each do |command| instance_variable_set("@#{command}", @build.send(command).clone) end @linker = LinkerConfig.new([], [], [], []) @rbfiles = Dir.glob("#{dir}/mrblib/*.rb").sort - @objs = Dir.glob("#{dir}/src/*.{c,cpp,cxx,cc,m,asm,S}").map do |f| + @objs = Dir.glob("#{dir}/src/*.{c,cpp,cxx,cc,m,asm,s,S}").map do |f| 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,cc,m,asm,S}").map do |f| + @test_objs = Dir.glob("#{dir}/test/*.{c,cpp,cxx,cc,m,asm,s,S}").map do |f| objfile(f.relative_path_from(dir).to_s.pathmap("#{build_dir}/%X")) end @test_preload = nil # 'test/assert.rb' @@ -74,6 +73,8 @@ module MRuby @requirements = [] @dependencies = [] + @export_include_paths = [] + @export_include_paths << "#{dir}/include" if File.directory? "#{dir}/include" instance_eval(&@initializer) @@ -88,6 +89,7 @@ module MRuby compilers.each do |compiler| compiler.define_rules build_dir, "#{dir}" compiler.defines << %Q[MRBGEM_#{funcname.upcase}_VERSION=#{version}] + compiler.include_paths << "#{dir}/include" if File.directory? "#{dir}/include" end define_gem_init_builder @@ -338,6 +340,25 @@ module MRuby rescue TSort::Cyclic => e fail "Circular mrbgem dependency found: #{e.message}" end + + each do |g| + import_include_paths(g) + end + end + + def import_include_paths(g) + gem_table = @ary.reduce({}) { |res,v| res[v.name] = v; res } + g.dependencies.each do |dep| + dep_g = gem_table[dep[:gem]] + # We can do recursive call safely + # as circular dependency has already detected in the caller. + import_include_paths(dep_g) + + g.compilers.each do |compiler| + compiler.include_paths += dep_g.export_include_paths + g.export_include_paths += dep_g.export_include_paths + end + end end end # List end # Gem diff --git a/tasks/mruby_build_gem.rake b/tasks/mruby_build_gem.rake index e58dc5c71..5d2dc030c 100644 --- a/tasks/mruby_build_gem.rake +++ b/tasks/mruby_build_gem.rake @@ -35,8 +35,9 @@ module MRuby Gem.current.build_config_initializer = block gems << Gem.current - cxx_srcs = Dir.glob("#{Gem.current.dir}/src/*.{cpp,cxx,cc}") - cxx_srcs += Dir.glob("#{Gem.current.dir}/test/*.{cpp,cxx,cc}") + cxx_srcs = ['src', 'test', 'tools'].map do |subdir| + Dir.glob("#{Gem.current.dir}/#{subdir}/*.{cpp,cxx,cc}") + end.flatten enable_cxx_abi unless cxx_srcs.empty? Gem.current |
