def genpluginproject(
    architecture,
    module,
    project=None,
    projectdir=None,
    sources=[],
    sourcedirs=[],
    libraries=[],
    extradirs=[],
    extraexportsymbols=[],
    outputdir=":::Lib:lib-dynload",
    libraryflags=None,
    stdlibraryflags=None,
):
    if architecture == "all":
        # For the time being we generate two project files. Not as nice as
        # a single multitarget project, but easier to implement for now.
        genpluginproject(
            "ppc", module, project, projectdir, sources, sourcedirs, libraries, extradirs, extraexportsymbols, outputdir
        )
        genpluginproject(
            "carbon",
            module,
            project,
            projectdir,
            sources,
            sourcedirs,
            libraries,
            extradirs,
            extraexportsymbols,
            outputdir,
        )
        return
    templatename = "template-%s" % architecture
    targetname = "%s.%s" % (module, architecture)
    dllname = "%s.%s.slb" % (module, architecture)
    if not project:
        if architecture != "ppc":
            project = "%s.%s.mcp" % (module, architecture)
        else:
            project = "%s.mcp" % module
    if not projectdir:
        projectdir = PROJECTDIR
    if not sources:
        sources = [module + "module.c"]
    if not sourcedirs:
        for moduledir in MODULEDIRS:
            if "%" in moduledir:
                # For historical reasons an initial _ in the modulename
                # is not reflected in the folder name
                if module[0] == "_":
                    modulewithout_ = module[1:]
                else:
                    modulewithout_ = module
                moduledir = moduledir % modulewithout_
            fn = os.path.join(projectdir, os.path.join(moduledir, sources[0]))
            if os.path.exists(fn):
                moduledir, sourcefile = os.path.split(fn)
                sourcedirs = [relpath(projectdir, moduledir)]
                sources[0] = sourcefile
                break
        else:
            print "Warning: %s: sourcefile not found: %s" % (module, sources[0])
            sourcedirs = []
    if architecture == "carbon":
        prefixname = "mwerks_carbonplugin_config.h"
    else:
        prefixname = "mwerks_plugin_config.h"
    dict = {
        "sysprefix": relpath(projectdir, sys.prefix),
        "sources": sources,
        "extrasearchdirs": sourcedirs + extradirs,
        "libraries": libraries,
        "mac_outputdir": outputdir,
        "extraexportsymbols": extraexportsymbols,
        "mac_targetname": targetname,
        "mac_dllname": dllname,
        "prefixname": prefixname,
    }
    if libraryflags:
        dict["libraryflags"] = libraryflags
    if stdlibraryflags:
        dict["stdlibraryflags"] = stdlibraryflags
    mkcwproject.mkproject(
        os.path.join(projectdir, project), module, dict, force=FORCEREBUILD, templatename=templatename
    )
Exemple #2
0
import mkcwproject
Exemple #3
0
import mkcwproject
Exemple #4
0
import mkcwproject
Exemple #5
0
import mkcwproject
import sys
dict = {
	"sysprefix": sys.prefix,
	"sources": ["mkcwtestmodule.c"],
	"extrasearchdirs": [],
}
	
	
mkcwproject.mkproject("mkcwtest.prj", "mkcwtest", dict)
mkcwproject.buildproject("mkcwtest.prj")