1 MRuby::Build.new do |conf|
3 # Gets set by the VS command prompts.
4 if ENV['VisualStudioVersion'] || ENV['VSINSTALLDIR']
12 # include the default GEMs
17 # Cross Compiling configuration for Digilent chipKIT Max32
18 # http://www.digilentinc.com/Products/Detail.cfm?Prod=CHIPKIT-MAX32
20 # Requires MPIDE (https://github.com/chipKIT32/chipKIT32-MAX)
22 # This configuration is based on @kyab's version
23 # http://d.hatena.ne.jp/kyab/20130201
24 MRuby::CrossBuild.new("chipKITMax32") do |conf|
28 # MPIDE_PATH = '/Applications/Mpide.app/Contents/Resources/Java'
30 MPIDE_PATH = '/opt/mpide-0023-linux-20120903'
32 PIC32_PATH = "#{MPIDE_PATH}/hardware/pic32"
35 cc.command = "#{PIC32_PATH}/compiler/pic32-tools/bin/pic32-gcc"
36 cc.include_paths << ["#{PIC32_PATH}/cores/pic32",
37 "#{PIC32_PATH}/variants/Max32",
38 "#{PIC32_PATH}/libraries"]
39 cc.flags = %w(-O2 -mno-smart-io -w -ffunction-sections -fdata-sections -g -mdebugger -Wcast-align
40 -fno-short-double -mprocessor=32MX795F512L -DF_CPU=80000000L -DARDUINO=23 -D_BOARD_MEGA_
41 -DMPIDEVER=0x01000202 -DMPIDE=23)
42 cc.compile_options = %Q[%{flags} -o "%{outfile}" -c "%{infile}"]
44 #configuration for low memory environment
45 cc.defines << %w(MRB_HEAP_PAGE_SIZE=64)
46 cc.defines << %w(KHASH_DEFAULT_SIZE=8)
47 cc.defines << %w(MRB_STR_BUF_MIN_SIZE=20)
48 cc.defines << %w(MRB_GC_STRESS)
49 #cc.defines << %w(MRB_DISABLE_STDIO) #if you dont need stdio.
50 #cc.defines << %w(POOL_PAGE_SIZE=1000) #effective only for use with mruby-eval
54 cxx.command = conf.cc.command.dup
55 cxx.include_paths = conf.cc.include_paths.dup
56 cxx.flags = conf.cc.flags.dup
57 cxx.defines = conf.cc.defines.dup
58 cxx.compile_options = conf.cc.compile_options.dup
61 conf.archiver do |archiver|
62 archiver.command = "#{PIC32_PATH}/compiler/pic32-tools/bin/pic32-ar"
63 archiver.archive_options = 'rcs "%{outfile}" %{objs}'
69 #do not build test executable
70 conf.build_mrbtest_lib_only
72 #disable C++ exception
73 conf.disable_cxx_exception
76 conf.gem :core => "mruby-print"
77 conf.gem :core => "mruby-math"
78 conf.gem :core => "mruby-enum-ext"
80 #light-weight regular expression
81 conf.gem :github => "masamitsu-murase/mruby-hs-regexp", :branch => "master"
84 #conf.gem :github =>"kyab/mruby-arduino", :branch => "master"