def initialize_cxx(env):
    """Initialize C++ compiler from distutils info."""
    from SCons.Tool import FindTool

    def set_cxx_from_distutils():
        if len(env['cxx_opt']) > 0:
            if len(env['cxx_opt_path']) > 0:
                cxx = pjoin(env['cxx_opt_path'], env['cxx_opt'])
            else:
                cxx = env['cxx_opt']

            if built_with_mstools(env):
                name = "msvc"
                env.Tool(name)
            else:
                name = get_cxx_type(env, cxx)
            info("Detected CXX type: %s" % name)
            env.Tool(name)
        else:
            name = FindTool(DEF_CXX_COMPILERS, env)
            info("Detected CXX type: %s" % name)
            if name:
                env.Tool(name)
        return name

    if is_bypassed(env):
        # Here, the --compiler option is the scons tool name
        debug('Setting cxx_opt from scons.')
        name = env['cxx_opt']
        # Do not initialize twice the same tool
        if not name == env['cc_opt']:
            env.Tool(name)
    else:
        name = set_cxx_from_distutils()

    if name:
        warn("Setting for CXX tool: %s" % name)
        configure_compiler(name, env, "CXX")
        env['CXXFILESUFFIX'] = '.cxx'
    else:
        warn("Found no CXX tool: %s")
        # Some scons tools initialize CXX env var even if no CXX available.
        # This is just confusing, so remove the key here since we could not
        # initialize any CXX tool.
        if env.has_key('CXX'):
            del env['CXX']
Exemple #2
0
def initialize_cxx(env):
    """Initialize C++ compiler from distutils info."""
    from SCons.Tool import FindTool
    def set_cxx_from_distutils():
        if len(env['cxx_opt']) > 0:
            if len(env['cxx_opt_path']) > 0:
                cxx = pjoin(env['cxx_opt_path'], env['cxx_opt'])
            else:
                cxx = env['cxx_opt']

            if built_with_mstools(env):
                name = "msvc"
                env.Tool(name)
            else:
                name = get_cxx_type(env, cxx)
            info("Detected CXX type: %s" % name)
            env.Tool(name)
        else:
            name =  FindTool(DEF_CXX_COMPILERS, env)
            info("Detected CXX type: %s" % name)
            if name:
                env.Tool(name)
        return name

    if is_bypassed(env):
        # Here, the --compiler option is the scons tool name
        debug('Setting cxx_opt from scons.')
        name = env['cxx_opt']
        # Do not initialize twice the same tool
        if not name == env['cc_opt']:
            env.Tool(name)
    else:
        name = set_cxx_from_distutils()

    if name:
        warn("Setting for CXX tool: %s" % name)
        configure_compiler(name, env, "CXX")
        env['CXXFILESUFFIX'] = '.cxx'
    else:
        warn("Found no CXX tool: %s")
        # Some scons tools initialize CXX env var even if no CXX available.
        # This is just confusing, so remove the key here since we could not
        # initialize any CXX tool.
        if env.has_key('CXX'):
            del env['CXX']
Exemple #3
0
    def set_cc_from_distutils():
        if len(env['cc_opt_path']) > 0:
            debug('Setting cc_opt_path from distutils (%s).' % env['cc_opt_path'])
            cc = pjoin(env["cc_opt_path"], env["cc_opt"])
        else:
            debug('Setting wo cc_opt_path')
            cc = env["cc_opt"]

        if built_with_mstools(env):
            info('Detecting ms build.')
            name = "msvc"
            # We need msvs tool too (before customization !)
            env.Tool('msvs')
        else:
            name = get_cc_type(env, cc)
            if name == 'gcc' and sys.platform == 'win32':
                name = 'mingw'
                debug('Changing cc => mingw')

            info('Detected CC type: %s' % name)
            try:
                env.Tool(name)
                env['CC'] = env['cc_opt']
            except ImportError:
                raise UnknownCompiler(env['cc_opt'])

        return name
    def set_cc_from_distutils():
        if len(env['cc_opt_path']) > 0:
            debug('Setting cc_opt_path from distutils (%s).' %
                  env['cc_opt_path'])
            cc = pjoin(env["cc_opt_path"], env["cc_opt"])
        else:
            debug('Setting wo cc_opt_path')
            cc = env["cc_opt"]

        if built_with_mstools(env):
            info('Detecting ms build.')
            name = "msvc"
            # We need msvs tool too (before customization !)
            env.Tool('msvs')
        else:
            name = get_cc_type(env, cc)
            if name == 'gcc' and sys.platform == 'win32':
                name = 'mingw'
                debug('Changing cc => mingw')

            info('Detected CC type: %s' % name)
            try:
                env.Tool(name)
                env['CC'] = env['cc_opt']
            except ImportError:
                raise UnknownCompiler(env['cc_opt'])

        return name
