[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 |
|
---|
| 18 | # Cross Compiling configuration for Intel Galileo on Arduino environment
|
---|
| 19 | # http://arduino.cc/en/ArduinoCertified/IntelGalileo
|
---|
| 20 | #
|
---|
| 21 | # Requires Arduino IDE for Intel Galileo
|
---|
| 22 | MRuby::CrossBuild.new("Galileo") do |conf|
|
---|
| 23 | toolchain :gcc
|
---|
| 24 |
|
---|
| 25 | # Mac OS X
|
---|
| 26 | # Assume you renamed Arduino.app to Arduino_Galileo.app
|
---|
| 27 | GALILEO_ARDUINO_PATH = '/Applications/Arduino_Galileo.app/Contents/Resources/Java'
|
---|
| 28 | # GNU Linux
|
---|
| 29 | #ARDUINO_GALILEO_PATH = '/opt/arduino'
|
---|
| 30 |
|
---|
| 31 | GALILEO_BIN_PATH = "#{GALILEO_ARDUINO_PATH}/hardware/tools/x86/i386-pokysdk-darwin/usr/bin/i586-poky-linux-uclibc"
|
---|
| 32 | GALILEO_SYSROOT = "#{GALILEO_ARDUINO_PATH}/hardware/tools/x86/i586-poky-linux-uclibc"
|
---|
| 33 | GALILEO_X86_PATH = "#{GALILEO_ARDUINO_PATH}/hardware/arduino/x86"
|
---|
| 34 |
|
---|
| 35 |
|
---|
| 36 | conf.cc do |cc|
|
---|
| 37 | cc.command = "#{GALILEO_BIN_PATH}/i586-poky-linux-uclibc-gcc"
|
---|
| 38 | cc.include_paths << ["#{GALILEO_X86_PATH}/cores/arduino", "#{GALILEO_X86_PATH}/variants/galileo_fab_d"]
|
---|
| 39 | cc.flags = %w(-m32 -march=i586 -c -g -Os -w
|
---|
| 40 | -ffunction-sections -fdata-sections -MMD -DARDUINO=153)
|
---|
| 41 | cc.flags << "--sysroot=#{GALILEO_SYSROOT}"
|
---|
| 42 | cc.compile_options = "%{flags} -o %{outfile} -c %{infile}"
|
---|
| 43 | end
|
---|
| 44 |
|
---|
| 45 | conf.cxx do |cxx|
|
---|
| 46 | cxx.command = "#{GALILEO_BIN_PATH}/i586-poky-linux-uclibc-g++"
|
---|
| 47 | cxx.include_paths = conf.cc.include_paths.dup
|
---|
| 48 | cxx.include_paths << "#{GALILEO_ARDUINO_PATH}/hardware/tools/x86/i586-poky-linux-uclibc/usr/include/c++"
|
---|
| 49 | cxx.include_paths << "#{GALILEO_ARDUINO_PATH}/hardware/tools/x86/i586-poky-linux-uclibc/usr/include/c++/i586-poky-linux-uclibc"
|
---|
| 50 | cxx.flags = conf.cc.flags.dup
|
---|
| 51 | cxx.defines = conf.cc.defines.dup
|
---|
| 52 | cxx.compile_options = conf.cc.compile_options.dup
|
---|
| 53 | end
|
---|
| 54 |
|
---|
| 55 | conf.archiver do |archiver|
|
---|
| 56 | archiver.command = "#{GALILEO_BIN_PATH}/i586-poky-linux-uclibc-ar"
|
---|
| 57 | archiver.archive_options = 'rcs %{outfile} %{objs}'
|
---|
| 58 | end
|
---|
| 59 |
|
---|
| 60 | conf.linker do |linker|
|
---|
| 61 | linker.command = "#{GALILEO_BIN_PATH}/i586-poky-linux-uclibc-g++"
|
---|
| 62 | linker.flags = %w(-m32 -march=i586)
|
---|
| 63 | linker.flags << "--sysroot=#{GALILEO_SYSROOT}"
|
---|
| 64 | linker.flags << %w(-Os -Wl,--gc-sections)
|
---|
| 65 | linker.libraries = %w(m pthread)
|
---|
| 66 | end
|
---|
| 67 |
|
---|
| 68 | #no executables
|
---|
| 69 | conf.bins = []
|
---|
| 70 |
|
---|
| 71 | #do not build executable test
|
---|
| 72 | conf.build_mrbtest_lib_only
|
---|
| 73 |
|
---|
| 74 | #official mrbgems
|
---|
| 75 | conf.gem :core => "mruby-sprintf"
|
---|
| 76 | conf.gem :core => "mruby-print"
|
---|
| 77 | conf.gem :core => "mruby-math"
|
---|
| 78 | conf.gem :core => "mruby-time"
|
---|
| 79 | conf.gem :core => "mruby-struct"
|
---|
| 80 | conf.gem :core => "mruby-enum-ext"
|
---|
| 81 | conf.gem :core => "mruby-string-ext"
|
---|
| 82 | conf.gem :core => "mruby-numeric-ext"
|
---|
| 83 | conf.gem :core => "mruby-array-ext"
|
---|
| 84 | conf.gem :core => "mruby-hash-ext"
|
---|
| 85 | conf.gem :core => "mruby-range-ext"
|
---|
| 86 | conf.gem :core => "mruby-proc-ext"
|
---|
| 87 | conf.gem :core => "mruby-symbol-ext"
|
---|
| 88 | conf.gem :core => "mruby-random"
|
---|
| 89 | conf.gem :core => "mruby-object-ext"
|
---|
| 90 | conf.gem :core => "mruby-objectspace"
|
---|
| 91 | conf.gem :core => "mruby-fiber"
|
---|
| 92 | conf.gem :core => "mruby-toplevel-ext"
|
---|
| 93 |
|
---|
| 94 | #lightweigh regular expression
|
---|
| 95 | conf.gem :github => "masamitsu-murase/mruby-hs-regexp", :branch => "master"
|
---|
| 96 |
|
---|
| 97 | #Arduino API
|
---|
| 98 | #conf.gem :github =>"kyab/mruby-arduino", :branch => "master" do |g|
|
---|
| 99 | # g.cxx.include_paths << "#{GALILEO_X86_PATH}/libraries/Wire"
|
---|
| 100 | # g.cxx.include_paths << "#{GALILEO_X86_PATH}/libraries/Servo"
|
---|
| 101 |
|
---|
| 102 | #enable unsupported Servo class
|
---|
| 103 | # g.cxx.defines << "MRUBY_ARDUINO_GALILEO_ENABLE_SERVO"
|
---|
| 104 | #end
|
---|
| 105 |
|
---|
| 106 | end
|
---|