Source

pygame / config / config_compiler.py

marcus 852695e 








































class CompilerDependency (object):
    """
    Generic compiler flag and dependency class.
    """
    def __init__ (self, name, cflags, lflags):
        self.name = name
        self.cflags = cflags
        self.lflags = lflags
        self.gdefines = [("HAVE_" + self.name.upper(), None)]

    def setup_module (self, module):
        if not module.canbuild:
            return

        # update compiler/linker args for the module
        module.cflags += self.cflags
        module.lflags += self.lflags
        module.globaldefines += self.gdefines 

def get_dependencies (cfg, compiler):
    dep = CompilerDependency
    deps = []
    if compiler == 'unix' or compiler == 'cygwin' or \
       compiler == 'mingw32' or compiler == 'mingw32-console':
        # TODO: check compiler version!
        if cfg.build['OPENMP']:
            deps.append (dep ('openmp', ['-fopenmp'], ['-fopenmp']))
    elif compiler == 'msvc':
        if cfg.build['OPENMP']:
            deps.append (dep ('openmp', ['/openmp'], ['/openmp']))
    elif compiler == 'icc':
        if cfg.build['OPENMP']:
            deps.append (dep ('openmp', ['-openmp'], ['-openmp']))

    for d in deps:
        print ("Adding compiler flags '%s':" % d.name)
        print ("")
        print ("\tCFlags : " + repr(d.cflags))
        print ("\tLFlags : " + repr(d.lflags))
        print ("")
        
    return deps
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.