| 1 |
MRuby::Toolchain.new(:visualcpp) do |conf, _params| |
| 2 |
compiler_flags = %w(/nologo /W3 /MD /O2 /D_CRT_SECURE_NO_WARNINGS) |
| 3 |
[conf.cc, conf.cxx].each do |compiler| |
| 4 |
if compiler == conf.cc |
| 5 |
compiler.command = ENV['CC'] || 'cl.exe' |
| 6 |
# C4013: implicit function declaration |
| 7 |
compiler.flags = [*(ENV['CFLAGS'] || compiler_flags + %w(/we4013))] |
| 8 |
else |
| 9 |
compiler.command = ENV['CXX'] || 'cl.exe' |
| 10 |
compiler.flags = [*(ENV['CXXFLAGS'] || ENV['CFLAGS'] || compiler_flags + %w(/EHs))] |
| 11 |
end |
| 12 |
compiler.defines = %w(MRB_STACK_EXTEND_DOUBLING) |
| 13 |
compiler.option_include_path = %q[/I"%s"] |
| 14 |
compiler.option_define = '/D%s' |
| 15 |
compiler.compile_options = %Q[/Zi /c /Fo"%{outfile}" %{flags} "%{infile}"] |
| 16 |
compiler.preprocess_options = %Q[/EP %{flags} "%{infile}" > "%{outfile}"] |
| 17 |
compiler.cxx_compile_flag = '/TP' |
| 18 |
compiler.cxx_exception_flag = '/EHs' |
| 19 |
end |
| 20 |
|
| 21 |
conf.linker do |linker| |
| 22 |
linker.command = ENV['LD'] || 'link.exe' |
| 23 |
linker.flags = [ENV['LDFLAGS'] || %w(/NOLOGO /DEBUG /INCREMENTAL:NO /OPT:ICF /OPT:REF)] |
| 24 |
linker.libraries = %w() |
| 25 |
linker.library_paths = %w() |
| 26 |
linker.option_library = '%s.lib' |
| 27 |
linker.option_library_path = '/LIBPATH:%s' |
| 28 |
linker.link_options = %Q[%{flags} /OUT:"%{outfile}" %{objs} %{flags_before_libraries} %{libs} %{flags_after_libraries}] |
| 29 |
end |
| 30 |
|
| 31 |
conf.archiver do |archiver| |
| 32 |
archiver.command = ENV['AR'] || 'lib.exe' |
| 33 |
archiver.archive_options = '/nologo /OUT:"%{outfile}" %{objs}' |
| 34 |
end |
| 35 |
|
| 36 |
conf.yacc do |yacc| |
| 37 |
yacc.command = ENV['YACC'] || 'bison.exe' |
| 38 |
yacc.compile_options = %q[-o "%{outfile}" "%{infile}"] |
| 39 |
end |
| 40 |
|
| 41 |
conf.gperf do |gperf| |
| 42 |
gperf.command = 'gperf.exe' |
| 43 |
gperf.compile_options = %q[-L ANSI-C -C -p -j1 -i 1 -g -o -t -N mrb_reserved_word -k"1,3,$" "%{infile}" > "%{outfile}"] |
| 44 |
end |
| 45 |
|
| 46 |
conf.exts do |exts| |
| 47 |
exts.object = '.obj' |
| 48 |
exts.executable = '.exe' |
| 49 |
exts.library = '.lib' |
| 50 |
end |
| 51 |
|
| 52 |
conf.file_separator = '\\' |
| 53 |
end |