from building import *from SCons.Script import AddOption, GetOptionimport oscwd = GetCurrentDir()src = []group = []def merge_sketch_file_as_cpp(sketch_path, sketch_cpp_filename):sketch_cpp_f = open(os.path.join(cwd, sketch_cpp_filename), 'w+')sketch_cpp_f.writelines(['#include <RTduino.h>\n', \'#define setup sketch_setup\n', \'#define loop sketch_loop\n', \'#include <{}>\n'.format(sketch_path), \'RTDUINO_SKETCH_LOADER("sketch", sketch_setup, sketch_loop);\n'])sketch_cpp_f.close()return sketch_cpp_filenameAddOption('--sketch',dest = 'sketch',type = 'string',default = None,help = 'set Arduino sketch path and file name')sketch_path = GetOption('sketch')if sketch_path == None:Return('group')if os.path.exists(sketch_path) == False or os.path.isfile(sketch_path) == False:print('[RTduino] Cannot find the sketch file. Please confirm the ino path and file name is correct!')Return('group')src += [merge_sketch_file_as_cpp(sketch_path, 'sketch.cpp')] # generate a sketch.cpp to include the ino filegroup = DefineGroup('RTduino-sketches', src, depend = ['PKG_USING_RTDUINO'])Return('group')
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
1. 开源生态
2. 协作、人、软件
3. 评估模型