Skip to content

Commit

Permalink
Fix for compiling mruby as C++ on Visual Studio toolchain
Browse files Browse the repository at this point in the history
  • Loading branch information
dabroz authored and matz committed Nov 24, 2016
1 parent 18757c8 commit 44c3859
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tasks/mruby_build.rake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions tasks/mruby_build_commands.rake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions tasks/toolchains/gcc.rake
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand All @@ -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|
Expand Down
2 changes: 2 additions & 0 deletions tasks/toolchains/visualcpp.rake
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand All @@ -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|
Expand Down

0 comments on commit 44c3859

Please sign in to comment.