def projectRoot( pathName=""): result = pathName if not result: result = os.getcwd() if result.find("bjects") != -1: if result.find("Debug") != -1: projectName = os.path.split(result[result.find("Debug") + \ len("Debug") + 1:])[0] result = os.environ[projectName.upper()] assert os.path.exists(result), result result = os.path.abspath(result) # TODO Hack. if "OverlaySupportFiles" in result: result = utils.nativePath(os.environ["ARCGIS"]) else: # It is assumed that the toplevel directory containing a CMakeLists.txt # file is the root of the project. We may want to fine-tune this by # searching for the PROJECT/project function in this CMakeLists.txt file. parentDirectory = os.path.dirname(result) while os.path.exists(parentDirectory) and \ os.path.exists(os.path.join(parentDirectory, "CMakeLists.txt")): result = parentDirectory parentDirectory = os.path.dirname(result) assert os.path.exists(os.path.join(result, "CMakeLists.txt")), result assert os.path.exists(result), result assert os.path.isdir(result), result return result
def projectRoot(pathName=""): result = pathName if not result: result = os.getcwd() if result.find("bjects") != -1: if result.find("Debug") != -1: projectName = os.path.split(result[result.find("Debug") + \ len("Debug") + 1:])[0] result = os.environ[projectName.upper()] assert os.path.exists(result), result result = os.path.abspath(result) # TODO Hack. if "OverlaySupportFiles" in result: result = utils.nativePath(os.environ["ARCGIS"]) else: # It is assumed that the toplevel directory containing a CMakeLists.txt # file is the root of the project. We may want to fine-tune this by # searching for the PROJECT/project function in this CMakeLists.txt file. parentDirectory = os.path.dirname(result) while os.path.exists(parentDirectory) and \ os.path.exists(os.path.join(parentDirectory, "CMakeLists.txt")): result = parentDirectory parentDirectory = os.path.dirname(result) assert os.path.exists(os.path.join(result, "CMakeLists.txt")), result assert os.path.exists(result), result assert os.path.isdir(result), result return result
def configureProject( generator, name): # None if no such variable is set. rootCMakeLists = os.environ.get("%s_ROOT_CMAKELISTS_FILE" % (name.upper())) # Having a per project setting is required by DEVENV env # KDJ: What's this PCRTREE special stuff? if name.upper() == "PCRTREE2PACKAGE": name = "PCRTREE2" sources = utils.environmentVariableAsNativePath(name.upper()) elif rootCMakeLists: # Project's toplevel CMakeLists.txt file is stored in an a-typical # location. sources = os.path.split(utils.nativePath(rootCMakeLists))[0] elif os.path.exists(os.path.join(utils.environmentVariableAsNativePath( name.upper()), "CMakeLists.txt")): # Try new style. Cmake file in the root. sources = utils.environmentVariableAsNativePath(name.upper()) elif os.path.exists("%s/Sources/cplusplus" % \ utils.environmentVariableAsNativePath(name.upper())): sources = "%s/Sources/cplusplus" % \ utils.environmentVariableAsNativePath(name.upper()) else: sources = "%s/sources/cplusplus" % \ utils.environmentVariableAsNativePath(name.upper()) assert os.path.exists(sources), sources assert os.path.isdir(sources), sources objects = "%s/%s" % (objectsBuildTypeRoot(), projectBaseName(name)) if not os.path.exists(objects): os.mkdir(objects) assert os.path.isdir(objects), objects os.chdir(objects) # "-D CMAKE_VERBOSE_MAKEFILE=TRUE " # "-Wdev " # "--graphviz=%s.dot " command = "cmake -v " \ "-G %s " \ "-D CMAKE_BUILD_TYPE=%s " \ "-D CMAKE_INSTALL_PREFIX=\"%s/install\" " \ "\"%s\"" % ( generator, buildType(), objects, sources) return utils.call(command)
def configureProject(generator, name): # None if no such variable is set. rootCMakeLists = os.environ.get("%s_ROOT_CMAKELISTS_FILE" % (name.upper())) # Having a per project setting is required by DEVENV env # KDJ: What's this PCRTREE special stuff? if name.upper() == "PCRTREE2PACKAGE": name = "PCRTREE2" sources = utils.environmentVariableAsNativePath(name.upper()) elif rootCMakeLists: # Project's toplevel CMakeLists.txt file is stored in an a-typical # location. sources = os.path.split(utils.nativePath(rootCMakeLists))[0] elif os.path.exists( os.path.join(utils.environmentVariableAsNativePath(name.upper()), "CMakeLists.txt")): # Try new style. Cmake file in the root. sources = utils.environmentVariableAsNativePath(name.upper()) elif os.path.exists("%s/Sources/cplusplus" % \ utils.environmentVariableAsNativePath(name.upper())): sources = "%s/Sources/cplusplus" % \ utils.environmentVariableAsNativePath(name.upper()) else: sources = "%s/sources/cplusplus" % \ utils.environmentVariableAsNativePath(name.upper()) assert os.path.exists(sources), sources assert os.path.isdir(sources), sources objects = "%s/%s" % (objectsBuildTypeRoot(), projectBaseName(name)) if not os.path.exists(objects): os.mkdir(objects) assert os.path.isdir(objects), objects os.chdir(objects) # "-D CMAKE_VERBOSE_MAKEFILE=TRUE " # "-Wdev " # "--graphviz=%s.dot " command = "cmake -v " \ "-G %s " \ "-D CMAKE_BUILD_TYPE=%s " \ "-D CMAKE_INSTALL_PREFIX=\"%s/install\" " \ "\"%s\"" % ( generator, buildType(), objects, sources) return utils.call(command)