mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Fix for compiling mruby as C++ on Visual Studio toolchain
This commit is contained in:
committed by
Yukihiro "Matz" Matsumoto
parent
18757c8f7b
commit
44c3859a97
@@ -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|
|
||||
|
||||
Reference in New Issue
Block a user