def __init__(self): self.c_sources = [] self.cpp_sources = [] for path in SOURCE_DIRS: self.c_sources += file_utils.find(path, '*.c') self.cpp_sources += file_utils.find(path, ['*.cpp', '*.ino']) self.objs = [self.get_obj_path(x) for x in self.c_sources + self.cpp_sources] self.objs += [ARDUINO_ENV.core_lib_output_path] self.deps = gcc_utils.get_dependency_dict(BUILD_DIR)
COMPILER_INCLUDE_DIRS = [ _globals.from_proj_root('include'), _globals.from_proj_root('test', 'unit_test_harness', 'Unity') ] LINKER = 'gcc' SOURCE_DIRS = [ _globals.from_proj_root('source'), _globals.from_proj_root('test', 'unit_test_harness', 'Unity'), _globals.from_proj_root('test', 'unit_tests') ] SOURCES = [] for sdir in SOURCE_DIRS: SOURCES += file_utils.find(sdir, '*.c') # Add generated source manually SOURCES += [UNIT_TEST_RUNNER_SOURCE] OBJECTS = [_globals.source_to_obj_path(source, OBJ_DIR) for source in SOURCES] DEPS = gcc_utils.get_dependency_dict(OBJ_DIR) EXE_TARGET_NAME = _globals.get_exe_target_name(NAME, 'exe') EXE_TARGET = os.path.join(BUILD_DIR, EXE_TARGET_NAME) #----------------------------------------------------------- # Doit task generators
import sys sys.path.append('../..') from doit_helpers import file_utils from doit_helpers import gcc_utils DOIT_CONFIG = {'default_tasks': ['run_exe']} BUILD_DIR = 'build' SOURCES = file_utils.find('src', ['*.c']) TARGET = 'example.exe' gcc_env = gcc_utils.GccEnv(BUILD_DIR) gcc_env.variables['c preprocessor defs'].append('THINGO_VAL=4') gcc_env.variables['c source files'] = SOURCES def task_build(): tasks = gcc_env.get_c_compile_tasks() tasks += gcc_env.get_link_exe_tasks(TARGET) for task in tasks: yield task def task_run_exe(): return { 'actions': [TARGET], 'targets': ['run exe'], 'file_dep': [TARGET], 'verbosity': 2