Skip to content
Permalink
Browse files
Fix for compiling mruby as C++ on Visual Studio toolchain
  • Loading branch information
dabroz authored and matz committed Nov 24, 2016
1 parent 18757c8 commit 44c3859a9725a5fb41e374ba91b52459498b8f17
Showing 4 changed files with 6 additions and 1 deletion.
@@ -120,7 +120,7 @@ module MRuby
def enable_cxx_abi
return if @cxx_exception_disabled or @cxx_abi_enabled
compilers.each { |c| c.defines += %w(MRB_ENABLE_CXX_EXCEPTION) }
compilers.each { |c| c.flags << '-x c++'}
compilers.each { |c| c.flags << c.cxx_compile_flag }
linker.command = cxx.command if toolchains.find { |v| v == 'gcc' }
@cxx_abi_enabled = true
end
@@ -41,6 +41,7 @@ module MRuby
class Command::Compiler < Command
attr_accessor :flags, :include_paths, :defines, :source_exts
attr_accessor :compile_options, :option_define, :option_include_path, :out_ext
attr_accessor :cxx_compile_flag

def initialize(build, source_exts=[])
super(build)
@@ -6,6 +6,7 @@ MRuby::Toolchain.new(:gcc) do |conf, _params|
cc.option_include_path = '-I%s'
cc.option_define = '-D%s'
cc.compile_options = '%{flags} -MMD -o %{outfile} -c %{infile}'
cc.cxx_compile_flag = '-x c++'
end

[conf.cxx].each do |cxx|
@@ -15,6 +16,7 @@ MRuby::Toolchain.new(:gcc) do |conf, _params|
cxx.option_include_path = '-I%s'
cxx.option_define = '-D%s'
cxx.compile_options = '%{flags} -MMD -o %{outfile} -c %{infile}'
cxx.cxx_compile_flag = '-x c++'
end

conf.linker do |linker|
@@ -7,6 +7,7 @@ MRuby::Toolchain.new(:visualcpp) do |conf, _params|
cc.option_include_path = '/I%s'
cc.option_define = '/D%s'
cc.compile_options = "%{flags} /Fo%{outfile} %{infile}"
cc.cxx_compile_flag = '/TP'
end

conf.cxx do |cxx|
@@ -16,6 +17,7 @@ MRuby::Toolchain.new(:visualcpp) do |conf, _params|
cxx.option_include_path = '/I%s'
cxx.option_define = '/D%s'
cxx.compile_options = "%{flags} /Fo%{outfile} %{infile}"
cxx.cxx_compile_flag = '/TP'
end

conf.linker do |linker|

0 comments on commit 44c3859

Please sign in to comment.