예제 #1
0
def write_aom_config(system, arch, variables, cache_variables):
    # read template cmake file
    variables['year'] = datetime.datetime.now().year
    cp.parse(
        variables, [],
        os.path.join(AOM_DIR, 'build', 'cmake',
                     'generate_aom_config_templates.cmake'))

    # filter variables
    cache_variables = [
        x for x in sorted(cache_variables)
        if x and not x.startswith((' ', 'CMAKE', 'AOM'))
    ]

    # inherit this from the mozilla build config
    cache_variables.remove('HAVE_PTHREAD_H')

    outdir = os.path.join('config', system, arch, 'config')
    try:
        os.makedirs(outdir)
    except OSError:
        pass

    with open(os.path.join(outdir, 'aom_config.h'), 'w') as f:
        header = variables['h_file_header_block']
        f.write(header)
        f.write('\n')
        for var in cache_variables:
            f.write('#define %s %s\n' % (var, variables[var]))
        f.write('#endif /* AOM_CONFIG_H_ */\n')

    with open(os.path.join(outdir, 'aom_config.asm'), 'w') as f:
        header = variables['asm_file_header_block']
        f.write(header)
        f.write('\n')
        for var in cache_variables:
            if var in [
                    'INCLUDE_INSTALL_DIR', 'INLINE', 'LIB_INSTALL_DIR',
                    'RESTRICT'
            ]:
                continue
            if arch == 'arm':
                f.write('.equ %s, %s\n' % (var, variables[var]))
            else:
                f.write('%s equ %s\n' % (var, variables[var]))

        if arch == 'arm':
            f.write('.section	.note.GNU-stack,"",%progbits')
예제 #2
0
    ]
    for cpu, system, arch, generate_sources in platforms:
        print('Running CMake for %s (%s)' % (cpu, system))
        variables = shared_variables.copy()
        variables['AOM_TARGET_CPU'] = cpu

        # We skip compiling test programs that detect these
        variables['HAVE_FEXCEPT'] = 1
        variables['INLINE'] = 'inline'
        if cpu == 'x86' and system == 'linux':
            variables['CONFIG_PIC'] = 1
        if system == 'win' and not arch.startswith('mingw'):
            variables['MSVC'] = 1

        cache_variables = []
        sources = cp.parse(variables, cache_variables,
                           os.path.join(AOM_DIR, 'CMakeLists.txt'))

        # Disable HAVE_UNISTD_H.
        cache_variables.remove('HAVE_UNISTD_H')

        write_aom_config(system, arch, variables, cache_variables)

        # Currently, the sources are the same for each supported cpu
        # regardless of operating system / compiler. If that changes, we'll
        # have to generate sources for each combination.
        if generate_sources:
            # Remove spurious sources and perl files
            sources = filter(lambda x: x.startswith(AOM_DIR), sources)
            sources = filter(lambda x: not x.endswith('.pl'), sources)

            # Filter out exports