Пример #1
0
def get_compile_command(source_path):
    """ Return a compiler command string """
    cmd_args = [COMPILER]
    cmd_args += ['-D'+d for d in COMPILER_DEFINITIONS]
    cmd_args += ['-I'+i for i in COMPILER_INCLUDE_DIRS]
    cmd_args += COMPILER_FLAGS + ['-c']
    cmd_args += ['-o', utilities.source_to_obj(source_path, OBJ_DIR)]
    cmd_args += [source_path]
    return arg_list_to_command_string(cmd_args)
def get_compile_tasks():
    tasks = [get_build_dir_task()]

    for source in SOURCES:
        target = utilities.source_to_obj(source, OBJ_DIR)
        dependencies = [BUILD_DIR_DUMMY] + [source] + HEADERS
        tasks.append({
            'name': source.replace('.c', '.o'),
            'actions': [get_compile_command(source)],
            'targets': [target],
            'file_dep': dependencies,
            'clean': True
        })
    return tasks
Пример #3
0
def get_compile_tasks():
    tasks = [get_build_dir_task()]

    for source in SOURCES:
        obj = utilities.source_to_obj(source, OBJ_DIR)
        dep = utilities.source_to_dep(source, OBJ_DIR)
        dependencies = [BUILD_DIR_DUMMY]
        depfile_deps = utilities.get_obj_dependencies(obj)
        if depfile_deps is None:
            dependencies += [source] + HEADERS
        else:
            dependencies += depfile_deps
        tasks.append({
            'name': source.replace('.c', '.o'),
            'actions': [get_compile_command(source)],
            'targets': [obj, dep],
            'file_dep': dependencies,
            'clean': True
        })
    return tasks
Пример #4
0
    build_globals.from_proj_root('my_static_lib'),
    build_globals.from_proj_root('test_harness', 'Unity')
]

LINKER = 'gcc'

SOURCE_DIRS = ['src', 'tests', 'test_harness', 'my_static_lib']

SOURCES = utilities.find_files(SOURCE_DIRS, extensions=['.c'])

HEADERS = utilities.find_files(SOURCE_DIRS, extensions=['.h'])

# manually add auto-generated sources as they can't be found before building
SOURCES += [build_globals.UNIT_TEST_RUNNER_SOURCE]

OBJECTS = [utilities.source_to_obj(source, OBJ_DIR) for source in SOURCES]

EXE_TARGET_NAME = build_globals.get_exe_target_name(NAME, 'exe')

EXE_TARGET = os.path.join(BUILD_DIR, EXE_TARGET_NAME)


#-----------------------------------------------------------
# Functions


def arg_list_to_command_string(arg_list):
    return ''.join([arg+' ' for arg in arg_list])


def get_compile_command(source_path):