def initialize_f77(env):
    """Initialize F77 compiler from distutils info."""
    from SCons.Tool import FindTool

    def set_f77_from_distutils():
        if len(env['f77_opt']) > 0:
            debug('Setting F77 from distutils: %s' % env['f77_opt'])
            if len(env['f77_opt_path']) > 0:
                f77 = pjoin(env['f77_opt_path'], env['f77_opt'])
            else:
                f77 = env['f77_opt']

            name = get_f77_type(env, f77)
            info('Detecting F77 type: %s' % name)
            env.Tool(name)
        else:
            debug('Setting F77 from default list')
            name = FindTool(DEF_FORTRAN_COMPILERS, env)
            debug('Found: %s' % name)
            if name:
                env.Tool(name)

        return name

    env.AppendUnique(F77FILESUFFIXES=['.f'])
    if is_bypassed(env):
        # Here, the --compiler option is the scons tool name
        debug('Setting f77_opt from scons.')
        name = env['f77_opt']
        env.Tool(name)
    else:
        name = set_f77_from_distutils()
    if name:
        warn("Setting for F77 tool: %s" % name)
        configure_compiler(name, env, "F77")
    else:
        warn("Found no F77 tool")
Exemple #6
0
def initialize_f77(env):
    """Initialize F77 compiler from distutils info."""
    from SCons.Tool import FindTool
    def set_f77_from_distutils():
        if len(env['f77_opt']) > 0:
            debug('Setting F77 from distutils: %s' % env['f77_opt'])
            if len(env['f77_opt_path']) > 0:
                f77 = pjoin(env['f77_opt_path'], env['f77_opt'])
            else:
                f77 = env['f77_opt']

            name = get_f77_type(env, f77)
            info('Detecting F77 type: %s' % name)
            env.Tool(name)
        else:
            debug('Setting F77 from default list')
            name =  FindTool(DEF_FORTRAN_COMPILERS, env)
            debug('Found: %s' % name)
            if name:
                env.Tool(name)

        return name

    env.AppendUnique(F77FILESUFFIXES = ['.f'])
    if is_bypassed(env):
        # Here, the --compiler option is the scons tool name
        debug('Setting f77_opt from scons.')
        name = env['f77_opt']
        env.Tool(name)
    else:
        name = set_f77_from_distutils()
    if name:
        warn("Setting for F77 tool: %s" % name)
        configure_compiler(name, env, "F77")
    else:
        warn("Found no F77 tool")
