Ejemplo n.º 1
0
def main():
    args = parse_args()
    prefix = ""
    external = "external"
    CC = genHelper.determineCC(args)
    CXX = genHelper.determineCXX(args)
    if (args.externalLibDir):
        external = args.externalLibDir
    cmd = os.path.join(
        os.path.dirname(os.path.dirname(__file__)),
        "setUpScripts/generateCompFile.py") + """ -installName {name}
     -outFilename compfile.mk -externalLoc {external} -CC {CC} -CXX {CXX}
      -neededLibs {libs} -outname {name}"""
    if args.private:
        cmd += " -private "
    if args.prefix and args.prefix != "":
        prefix = args.prefix
        cmd += " -prefix {prefix}"
    if args.ldFlags and "" != args.ldFlags:
        cmd += " -ldFlags " + args.ldFlags
    if args.cxxFlags and "" != args.cxxFlags:
        addingFlags = " -cxxFlags \""
        if args.cxxFlags.startswith("-"):
            addingFlags += "\\"
        cmd += addingFlags + args.cxxFlags + "\""
    cmd = " ".join(cmd.split())
    cmd = cmd.format(name=args.name,
                     external=external,
                     CC=CC,
                     CXX=CXX,
                     libs=args.libs,
                     prefix=prefix)
    Utils.run(cmd)
Ejemplo n.º 2
0
def main():
    args = parse_args()
    CC = genHelper.determineCC(args)
    CXX = genHelper.determineCXX(args)
    external = "external"
    outname = "out"
    prefix = "./"
    installName = "out"
    neededLibs = "none"
    ldFlags = ""
    cxxFlags = ""
    if args.ldFlags and "" != args.ldFlags:
        ldFlags = args.ldFlags  
    if args.cxxFlags and "" != args.cxxFlags:
        cxxFlags = args.cxxFlags        
    if args.externalLoc:
        external = args.externalLoc
    if args.outname:
        outname = args.outname
    if args.installName:
        installName = args.installName
    if args.prefix:
        prefix = args.prefix
    if args.neededLibs:
        neededLibs = args.neededLibs.split(",")
    genHelper.generateCompfileFull(args.outFilename, external, CC, CXX, outname, installName, prefix, neededLibs, ldFlags, cxxFlags)
Ejemplo n.º 3
0
def main():
    args = parse_args()
    projectOut = os.path.join(args.dest[0], args.projName[0])
    os.mkdir(projectOut)
    genSrc(projectOut, args.projName[0], ["iostream", "string", "unistd.h", "vector", "cstdint", "cstdio", "cstddef", "utility", "map", "unordered_map", "algorithm"])
    CC = genHelper.determineCC(args)
    CXX = genHelper.determineCXX(args)
    external = "external"
    outname = args.projName[0]
    prefix = "./"
    installName = args.projName[0]
    neededLibs = "none"        
    if args.externalLoc:
        external = os.path.realpath(args.externalLoc[0])
    if args.neededLibs:
        neededLibs = args.neededLibs[0].split(",")
    genHelper.generateCompfileFull(os.path.join(projectOut, "compfile.mk"), external, CC, CXX, outname, installName, prefix, neededLibs)
    with open(os.path.join(projectOut, "configure.py"), "w") as configFile:
        if(args.neededLibs):
            configFile.write(genHelper.mkConfigFileStr(outname, args.neededLibs[0]))
        else:
            configFile.write(genHelper.mkConfigFileStr(outname, ""))
    os.chmod(os.path.join(projectOut, "configure.py"), stat.S_IXGRP | stat.S_IXOTH | stat.S_IXUSR | stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH | stat.S_IWUSR)
    exFrom = os.path.abspath(os.path.dirname(__file__))
    cpSetUpCmd = exFrom + "/copySetUpFiles.py -from " + exFrom +"/../../ -to " + projectOut
    print CT.boldBlack(cpSetUpCmd)
    Utils.run(cpSetUpCmd)
    cpMakefilesCmd = "cp " + exFrom + "/../cppSetUpFiles/*akefile* " + projectOut
    print CT.boldBlack(cpMakefilesCmd)
    Utils.run(cpMakefilesCmd)
