def make(commit=DEFAULT_HASH): softdir = getSoftDir() if commit != 'master': if checkExists(get_path(commit)): return blddir = softdir / "UKFTractography-build" with local.cwd(softdir): repo = downloadGithubRepo('pnlbwh/ukftractography', commit) sha, date = getCommitInfo(repo) outbinary = get_path(sha) if checkExists(outbinary): return logging.info("Build code:") blddir.mkdir() with local.cwd(blddir): cmake(repo) import plumbum.cmd plumbum.cmd.make['-j', psutil.cpu_count(logical=False)] & FG binary1 = blddir / 'ukf/bin/UKFTractography' binary2 = blddir / 'UKFTractography-build/UKFTractography/bin/UKFTractography' # later commits binary = binary1 if binary1.exists() else binary2 outbinary.dirname.mkdir() binary.move(outbinary) # chmod('a-w', outbinary) with open(outbinary.dirname / 'env.sh', 'w') as f: f.write("export PATH={}:$PATH".format(outbinary.dirname)) symlink = get_path(date).dirname print("Make symlink: {} -> {}".format(symlink, get_path(sha).dirname)) symlink.unlink() get_path(sha).dirname.symlink(symlink) blddir.delete() logging.info("Made '{}'".format(outbinary)) logging.info("Made '{}'".format(get_path(date)))
def build_udfs(): logger.info('Building UDFs') ibis_home_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) udf_dir = os.path.join(ibis_home_dir, 'ci', 'udf') with local.cwd(udf_dir): assert cmake('.') and make('VERBOSE=1')
def make(commit=DEFAULT_HASH): softdir = getSoftDir() if commit != 'master': if checkExists(get_path(commit)): return blddir = softdir / "dcm2niix-build" with local.cwd(softdir): repo = downloadGithubRepo('rordenlab/dcm2niix', commit) sha, date = getCommitInfo(repo) outbinary = get_path(sha) if checkExists(outbinary): return logging.info("Build code:") blddir.mkdir() with local.cwd(blddir): cmake(repo, "-DUSE_STATIC_RUNTIME:BOOL=OFF") import plumbum.cmd plumbum.cmd.make['-j', psutil.cpu_count(logical=False)] & FG binary = blddir / 'bin/dcm2niix' outbinary.dirname.mkdir() binary.move(outbinary) # chmod('a-w', outbinary) with open(outbinary.dirname / 'env.sh', 'w') as f: f.write("export PATH={}:$PATH".format(outbinary.dirname)) symlink = get_path(date).dirname print("Make symlink: {} -> {}".format(symlink, get_path(sha).dirname)) symlink.unlink() get_path(sha).dirname.symlink(symlink) blddir.delete() logging.info("Made '{}'".format(outbinary)) logging.info("Made '{}'".format(get_path(date)))
def make(commit=DEFAULT_HASH): softdir = getSoftDir() blddir = softdir / "ANTs-build" with local.cwd(softdir): repo = downloadGithubRepo('ANTsX/ANTs', commit) sha, date = getCommitInfo(repo) out = get_path(sha) # if output binary directory already exists, then return if checkExists(out): return logging.info("Build code:") blddir.mkdir() with local.cwd(blddir): cmake(repo) import plumbum.cmd plumbum.cmd.make['-j', psutil.cpu_count(logical=False)] & FG # copy ANTs scripts cp('-a', (softdir / 'ANTs' / 'Scripts').list(), blddir / 'ANTS-build' / 'Examples') # move binary directory (blddir / 'ANTS-build' / 'Examples').move(out) # write PATH and ANTSPATH with open(out / 'env.sh', 'w') as f: f.write("export PATH={}:$PATH\n".format(out)) f.write("export ANTSPATH={}\n".format(out)) # generate symbolink links symlink = get_path(date) print("Make symlink: {} -> {}".format(symlink, get_path(sha))) symlink.unlink() get_path(sha).symlink(symlink) logging.info("Made '{}'".format(out))
def install_uchroot(self): builddir = settings.CFG["build_dir"].value() with local.cwd(builddir): if not os.path.exists("erlent/.git"): git("clone", "[email protected]:PolyJIT/erlent") else: with local.cwd("erlent"): git("pull", "--rebase") mkdir("-p", "erlent/build") with local.cwd("erlent/build"): from plumbum.cmd import cmake, make, cp cmake("../") make() erlent_path = os.path.abspath(os.path.join(builddir, "erlent", "build")) os.environ["PATH"] = os.path.pathsep.join([erlent_path, os.environ[ "PATH"]]) local.env.update(PATH=os.environ["PATH"]) if not find_package("uchroot"): sys.exit(-1) settings.CFG["env"]["lookup_path"].value().append(erlent_path)
def make(commit=DEFAULT_HASH, delete=False): """Downloads and compiles BRAINSTools binaries. Output is '$soft/BRAINSTools-bin-<hash>'.""" if os.getenv("CONDA_PREFIX"): # add CONDA_PREFIX paths to the compiler flags so we prefer conda's includes and libs conda_prefix = os.getenv("CONDA_PREFIX") build_flags = " -I{conda_prefix}/include -L{conda_prefix}/lib".format(conda_prefix=conda_prefix) cflags = os.getenv("CFLAGS") + " " + build_flags cxxflags = os.getenv("CXXFLAGS") + " " + build_flags local.env["CFLAGS"] = cflags local.env["CXXFLAGS"] = cxxflags local.env["ICU_ROOT_DIR"] = conda_prefix local.env["ICU_ROOT"] = conda_prefix dest = getSoftDir() if commit != 'master': out = dest / ('BRAINSTools-bin-'+commit) if checkExists(out): return blddir = dest / "BRAINSTools-build" with local.cwd(dest): repo = downloadGithubRepo('BRAINSia/BRAINSTools', commit) sha, date = getCommitInfo(repo) out = dest / ('BRAINSTools-bin-'+sha) symlink = dest / ('BRAINSTools-bin-'+date) symlink.unlink() log.info("Make '{}'".format(out)) log.info("Make '{}'".format(symlink)) if checkExists(out): return logging.info("Build code:") blddir.mkdir() with local.cwd(blddir): cmake(repo ,"-DBRAINSTools_INSTALL_DEVELOPMENT=OFF" ,"-DBRAINSTools_MAX_TEST_LEVEL=0" ,"-DBRAINSTools_SUPERBUILD=ON" ,"-DBRAINSTools_USE_QT=OFF" ,"-DBRAINS_DEBUG_IMAGE_WRITE=OFF" ,"-DBUILD_STYLE_UTILS=OFF" ,"-DBUILD_TESTING=OFF" ,"-DCMAKE_BUILD_TYPE=Release" ,"-DCMAKE_COLOR_MAKEFILE=ON" ,"-DCMAKE_EXE_LINKER_FLAGS=' '" ,"-DCMAKE_EXE_LINKER_FLAGS_DEBUG=" ,"-DCMAKE_EXE_LINKER_FLAGS_MINSIZEREL=" ,"-DCMAKE_EXE_LINKER_FLAGS_RELEASE=" ,"-DCMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO=" ,"-DCMAKE_EXPORT_COMPILE_COMMANDS=OFF" ,"-DCMAKE_INSTALL_PREFIX:PATH=/usr/local" ,"-DCMAKE_MODULE_LINKER_FLAGS=' '" ,"-DCMAKE_MODULE_LINKER_FLAGS_DEBUG=" ,"-DCMAKE_MODULE_LINKER_FLAGS_MINSIZEREL=" ,"-DCMAKE_MODULE_LINKER_FLAGS_RELEASE=" ,"-DCMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO=" ,"-DCMAKE_PROJECT_NAME:STATIC=SuperBuild_BRAINSTools" ,"-DCMAKE_SHARED_LINKER_FLAGS=' '" ,"-DCMAKE_SHARED_LINKER_FLAGS_DEBUG=" ,"-DCMAKE_SHARED_LINKER_FLAGS_MINSIZEREL=" ,"-DCMAKE_SHARED_LINKER_FLAGS_RELEASE=" ,"-DCMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO=" ,"-DCMAKE_SKIP_INSTALL_RPATH=NO" ,"-DCMAKE_SKIP_RPATH=NO" ,"-DCMAKE_STATIC_LINKER_FLAGS=" ,"-DCMAKE_STATIC_LINKER_FLAGS_DEBUG=" ,"-DCMAKE_STATIC_LINKER_FLAGS_MINSIZEREL=" ,"-DCMAKE_STATIC_LINKER_FLAGS_RELEASE=" ,"-DCMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO=" ,"-DCMAKE_USE_RELATIVE_PATHS=OFF" ,"-DCMAKE_VERBOSE_MAKEFILE=FALSE" ,"-DCOVERAGE_EXTRA_FLAGS=-l" ,"-DCTEST_SUBMIT_RETRY_COUNT=3" ,"-DCTEST_SUBMIT_RETRY_DELAY=5" ,"-DDART_TESTING_TIMEOUT=1500" ,"-DEXTERNAL_PROJECT_BUILD_TYPE=Release" ,"-DFORCE_EXTERNAL_BUILDS=OFF" ,"-DITK_VERSION_MAJOR=4" ,"-DSuperBuild_BRAINSTools_BUILD_DICOM_SUPPORT=ON" ,"-DSuperBuild_BRAINSTools_USE_CTKAPPLAUNCHER=OFF" ,"-DSuperBuild_BRAINSTools_USE_GIT_PROTOCOL=ON" ,"-DUSE_ANTS=ON" ,"-DUSE_AutoWorkup=OFF" ,"-DUSE_BRAINSABC=OFF" ,"-DUSE_BRAINSConstellationDetector=OFF" ,"-DUSE_BRAINSContinuousClass=OFF" ,"-DUSE_BRAINSCreateLabelMapFromProbabilityMaps=OFF" ,"-DUSE_BRAINSCut=OFF" ,"-DUSE_BRAINSDWICleanup=OFF" ,"-DUSE_BRAINSDemonWarp=OFF" ,"-DUSE_BRAINSFit=OFF" ,"-DUSE_BRAINSInitializedControlPoints=OFF" ,"-DUSE_BRAINSLabelStats=OFF" ,"-DUSE_BRAINSLandmarkInitializer=OFF" ,"-DUSE_BRAINSMultiModeSegment=OFF" ,"-DUSE_BRAINSMultiSTAPLE=OFF" ,"-DUSE_BRAINSMush=OFF" ,"-DUSE_BRAINSPosteriorToContinuousClass=OFF" ,"-DUSE_BRAINSROIAuto=OFF" ,"-DUSE_BRAINSResample=OFF" ,"-DUSE_BRAINSSnapShotWriter=OFF" ,"-DUSE_BRAINSStripRotation=OFF" ,"-DUSE_BRAINSSurfaceTools=OFF" ,"-DUSE_BRAINSTalairach=OFF" ,"-DUSE_BRAINSTransformConvert=OFF" ,"-DUSE_ConvertBetweenFileFormats=ON" ,"-DUSE_DWIConvert=ON" ,"-DUSE_DebugImageViewer=OFF" ,"-DUSE_GTRACT=OFF" ,"-DUSE_ICCDEF=OFF" ,"-DUSE_ImageCalculator=OFF" ,"-DUSE_ReferenceAtlas=OFF" ,"-DUSE_SYSTEM_DCMTK=OFF" ,"-DUSE_SYSTEM_ITK=OFF" ,"-DUSE_SYSTEM_SlicerExecutionModel=OFF" ,"-DUSE_SYSTEM_VTK=OFF" ,"-DVTK_GIT_REPOSITORY=git://vtk.org/VTK.git" ) import plumbum.cmd plumbum.cmd.make['-j', psutil.cpu_count(logical=False)] & FG (blddir / 'bin').move(out) with open(blddir / 'ANTs/Scripts/antsRegistrationSyN.sh', 'r') as src: with open(out / 'antsRegistrationSyN.sh', 'w') as dest: for idx, line in enumerate(src): if idx == 0: dest.write('#!/usr/bin/env bash') else: dest.write(line) st = os.stat(str(out / 'antsRegistrationSyN.sh')) os.chmod(str(out / 'antsRegistrationSyN.sh'), st.st_mode | stat.S_IEXEC) # (blddir / 'ANTs/Scripts/antsRegistrationSyN.sh').copy(out) with open(out / 'env.sh', 'w') as f: f.write("export PATH={}:$PATH\n".format(out)) f.write("export ANTSPATH={}\n".format(out)) # chmod('a-w', out.glob('*')) # chmod('a-w', out) symlink.unlink() out.symlink(symlink) if sys.flags.interactive: if input("Delete build directory? [y/N]") == "y": blddir.delete() log.info("Made '{}'".format(get_path(sha))) log.info("Made '{}'".format(symlink))
def main(self): blddir = self.parent.dest / "BRAINSTools-build" with local.cwd(self.parent.dest): repo = downloadGithubRepo('BRAINSia/BRAINSTools', self.parent.commit) sha, date = getCommitInfo(repo) logging.info("Build code:") blddir.mkdir() with local.cwd(blddir): cmake( repo, "-DBRAINSTools_INSTALL_DEVELOPMENT=OFF", "-DBRAINSTools_MAX_TEST_LEVEL=0", "-DBRAINSTools_SUPERBUILD=ON", "-DBRAINSTools_USE_QT=OFF", "-DBRAINS_DEBUG_IMAGE_WRITE=OFF", "-DBUILD_STYLE_UTILS=OFF", "-DBUILD_TESTING=OFF", "-DCMAKE_BUILD_TYPE=Release", "-DCMAKE_COLOR_MAKEFILE=ON", "-DCMAKE_EXE_LINKER_FLAGS=' '", "-DCMAKE_EXE_LINKER_FLAGS_DEBUG=", "-DCMAKE_EXE_LINKER_FLAGS_MINSIZEREL=", "-DCMAKE_EXE_LINKER_FLAGS_RELEASE=", "-DCMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO=", "-DCMAKE_EXPORT_COMPILE_COMMANDS=OFF", "-DCMAKE_INSTALL_PREFIX:PATH=/usr/local", "-DCMAKE_MODULE_LINKER_FLAGS=' '", "-DCMAKE_MODULE_LINKER_FLAGS_DEBUG=", "-DCMAKE_MODULE_LINKER_FLAGS_MINSIZEREL=", "-DCMAKE_MODULE_LINKER_FLAGS_RELEASE=", "-DCMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO=", "-DCMAKE_PROJECT_NAME:STATIC=SuperBuild_BRAINSTools", "-DCMAKE_SHARED_LINKER_FLAGS=' '", "-DCMAKE_SHARED_LINKER_FLAGS_DEBUG=", "-DCMAKE_SHARED_LINKER_FLAGS_MINSIZEREL=", "-DCMAKE_SHARED_LINKER_FLAGS_RELEASE=", "-DCMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO=", "-DCMAKE_SKIP_INSTALL_RPATH=NO", "-DCMAKE_SKIP_RPATH=NO", "-DCMAKE_STATIC_LINKER_FLAGS=", "-DCMAKE_STATIC_LINKER_FLAGS_DEBUG=", "-DCMAKE_STATIC_LINKER_FLAGS_MINSIZEREL=", "-DCMAKE_STATIC_LINKER_FLAGS_RELEASE=", "-DCMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO=", "-DCMAKE_USE_RELATIVE_PATHS=OFF", "-DCMAKE_VERBOSE_MAKEFILE=FALSE", "-DCOVERAGE_EXTRA_FLAGS=-l", "-DCTEST_SUBMIT_RETRY_COUNT=3", "-DCTEST_SUBMIT_RETRY_DELAY=5", "-DDART_TESTING_TIMEOUT=1500", "-DEXTERNAL_PROJECT_BUILD_TYPE=Release", "-DFORCE_EXTERNAL_BUILDS=OFF", "-DITK_VERSION_MAJOR=4", "-DSuperBuild_BRAINSTools_BUILD_DICOM_SUPPORT=ON", "-DSuperBuild_BRAINSTools_USE_CTKAPPLAUNCHER=OFF", "-DSuperBuild_BRAINSTools_USE_GIT_PROTOCOL=ON", "-DUSE_ANTS=ON", "-DUSE_AutoWorkup=OFF", "-DUSE_BRAINSABC=OFF", "-DUSE_BRAINSConstellationDetector=OFF", "-DUSE_BRAINSContinuousClass=OFF", "-DUSE_BRAINSCreateLabelMapFromProbabilityMaps=OFF", "-DUSE_BRAINSCut=OFF", "-DUSE_BRAINSDWICleanup=OFF", "-DUSE_BRAINSDemonWarp=OFF", "-DUSE_BRAINSFit=OFF", "-DUSE_BRAINSInitializedControlPoints=OFF", "-DUSE_BRAINSLabelStats=OFF", "-DUSE_BRAINSLandmarkInitializer=OFF", "-DUSE_BRAINSMultiModeSegment=OFF", "-DUSE_BRAINSMultiSTAPLE=OFF", "-DUSE_BRAINSMush=OFF", "-DUSE_BRAINSPosteriorToContinuousClass=OFF", "-DUSE_BRAINSROIAuto=OFF", "-DUSE_BRAINSResample=OFF", "-DUSE_BRAINSSnapShotWriter=OFF", "-DUSE_BRAINSStripRotation=OFF", "-DUSE_BRAINSSurfaceTools=OFF", "-DUSE_BRAINSTalairach=OFF", "-DUSE_BRAINSTransformConvert=OFF", "-DUSE_ConvertBetweenFileFormats=ON", "-DUSE_DWIConvert=ON", "-DUSE_DebugImageViewer=OFF", "-DUSE_GTRACT=OFF", "-DUSE_ICCDEF=OFF", "-DUSE_ImageCalculator=OFF", "-DUSE_ReferenceAtlas=OFF", "-DUSE_SYSTEM_DCMTK=OFF", "-DUSE_SYSTEM_ITK=OFF", "-DUSE_SYSTEM_SlicerExecutionModel=OFF", "-DUSE_SYSTEM_VTK=OFF", "-DVTK_GIT_REPOSITORY=git://vtk.org/VTK.git") make['all'] & FG out = self.parent.dest / 'BRAINSTools-bin-' + sha symlink = self.parent.dest / 'BRAINSTools-bin-' + date (blddir / 'bin').move(out) (blddir / 'ANTs/Scripts/antsRegistrationSyN.sh').copy(out) chmod('a-w', out // '*') chmod('a-w', out) outdir.symlink(symlink)
def main(): srcdir = self.prefix / "BRAINSTools" blddir = self.prefix / "BRAINSTools-build" logging.info("Get source:") if not srcdir.exists(): repo = 'https://github.com/BRAINSia/BRAINSTools.git' git("clone", repo, srcdir) else: with local.cwd(srcdir): git("fetch", "origin") if self.githash is not None: git("checkout", args.githash) clone_hash = git("rev-parse", "--short", "HEAD")[:-1] # remove trailing \n logging.info("Build code:") blddir.mkdir() with local.cwd(blddir): cmake( srcdir, "-DBRAINSTools_INSTALL_DEVELOPMENT=OFF", "-DBRAINSTools_MAX_TEST_LEVEL=0", "-DBRAINSTools_SUPERBUILD=ON", "-DBRAINSTools_USE_QT=OFF", "-DBRAINS_DEBUG_IMAGE_WRITE=OFF", "-DBUILD_STYLE_UTILS=OFF", "-DBUILD_TESTING=OFF", "-DCMAKE_BUILD_TYPE=Release", "-DCMAKE_COLOR_MAKEFILE=ON", "-DCMAKE_EXE_LINKER_FLAGS=' '", "-DCMAKE_EXE_LINKER_FLAGS_DEBUG=", "-DCMAKE_EXE_LINKER_FLAGS_MINSIZEREL=", "-DCMAKE_EXE_LINKER_FLAGS_RELEASE=", "-DCMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO=", "-DCMAKE_EXPORT_COMPILE_COMMANDS=OFF", "-DCMAKE_INSTALL_PREFIX:PATH=/usr/local", "-DCMAKE_MODULE_LINKER_FLAGS=' '", "-DCMAKE_MODULE_LINKER_FLAGS_DEBUG=", "-DCMAKE_MODULE_LINKER_FLAGS_MINSIZEREL=", "-DCMAKE_MODULE_LINKER_FLAGS_RELEASE=", "-DCMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO=", "-DCMAKE_PROJECT_NAME:STATIC=SuperBuild_BRAINSTools", "-DCMAKE_SHARED_LINKER_FLAGS=' '", "-DCMAKE_SHARED_LINKER_FLAGS_DEBUG=", "-DCMAKE_SHARED_LINKER_FLAGS_MINSIZEREL=", "-DCMAKE_SHARED_LINKER_FLAGS_RELEASE=", "-DCMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO=", "-DCMAKE_SKIP_INSTALL_RPATH=NO", "-DCMAKE_SKIP_RPATH=NO", "-DCMAKE_STATIC_LINKER_FLAGS=", "-DCMAKE_STATIC_LINKER_FLAGS_DEBUG=", "-DCMAKE_STATIC_LINKER_FLAGS_MINSIZEREL=", "-DCMAKE_STATIC_LINKER_FLAGS_RELEASE=", "-DCMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO=", "-DCMAKE_USE_RELATIVE_PATHS=OFF", "-DCMAKE_VERBOSE_MAKEFILE=FALSE", "-DCOVERAGE_EXTRA_FLAGS=-l", "-DCTEST_SUBMIT_RETRY_COUNT=3", "-DCTEST_SUBMIT_RETRY_DELAY=5", "-DDART_TESTING_TIMEOUT=1500", "-DEXTERNAL_PROJECT_BUILD_TYPE=Release", "-DFORCE_EXTERNAL_BUILDS=OFF", "-DITK_VERSION_MAJOR=4", "-DSuperBuild_BRAINSTools_BUILD_DICOM_SUPPORT=ON", "-DSuperBuild_BRAINSTools_USE_CTKAPPLAUNCHER=OFF", "-DSuperBuild_BRAINSTools_USE_GIT_PROTOCOL=ON", "-DUSE_ANTS=ON", "-DUSE_AutoWorkup=OFF", "-DUSE_BRAINSABC=OFF", "-DUSE_BRAINSConstellationDetector=OFF", "-DUSE_BRAINSContinuousClass=OFF", "-DUSE_BRAINSCreateLabelMapFromProbabilityMaps=OFF", "-DUSE_BRAINSCut=OFF", "-DUSE_BRAINSDWICleanup=OFF", "-DUSE_BRAINSDemonWarp=OFF", "-DUSE_BRAINSFit=OFF", "-DUSE_BRAINSInitializedControlPoints=OFF", "-DUSE_BRAINSLabelStats=OFF", "-DUSE_BRAINSLandmarkInitializer=OFF", "-DUSE_BRAINSMultiModeSegment=OFF", "-DUSE_BRAINSMultiSTAPLE=OFF", "-DUSE_BRAINSMush=OFF", "-DUSE_BRAINSPosteriorToContinuousClass=OFF", "-DUSE_BRAINSROIAuto=OFF", "-DUSE_BRAINSResample=OFF", "-DUSE_BRAINSSnapShotWriter=OFF", "-DUSE_BRAINSStripRotation=OFF", "-DUSE_BRAINSSurfaceTools=OFF", "-DUSE_BRAINSTalairach=OFF", "-DUSE_BRAINSTransformConvert=OFF", "-DUSE_ConvertBetweenFileFormats=ON", "-DUSE_DWIConvert=ON", "-DUSE_DebugImageViewer=OFF", "-DUSE_GTRACT=OFF", "-DUSE_ICCDEF=OFF", "-DUSE_ImageCalculator=OFF", "-DUSE_ReferenceAtlas=OFF", "-DUSE_SYSTEM_DCMTK=OFF", "-DUSE_SYSTEM_ITK=OFF", "-DUSE_SYSTEM_SlicerExecutionModel=OFF", "-DUSE_SYSTEM_VTK=OFF", "-DVTK_GIT_REPOSITORY=git://vtk.org/VTK.git") make['all'] & FG outbin = self.prefix / 'BRAINSTools-bin-' + clone_hash (blddir / 'bin').move(outbin)
def make(commit=DEFAULT_HASH, delete=False): """Downloads and compiles BRAINSTools binaries. Output is '$soft/BRAINSTools-bin-<hash>'.""" dest = getSoftDir() if commit != 'master': out = dest / ('BRAINSTools-bin-' + commit) if checkExists(out): return blddir = dest / "BRAINSTools-build" with local.cwd(dest): repo = downloadGithubRepo('BRAINSia/BRAINSTools', commit) for line in fileinput.input(repo / 'SuperBuild' / 'External_ITKv5.cmake', inplace=True): print(line.replace('itk.org', 'github.com/InsightSoftwareConsortium'), end='') sha, date = getCommitInfo(repo) out = dest / ('BRAINSTools-bin-' + sha) symlink = dest / ('BRAINSTools-bin-' + date) symlink.unlink() log.info("Make '{}'".format(out)) log.info("Make '{}'".format(symlink)) if checkExists(out): return logging.info("Build code:") blddir.mkdir() with local.cwd(blddir): cmake( repo, "-DBRAINSTools_BUILD_DICOM_SUPPORT:BOOL=OFF", "-DBRAINSTools_MAX_TEST_LEVEL:STRING=0", "-DBRAINSTools_REQUIRES_VTK:BOOL=OFF", "-DBRAINSTools_USE_CTKAPPLAUNCHER:BOOL=OFF", "-DBUILD_TESTING:BOOL=OFF", "-DUSE_ANTS:BOOL=OFF", "-DUSE_AutoWorkup:BOOL=OFF", "-DUSE_BRAINSABC:BOOL=OFF", "-DUSE_BRAINSConstellationDetector:BOOL=OFF", "-DUSE_BRAINSDWICleanup:BOOL=OFF", "-DUSE_BRAINSFit:BOOL=OFF", "-DUSE_BRAINSInitializedControlPoints:BOOL=OFF", "-DUSE_BRAINSLabelStats:BOOL=OFF", "-DUSE_BRAINSLandmarkInitializer:BOOL=OFF", "-DUSE_BRAINSROIAuto:BOOL=OFF", "-DUSE_BRAINSResample:BOOL=OFF", "-DUSE_BRAINSSnapShotWriter:BOOL=OFF", "-DUSE_BRAINSStripRotation:BOOL=OFF", "-DUSE_BRAINSTransformConvert:BOOL=OFF", "-DUSE_ImageCalculator:BOOL=OFF", "-DUSE_ReferenceAtlas:BOOL=OFF", "-DCMAKE_SKIP_INSTALL_RPATH:BOOL=ON", "-DCMAKE_SKIP_RPATH:BOOL=ON") import plumbum.cmd plumbum.cmd.make['-j', psutil.cpu_count(logical=False)] & FG (blddir / 'bin').move(out) with open(out / 'env.sh', 'w') as f: f.write("export PATH={}:$PATH\n".format(out)) symlink.unlink() out.symlink(symlink) log.info("Made '{}'".format(get_path(sha))) log.info("Made '{}'".format(symlink))