From 172cd281ba221e02ef293f85d25ebe7caed8f314 Mon Sep 17 00:00:00 2001 From: Per Lundberg Date: Fri, 22 Nov 2013 22:17:01 +0200 Subject: Automatically detect toolchain if it is visualcpp, and hence we drop vs2010.rake altogether - it’s no longer needed. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_config.rb | 8 +++++++- tasks/toolchains/visualcpp.rake | 44 +++++++++++++++++++++++++++++++++++++++++ tasks/toolchains/vs2010.rake | 3 --- tasks/toolchains/vs2012.rake | 44 ----------------------------------------- 4 files changed, 51 insertions(+), 48 deletions(-) create mode 100644 tasks/toolchains/visualcpp.rake delete mode 100644 tasks/toolchains/vs2010.rake delete mode 100644 tasks/toolchains/vs2012.rake diff --git a/build_config.rb b/build_config.rb index fce424686..83dc01940 100644 --- a/build_config.rb +++ b/build_config.rb @@ -1,6 +1,12 @@ MRuby::Build.new do |conf| # load specific toolchain settings - toolchain :gcc + + # Gets set by the VS command prompts. + if ENV['VisualStudioVersion'] + toolchain :visualcpp + else + toolchain :gcc + end # Use mrbgems # conf.gem 'examples/mrbgems/ruby_extension_example' diff --git a/tasks/toolchains/visualcpp.rake b/tasks/toolchains/visualcpp.rake new file mode 100644 index 000000000..fc51dbc02 --- /dev/null +++ b/tasks/toolchains/visualcpp.rake @@ -0,0 +1,44 @@ +MRuby::Toolchain.new(:visualcpp) do |conf| + [conf.cc, conf.cxx].each do |cc| + cc.command = ENV['CC'] || 'cl.exe' + cc.flags = [ENV['CFLAGS'] || %w(/c /nologo /W3 /D_DEBUG /MDd /Zi /Od /RTC1 /DHAVE_STRING_H /DNO_GETTIMEOFDAY /D_CRT_SECURE_NO_WARNINGS)] + cc.include_paths = ["#{MRUBY_ROOT}/include"] + cc.defines = %w(DISABLE_GEMS) + cc.option_include_path = '/I%s' + cc.option_define = '/D%s' + cc.compile_options = "%{flags} /Fo%{outfile} %{infile}" + end + + conf.linker do |linker| + linker.command = ENV['LD'] || 'link.exe' + linker.flags = [ENV['LDFLAGS'] || %w(/nologo)] + linker.libraries = %w() + linker.library_paths = %w() + linker.option_library = '%s.lib' + linker.option_library_path = '/LIBPATH:%s' + linker.link_options = "%{flags} /OUT:%{outfile} %{objs} %{flags_before_libraries} %{libs} %{flags_after_libraries}" + end + + conf.archiver do |archiver| + archiver.command = ENV['AR'] || 'lib.exe' + archiver.archive_options = '/nologo /OUT:%{outfile} %{objs}' + end + + conf.yacc do |yacc| + yacc.command = ENV['YACC'] || 'bison.exe' + yacc.compile_options = '-o %{outfile} %{infile}' + end + + conf.gperf do |gperf| + gperf.command = 'gperf.exe' + gperf.compile_options = '-L ANSI-C -C -p -j1 -i 1 -g -o -t -N mrb_reserved_word -k"1,3,$" %{infile} > %{outfile}' + end + + conf.exts do |exts| + exts.object = '.obj' + exts.executable = '.exe' + exts.library = '.lib' + end + + conf.file_separator = '\\' +end diff --git a/tasks/toolchains/vs2010.rake b/tasks/toolchains/vs2010.rake deleted file mode 100644 index 783dc8831..000000000 --- a/tasks/toolchains/vs2010.rake +++ /dev/null @@ -1,3 +0,0 @@ -MRuby::Toolchain.new(:vs2010) do |conf| - toolchain :vs2012 -end diff --git a/tasks/toolchains/vs2012.rake b/tasks/toolchains/vs2012.rake deleted file mode 100644 index f4039cc29..000000000 --- a/tasks/toolchains/vs2012.rake +++ /dev/null @@ -1,44 +0,0 @@ -MRuby::Toolchain.new(:vs2012) do |conf| - [conf.cc, conf.cxx].each do |cc| - cc.command = ENV['CC'] || 'cl.exe' - cc.flags = [ENV['CFLAGS'] || %w(/c /nologo /W3 /D_DEBUG /MDd /Zi /Od /RTC1 /DHAVE_STRING_H /DNO_GETTIMEOFDAY /D_CRT_SECURE_NO_WARNINGS)] - cc.include_paths = ["#{MRUBY_ROOT}/include"] - cc.defines = %w(DISABLE_GEMS) - cc.option_include_path = '/I%s' - cc.option_define = '/D%s' - cc.compile_options = "%{flags} /Fo%{outfile} %{infile}" - end - - conf.linker do |linker| - linker.command = ENV['LD'] || 'link.exe' - linker.flags = [ENV['LDFLAGS'] || %w(/nologo)] - linker.libraries = %w() - linker.library_paths = %w() - linker.option_library = '%s.lib' - linker.option_library_path = '/LIBPATH:%s' - linker.link_options = "%{flags} /OUT:%{outfile} %{objs} %{flags_before_libraries} %{libs} %{flags_after_libraries}" - end - - conf.archiver do |archiver| - archiver.command = ENV['AR'] || 'lib.exe' - archiver.archive_options = '/nologo /OUT:%{outfile} %{objs}' - end - - conf.yacc do |yacc| - yacc.command = ENV['YACC'] || 'bison.exe' - yacc.compile_options = '-o %{outfile} %{infile}' - end - - conf.gperf do |gperf| - gperf.command = 'gperf.exe' - gperf.compile_options = '-L ANSI-C -C -p -j1 -i 1 -g -o -t -N mrb_reserved_word -k"1,3,$" %{infile} > %{outfile}' - end - - conf.exts do |exts| - exts.object = '.obj' - exts.executable = '.exe' - exts.library = '.lib' - end - - conf.file_separator = '\\' -end -- cgit v1.2.3