Ejemplo n.º 4
0
def main():
    args = parse_args()
    CC = genHelper.determineCC(args)
    CXX = genHelper.determineCXX(args)
    external = "external"
    outname = "out"
    prefix = "./"
    installName = "out"
    neededLibs = "none"
    ldFlags = ""
    cxxFlags = ""
    if args.ldFlags and "" != args.ldFlags:
        ldFlags = args.ldFlags  
    if args.cxxFlags and "" != args.cxxFlags:
        cxxFlags = args.cxxFlags        
    if args.externalLoc:
        external = args.externalLoc
    if args.outname:
        outname = args.outname
    if args.installName:
        installName = args.installName
    if args.prefix:
        prefix = args.prefix
    if args.neededLibs:
        neededLibs = args.neededLibs.split(",")
    genHelper.generateCompfileFull(args.outFilename, external, CC, CXX, outname, installName, prefix, neededLibs, ldFlags, cxxFlags, args.private)
Ejemplo n.º 5
0
def main():
    args = parse_args()
    prefix = "";
    external = "external";
    CC = genHelper.determineCC(args)
    CXX = genHelper.determineCXX(args)
    if(args.externalLibDir):
        external = args.externalLibDir;
    cmd = os.path.join(os.path.dirname(os.path.dirname(__file__)), "setUpScripts/generateCompFile.py") + """ -installName {name}
     -outFilename compfile.mk -externalLoc {external} -CC {CC} -CXX {CXX}
      -neededLibs {libs} -outname {name}"""
    if args.private:
      cmd += " -private ";
    if args.prefix and args.prefix != "":
        prefix = args.prefix;
        cmd += " -prefix {prefix}"
    if args.ldFlags and "" != args.ldFlags:
        cmd += " -ldFlags " + args.ldFlags
    if args.cxxFlags and "" != args.cxxFlags:
        addingFlags = " -cxxFlags \""
        if args.cxxFlags.startswith("-"):
            addingFlags += "\\"
        cmd += addingFlags + args.cxxFlags + "\""
    cmd = " ".join(cmd.split())
    cmd = cmd.format(name = args.name, external = external, CC=CC, CXX=CXX, libs = args.libs, prefix = prefix)
    Utils.run(cmd)
Ejemplo n.º 6
0
def genCppProject(args):
    projectOut = os.path.join(args.dest, args.projName)
    if os.path.exists(projectOut):
        if args.overwrite:
            shutil.rmtree(projectOut)
        else:
            raise Exception("Directory " + str(projectOut) +
                            " already exists, use --overWrite to delete")
    #create project dir
    os.mkdir(projectOut)
    #generate skeleton source code directory
    genSrc(projectOut, args.projName, [
        "iostream", "string", "unistd.h", "vector", "cstdint", "cstdio",
        "cstddef", "utility", "map", "unordered_map", "algorithm"
    ])
    #determine c++ and c compilers
    CC = genHelper.determineCC(args)
    CXX = genHelper.determineCXX(args)
    external = "external"
    outname = args.projName
    prefix = "./"
    installName = args.projName
    neededLibs = "none"
    if args.externalLoc:
        external = os.path.realpath(args.externalLoc)
    if args.neededLibs:
        neededLibs = args.neededLibs.split(",")
    #generate the compfile
    genHelper.generateCompfileFull(os.path.join(projectOut, "compfile.mk"),
                                   external, CC, CXX, outname, installName,
                                   prefix, neededLibs)
    #generate config file
    with open(os.path.join(projectOut, "configure.py"), "w") as configFile:
        if args.neededLibs:
            configFile.write(
                genHelper.mkConfigFileStr(outname, args.neededLibs))
        else:
            configFile.write(genHelper.mkConfigFileStr(outname, ""))
    #make executable
    os.chmod(
        os.path.join(projectOut, "configure.py"),
        stat.S_IXGRP | stat.S_IXOTH | stat.S_IXUSR | stat.S_IRUSR
        | stat.S_IRGRP | stat.S_IROTH | stat.S_IWUSR)
    #determine this file's location to dtermine where to copy setup and make files to
    exFrom = os.path.abspath(os.path.dirname(__file__))
    cpSetUpCmd = exFrom + "/copySetUpFiles.py -from " + exFrom + "/../../ -to " + projectOut
    print CT.boldBlack(cpSetUpCmd)
    Utils.run(cpSetUpCmd)
    cpMakefilesCmd = "cp " + exFrom + "/../cppMakefiles/Makefile " + projectOut
    print CT.boldBlack(cpMakefilesCmd)
    Utils.run(cpMakefilesCmd)
    #generate README.md
    genReadme(projectOut, args.projName)
