[331] | 1 | MRuby::Toolchain.new(:visualcpp) do |conf, _params|
|
---|
[281] | 2 | conf.cc do |cc|
|
---|
[270] | 3 | cc.command = ENV['CC'] || 'cl.exe'
|
---|
[331] | 4 | # C4013: implicit function declaration
|
---|
| 5 | cc.flags = [ENV['CFLAGS'] || %w(/c /nologo /W3 /we4013 /Zi /MD /O2 /utf-8 /D_CRT_SECURE_NO_WARNINGS)]
|
---|
[270] | 6 | cc.defines = %w(DISABLE_GEMS MRB_STACK_EXTEND_DOUBLING)
|
---|
| 7 | cc.option_include_path = '/I%s'
|
---|
| 8 | cc.option_define = '/D%s'
|
---|
| 9 | cc.compile_options = "%{flags} /Fo%{outfile} %{infile}"
|
---|
[331] | 10 | cc.cxx_compile_flag = '/TP'
|
---|
| 11 | cc.cxx_exception_flag = '/EHs'
|
---|
[270] | 12 | end
|
---|
| 13 |
|
---|
[281] | 14 | conf.cxx do |cxx|
|
---|
[270] | 15 | cxx.command = ENV['CXX'] || 'cl.exe'
|
---|
[331] | 16 | cxx.flags = [ENV['CXXFLAGS'] || ENV['CFLAGS'] || %w(/c /nologo /W3 /Zi /MD /O2 /EHs /utf-8 /D_CRT_SECURE_NO_WARNINGS)]
|
---|
[270] | 17 | cxx.defines = %w(DISABLE_GEMS MRB_STACK_EXTEND_DOUBLING)
|
---|
| 18 | cxx.option_include_path = '/I%s'
|
---|
| 19 | cxx.option_define = '/D%s'
|
---|
| 20 | cxx.compile_options = "%{flags} /Fo%{outfile} %{infile}"
|
---|
[331] | 21 | cxx.cxx_compile_flag = '/TP'
|
---|
| 22 | cxx.cxx_exception_flag = '/EHs'
|
---|
[270] | 23 | end
|
---|
| 24 |
|
---|
| 25 | conf.linker do |linker|
|
---|
| 26 | linker.command = ENV['LD'] || 'link.exe'
|
---|
[281] | 27 | linker.flags = [ENV['LDFLAGS'] || %w(/MANIFEST /NXCOMPAT /DYNAMICBASE /MACHINE:X86 /INCREMENTAL /SUBSYSTEM:CONSOLE /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /ERRORREPORT:PROMPT /NOLOGO /TLBID:1)]
|
---|
| 28 | linker.flags << "/PDB:\"#{conf.build_dir}\\vc140.pdb\""
|
---|
| 29 | #linker.flags << "/PGD:\"%{outdir}\\%{outfilebase}.pgd\""
|
---|
| 30 | linker.flags << "/ManifestFile:\"%{outdir}\\%{outfilebase}.exe.intermediate.manifest\""
|
---|
[270] | 31 | linker.libraries = %w()
|
---|
| 32 | linker.library_paths = %w()
|
---|
| 33 | linker.option_library = '%s.lib'
|
---|
| 34 | linker.option_library_path = '/LIBPATH:%s'
|
---|
| 35 | linker.link_options = "%{flags} /OUT:%{outfile} %{objs} %{flags_before_libraries} %{libs} %{flags_after_libraries}"
|
---|
| 36 | end
|
---|
| 37 |
|
---|
| 38 | conf.archiver do |archiver|
|
---|
| 39 | archiver.command = ENV['AR'] || 'lib.exe'
|
---|
| 40 | archiver.archive_options = '/nologo /OUT:%{outfile} %{objs}'
|
---|
| 41 | end
|
---|
| 42 |
|
---|
| 43 | conf.yacc do |yacc|
|
---|
| 44 | yacc.command = ENV['YACC'] || 'bison.exe'
|
---|
| 45 | yacc.compile_options = '-o %{outfile} %{infile}'
|
---|
| 46 | end
|
---|
| 47 |
|
---|
| 48 | conf.gperf do |gperf|
|
---|
| 49 | gperf.command = 'gperf.exe'
|
---|
| 50 | gperf.compile_options = '-L ANSI-C -C -p -j1 -i 1 -g -o -t -N mrb_reserved_word -k"1,3,$" %{infile} > %{outfile}'
|
---|
| 51 | end
|
---|
| 52 |
|
---|
| 53 | conf.exts do |exts|
|
---|
| 54 | exts.object = '.obj'
|
---|
| 55 | exts.executable = '.exe'
|
---|
| 56 | exts.library = '.lib'
|
---|
| 57 | end
|
---|
| 58 |
|
---|
| 59 | conf.file_separator = '\\'
|
---|
[331] | 60 |
|
---|
| 61 | if require 'open3'
|
---|
| 62 | Open3.popen3 conf.cc.command do |_, _, e, _|
|
---|
| 63 | if /Version (\d{2})\.\d{2}\.\d{5}/ =~ e.gets && $1.to_i <= 17
|
---|
| 64 | m = "# VS2010/2012 support will be dropped after the next release! #"
|
---|
| 65 | h = "#" * m.length
|
---|
| 66 | puts h, m, h
|
---|
| 67 | end
|
---|
| 68 | end
|
---|
| 69 | end
|
---|
| 70 |
|
---|
[270] | 71 | end
|
---|