Merge pull request #3139 from cremno/fix-vs2010-build

deprecate and fix VS2010/2012 build
This commit is contained in:
Yukihiro "Matz" Matsumoto
2016-03-23 00:22:26 +09:00
2 changed files with 26 additions and 3 deletions
+13 -1
View File
@@ -22,7 +22,19 @@ struct mrb_state;
# error "You can't define MRB_INT16 and MRB_INT64 at the same time."
#endif
#include <inttypes.h>
#if defined _MSC_VER && _MSC_VER < 1800
# define PRIo64 "llo"
# define PRId64 "lld"
# define PRIx64 "llx"
# define PRIo16 "ho"
# define PRId16 "hd"
# define PRIx16 "hx"
# define PRIo32 "o"
# define PRId32 "d"
# define PRIx32 "x"
#else
# include <inttypes.h>
#endif
#if defined(MRB_INT64)
typedef int64_t mrb_int;
+13 -2
View File
@@ -1,5 +1,5 @@
MRuby::Toolchain.new(:visualcpp) do |conf, _params|
[conf.cc].each do |cc|
conf.cc do |cc|
cc.command = ENV['CC'] || 'cl.exe'
# C4013: implicit function declaration
cc.flags = [ENV['CFLAGS'] || %w(/c /nologo /W3 /we4013 /Zi /MD /O2 /D_CRT_SECURE_NO_WARNINGS)]
@@ -9,7 +9,7 @@ MRuby::Toolchain.new(:visualcpp) do |conf, _params|
cc.compile_options = "%{flags} /Fo%{outfile} %{infile}"
end
[conf.cxx].each do |cxx|
conf.cxx do |cxx|
cxx.command = ENV['CXX'] || 'cl.exe'
cxx.flags = [ENV['CXXFLAGS'] || ENV['CFLAGS'] || %w(/c /nologo /W3 /Zi /MD /O2 /EHs /D_CRT_SECURE_NO_WARNINGS)]
cxx.defines = %w(DISABLE_GEMS MRB_STACK_EXTEND_DOUBLING)
@@ -50,4 +50,15 @@ MRuby::Toolchain.new(:visualcpp) do |conf, _params|
end
conf.file_separator = '\\'
if require 'open3'
Open3.popen3 conf.cc.command do |_, _, e, _|
if /Version (?<v>\d{2}\.\d{2}\.\d{5})/ =~ e.gets && v.to_i <= 17
m = "# VS2010/2012 support will be dropped after the next release! #"
h = "#" * m.length
puts h, m, h
end
end
end
end