Ejemplo n.º 7
0
 def __processArgs(self):
     if self.args.libs:
         inLibs = self.args.libs.split(",")
         for lib in inLibs:
             self.setUpsNeeded.append(lib.lower())
     if self.args.compfile:
         self.parseSetUpNeeded(self.args.compfile[0])
         self.parserForCompilers(self.args.compfile[0])
     # if no compfile need to determine compiler, will default to env CC and CXX
     else:
         self.CC = genHelper.determineCC(self.args)
         self.CXX = genHelper.determineCXX(self.args)
     if "clang" in self.CXX:
         self.args.clang = True
     else:
         self.args.clang = False
Ejemplo n.º 8
0
def main():
    args = parse_args()
    prefix = ""
    external = "external"
    CC = genHelper.determineCC(args)
    CXX = genHelper.determineCXX(args)
    if args.externalLibDir:
        external = args.externalLibDir
    cmd = """scripts/setUpScripts/generateCompFile.py -installName {name}
     -outFilename compfile.mk -externalLoc {external} -CC {CC} -CXX {CXX}
      -neededLibs {libs} -outname {name}"""
    if args.prefix and args.prefix != "":
        prefix = args.prefix
        cmd += " -prefix {prefix}"
    cmd = " ".join(cmd.split())
    cmd = cmd.format(name=args.name, external=external, CC=CC, CXX=CXX, libs=args.libs, prefix=prefix)
    Utils.run(cmd)
Ejemplo n.º 9
0
def genCppProject(args):
    projectOut = os.path.join(args.dest, args.projName)
    if os.path.exists(projectOut):
        if args.overwrite:
            shutil.rmtree(projectOut)
        else:
            raise Exception("Directory " + str(projectOut) + " already exists, use --overWrite to delete")
    #create project dir
    os.mkdir(projectOut)
    #generate skeleton source code directory
    genSrc(projectOut, args.projName, ["iostream", "string", "unistd.h", "vector", "cstdint", "cstdio", "cstddef", "utility", "map", "unordered_map", "algorithm"])
    #determine c++ and c compilers
    CC = genHelper.determineCC(args)
    CXX = genHelper.determineCXX(args)
    external = "external"
    outname = args.projName
    prefix = "./"
    installName = args.projName
    neededLibs = "none"        
    if args.externalLoc:
        external = os.path.realpath(args.externalLoc)
    if args.neededLibs:
        neededLibs = args.neededLibs.split(",")
    #generate the compfile
    genHelper.generateCompfileFull(os.path.join(projectOut, "compfile.mk"), external, CC, CXX, outname, installName, prefix, neededLibs)
    #generate config file
    with open(os.path.join(projectOut, "configure.py"), "w") as configFile:
        if args.neededLibs:
            configFile.write(genHelper.mkConfigFileStr(outname, args.neededLibs))
        else:
            configFile.write(genHelper.mkConfigFileStr(outname, ""))
    #make executable
    os.chmod(os.path.join(projectOut, "configure.py"), stat.S_IXGRP | stat.S_IXOTH | stat.S_IXUSR | stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH | stat.S_IWUSR)
    #determine this file's location to dtermine where to copy setup and make files to
    exFrom = os.path.abspath(os.path.dirname(__file__))
    cpSetUpCmd = exFrom + "/copySetUpFiles.py -from " + exFrom + "/../../ -to " + projectOut
    print CT.boldBlack(cpSetUpCmd)
    Utils.run(cpSetUpCmd)
    cpMakefilesCmd = "cp " + exFrom + "/../cppMakefiles/Makefile " + projectOut
    print CT.boldBlack(cpMakefilesCmd)
    Utils.run(cpMakefilesCmd)
    #generate README.md
    genReadme(projectOut, args.projName)
