summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2016-03-23 00:22:26 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2016-03-23 00:22:26 +0900
commit7d0612528e564ac07bb0435004fe04c46af295a2 (patch)
treeeb75c035d0f4669ed5713cf8d1492607a614fbdc
parent2b0baec32a6bfe72a18199cc864c43d07575b14b (diff)
parent30b0100e6cffe12d09e497f609b174d819d04014 (diff)
downloadmruby-7d0612528e564ac07bb0435004fe04c46af295a2.tar.gz
mruby-7d0612528e564ac07bb0435004fe04c46af295a2.zip
Merge pull request #3139 from cremno/fix-vs2010-build
deprecate and fix VS2010/2012 build
-rw-r--r--include/mruby/value.h14
-rw-r--r--tasks/toolchains/visualcpp.rake15
2 files changed, 26 insertions, 3 deletions
diff --git a/include/mruby/value.h b/include/mruby/value.h
index 0eac19df9..4330b9441 100644
--- a/include/mruby/value.h
+++ b/include/mruby/value.h
@@ -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;
diff --git a/tasks/toolchains/visualcpp.rake b/tasks/toolchains/visualcpp.rake
index 978fe26ab..7a02eafe6 100644
--- a/tasks/toolchains/visualcpp.rake
+++ b/tasks/toolchains/visualcpp.rake
@@ -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