示例#1
0
 def UseBefore(self, _otherProject):
     """ 
     Sets a flag that says that self must be used before _otherProjects in a cmake file. 
     Throws DependencyError if _otherProject wants to be used before self.
     _otherProject - May be a project, or a function returning a project.
     """
     otherProject = csnProject.ToProject(_otherProject)
     if otherProject.dependenciesManager.WantsToBeUsedBefore(self.project):
         raise DependencyError, "Cyclic use-before relation between %s and %s" % (
             self.project.name, otherProject.name)
     self.useBefore.append(otherProject)
示例#2
0
    def AddTests(self,
                 listOfTests,
                 _cxxTestProject,
                 _enableWxWidgets=0,
                 _dependencies=None,
                 _pch=""):
        """
        _cxxTestProject -- May be the cxxTest project instance, or a function returning a cxxTest project instance.
        listOfTests -- List of source files containing cxx test classes.
        """
        cxxTestProject = csnProject.ToProject(_cxxTestProject)

        if self.testProject is None:
            self.__CreateTestProject(cxxTestProject, _enableWxWidgets)

        for test in listOfTests:
            absPathToTest = self.testProject.pathsManager.PrependRootFolderToRelativePath(
                test)
            self.testProject.AddSources([absPathToTest], _checkExists=0)

        wxRunnerArg = None
        if _enableWxWidgets:
            wxRunnerArg = "--template \"%s\"" % (csnUtility.GetRootOfCSnake() +
                                                 "/resources/wxRunner.tpl")
        else:
            wxRunnerArg = "--template \"%s\"" % (
                csnUtility.GetRootOfCSnake() + "/resources/%s" %
                self.testProject.context.GetTestRunnerTemplate())

        pythonScript = "%s/CxxTest/cxxtestgen.py" % cxxTestProject.GetSourceRootFolder(
        )
        command = "\"%s\" \"%s\" %s --have-eh --error-printer -o \"%s\" " % (
            csnUtility.NormalizePath(self.testProject.context.GetPythonPath()),
            pythonScript, wxRunnerArg, self.testRunnerSourceFile)
        depends = []
        for source in self.testProject.GetSources():
            if os.path.splitext(source)[1] in (".h", ".hpp"):
                depends.append('"%s"' % source)
                command += ' "%s"' % source
        self.testProject.AddRule("Create test runner",
                                 self.testRunnerSourceFile, command, depends)
        self.testProject.AddCMakeInsertAfterTarget(CustomCMakeLinesTest,
                                                   self.testProject)
        self.holdingProject.AddCMakeInsertBeginning(
            CustomCMakeLinesTestHoldingProject, self.holdingProject)
        self.testProject.AddLibraries(["DelayImp"], _WIN32=1)

        if not _dependencies is None:
            self.testProject.AddProjects(_dependencies)

        if (_pch != ""):
            self.testProject.SetPrecompiledHeader(_pch)
示例#3
0
    def AddProjects(self,
                    _projects,
                    _dependency=True,
                    _includeInSolution=True):
        for project in _projects:
            projectToAdd = csnProject.ToProject(project)
            if projectToAdd in self.GetProjects():
                continue

            if self.project is projectToAdd:
                raise DependencyError, "Project %s cannot be added to itself" % (
                    projectToAdd.name)

            if not projectToAdd in self.projects:
                self.projects.add(projectToAdd)
                if not _dependency:
                    self.projectsNonRequired.add(projectToAdd)
                if _includeInSolution:
                    self.projectsIncludedInSolution.add(projectToAdd)
示例#4
0
    def DependsOn(self, _otherProject, _skipList=None):
        """ 
        Returns true if self is (directly or indirectly) dependent upon _otherProject. 
        _otherProject - May be a project, or a function returning a project.
        _skipList - Used to not process project twice during the recursion (also prevents infinite loops).
        """
        if _skipList is None:
            _skipList = []

        otherProject = csnProject.ToProject(_otherProject)
        assert not self.project in _skipList, "\n\nError: %s should not be in stoplist" % (
            self.project.name)
        _skipList.append(self.project)
        for requiredProject in self.GetProjects(_onlyRequiredProjects=1):
            if requiredProject in _skipList:
                continue
            if requiredProject is otherProject or requiredProject.dependenciesManager.DependsOn(
                    otherProject, _skipList):
                return True
        return False
示例#5
0
    def WantsToBeUsedBefore(self, _otherProject):
        """ 
        Return true if self wants to be used before _otherProject.
        _otherProject - May be a project, or a function returning a project.
        """
        otherProject = csnProject.ToProject(_otherProject)

        #if otherProject in self.GetProjects(_recursive = 1, _onlyRequiredProjects = 1):
        #    return 1
        #if self.project in otherProject.dependenciesManager.GetProjects(_recursive = 1, _onlyRequiredProjects = 1):
        #    return 0

        if self.project is otherProject:
            return 0

        if otherProject in self.useBefore:
            return 1

        for requiredProject in self.GetProjects(_recursive=1,
                                                _onlyRequiredProjects=1):
            if otherProject in requiredProject.dependenciesManager.useBefore:
                return 1

        return 0
示例#6
0
from csnToolkitOpen import *
import csnProject

# Definition of the plugin
coronaryArteryModelingPlugin = GimiasPluginProject(
    "CoronaryArteryModelingPlugin", api)
# plugin dependencies
projects = [
    gmCore, guiBridgeLib, baseLibVTK, guiBridgeLibWxWidgets, alglib_v3_10_0
    #cArteryModellingLib
]
coronaryArteryModelingPlugin.AddProjects(projects)
coronaryArteryModelingPlugin.AddProjects([cArteryModellingLib],
                                         dependency=False)
coronaryArteryModelingPlugin.AddIncludeFolders([
    csnProject.ToProject(cArteryModellingLib).GetSourceRootFolder() +
    "/libmodules/TubularGeodesicComputation/include"
])
coronaryArteryModelingPlugin.AddIncludeFolders([
    csnProject.ToProject(cArteryModellingLib).GetSourceRootFolder() +
    "/libmodules/RotationalAngioIO/include"
])
coronaryArteryModelingPlugin.AddIncludeFolders([
    csnProject.ToProject(cArteryModellingLib).GetSourceRootFolder() +
    "/libmodules/RotationalAngioGeo/include"
])
coronaryArteryModelingPlugin.AddIncludeFolders([
    csnProject.ToProject(cArteryModellingLib).GetSourceRootFolder() +
    "/libmodules/OptimalSubsequenceBijection/include"
])
coronaryArteryModelingPlugin.AddIncludeFolders([