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 = %Q[%{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(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
|
---|
51 | end
|
---|
52 |
|
---|
53 | conf.cxx do |cxx|
|
---|
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
|
---|
59 | end
|
---|
60 |
|
---|
61 | conf.archiver do |archiver|
|
---|
62 | archiver.command = "#{PIC32_PATH}/compiler/pic32-tools/bin/pic32-ar"
|
---|
63 | archiver.archive_options = 'rcs "%{outfile}" %{objs}'
|
---|
64 | end
|
---|
65 |
|
---|
66 | #no executables
|
---|
67 | conf.bins = []
|
---|
68 |
|
---|
69 | #do not build test executable
|
---|
70 | conf.build_mrbtest_lib_only
|
---|
71 |
|
---|
72 | #disable C++ exception
|
---|
73 | conf.disable_cxx_exception
|
---|
74 |
|
---|
75 | #gems from core
|
---|
76 | conf.gem :core => "mruby-print"
|
---|
77 | conf.gem :core => "mruby-math"
|
---|
78 | conf.gem :core => "mruby-enum-ext"
|
---|
79 |
|
---|
80 | #light-weight regular expression
|
---|
81 | conf.gem :github => "masamitsu-murase/mruby-hs-regexp", :branch => "master"
|
---|
82 |
|
---|
83 | #Arduino API
|
---|
84 | #conf.gem :github =>"kyab/mruby-arduino", :branch => "master"
|
---|
85 |
|
---|
86 | end
|
---|