def objectsBuildTypeRoot(pathName=""): assert ("OBJECTS" in os.environ) result = utils.environmentVariableAsNativePath("OBJECTS") if pathName: result = os.path.join(result, projectName(pathName)) assert os.path.exists(result), result assert os.path.isdir(result), result return result
def objectsBuildTypeRoot( pathName=""): assert("OBJECTS" in os.environ) result = utils.environmentVariableAsNativePath("OBJECTS") if pathName: result = os.path.join(result, projectName(pathName)) 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)
def setDefaultsEnvSettingsAndSourceDotDevenv(): # TODO pcr bugzilla #128: doc DEVENCRC or ~/.devenv in .dox files of DEVENV # implementation note: # - use _ as start for all vars in this function since we 'source' .devenv # into the current scope and consider all without '_'-start # - to reject a float value for an integer option set the default # explicit to int(), see makeNrOfJobs # Defaults (linux, win32 are overwritten afterwards): _dotDevenv = { # build cmake's fast variant of target # issue: the idea was to simply prepend /fast to the target as # stated in # http://www.cmake.org/Wiki/CMake_FAQ#Is_there_a_way_to_skip_checking_of_dependent_libraries_when_compiling.3F # but alas, not all targets support a fast variant # therefore we also need to set replaceAllTarget to make cmakeFast usefull # with 'make all' which is our default F8 vi binding 'cmakeFast' : False, # replace 'all' by another target 'replaceAllTarget': 'all', # start unittest app from the debugger 'debugUnittest' : False, # boost unittest's --log_level 'unitTestLogLevel' : 'error', # boost unittest's --show_progress=yes/no 'unitTestShowProgress' : 'yes', # boost unittest's --detect_memory_leaks # with patch for 0 value, see below 'unitTestDetectMemoryLeaks' :int(1), # debugger invocation (unittestapp is appended) # valgrind as debugger value also works 'debugger' : "gdb", # number paralel compiles from make 'makeNrOfJobs' : int(4), # call something else instead of # _buildCMakeTarget down in vimbuild.py 'callInsteadOfCMakeTarget' : "", # -k passed to make, do NOT stop on first build error 'makeKeepGoing' : False, # internals not sourced from ~/.devenv '_makeTargetSlash' : "/" } # Defaults different on win32: if sys.platform == "win32": # invoke visual studio _dotDevenv['debugger'] = "devenv /debugexe" # value Kor found wise for Dual Core _dotDevenv['makeNrOfJobs'] = int(3) _dotDevenv['_makeTargetSlash'] = "\\" return _dotDevenv _home = utils.environmentVariableAsNativePath("HOME") if "DEVENVRC" in os.environ: _dotDevenvFile = utils.environmentVariableAsNativePath("DEVENVRC") else: _dotDevenvFile = os.path.join(_home, ".devenvrc") if not os.path.exists(_dotDevenvFile): _dotDevenvFile = os.path.join(_home, ".devenv") if os.path.exists(_dotDevenvFile): exec(open(_dotDevenvFile).read()) for i in locals().keys(): if i[0] != "_": if not i in _dotDevenv.keys(): print("Warning $HOME/.devenv:",i,"is not a recognized setting") elif type(_dotDevenv[i]) != type(locals()[i]): print("Warning $HOME/.devenv:",i,"does not have correct type") else: _dotDevenv[i] = locals()[i] if i == "unitTestLogLevel" and _dotDevenv[i] not in \ ["all","success","test_suite","message","warning","error","cpp_exception","system_error","fatal_error","nothing"]: print("Warning $HOME/.devenv: unitTestLogLevel does not have a recognized value") return _dotDevenv
def projectBaseName( name): return os.path.basename(utils.environmentVariableAsNativePath(name.upper()))
def projectDirectory( name): variable = name.upper() directory = utils.environmentVariableAsNativePath(variable) return directory
def devEnvRoot(): return utils.environmentVariableAsNativePath("DEVENV")
def testsRoot(): assert("TESTS" in os.environ) return utils.environmentVariableAsNativePath("TESTS")
def testsRoot(): assert(os.environ.has_key("TESTS")) return utils.environmentVariableAsNativePath("TESTS")
def projectBaseName(name): return os.path.basename(utils.environmentVariableAsNativePath( name.upper()))
def projectDirectory(name): variable = name.upper() directory = utils.environmentVariableAsNativePath(variable) return directory
def testsRoot(): assert ("TESTS" in os.environ) return utils.environmentVariableAsNativePath("TESTS")