Exemplo n.º 1
0
def get_pyext_environment(env, mod_prefix, cplusplus=True,
                          extra_modules=[]):
    """Get a modified environment for building a Python extension.
       `mod_prefix` should be a unique prefix for this module.
       If `cplusplus` is True, additional configuration suitable for a C++
       extension is done."""
    #print env['CXXFLAGS'], env['CPPPATH']
    e = bug_fixes.clone_env(env)

    e['LDMODULEPREFIX'] = ''
    # We're not going to link against the extension, so don't need a Windows
    # import library (.lib file):
    e['no_import_lib'] = 1
    platform = e['PLATFORM']
    if e['wine']:
        # Directory containing python26.lib:
        e.Append(LIBPATH=['/usr/lib/w32comp/w32python/2.6/lib/'])
        e['SHLIBSUFFIX']=e['IMP_PYTHON_SO']
        # Have to set SHLIBSUFFIX and PREFIX on Windows otherwise the
        # mslink tool complains
        e['SHLIBPREFIX'] = ''
    e.Replace(LDMODULEFLAGS=env['IMP_PYTHON_LINKFLAGS'])
    e['LDMODULESUFFIX'] =e['IMP_PYTHON_SO']
    #print e['LDMODULEFLAGS']
    e.Replace(CXXFLAGS=e['IMP_PYTHON_CXXFLAGS'])
    #e['CXXFLAGS']=cxxs
    e.Append(CPPDEFINES=['IMP_SWIG_WRAPPER'])
    utility.add_to_include_path(e, _get_python_include(e))
    _fix_aix_cpp_link(e, cplusplus, 'LDMODULEFLAGS')
    #print env['LDMODULEFLAGS']
    _add_flags(e, extra_modules=extra_modules)
    if dependency.clang.get_is_clang(env):
        # clang notices that python tuples are implemented using the array/struct hack
        e.Append(CXXFLAGS='-Wno-array-bounds')
    return e
Exemplo n.º 2
0
def get_bin_environment(envi, extra_modules=[], extra_dependencies=[]):
    env= bug_fixes.clone_env(envi)
    env.Replace(LINKFLAGS=env['IMP_BIN_LINKFLAGS'])
    if env.get('IMP_BIN_CXXFLAGS', None):
        env.Replace(CXXFLAGS=env['IMP_BIN_CXXFLAGS'])
    _add_flags(env, extra_modules=extra_modules,
               extra_dependencies=extra_dependencies)
    return env
Exemplo n.º 3
0
def get_test_environment(envi):
    env= bug_fixes.clone_env(envi)
    env.Replace(LINKFLAGS=env['IMP_BIN_LINKFLAGS'])
    env.Replace(LIBS=utility.get_env_paths(envi, 'libs'))
    if env['IMP_USE_RPATH']:
        dylinkflags=[]
        for p in env['LIBPATH']:
            if p[0] != '#':
                env.Prepend(RPATH=[p])
    env['IMP_OUTER_ENVIRONMENT']= envi
    return env
Exemplo n.º 4
0
def get_staticlib_environment(env):
    """Get a modified environment suitable for building shared libraries
       (i.e. using gcc ELF visibility macros or MSVC dllexport/dllimport macros
       to mark dynamic symbols as exported or private). `cppdefine` should be
       the name of a cpp symbol to define to tell MSVC that we are building the
       library (by convention something of the form FOO_EXPORTS).
       If `cplusplus` is True, additional configuration suitable for a C++
       shared library is done."""
    e = bug_fixes.clone_env(env)
    e.Replace(LIBLINKFLAGS=env['IMP_ARLIB_LINKFLAGS'])
    _add_flags(e)
    _fix_aix_cpp_link(e, True, 'LINKFLAGS')
    return e
Exemplo n.º 5
0
def get_sharedlib_environment(env, cppdefine, cplusplus=False,
                              extra_modules=[]):
    """Get a modified environment suitable for building shared libraries
       (i.e. using gcc ELF visibility macros or MSVC dllexport/dllimport macros
       to mark dynamic symbols as exported or private). `cppdefine` should be
       the name of a cpp symbol to define to tell MSVC that we are building the
       library (by convention something of the form FOO_EXPORTS).
       If `cplusplus` is True, additional configuration suitable for a C++
       shared library is done."""
    e = bug_fixes.clone_env(env)
    e.Append(CPPDEFINES=[cppdefine, '${VIS_CPPDEFINES}'],
             CXXFLAGS='${VIS_CXXFLAGS}')
    e.Replace(SHLINKFLAGS=env['IMP_SHLIB_LINKFLAGS'])
    _fix_aix_cpp_link(e, cplusplus, 'SHLINKFLAGS')
    _add_flags(e, extra_modules=extra_modules)
    return e
Exemplo n.º 6
0
def add_doc_page(env, type,
                 authors,
                 version,
                 brief, overview,
                 publications,
                 license,
                 extra_sections=[]):
    env=bug_fixes.clone_env(env)
    if extra_sections!=[]:
        extras=".\n\n".join(["<b>"+ s[0] +":</b> "+s[1] for s in extra_sections])
    else:
        extras=""
    pg=_MakeModPage(source=[env.Value(type),
                            env.Value(authors),
                            env.Value(version),
                            env.Value(brief),
                            env.Value(overview),
                            env.Value(publications),
                            env.Value(license),
                            env.Value(extras)],
                    target='generated/overview.dox', env=env)
    return pg
Exemplo n.º 7
0
def get_named_environment(env, name, modules, dependencies):
    e = bug_fixes.clone_env(env)
    e['IMP_CURRENT_NAME']=name
    e['IMP_CURRENT_DEPENDENCIES']=dependencies
    e['IMP_CURRENT_MODULES']=modules
    return e