#! /usr/bin/env python
-import os,subprocess,sys,re,datetime,shutil,glob
-import ConfigParser
-import tarfile
+import os,sys,shutil,glob
current_directory=os.path.dirname(os.path.abspath(__file__))
-# Read configuration
-config_filename="SalomeMiniConfig.cfg"
-config = ConfigParser.SafeConfigParser()
-config.optionxform = str # case sensitive
-config.read(os.path.join(current_directory, config_filename))
-# third argument of get: interpolation(0) or raw mode(1)
-cmake_archive=config.get('Prerequisites', 'cmake_archive', 0)
-cmake_url=config.get('Prerequisites', 'cmake_url', 0)
-hdf5_archive=config.get('Prerequisites', 'hdf5_archive', 0)
-hdf5_url=config.get('Prerequisites', 'hdf5_url', 0)
-swig_archive=config.get('Prerequisites', 'swig_archive', 0)
-swig_url=config.get('Prerequisites', 'swig_url', 0)
-qt_archive=config.get('Prerequisites', 'qt_archive', 0)
-qt_url=config.get('Prerequisites', 'qt_url', 0)
-med_archive=config.get('Prerequisites', 'med_archive', 0)
-med_url=config.get('Prerequisites', 'med_url', 0)
-python_archive=config.get('Prerequisites', 'python_archive', 0)
-python_url=config.get('Prerequisites', 'python_url', 0)
-python_version_short=config.get('Prerequisites', 'python_version_short', 0)
-python_version_long=config.get('Prerequisites', 'python_version_long', 0)
-swig_version=config.get('Prerequisites', 'swig_version', 0)
-swig_url=config.get('Prerequisites', 'swig_url', 0)
-paraview_git_repo=config.get('ParaView', 'paraview_git_repo', 0)
-paraview_git_version=config.get('ParaView', 'paraview_git_version', 0)
-paraview_version=config.get('ParaView', 'paraview_version', 0)
-salome_git_repo=config.get('SALOME', 'salome_git_repo', 0)
-medcoupling_version=config.get('SALOME', 'medcoupling_version', 0)
-kernel_version=config.get('SALOME', 'kernel_version', 0)
-gui_version=config.get('SALOME', 'gui_version', 0)
-paravis_version=config.get('SALOME', 'paravis_version', 0)
-make_nb_jobs=config.get('Build options', 'make_nb_jobs', 0)
-do_archive_download=config.getboolean('Build options', 'do_archive_download')
-
-# Download archives
-local_archives_path=os.path.join(current_directory,"archives")
-if not os.path.exists(local_archives_path):
- os.makedirs(local_archives_path)
- do_archive_download=True
- pass
-
-import urllib2
-def download(url, outfile):
- print "Downloading",outfile,"..."
- if os.path.exists(outfile):
- print "Already downloaded" # :TODO: should include MD5 check
- return
- try:
- remotefile=urllib2.urlopen(url)
- except urllib2.HTTPError:
- print "Unable to fetch url:", url
- sys.exit(1)
- pass
- with open(outfile,'w') as localfile:
- buf = remotefile.read(65536)
- while buf != "":
- localfile.write(buf)
- buf = remotefile.read(65536)
- pass
- pass
- remotefile.close()
- pass
+from salome_environ import *
-cmakeLoc=os.path.join(local_archives_path,cmake_archive)
-pythonLoc=os.path.join(local_archives_path,python_archive)
-hdf5Loc=os.path.join(local_archives_path,hdf5_archive)
-swigLoc=os.path.join(local_archives_path,swig_archive)
-qtLoc=os.path.join(local_archives_path,qt_archive)
-medLoc=os.path.join(local_archives_path,med_archive)
+envAcc={}
-if not os.path.exists(cmakeLoc) \
- or not os.path.exists(pythonLoc) \
- or not os.path.exists(hdf5Loc) \
- or not os.path.exists(swigLoc) \
- or not os.path.exists(qtLoc) \
- or not os.path.exists(medLoc):
- do_archive_download=True
- pass
+# Read configuration
+from salome_config import read_config_file
+read_config_file(os.path.join(current_directory, "SalomeMiniConfig.cfg"))
+from salome_config import config
-if do_archive_download:
- download(cmake_url, cmakeLoc)
- download(med_url, medLoc)
- download(hdf5_url, hdf5Loc)
- download(swig_url, swigLoc)
- download(qt_url, qtLoc)
- download(python_url, pythonLoc)
- pass
+# Check system prerequisites
+from salome_check_version import *
+check_gcc_version(config["gcc_version_min"], envAcc)
+# Download archives
+from salome_download import download_archives
+download_archives(current_directory)
# Prepare build
-paraviewLoc=(paraview_git_repo,paraview_git_version)
-
-medcouplingLoc=(os.path.join(salome_git_repo,"tools","medcoupling.git"),medcoupling_version)
-kernelLoc=(os.path.join(salome_git_repo,"modules","kernel.git"),kernel_version)
-guiLoc=(os.path.join(salome_git_repo,"modules","gui.git"),gui_version)
-paravisLoc=(os.path.join(salome_git_repo,"modules","paravis.git"),paravis_version)
-
rootDir="SalomeMini"
-paraCompFlag="-j%s"%make_nb_jobs
-cfgOut="config_out.log"
-cfgErr="config_err.log"
-compOut="compile_out.log"
-compErr="compile_err.log"
-okFlag=".install_ok"
-
# Manage dependencies
-__softwares = ["cmake","python","hdf5","swig","qt","med","medcoupling","paraview","gui","paravis"]
-__softwareChanged = {}
-for s in __softwares:
- __softwareChanged[s] = False
+__softwares = ["cmake","python","hdf5","swig","qt","med","medcoupling","paraview","paravis"]
__dependencies={
"cmake": [],
- "python": [],
+ "python": ["cmake"],
"hdf5": ["cmake"],
"swig": ["python"],
- "qt": [],
+ "qt": ["cmake"],
"med": ["hdf5","python"],
- "medcoupling": ["python","med"],
+ "medcoupling": ["python","med","swig"],
"paraview": ["hdf5","python","qt","cmake"],
- "gui": [""], # not built, only used to get cmake files from sources
- "paravis": ["cmake","paraview","medcoupling","gui"],
+ "paravis": ["paraview","medcoupling"],
}
-def some_dependency_has_changed(software):
- for x in __dependencies[software]:
- if __softwareChanged[x]:
- return True
- return False
-
-# Manage environment
-
-def cmake_Environ(installDir,envAcc):
- pathAdd=[os.path.join(installDir,"bin")]
- addEnv(envAcc,"PATH",pathAdd)
- pass
-
-def python_Environ(installDir,envAcc):
- pathAdd=[os.path.join(installDir,"bin")]
- ldPathAdd=[os.path.join(installDir,"lib")]
- addEnv(envAcc,"PATH",pathAdd)
- addEnv(envAcc,"LD_LIBRARY_PATH",ldPathAdd)
- envAcc["PYTHONHOME"]=installDir
- envAcc["PYTHONSTARTUP"]=os.path.join(installDir,"pythonrc.py")
- envAcc["PYTHON_VERSION"]=python_version_short
- envAcc["PYTHON_INCLUDE"]=os.path.join(installDir,"include","python%s"%envAcc["PYTHON_VERSION"])
- pass
-
-def hdf5_Environ(installDir,envAcc):
- envAcc["HDF5HOME"]=installDir
- envAcc["HDF5_DISABLE_VERSION_CHECK"]="1"
- pathAdd=[os.path.join(installDir,"bin")]
- ldPathAdd=[os.path.join(installDir,"lib")]
- addEnv(envAcc,"PATH",pathAdd)
- addEnv(envAcc,"LD_LIBRARY_PATH",ldPathAdd)
- pass
-
-def swig_Environ(installDir,envAcc):
- pathAdd=[os.path.join(installDir,"bin")]
- addEnv(envAcc,"PATH",pathAdd)
- envAcc["SWIG_ROOT_DIR"]=installDir
- envAcc["SWIG_LIB"]=os.path.join(installDir,"share","swig",swig_version)
- pass
-
-def qt_Environ(installDir,envAcc):
- pathAdd=[os.path.join(installDir,"bin")]
- ldPathAdd=[os.path.join(installDir,"lib")]
- addEnv(envAcc,"PATH",pathAdd)
- addEnv(envAcc,"LD_LIBRARY_PATH",ldPathAdd)
- envAcc["QTDIR"]=installDir
- envAcc["QT_PLUGIN_PATH"]=os.path.join(installDir,"plugins")
- pass
-
-def med_Environ(installDir,envAcc):
- pathAdd=[os.path.join(installDir,"bin")]
- ldPathAdd=[os.path.join(installDir,"lib")]
- pyPathAdd=[os.path.join(installDir,"lib","python%s"%python_version_short,"site-packages")]
- addEnv(envAcc,"PATH",pathAdd)
- addEnv(envAcc,"LD_LIBRARY_PATH",ldPathAdd)
- addEnv(envAcc,"PYTHONPATH",pyPathAdd)
- envAcc["MED3HOME"]=installDir
- pass
-
-def medcoupling_Environ(installDir,envAcc):
- pathAdd=[os.path.join(installDir,"bin")]
- ldPathAdd=[os.path.join(installDir,"lib")]
- pyPathAdd=[os.path.join(installDir,"lib","python%s"%python_version_short,"site-packages")]
- addEnv(envAcc,"PATH",pathAdd)
- addEnv(envAcc,"LD_LIBRARY_PATH",ldPathAdd)
- addEnv(envAcc,"PYTHONPATH",pyPathAdd)
- addEnv(envAcc,"PATH",pathAdd)
- addEnv(envAcc,"LD_LIBRARY_PATH",ldPathAdd)
- addEnv(envAcc,"PYTHONPATH",pyPathAdd)
- envAcc["MEDCOUPLINGHOME"]=installDir
- pass
-
-def paraview_Environ(installDir,envAcc):
- envAcc["PVHOME"]=installDir
- envAcc["PVVERSION"]=paraview_version
- pathAdd=[os.path.join(installDir,"bin")]
- addEnv(envAcc,"PATH",pathAdd)
- ldPathAdd=[os.path.join(installDir,"lib","paraview-%s"%paraview_version)]
- addEnv(envAcc,"LD_LIBRARY_PATH",ldPathAdd)
- pyPathAdd =[os.path.join(installDir,"lib","paraview-%s"%paraview_version,"site-packages")]
- pyPathAdd+=[os.path.join(installDir,"lib","paraview-%s"%paraview_version,"site-packages","vtk")]
- pyPathAdd+=[os.path.join(installDir,"lib","paraview-%s"%paraview_version,"site-packages","paraview","vtk")]
- addEnv(envAcc,"PYTHONPATH",pyPathAdd)
- pvPlgPathAdd=[os.path.join(installDir,"lib","paraview-%s"%paraview_version)]
- addEnv(envAcc,"PV_PLUGIN_PATH",pvPlgPathAdd)
- pass
-
-def paravis_Environ(installDir,envAcc):
- ldPathAdd=[os.path.join(installDir,"lib","salome")]
- pvPlgPathAdd=[os.path.join(installDir,"lib","paraview")]
- addEnv(envAcc,"LD_LIBRARY_PATH",ldPathAdd)
- addEnv(envAcc,"PV_PLUGIN_PATH",pvPlgPathAdd)
- pass
+from salome_config import initialize
+initialize(__softwares, __dependencies)
####################
-def addEnv(dico,key,val):
- if key not in dico.keys():
- dico[key]=val
- else:
- dico[key]+=val
-
-class AutoChdir:
- def __init__(self,dn):
- os.chdir(dn)
- def __del__(self):
- os.chdir("..")
-
-def extractSrcFromArchive(srcLoc,srcDir,pattern):
- print "Extracting archive: ", srcLoc
- tmpDir="tmp"
- zz=AutoChdir(srcDir)
- if os.path.exists(tmpDir):
- assert(False)
- srcDN=None
- ret=None
- myExt=os.path.splitext(srcLoc)[1]
-
- try:
- tar_file = tarfile.open(name=srcLoc, mode='r|*')
- name0 = tar_file.getnames()[0] # raise IndexError if tar_file is empty
- base0 = name0.split('/')[0]
- ret = os.path.realpath(os.path.join(os.getcwd(), base0))
- if os.path.exists(ret):
- print("\"%s\" already exists : keep it as this !"%ret)
- tar_file.close()
- return ret
- os.mkdir(tmpDir)
- tar_file.extractall(tmpDir)
- tar_file.close()
- except:
- shutil.rmtree(tmpDir)
- assert(False)
- pass
- unzipDir = os.path.join(tmpDir, base0)
- shutil.move(unzipDir, os.getcwd())
- os.rmdir(tmpDir)
- return ret
-
-def extractSrcFromGit(gitLoc,srcDir,pattern):
- print "Connecting to git repository: ", gitLoc[0]
- zz=AutoChdir(srcDir)
- assert(isinstance(gitLoc,tuple))
- assert(len(gitLoc)==2)
- dirGitLoc=os.path.splitext(os.path.basename(gitLoc[0]))[0]
- ret=os.path.realpath(os.path.join(os.getcwd(),dirGitLoc))
- if not os.path.exists(dirGitLoc):
- print("Cloning %s..."%dirGitLoc)
- def __connect():
- p=subprocess.Popen("GIT_SSL_NO_VERIFY=true git clone %s"%(gitLoc[0]), shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
- p_out,p_err=p.communicate()
- return p.returncode, p_out, p_err
- tries=0
- while True:
- _status,_out,_err = __connect()
- if _status == 0 or tries > 1:
- break
- print _out
- print _err
- print "Try again"
- tries = tries+1
- pass
- assert(_status==0)
- else:
- assert(os.path.exists(os.path.join(dirGitLoc,".git")))
- p=subprocess.Popen(["git","fetch"],cwd=dirGitLoc,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
- p.communicate()
- pass
- p=subprocess.Popen(["git","checkout",gitLoc[1]],cwd=dirGitLoc,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
- p_out,p_err=p.communicate()
- if p.returncode != 0:
- msg = "Error in checkout\n" + p_err
- raise Exception(msg)
- if dirGitLoc=="ParaView":
- p=subprocess.Popen(["git","submodule","update","--init"],cwd=dirGitLoc,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
- p_out,p_err=p.communicate()
- if p.returncode != 0:
- msg = "Error in submodule update\n" + p_err
- raise Exception(msg)
- return ret
-
-
-def extractSrc(srcDir,pattern):
- srcLoc=eval("%sLoc"%pattern)
- if isinstance(srcLoc,str):
- return extractSrcFromArchive(srcLoc,srcDir,pattern)
- elif isinstance(srcLoc,tuple):
- return extractSrcFromGit(srcLoc,srcDir,pattern)
- else:
- raise Exception("Unrecognized localization of source : %s"%srcLoc)
-
-def computeEnv(envAcc,withDft=True):
- import os,copy
- if withDft:
- d=copy.deepcopy(os.environ)
- for k in os.environ.keys():
- if k not in envAcc.keys():
- del d[k]
- else:
- d={}
- for k in envAcc.keys():
- l=[]
- if k in d.keys():
- l=d[k].split(os.pathsep)
- tmp=envAcc[k]
- if not isinstance(tmp,list):
- tmp=[tmp]
- l=tmp+l
- if k!="PYTHONSTARTUP":
- d[k]=os.pathsep.join(l)
- else:
- d[k]=l[-1]
- #
- if "PATH" not in d.keys():
- d["PATH"]=os.environ["PATH"]
- return d
-
-def getCurrentVersion(srcDir,pattern):
- zz=AutoChdir(srcDir)
- srcLoc=eval("%sLoc"%pattern)
- if isinstance(srcLoc,str):
- s = os.path.splitext(os.path.basename(srcLoc))[0]
- if s.endswith(".tar"):
- s = s[:-4]
- return s
- elif isinstance(srcLoc,tuple):
- dirGitLoc=os.path.splitext(os.path.basename(srcLoc[0]))[0]
- p=subprocess.Popen(["git","rev-parse","--verify","HEAD"],cwd=dirGitLoc,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
- p_out,p_err=p.communicate()
- if p.returncode != 0:
- msg = "Error in getCurrentVersion\n" + p_err
- raise Exception(msg)
- return p_out.strip()
-
-def compilePart0(topSrcDir,pattern,envAcc,srcDir,topBuildDir,topInstallDir,addCfgParam,forceRebuild):
- assert(os.path.isdir(srcDir))
- baseName=os.path.basename(srcDir)
- myBuildDir=os.path.realpath(os.path.join(topBuildDir,baseName))
- myInstallDir=os.path.realpath(os.path.join(topInstallDir,baseName))
- if os.path.exists(myBuildDir):
- if forceRebuild:
- shutil.rmtree(myBuildDir)
- os.mkdir(myBuildDir)
- else:
- if not os.path.exists(os.path.join(myBuildDir,okFlag)):
- shutil.rmtree(myBuildDir)
- os.mkdir(myBuildDir)
- else:
- with open(os.path.join(myBuildDir,okFlag)) as f:
- built_version = f.readline()
- built_version = built_version.strip()
- current_version = getCurrentVersion(topSrcDir,pattern)
- if current_version != built_version:
- print("For \"%s\" : Version has changed !"%srcDir)
- print(" Built version: %s"%built_version)
- print(" Needed version: %s"%current_version)
- shutil.rmtree(myBuildDir)
- os.mkdir(myBuildDir)
- else:
- if some_dependency_has_changed(pattern):
- print("For \"%s\" : Some dependencies have changed !"%srcDir)
- shutil.rmtree(myBuildDir)
- os.mkdir(myBuildDir)
- else:
- print("For \"%s\" : Do nothing !"%srcDir)
- return myBuildDir,myInstallDir,False
- else:
- os.mkdir(myBuildDir)
- pass
- __softwareChanged[pattern] = True
- return myBuildDir,myInstallDir,True
-
-def compilePart1(p,buildDir):
- a,b=p.communicate()
- f=file(os.path.join(buildDir,cfgOut),"w") ; f.write(a) ; f.flush()
- f=file(os.path.join(buildDir,cfgErr),"w") ; f.write(b) ; f.flush()
- if p.returncode != 0:
- msg = "Error in build step. See details in %s and %s\n"%(os.path.join(buildDir,cfgOut), os.path.join(buildDir,cfgErr))
- raise Exception(msg)
-
-def compilePart2(topSrcDir,pattern,envAcc,buildDir,splitInstall):
- print("make in %s"%(buildDir))
- if not splitInstall:
- p=subprocess.Popen(["make",paraCompFlag,"install"],cwd=buildDir,env=computeEnv(envAcc),stdout=subprocess.PIPE,stderr=subprocess.PIPE)
- a,b=p.communicate()
- f=file(os.path.join(buildDir,compOut),"w") ; f.write(a) ; f.flush()
- f=file(os.path.join(buildDir,compErr),"w") ; f.write(b) ; f.flush()
- if p.returncode != 0:
- msg = "Error in build step. See details in %s and %s\n"%(os.path.join(buildDir,compOut), os.path.join(buildDir,compErr))
- raise Exception(msg)
- else:
- p=subprocess.Popen(["make",paraCompFlag],cwd=buildDir,env=computeEnv(envAcc),stdout=subprocess.PIPE,stderr=subprocess.PIPE)
- a0,b0=p.communicate()
- f=file(os.path.join(buildDir,compOut),"w") ; f.write(a0) ; f.flush()
- f=file(os.path.join(buildDir,compErr),"w") ; f.write(b0) ; f.flush()
- if p.returncode != 0:
- msg = "Error in build step. See details in %s and %s\n"%(os.path.join(buildDir,compOut), os.path.join(buildDir,compErr))
- raise Exception(msg)
- p=subprocess.Popen(["make",paraCompFlag,"install"],cwd=buildDir,env=computeEnv(envAcc),stdout=subprocess.PIPE,stderr=subprocess.PIPE)
- a1,b1=p.communicate()
- f=file(os.path.join(buildDir,compOut),"w") ; f.write(a0+a1) ; f.flush()
- f=file(os.path.join(buildDir,compErr),"w") ; f.write(b0+b1) ; f.flush()
- if p.returncode != 0:
- msg = "Error in build step. See details in %s and %s\n"%(os.path.join(buildDir,compOut), os.path.join(buildDir,compErr))
- raise Exception(msg)
- pass
- current_version = getCurrentVersion(topSrcDir,pattern)
- with open(os.path.join(buildDir,okFlag),"w") as f:
- f.write(current_version + "\n")
- f.write(str(datetime.datetime.now()))
- f.flush()
- pass
-
-def compileOldCommon(topSrcDir,pattern,envAcc,srcDir,topBuildDir,topInstallDir,addCfgParam,forceRebuild,splitInstall):
- myBuildDir,myInstallDir,shouldContinue=compilePart0(topSrcDir,pattern,envAcc,srcDir,topBuildDir,topInstallDir,addCfgParam,forceRebuild)
- if not shouldContinue:
- return myInstallDir
- myCmd=[os.path.join(srcDir,"configure"),"--prefix=%s"%(myInstallDir)]+addCfgParam
- print "Command: ", " ".join(myCmd)
- p=subprocess.Popen(myCmd,cwd=myBuildDir,env=computeEnv(envAcc),stdout=subprocess.PIPE,stderr=subprocess.PIPE)
- compilePart1(p,myBuildDir)
- compilePart2(topSrcDir,pattern,envAcc,myBuildDir,splitInstall)
- return myInstallDir
-
-def compileOld(topSrcDir,pattern,envAcc,srcDir,topBuildDir,topInstallDir,addCfgParam,forceRebuild):
- return compileOldCommon(topSrcDir,pattern,envAcc,srcDir,topBuildDir,topInstallDir,addCfgParam,forceRebuild,False)
-
-def compileVeryOld(topSrcDir,pattern,envAcc,srcDir,topBuildDir,topInstallDir,addCfgParam,forceRebuild):
- return compileOldCommon(topSrcDir,pattern,envAcc,srcDir,topBuildDir,topInstallDir,addCfgParam,forceRebuild,True)
-
-def compileNew(topSrcDir,pattern,envAcc,srcDir,topBuildDir,topInstallDir,addCfgParam,forceRebuild):
- myBuildDir,myInstallDir,shouldContinue=compilePart0(topSrcDir,pattern,envAcc,srcDir,topBuildDir,topInstallDir,addCfgParam,forceRebuild)
- if not shouldContinue:
- return myInstallDir
- myCmd=["cmake","-DCMAKE_INSTALL_PREFIX=%s"%(myInstallDir)]+addCfgParam+[srcDir]
- print(" ".join(myCmd))
- p=subprocess.Popen(myCmd,cwd=myBuildDir,env=computeEnv(envAcc),stdout=subprocess.PIPE,stderr=subprocess.PIPE)
- compilePart1(p,myBuildDir)
- compilePart2(topSrcDir,pattern,envAcc,myBuildDir,False)
- return myInstallDir
-
-def accumulateEnv(installDir,pattern,envAcc):
- """ envAcc out parameter"""
- zeAccumulator=eval("%s_Environ"%pattern)
- zeAccumulator(installDir,envAcc)
- pass
-
-def generateInlineEnv(envAcc):
- d=computeEnv(envAcc)
- return "env "+" ".join(["%s=%s"%(k,d[k]) for k in d.keys()])
-
-def generateFileEnv(envAcc):
- d=computeEnv(envAcc)
- return "\n".join(["export %s=\"%s\""%(k,d[k]) for k in d.keys()])
-
-def bidouilleForCMake(topSrcDir,guiSrcDir):
- kernelFake="DUMMY_KERNEL"
- zeKernelFake=os.path.join(topSrcDir,kernelFake)
- if os.path.exists(zeKernelFake):
- shutil.rmtree(zeKernelFake)
- os.mkdir(zeKernelFake)
- distDir=os.path.join(zeKernelFake,"salome_adm")
- os.mkdir(distDir)
- shutil.copytree(os.path.join(guiSrcDir,"adm_local","cmake_files"),os.path.join(distDir,"cmake_files"))
- return os.path.abspath(zeKernelFake)
-
-def copyCMakeFromSrcToInstall(srcDir,installDir):
- zeSrcDir=os.path.join(srcDir,"cmake_files")
- zeInstDir=os.path.join(installDir,"cmake_files")
- for fi in glob.glob(os.path.join(zeSrcDir,"*.cmake")):
- shutil.copy(fi,zeInstDir)
+from salome_download import *
+from salome_compile import *
def patchCMakeLists(topSrcDir,srcDir):
realSrcDirSrc=os.path.join(srcDir,'src','Plugins','MEDReader')
if os.path.exists(destReal):
shutil.rmtree(destReal)
shutil.copytree(realSrcDirSrc,destReal)
- linesToAdd0="""INCLUDE(UseQtExt)
+ linesToAdd0="""LIST(APPEND CMAKE_MODULE_PATH "${CONFIGURATION_ROOT_DIR}/cmake")
+"""
+ linesToAdd1="""INCLUDE(UseQtExt)
"""
- linesToAdd1="""IF (NOT SALOME_GUI_BUILD_WITH_QT5)
+ linesToAdd2="""IF (NOT SALOME_GUI_BUILD_WITH_QT5)
FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui QtXml QtHelp)
ELSE()
FIND_PACKAGE(SalomeQt5 REQUIRED)
cmakeToPatch=os.path.join(destReal,"CMakeLists.txt")
assert(os.path.exists(cmakeToPatch))
f=file(cmakeToPatch) ; lines=f.readlines()
- pos0=filter(lambda (x,y): "INCLUDE(SalomeSetupPlatform)" in y,enumerate(lines))
+
+ pos0=filter(lambda (x,y): "INCLUDE(SalomeMacros)" in y,enumerate(lines))
assert(len(pos0)==1) ; pos0=pos0[0]
- lines=lines[0:pos0[0]+1]+[linesToAdd0]+lines[pos0[0]+1:]
- pos1=filter(lambda (x,y): "FIND_PACKAGE(SalomeMEDFile REQUIRED)" in y,enumerate(lines))
+ print pos0
+ lines=lines[0:pos0[0]]+[linesToAdd0]+lines[pos0[0]:]
+
+ pos1=filter(lambda (x,y): "INCLUDE(SalomeSetupPlatform)" in y,enumerate(lines))
assert(len(pos1)==1) ; pos1=pos1[0]
lines=lines[0:pos1[0]+1]+[linesToAdd1]+lines[pos1[0]+1:]
+
+ pos2=filter(lambda (x,y): "FIND_PACKAGE(SalomeMEDFile REQUIRED)" in y,enumerate(lines))
+ assert(len(pos2)==1) ; pos2=pos2[0]
+ lines=lines[0:pos2[0]+1]+[linesToAdd2]+lines[pos2[0]+1:]
+
f=file(cmakeToPatch,"w") ; f.writelines(lines)
return os.path.abspath(destReal)
os.mkdir(rootDir)
zz=AutoChdir(rootDir)
-envAcc={}
+
topSrcDir="src"
topBuildDir="build"
#
pattern="python"
srcDir=extractSrc(topSrcDir,pattern)
-installDir=compileOld(topSrcDir,pattern,envAcc,srcDir,topBuildDir,topInstallDir,["--enable-shared","--enable-unicode=ucs4","-without-pymalloc"],False)
+installDir=compileOld(topSrcDir,pattern,envAcc,srcDir,topBuildDir,topInstallDir,
+ ["--enable-shared",
+ "--enable-unicode=ucs4",
+ "-without-pymalloc"
+ ],False)
accumulateEnv(installDir,pattern,envAcc)
#
pattern="hdf5"
srcDir=extractSrc(topSrcDir,pattern)
installDir=compileNew(topSrcDir,pattern,envAcc,srcDir,topBuildDir,topInstallDir,
- ['-DHDF5_BUILD_HL_LIB=ON','-DHDF5_BUILD_TOOLS=ON','-DBUILD_SHARED_LIBS=ON','-DHDF5_ENABLE_Z_LIB_SUPPORT=ON','-DCMAKE_BUILD_TYPE=Release'],False)
+ ['-DHDF5_BUILD_HL_LIB=ON',
+ '-DHDF5_BUILD_TOOLS=ON',
+ '-DBUILD_SHARED_LIBS=ON',
+ '-DHDF5_ENABLE_Z_LIB_SUPPORT=ON',
+ '-DCMAKE_BUILD_TYPE=Release'
+ ],False)
accumulateEnv(installDir,pattern,envAcc)
#
pattern="swig"
srcDir=extractSrc(topSrcDir,pattern)
-installDir=compileVeryOld(topSrcDir,pattern,envAcc,srcDir,topBuildDir,topInstallDir,["--without-pcre","--without-octave"],False)
+installDir=compileVeryOld(topSrcDir,pattern,envAcc,srcDir,topBuildDir,topInstallDir,
+ ["--without-pcre",
+ "--without-octave"
+ ],False)
accumulateEnv(installDir,pattern,envAcc)
#
pattern="qt"
srcDir=extractSrc(topSrcDir,pattern)
-installDir=compileVeryOld(topSrcDir,pattern,envAcc,srcDir,topBuildDir,topInstallDir,["-opensource","-confirm-license","-no-rpath","-qt-xcb"],False)
+installDir=compileVeryOld(topSrcDir,pattern,envAcc,srcDir,topBuildDir,topInstallDir,
+ ["-opensource",
+ "-confirm-license",
+ "-no-rpath",
+ "-qt-xcb"
+ ],False)
accumulateEnv(installDir,pattern,envAcc)
#
pattern="med"
srcDir=extractSrc(topSrcDir,pattern)
-installDir=compileOld(topSrcDir,pattern,envAcc,srcDir,topBuildDir,topInstallDir,["--with-hdf5=%s"%(envAcc["HDF5HOME"]),"--enable-production"],False)
+installDir=compileOld(topSrcDir,pattern,envAcc,srcDir,topBuildDir,topInstallDir,
+ ["--with-hdf5=%s"%(envAcc["HDF5HOME"]),
+ "--enable-production"
+ ],False)
accumulateEnv(installDir,pattern,envAcc)
#
+pattern="repoConfig"
+srcDir=extractSrc(topSrcDir,pattern)
+accumulateEnv(srcDir,pattern,envAcc)
+#
pattern="medcoupling"
srcDir=extractSrc(topSrcDir,pattern)
installDir=compileNew(topSrcDir,pattern,envAcc,srcDir,topBuildDir,topInstallDir,
- ["-DMEDFILE_ROOT_DIR=%s"%(envAcc["MED3HOME"]),"-DCMAKE_BUILD_TYPE=Debug","-DMEDCOUPLING_BUILD_DOC=OFF","-DMEDCOUPLING_BUILD_TESTS=OFF",
- "-DMEDCOUPLING_PARTITIONER_METIS=OFF","-DMEDCOUPLING_ENABLE_RENUMBER=OFF","-DMEDCOUPLING_PARTITIONER_SCOTCH=OFF",
+ ["-DCMAKE_BUILD_TYPE=Debug",
+ "-DMEDCOUPLING_BUILD_DOC=OFF",
+ "-DMEDCOUPLING_BUILD_TESTS=OFF",
+ "-DMEDCOUPLING_PARTITIONER_METIS=OFF",
+ "-DMEDCOUPLING_ENABLE_RENUMBER=OFF",
+ "-DMEDCOUPLING_PARTITIONER_SCOTCH=OFF",
+ "-DCONFIGURATION_ROOT_DIR=%s"%(envAcc["CONFIGURATION_ROOT_DIR"]),
+ "-DCONFIGURATION_CMAKE_DIR=%s/cmake"%(envAcc["CONFIGURATION_ROOT_DIR"]),
+ "-DPYTHONROOT_DIR=%s"%envAcc["PYTHONHOME"],
"-DPYTHONINTERP_ROOT_DIR=%s"%envAcc["PYTHONHOME"],
"-DPYTHONLIBS_ROOT_DIR=%s"%envAcc["PYTHONHOME"],
-],False)
+ "-DHDF5_ROOT_DIR=%s"%(envAcc["HDF5HOME"]),
+ "-DMEDFICHIER_ROOT_DIR=%s"%(envAcc["MED3HOME"]),
+ "-DMEDFILE_ROOT_DIR=%s"%(envAcc["MED3HOME"]),
+ "-DSWIG_EXECUTABLE=%s"%(envAcc["SWIG_EXECUTABLE"]),
+ "-DSWIG_VERSION=%s"%(envAcc["SWIG_VERSION"]),
+ ],False)
accumulateEnv(installDir,pattern,envAcc)
-#copyCMakeFromSrcToInstall(srcDir,installDir)#patch
#
pattern="paraview"
srcDir=extractSrc(topSrcDir,pattern)
installDir=compileNew(topSrcDir,pattern,envAcc,srcDir,topBuildDir,topInstallDir,
- ['-DPYTHON_ROOT_DIR=%s'%(envAcc["PYTHONHOME"]),'-DHDF5_ROOT_DIR=%s'%(envAcc["HDF5HOME"]),'-DPYTHON_EXECUTABLE=%s/bin/python%s'%(envAcc["PYTHONHOME"],envAcc["PYTHON_VERSION"]),
- '-DPYTHON_INCLUDE_DIR=%s'%(envAcc["PYTHON_INCLUDE"]),'-DPYTHON_LIBRARY=%s/lib/libpython%s.so'%(envAcc["PYTHONHOME"],envAcc["PYTHON_VERSION"]),
+ ['-DPYTHON_ROOT_DIR=%s'%(envAcc["PYTHONHOME"]),
+ '-DHDF5_ROOT_DIR=%s'%(envAcc["HDF5HOME"]),
+ '-DPYTHON_EXECUTABLE=%s/bin/python%s'%(envAcc["PYTHONHOME"],envAcc["PYTHON_VERSION"]),
+ '-DPYTHON_INCLUDE_DIR=%s'%(envAcc["PYTHON_INCLUDE"]),
+ '-DPYTHON_LIBRARY=%s/lib/libpython%s.so'%(envAcc["PYTHONHOME"],envAcc["PYTHON_VERSION"]),
'-DHDF5_LIBRARIES=%s/lib'%(envAcc["HDF5HOME"]),
- '-DHDF5_INCLUDE_DIRS=%s/include'%(envAcc["HDF5HOME"]),'-DHDF5_CXX_COMPILER_EXECUTABLE=%s/bin/h5pcc'%(envAcc["HDF5HOME"]),
- '-DHDF5_HL_INCLUDE_DIR=%s/include'%(envAcc["HDF5HOME"]),'-DHDF5_hdf5_hl_LIBRARY=%s/lib/libhdf5_hl.so'%(envAcc["HDF5HOME"]),
- '-DHDF5_hdf5_hl_LIBRARY_RELEASE=%s/lib/libhdf5_hl.so'%(envAcc["HDF5HOME"]),'-DHDF5_hdf5_hl_LIBRARY_DEBUG=%s/lib/libhdf5_hl.so'%(envAcc["HDF5HOME"]),
- '-DHDF5_HL_LIBRARY=%s/lib/libhdf5_hl.so'%(envAcc["HDF5HOME"]),'-DBUILD_SHARED_LIBS:BOOL=ON','-DCMAKE_BUILD_TYPE:STRING=Debug',
- '-DPARAVIEW_INSTALL_DEVELOPMENT:BOOL=ON','-DPARAVIEW_INSTALL_DEVELOPMENT_FILES:BOOL=ON','-DVTK_USE_64BIT_IDS:BOOL=OFF','-DPARAVIEW_BUILD_QT_GUI:BOOL=ON',
- '-DVTK_QT_USE_WEBKIT:BOOL=ON','-DQT_TESTING_INSTALL_DEVELOPMENT:BOOL=ON','-DPARAVIEW_ENABLE_PYTHON:BOOL=ON','-DVTK_USE_SYSTEM_HDF5:BOOL=ON','-DVTK_USE_GL2PS:BOOL=ON',
- '-DPARAVIEW_BUILD_PLUGIN_Moments:BOOL=OFF', '-DPARAVIEW_BUILD_PLUGIN_SierraPlotTools:BOOL=OFF', '-DPARAVIEW_BUILD_PLUGIN_SLACTools:BOOL=OFF',
+ '-DHDF5_INCLUDE_DIRS=%s/include'%(envAcc["HDF5HOME"]),
+ '-DHDF5_CXX_COMPILER_EXECUTABLE=%s/bin/h5pcc'%(envAcc["HDF5HOME"]),
+ '-DHDF5_HL_INCLUDE_DIR=%s/include'%(envAcc["HDF5HOME"]),
+ '-DHDF5_hdf5_hl_LIBRARY=%s/lib/libhdf5_hl.so'%(envAcc["HDF5HOME"]),
+ '-DHDF5_hdf5_hl_LIBRARY_RELEASE=%s/lib/libhdf5_hl.so'%(envAcc["HDF5HOME"]),
+ '-DHDF5_hdf5_hl_LIBRARY_DEBUG=%s/lib/libhdf5_hl.so'%(envAcc["HDF5HOME"]),
+ '-DHDF5_HL_LIBRARY=%s/lib/libhdf5_hl.so'%(envAcc["HDF5HOME"]),
+ '-DBUILD_SHARED_LIBS:BOOL=ON',
+ '-DCMAKE_BUILD_TYPE:STRING=Debug',
+ '-DPARAVIEW_INSTALL_DEVELOPMENT:BOOL=ON',
+ '-DPARAVIEW_INSTALL_DEVELOPMENT_FILES:BOOL=ON',
+ '-DVTK_USE_64BIT_IDS:BOOL=OFF',
+ '-DPARAVIEW_BUILD_QT_GUI:BOOL=ON',
+ '-DVTK_QT_USE_WEBKIT:BOOL=ON',
+ '-DQT_TESTING_INSTALL_DEVELOPMENT:BOOL=ON',
+ '-DPARAVIEW_ENABLE_PYTHON:BOOL=ON',
+ '-DVTK_USE_SYSTEM_HDF5:BOOL=ON',
+ '-DVTK_USE_GL2PS:BOOL=ON',
+ '-DPARAVIEW_BUILD_PLUGIN_Moments:BOOL=OFF',
+ '-DPARAVIEW_BUILD_PLUGIN_SierraPlotTools:BOOL=OFF',
+ '-DPARAVIEW_BUILD_PLUGIN_SLACTools:BOOL=OFF',
'-DPARAVIEW_INSTALL_DEVELOPMENT_FILES=ON',
- '-DVTK_NO_PYTHON_THREADS=OFF','-DPARAVIEW_ENABLE_CATALYST:BOOL=ON','-DPARAVIEW_BUILD_PLUGIN_AnalyzeNIfTIIO:BOOL=OFF','-DPARAVIEW_BUILD_PLUGIN_ArrowGlyph:BOOL=OFF',
- '-DPARAVIEW_BUILD_PLUGIN_CatalystScriptGeneratorPlugin:BOOL=ON','-DPARAVIEW_BUILD_PLUGIN_GMVReader:BOOL=OFF','-DPARAVIEW_BUILD_PLUGIN_MobileRemoteControl:BOOL=OFF',
- '-DPARAVIEW_BUILD_PLUGIN_NonOrthogonalSource:BOOL=OFF','-DPARAVIEW_BUILD_PLUGIN_QuadView:BOOL=OFF','-DPARAVIEW_BUILD_PLUGIN_PacMan:BOOL=OFF','-DPARAVIEW_BUILD_PLUGIN_PrismPlugin:BOOL=OFF',
- '-DPARAVIEW_BUILD_PLUGIN_RGBZView:BOOL=OFF','-DPARAVIEW_BUILD_PLUGIN_SciberQuestToolKit:BOOL=OFF','-DPARAVIEW_BUILD_PLUGIN_StreamingParticles:BOOL=ON',
- '-DPARAVIEW_BUILD_PLUGIN_UncertaintyRendering:BOOL=ON','-DPARAVIEW_ENABLE_MATPLOTLIB:BOOL=ON','-DPARAVIEW_BUILD_PLUGIN_EyeDomeLighting:BOOL=ON','-DPARAVIEW_BUILD_PLUGIN_ForceTime:BOOL=ON',
- '-DPARAVIEW_BUILD_PLUGIN_H5PartReader:BOOL=ON','-DPARAVIEW_BUILD_PLUGIN_PointSprite:BOOL=ON','-DPARAVIEW_BUILD_PLUGIN_SurfaceLIC:BOOL=ON',
- '-DCMAKE_BUILD_QT_GUI:BOOL=ON','-DVTK_USE_SYSTEM_LIBXML2:BOOL=ON','-DVTK_USE_OGGTHEORA_ENCODER:BOOL=ON','-DPARAVIEW_INSTALL_THIRD_PARTY_LIBRARIES:BOOL=OFF',
- '-DBUILD_DOCUMENTATION:BOOL=ON','-DBUILD_EXAMPLES:BOOL=OFF','-DBUILD_TESTING:BOOL=OFF', '-DPARAVIEW_GENERATE_PROXY_DOCUMENTATION:BOOL=ON','-DVTK_NO_PYTHON_THREADS=OFF',
- '-DVTK_PYTHON_FULL_THREADSAFE=ON','-DPARAVIEW_QT_VERSION=5','-DQT_HELP_GENERATOR=%s/bin/qhelpgenerator'%(envAcc["QTDIR"]),'-DVTK_BUILD_QT_DESIGNER_PLUGIN:BOOL=OFF','-DBUILD_DOCUMENTATION=OFF'],False)
+ '-DVTK_NO_PYTHON_THREADS=OFF',
+ '-DPARAVIEW_ENABLE_CATALYST:BOOL=ON',
+ '-DPARAVIEW_BUILD_PLUGIN_AnalyzeNIfTIIO:BOOL=OFF',
+ '-DPARAVIEW_BUILD_PLUGIN_ArrowGlyph:BOOL=OFF',
+ '-DPARAVIEW_BUILD_PLUGIN_CatalystScriptGeneratorPlugin:BOOL=ON',
+ '-DPARAVIEW_BUILD_PLUGIN_GMVReader:BOOL=OFF',
+ '-DPARAVIEW_BUILD_PLUGIN_MobileRemoteControl:BOOL=OFF',
+ '-DPARAVIEW_BUILD_PLUGIN_NonOrthogonalSource:BOOL=OFF',
+ '-DPARAVIEW_BUILD_PLUGIN_QuadView:BOOL=OFF',
+ '-DPARAVIEW_BUILD_PLUGIN_PacMan:BOOL=OFF',
+ '-DPARAVIEW_BUILD_PLUGIN_PrismPlugin:BOOL=OFF',
+ '-DPARAVIEW_BUILD_PLUGIN_RGBZView:BOOL=OFF',
+ '-DPARAVIEW_BUILD_PLUGIN_SciberQuestToolKit:BOOL=OFF',
+ '-DPARAVIEW_BUILD_PLUGIN_StreamingParticles:BOOL=ON',
+ '-DPARAVIEW_BUILD_PLUGIN_UncertaintyRendering:BOOL=ON',
+ '-DPARAVIEW_ENABLE_MATPLOTLIB:BOOL=ON',
+ '-DPARAVIEW_BUILD_PLUGIN_EyeDomeLighting:BOOL=ON',
+ '-DPARAVIEW_BUILD_PLUGIN_ForceTime:BOOL=ON',
+ '-DPARAVIEW_BUILD_PLUGIN_H5PartReader:BOOL=ON',
+ '-DPARAVIEW_BUILD_PLUGIN_PointSprite:BOOL=ON',
+ '-DPARAVIEW_BUILD_PLUGIN_SurfaceLIC:BOOL=ON',
+ '-DCMAKE_BUILD_QT_GUI:BOOL=ON',
+ '-DVTK_USE_SYSTEM_LIBXML2:BOOL=ON',
+ '-DVTK_USE_OGGTHEORA_ENCODER:BOOL=ON',
+ '-DPARAVIEW_INSTALL_THIRD_PARTY_LIBRARIES:BOOL=OFF',
+ '-DBUILD_DOCUMENTATION:BOOL=ON',
+ '-DBUILD_EXAMPLES:BOOL=OFF',
+ '-DBUILD_TESTING:BOOL=OFF',
+ '-DPARAVIEW_GENERATE_PROXY_DOCUMENTATION:BOOL=ON',
+ '-DVTK_NO_PYTHON_THREADS=OFF',
+ '-DVTK_PYTHON_FULL_THREADSAFE=ON',
+ '-DPARAVIEW_QT_VERSION=%s'%(envAcc["QTVERSION"]),
+ '-DQT_HELP_GENERATOR=%s/bin/qhelpgenerator'%(envAcc["QTDIR"]),
+ '-DVTK_BUILD_QT_DESIGNER_PLUGIN:BOOL=OFF',
+ '-DBUILD_DOCUMENTATION=OFF'
+ ],False)
accumulateEnv(installDir,pattern,envAcc)
#
-pattern="gui"
-srcDir=extractSrc(topSrcDir,pattern)
-fakeKernelDir=bidouilleForCMake(topSrcDir,srcDir)
-#
pattern="paravis"# for MEDReader
srcDir=extractSrc(topSrcDir,pattern)
srcDir=patchCMakeLists(topSrcDir,srcDir)# change Reference for source
installDir=compileNew(topSrcDir,pattern,envAcc,srcDir,topBuildDir,topInstallDir,
- ["-DMEDCOUPLING_ROOT_DIR=%s"%(envAcc["MEDCOUPLINGHOME"]),"-DKERNEL_ROOT_DIR=%s"%fakeKernelDir,
- '-DPYTHON_ROOT_DIR=%s'%(envAcc["PYTHONHOME"]),'-DHDF5_ROOT_DIR=%s'%(envAcc["HDF5HOME"]),
+ ["-DMEDCOUPLING_ROOT_DIR=%s"%(envAcc["MEDCOUPLINGHOME"]),
+ "-DCONFIGURATION_ROOT_DIR=%s"%(envAcc["CONFIGURATION_ROOT_DIR"]),
+ '-DPYTHON_ROOT_DIR=%s'%(envAcc["PYTHONHOME"]),
+ '-DHDF5_ROOT_DIR=%s'%(envAcc["HDF5HOME"]),
'-DPYTHON_EXECUTABLE=%s/bin/python%s'%(envAcc["PYTHONHOME"],envAcc["PYTHON_VERSION"]),
- '-DPYTHON_INCLUDE_DIR=%s'%(envAcc["PYTHON_INCLUDE"]),'-DPARAVIEW_QT_VERSION=5','-DQT_VERSION=5','-DSALOME_GUI_BUILD_WITH_QT5=ON','-DSALOME_INSTALL_SCRIPT_SCRIPTS=%s'%topInstallDir,
+ '-DPYTHON_INCLUDE_DIR=%s'%(envAcc["PYTHON_INCLUDE"]),
+ '-DPARAVIEW_QT_VERSION=5',
+ '-DQT_VERSION=5',
+ '-DSALOME_GUI_BUILD_WITH_QT5=ON',
+ '-DSALOME_INSTALL_SCRIPT_SCRIPTS=%s'%topInstallDir,
'-DPYTHON_LIBRARY=%s/lib/libpython%s.so'%(envAcc["PYTHONHOME"],envAcc["PYTHON_VERSION"])],False)
accumulateEnv(installDir,pattern,envAcc)
# END