Ejemplo n.º 10
0
def main():
    """@todo: Also add on adding CXXFLAGS or LDFLAGS and the such or look for environment ones"""
    args = parse_args()
    CC = genHelper.determineCC(args)
    CXX = genHelper.determineCXX(args)
    external = "external"
    outname = "out"
    prefix = "./"
    installName = "out"
    neededLibs = "none"        
    if args.externalLoc:
        external = args.externalLoc[0]
    if args.outname:
        outname = args.outname[0]
    if args.installName:
        installName = args.installName[0]
    if args.prefix:
        prefix = args.prefix[0]
    if args.neededLibs:
        neededLibs = args.neededLibs[0].split(",")
    genHelper.generateCompfileFull(args.outFilename[0], external, CC, CXX, outname, installName, prefix, neededLibs)
Ejemplo n.º 11
0
def main():
    args = parse_args()
    externalIncludes = []
    stdLibraryInc = ["iostream", "string", "unistd.h", "vector", "cstdint", "cstdio", "cstddef", "utility", "map", "unordered_map", "algorithm"]
    projectOut = os.path.join(args.dest[0], args.projName[0])
    os.mkdir(projectOut)
    if args.programType == "singleRing":
        genSrcSingleRingProgram(projectOut, args.projName[0], stdLibraryInc, externalIncludes, args.author)
    elif args.programType == "oneRing":
        genSrcWithOneRingProgram(projectOut, args.projName[0], stdLibraryInc, externalIncludes, args.author)
    elif args.programType == "oneCmd":
        genSrcWithOneCmdProgram(projectOut, args.projName[0], stdLibraryInc, externalIncludes, args.author)
    else:
        raise Exception("Error, only singleRing, oneRing,oneCmd available for options to programType, was given " + args.programType )
    
    CC = genHelper.determineCC(args)
    CXX = genHelper.determineCXX(args)
    external = "external"
    outname = args.projName[0]
    prefix = "./"
    installName = args.projName[0]
    neededLibs = ["njhcppdev"]        
    if args.externalLoc:
        external = os.path.realpath(args.externalLoc[0])
    if args.neededLibs:
        neededLibs = ["njhcppdev"] + args.neededLibs[0].split(",")
    genHelper.generateCompfileFull(os.path.join(projectOut, "compfile.mk"), external, CC, CXX, outname, installName, prefix, neededLibs)
    with open(os.path.join(projectOut, "configure.py"), "w") as configFile:
        if(args.neededLibs):
            configFile.write(genHelper.mkConfigFileStr(outname, ",".join(neededLibs)))
        else:
            configFile.write(genHelper.mkConfigFileStr(outname, "njhcppdev"))
    os.chmod(os.path.join(projectOut, "configure.py"), stat.S_IXGRP | stat.S_IXOTH | stat.S_IXUSR | stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH | stat.S_IWUSR)
    exFrom = os.path.abspath(os.path.dirname(__file__))
    cpSetUpCmd = exFrom + "/copySetUpFiles.py -from " + exFrom +"/../../ -to " + projectOut
    print CT.boldBlack(cpSetUpCmd)
    Utils.run(cpSetUpCmd)
    cpMakefilesCmd = "cp " + exFrom + "/../cppSetUpFiles/*akefile* " + projectOut
    print CT.boldBlack(cpMakefilesCmd)
    Utils.run(cpMakefilesCmd)