Пример #1
0
def build_library(src_paths, build_path, target, toolchain_name,
         dependencies_paths=None, options=None, name=None, clean=False,
         notify=None, verbose=False):
    if type(src_paths) != ListType: src_paths = [src_paths]
    
    for src_path in src_paths:
        if not exists(src_path):
            raise Exception("The library source folder does not exist: %s", src_path)
    
    # Toolchain instance
    toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options, notify)
    toolchain.VERBOSE = verbose
    toolchain.build_all = clean
    
    # The first path will give the name to the library
    name = basename(src_paths[0])
    toolchain.info("\n>>> BUILD LIBRARY %s (%s, %s)" % (name.upper(), target.name, toolchain_name))
    
    # Scan Resources
    resources = []
    for src_path in src_paths:
        resources.append(toolchain.scan_resources(src_path))
    
    # Dependencies Include Paths
    dependencies = Resources()
    if dependencies_paths is not None:
        for path in dependencies_paths:
            dependencies.add(toolchain.scan_resources(path))
    
    # Create the desired build directory structure
    bin_path = join(build_path, toolchain.obj_path)
    mkdir(bin_path)
    tmp_path = join(build_path, '.temp', toolchain.obj_path)
    mkdir(tmp_path)
    
    # Copy Headers
    for resource in resources:
        toolchain.copy_files(resource.headers, build_path, rel_path=resource.base_path)
    
    # Compile Sources
    objects = []
    for resource in resources:
        objects.extend(toolchain.compile_sources(resource, tmp_path, dependencies.inc_dirs))
    
    toolchain.build_library(objects, bin_path, name)
Пример #2
0
 # Library name can be set by: function parameter, option file, or directory name (in that order)
 if name is None:
     if 'lib_name' in options:
         name = options['lib_name']
     else:
         name = basename(main_src)
 
 toolchain.info("\n>>> BUILD LIBRARY %s (%s, %s)" % (name.upper(), target, toolchain_name))
 
 # Scan Resources
 resources = []
 for src_path in src_paths:
     resources.append(toolchain.scan_resources(src_path))
 
 # Just for the include paths
 lib_resources = Resources()
 if libraries_paths is not None:
     for path in libraries_paths:
         lib_resources.add(toolchain.scan_resources(path))
 
 # Create the desired build directory structure
 bin_path = join(build_path, toolchain.obj_path)
 mkdir(bin_path)
 
 tmp_path = join(build_path, '.temp', toolchain.obj_path)
 mkdir(tmp_path)
 
 # Copy Files
 for resource in resources:
     files_to_be_copied = resource.headers
     if resource.linker_script is not None:
Пример #3
0
    if name is None:
        if 'lib_name' in options:
            name = options['lib_name']
        else:
            name = basename(main_src)

    toolchain.info("\n>>> BUILD LIBRARY %s (%s, %s)" %
                   (name.upper(), target.name, toolchain_name))

    # Scan Resources
    resources = []
    for src_path in src_paths:
        resources.append(toolchain.scan_resources(src_path))

    # Just for the include paths
    lib_resources = Resources()
    if libraries_paths is not None:
        for path in libraries_paths:
            lib_resources.add(toolchain.scan_resources(path))

    # Create the desired build directory structure
    bin_path = join(build_path, toolchain.obj_path)
    mkdir(bin_path)

    tmp_path = join(build_path, '.temp', toolchain.obj_path)
    mkdir(tmp_path)

    # Copy Files
    for resource in resources:
        files_to_be_copied = resource.headers
        if resource.linker_script is not None: