11require "fileutils"
22
3- MRUBY_CONFIG = "prk_firmware-cortex-m0plus"
3+ ENV [ ' MRUBY_CONFIG' ] = "prk_firmware-cortex-m0plus"
44PICO_SDK_TAG = "1.5.0"
55
6- task :default => :all
6+ task :default => :production
77
88task :setup do
99 sh "bundle install"
@@ -13,40 +13,53 @@ task :setup do
1313 end
1414end
1515
16- desc "build production"
17- task :all => [ :libmruby , :test , :cmake_production , :build ]
16+ task :all => [ :libmruby , :test , :cmake , :build ]
17+
1818
1919desc "build debug (you may need to rake clean before this)"
20- task :debug => [ :libmruby , :test , :cmake_debug , :build ]
20+ task :debug do
21+ ENV [ 'PICORUBY_DEBUG' ] = '1'
22+ ENV [ '-DCMAKE_BUILD_TYPE' ] = 'Debug'
23+ Rake ::Task [ :all ] . invoke
24+ end
2125
22- file "lib/picoruby" do
23- sh "git submodule update --init --recursive"
26+ desc "build production"
27+ task :production do
28+ Rake ::Task [ :all ] . invoke
2429end
2530
26- task :libmruby_no_msc => "lib/picoruby" do
27- FileUtils . cd "lib/picoruby" do
28- sh "rake test"
29- sh "CFLAGS='-DPICORUBY_NO_MSC=1' MRUBY_CONFIG= #{ MRUBY_CONFIG } rake"
31+ desc "build PRK Firmware inclusive of keymap.rb (without mass storage)"
32+ task :build_with_keymap , [ 'keyboard_name' ] do | _t , args |
33+ unless args . keyboard_name
34+ raise "Argument `keyboard_name` missing. \n Usage: rake build_with_keymap[prk_meishi2] "
3035 end
36+ dir = "keyboards/#{ args . keyboard_name } "
37+ FileUtils . mkdir_p "#{ dir } /build"
38+ ENV [ 'PICORUBY_NO_MSC' ] = '1'
39+ ENV [ 'PRK_BUILD_DIR' ] = "#{ dir } /"
40+ Rake ::Task [ :all ] . invoke
3141end
3242
33- task :libmruby => "lib/picoruby" do
34- FileUtils . cd "lib/picoruby" do
35- sh "rake test"
36- sh "MRUBY_CONFIG= #{ MRUBY_CONFIG } rake"
37- end
43+ desc "build production with SQLite3 and SD card"
44+ task :sqlite3 do
45+ ENV [ 'PICORUBY_SQLITE3' ] = '1'
46+ ENV [ 'PICORUBY_SD_CARD' ] = '1'
47+ Rake :: Task [ :all ] . invoke
3848end
3949
40- def mruby_config
41- "MRUBY_CONFIG= #{ MRUBY_CONFIG } "
50+ file "lib/picoruby" do
51+ sh "git submodule update --init --recursive "
4252end
4353
44- task :cmake_debug do
45- sh "#{ mruby_config } cmake -DCMAKE_BUILD_TYPE=Debug -B build"
54+ task :libmruby => "lib/picoruby" do
55+ FileUtils . cd "lib/picoruby" do
56+ sh "rake test"
57+ sh "rake"
58+ end
4659end
4760
48- task :cmake_production do
49- sh "#{ mruby_config } cmake -B build"
61+ task :cmake do
62+ sh "cmake -B #{ ENV [ 'PRK_BUILD_DIR' ] } build"
5063end
5164
5265task :check_pico_sdk => :check_pico_sdk_path do
7184
7285desc "build without cmake preparation"
7386task :build => :check_pico_sdk do
74- sh "cmake --build build"
75- end
76-
77- desc "build PRK Firmware inclusive of keymap.rb (without mass storage)"
78- task :build_with_keymap , [ 'keyboard_name' ] => [ :libmruby_no_msc , :test ] do |_t , args |
79- unless args . keyboard_name
80- raise "Argument `keyboard_name` missing.\n Usage: rake build_with_keymap[prk_meishi2]"
81- end
82- dir = "keyboards/#{ args . keyboard_name } "
83- FileUtils . mkdir_p "#{ dir } /build"
84- #sh "cmake -DPICORUBY_NO_MSC=1 -DCMAKE_BUILD_TYPE=Debug -B #{dir}/build"
85- sh "#{ mruby_config } cmake -DPICORUBY_NO_MSC=1 -B #{ dir } /build"
86- sh "cmake --build #{ dir } /build"
87+ sh "cmake --build #{ ENV [ 'PRK_BUILD_DIR' ] } build"
8788end
8889
8990desc "clean built that includes keymap"
119120desc "clean built"
120121task :clean do
121122 FileUtils . cd "lib/picoruby" do
122- sh "MRUBY_CONFIG= #{ MRUBY_CONFIG } rake clean"
123+ sh "rake clean"
123124 end
124125 FileUtils . cd "build" do
125126 FileUtils . rm_rf Dir . glob ( "prk_firmware-*.*" )
134135desc "deep clean built"
135136task :deep_clean do
136137 FileUtils . cd "lib/picoruby" do
137- sh "MRUBY_CONFIG= #{ MRUBY_CONFIG } rake deep_clean"
138+ sh "rake deep_clean"
138139 end
139140 FileUtils . cd "build" do
140141 FileUtils . rm_rf Dir . glob ( "*" )
0 commit comments