From c1af5b5de8c5fe2d9766af50677c640402d4efef Mon Sep 17 00:00:00 2001 From: Gediminas Jakutis Date: Mon, 27 May 2019 13:25:35 +0300 Subject: build system: device building improvements. No longer depends on having the adhoc "espmake" in $PATH. This change now requires a few more explicit meson configuration options to build the firmware. Signed-off-by: Gediminas Jakutis --- meson_options.txt | 3 +++ src/device/meson.build | 27 ++++++++++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/meson_options.txt b/meson_options.txt index 3181893..e4ac698 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -4,3 +4,6 @@ option('fwflash', type : 'boolean', value : false, description : 'Automatically option('ssid', type : 'string', value : 'ssid', description : 'wireless ssid to compile into the firmware (no effect without fwbuild') option('password', type : 'string', value : 'password', description : 'wireless password to compile into the firmware (no effect without fwbuild') option('oledlib', type : 'string', description : 'path containing the SSD1306Spi.h file (required if fwbuild is true') +option('makeesparduino', type : 'string', description : 'path to the directory containing the makeEspArduino.mk file (required if fwbuild is true') +option('esplib', type : 'string', description : 'path to the esp8266lib (required if fwbuild is true') +option('board', type : 'string', value : 'd1_mini', description : 'board name identifier to provide to makeEspArduino') diff --git a/src/device/meson.build b/src/device/meson.build index d2e3c6e..10723b0 100644 --- a/src/device/meson.build +++ b/src/device/meson.build @@ -5,17 +5,32 @@ if get_option('fwbuild') libpath = get_option('oledlib') assert((libpath != ''), 'path to oled lib is empty') + mkesppath = get_option('makeesparduino') + assert((mkesppath != ''), 'path to directory with makeEspArduino.mk is empty') + + esplib = get_option('esplib') + assert((esplib != ''), 'path esplib is empty') + + board = get_option('board') + oledlib = [] foreach i : oledlibnames oledlib += files(libpath + '/' + i) endforeach + mkespard = files(mkesppath + '/makeEspArduino.mk') + assert((oledlib != []), 'oled lib not found in the supplied lib directory') espmake = find_program('espmake') printf = find_program('printf') cat = find_program('cat') cp = find_program('cp') + make = find_program('make') + nproc = find_program('nproc') + + nproc_out = run_command(nproc) + cpus = nproc_out.stdout().strip() fw_filenames = ['main.ino', 'DejaVu_Sans_Mono_13.h', @@ -51,7 +66,17 @@ if get_option('fwbuild') fw = custom_target('fw', output : fw_image, input : [fw_sources, fw_conf], - command : [espmake, '-C', builddir, '&&', cp, '/tmp/mkESP/main_d1_mini/main.bin', '@OUTDIR@/' + fw_image], + command : [make, + '-f', + mkespard, + 'ESP_ROOT=' + esplib, + 'BOARD=' + board, '-j' + cpus, + '-C', + builddir, + '&&', + cp, + '/tmp/mkESP/main_d1_mini/main.bin', + '@OUTDIR@/' + fw_image], install : true, install_dir : resource_dir) -- cgit v1.2.3