[279] | 1 | MRuby::Build.new do |conf|
|
---|
| 2 |
|
---|
| 3 | # Gets set by the VS command prompts.
|
---|
| 4 | if ENV['VisualStudioVersion'] || ENV['VSINSTALLDIR']
|
---|
| 5 | toolchain :visualcpp
|
---|
| 6 | else
|
---|
| 7 | toolchain :gcc
|
---|
| 8 | end
|
---|
| 9 |
|
---|
| 10 | enable_debug
|
---|
| 11 |
|
---|
| 12 | # include the default GEMs
|
---|
| 13 | conf.gembox 'default'
|
---|
| 14 |
|
---|
| 15 | end
|
---|
| 16 |
|
---|
| 17 | # Cross Compiling configuration for Digilent chipKIT Max32
|
---|
| 18 | # http://www.digilentinc.com/Products/Detail.cfm?Prod=CHIPKIT-MAX32
|
---|
| 19 | #
|
---|
| 20 | # Requires MPIDE (https://github.com/chipKIT32/chipKIT32-MAX)
|
---|
| 21 | #
|
---|
| 22 | # This configuration is based on @kyab's version
|
---|
| 23 | # http://d.hatena.ne.jp/kyab/20130201
|
---|
| 24 | MRuby::CrossBuild.new("chipKITMax32") do |conf|
|
---|
| 25 | toolchain :gcc
|
---|
| 26 |
|
---|
| 27 | # Mac OS X
|
---|
| 28 | # MPIDE_PATH = '/Applications/Mpide.app/Contents/Resources/Java'
|
---|
| 29 | # GNU Linux
|
---|
| 30 | MPIDE_PATH = '/opt/mpide-0023-linux-20120903'
|
---|
| 31 |
|
---|
| 32 | PIC32_PATH = "#{MPIDE_PATH}/hardware/pic32"
|
---|
| 33 |
|
---|
| 34 | conf.cc do |cc|
|
---|
| 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 = "%{flags} -o %{outfile} -c %{infile}"
|
---|
| 43 |
|
---|
| 44 | #configuration for low memory environment
|
---|
| 45 | cc.defines << %w(MRB_HEAP_PAGE_SIZE=64)
|
---|
| 46 | cc.defines << %w(MRB_USE_IV_SEGLIST)
|
---|
| 47 | cc.defines << %w(KHASH_DEFAULT_SIZE=8)
|
---|
| 48 | cc.defines << %w(MRB_STR_BUF_MIN_SIZE=20)
|
---|
| 49 | cc.defines << %w(MRB_GC_STRESS)
|
---|
| 50 | #cc.defines << %w(MRB_DISABLE_STDIO) #if you dont need stdio.
|
---|
| 51 | #cc.defines << %w(POOL_PAGE_SIZE=1000) #effective only for use with mruby-eval
|
---|
| 52 | end
|
---|
| 53 |
|
---|
| 54 | conf.cxx do |cxx|
|
---|
| 55 | cxx.command = conf.cc.command.dup
|
---|
| 56 | cxx.include_paths = conf.cc.include_paths.dup
|
---|
| 57 | cxx.flags = conf.cc.flags.dup
|
---|
| 58 | cxx.defines = conf.cc.defines.dup
|
---|
| 59 | cxx.compile_options = conf.cc.compile_options.dup
|
---|
| 60 | end
|
---|
| 61 |
|
---|
| 62 | conf.archiver do |archiver|
|
---|
| 63 | archiver.command = "#{PIC32_PATH}/compiler/pic32-tools/bin/pic32-ar"
|
---|
| 64 | archiver.archive_options = 'rcs %{outfile} %{objs}'
|
---|
| 65 | end
|
---|
| 66 |
|
---|
| 67 | #no executables
|
---|
| 68 | conf.bins = []
|
---|
| 69 |
|
---|
| 70 | #do not build test executable
|
---|
| 71 | conf.build_mrbtest_lib_only
|
---|
| 72 |
|
---|
| 73 | #disable C++ exception
|
---|
| 74 | conf.disable_cxx_exception
|
---|
| 75 |
|
---|
| 76 | #gems from core
|
---|
| 77 | conf.gem :core => "mruby-print"
|
---|
| 78 | conf.gem :core => "mruby-math"
|
---|
| 79 | conf.gem :core => "mruby-enum-ext"
|
---|
| 80 |
|
---|
| 81 | #light-weight regular expression
|
---|
| 82 | conf.gem :github => "masamitsu-murase/mruby-hs-regexp", :branch => "master"
|
---|
| 83 |
|
---|
| 84 | #Arduino API
|
---|
| 85 | #conf.gem :github =>"kyab/mruby-arduino", :branch => "master"
|
---|
| 86 |
|
---|
| 87 | end
|
---|