def initialize_cc(env):
    """Initialize C compiler from distutils info."""
    from SCons.Tool import FindTool

    def set_cc_from_distutils():
        if len(env['cc_opt_path']) > 0:
            debug('Setting cc_opt_path from distutils (%s).' %
                  env['cc_opt_path'])
            cc = pjoin(env["cc_opt_path"], env["cc_opt"])
        else:
            debug('Setting wo cc_opt_path')
            cc = env["cc_opt"]

        if built_with_mstools(env):
            info('Detecting ms build.')
            name = "msvc"
            # We need msvs tool too (before customization !)
            env.Tool('msvs')
        else:
            name = get_cc_type(env, cc)
            if name == 'gcc' and sys.platform == 'win32':
                name = 'mingw'
                debug('Changing cc => mingw')

            info('Detected CC type: %s' % name)
            try:
                env.Tool(name)
                env['CC'] = env['cc_opt']
            except ImportError:
                raise UnknownCompiler(env['cc_opt'])

        return name

    if is_bypassed(env):
        # Here, the --compiler option is the scons tool name
        debug('Setting cc_opt from scons.')
        name = env['cc_opt']
        if name == 'msvc':
            env.Tool('msvs')
        env.Tool(name)
    elif len(env['cc_opt']) > 0:
        debug('Setting cc_opt from distutils.')
        name = set_cc_from_distutils()
    else:
        debug('Setting cc_opt from default list.')
        name = FindTool(DEF_C_COMPILERS, env)
        env.Tool(name)

    warn('Setting for C tool: %s' % name)
    configure_compiler(name, env, "C")
Exemple #8
0
def initialize_cc(env):
    """Initialize C compiler from distutils info."""
    from SCons.Tool import FindTool

    def set_cc_from_distutils():
        if len(env['cc_opt_path']) > 0:
            debug('Setting cc_opt_path from distutils (%s).' % env['cc_opt_path'])
            cc = pjoin(env["cc_opt_path"], env["cc_opt"])
        else:
            debug('Setting wo cc_opt_path')
            cc = env["cc_opt"]

        if built_with_mstools(env):
            info('Detecting ms build.')
            name = "msvc"
            # We need msvs tool too (before customization !)
            env.Tool('msvs')
        else:
            name = get_cc_type(env, cc)
            if name == 'gcc' and sys.platform == 'win32':
                name = 'mingw'
                debug('Changing cc => mingw')

            info('Detected CC type: %s' % name)
            try:
                env.Tool(name)
                env['CC'] = env['cc_opt']
            except ImportError:
                raise UnknownCompiler(env['cc_opt'])

        return name

    if is_bypassed(env):
        # Here, the --compiler option is the scons tool name
        debug('Setting cc_opt from scons.')
        name = env['cc_opt']
        if name == 'msvc':
            env.Tool('msvs')
        env.Tool(name)
    elif len(env['cc_opt']) > 0:
        debug('Setting cc_opt from distutils.')
        name = set_cc_from_distutils()
    else:
        debug('Setting cc_opt from default list.')
        name = FindTool(DEF_C_COMPILERS, env)
        env.Tool(name)

    warn('Setting for C tool: %s' % name)
    configure_compiler(name, env, "C")
Exemple #9
0
    def set_f77_from_distutils():
        if len(env['f77_opt']) > 0:
            debug('Setting F77 from distutils: %s' % env['f77_opt'])
            if len(env['f77_opt_path']) > 0:
                f77 = pjoin(env['f77_opt_path'], env['f77_opt'])
            else:
                f77 = env['f77_opt']

            name = get_f77_type(env, f77)
            info('Detecting F77 type: %s' % name)
            env.Tool(name)
        else:
            debug('Setting F77 from default list')
            name =  FindTool(DEF_FORTRAN_COMPILERS, env)
            debug('Found: %s' % name)
            if name:
                env.Tool(name)

        return name
    def set_f77_from_distutils():
        if len(env['f77_opt']) > 0:
            debug('Setting F77 from distutils: %s' % env['f77_opt'])
            if len(env['f77_opt_path']) > 0:
                f77 = pjoin(env['f77_opt_path'], env['f77_opt'])
            else:
                f77 = env['f77_opt']

            name = get_f77_type(env, f77)
            info('Detecting F77 type: %s' % name)
            env.Tool(name)
        else:
            debug('Setting F77 from default list')
            name = FindTool(DEF_FORTRAN_COMPILERS, env)
            debug('Found: %s' % name)
            if name:
                env.Tool(name)

        return name