Commit 66e0df34 authored by take_cheeze's avatar take_cheeze

Fix C++ files detection for automatic C++ ABI enabling.

parent c5c87424
...@@ -40,7 +40,6 @@ module MRuby ...@@ -40,7 +40,6 @@ module MRuby
@name = name @name = name
@initializer = block @initializer = block
@version = "0.0.0" @version = "0.0.0"
@cxx_abi_enabled = false
MRuby::Gem.current = self MRuby::Gem.current = self
end end
...@@ -48,10 +47,6 @@ module MRuby ...@@ -48,10 +47,6 @@ module MRuby
not test_preload.nil? or not test_objs.empty? not test_preload.nil? or not test_objs.empty?
end end
def cxx_abi_enabled?
@cxx_abi_enabled
end
def setup def setup
MRuby::Gem.current = self MRuby::Gem.current = self
@build.compilers.each do |compiler| @build.compilers.each do |compiler|
...@@ -64,14 +59,12 @@ module MRuby ...@@ -64,14 +59,12 @@ module MRuby
@rbfiles = Dir.glob("#{dir}/mrblib/*.rb").sort @rbfiles = Dir.glob("#{dir}/mrblib/*.rb").sort
@objs = Dir.glob("#{dir}/src/*.{c,cpp,cxx,m,asm,S}").map do |f| @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")) objfile(f.relative_path_from(@dir).to_s.pathmap("#{build_dir}/%X"))
end end
@objs << objfile("#{build_dir}/gem_init") @objs << objfile("#{build_dir}/gem_init")
@test_rbfiles = Dir.glob("#{dir}/test/*.rb") @test_rbfiles = Dir.glob("#{dir}/test/*.rb")
@test_objs = Dir.glob("#{dir}/test/*.{c,cpp,cxx,m,asm,S}").map do |f| @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")) objfile(f.relative_path_from(dir).to_s.pathmap("#{build_dir}/%X"))
end end
@test_preload = nil # 'test/assert.rb' @test_preload = nil # 'test/assert.rb'
......
...@@ -30,12 +30,15 @@ module MRuby ...@@ -30,12 +30,15 @@ module MRuby
load gemrake load gemrake
return nil unless Gem.current return nil unless Gem.current
enable_cxx_abi if Gem.current.cxx_abi_enabled?
Gem.current.dir = gemdir Gem.current.dir = gemdir
Gem.current.build = MRuby::Build.current Gem.current.build = MRuby::Build.current
Gem.current.build_config_initializer = block Gem.current.build_config_initializer = block
gems << Gem.current gems << Gem.current
cxx_srcs = Dir.glob("#{Gem.current.dir}/src/*.{cpp,cxx}")
cxx_srcs += Dir.glob("#{Gem.current.dir}/test/*.{cpp,cxx}")
enable_cxx_abi unless cxx_srcs.empty?
Gem.current Gem.current
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment