From f9c996a4777942cb039f0d6a958af3a72e32afad Mon Sep 17 00:00:00 2001 From: Ian Bell Date: Thu, 2 Oct 2014 10:50:18 +0200 Subject: [PATCH] Build swig+MATLAB binary Signed-off-by: Ian Bell --- dev/buildbot/master/master.cfg | 97 ++++++++++++++++++++++++++++++++-- 1 file changed, 94 insertions(+), 3 deletions(-) diff --git a/dev/buildbot/master/master.cfg b/dev/buildbot/master/master.cfg index 91ce54d0..6d6f1cc7 100644 --- a/dev/buildbot/master/master.cfg +++ b/dev/buildbot/master/master.cfg @@ -266,25 +266,103 @@ def cmake_slave(mod_name, platform, git_mode = 'incremental', install = True, cm factory.addStep(DirectoryUpload(slavesrc="install_root",masterdest="public_html/binaries",url="binaries",compress="bz2")) return factory +def swig_matlab_pre(git_mode = 'incremental'): + """ + Download SWIG+MATLAB version, use it to build _wrap file for MATLAB builder, upload back to master + + The generated _wrap file is not platform dependent + """ + factory = BuildFactory() + working_folder = "build/build" + + factory.addStep(ShellCommand(command=cleanCommand, description='fullclean?', workdir="")) + # Download files from nightly build for swig + factory.addStep(FileDownload(mastersrc = 'public_html/nightly/swig/swig_MATLAB.tar.gz', slavedest = 'swig_MATLAB.tar.gz', haltOnFailure = True)) + # Directory for incompressible files + factory.addStep(MakeDirectory(dir='build/Web/_static/fluid_properties/incompressible', haltOnFailure = True)) + # Untar + factory.addStep(ShellCommand(command = 'tar -C Web/_static/fluid_properties/incompressible -xzvf swig_MATLAB.tar.gz', workdir = 'build', haltOnFailure = True)) + + + # check out the source + factory.addStep(Git(repourl='git://github.com/CoolProp/CoolProp', mode=git_mode, submodules = True, progress=True, haltOnFailure = True)) + factory.addStep(MakeDirectory(dir=working_folder+'/32bitDLL', haltOnFailure = True)) + factory.addStep(MakeDirectory(dir=working_folder+'/64bitDLL', haltOnFailure = True)) + factory.addStep(RemoveDirectory(dir="build/install_root", haltOnFailure = True)) + # Make 32-bit __stdcall DLL + factory.addStep(ShellCommand(command=["cmake", "../..", "-DCOOLPROP_32BIT_STDCALL_SHARED_LIBRARY=ON","-G", "Visual Studio 10"], + workdir= working_folder+'/32bitDLL', + haltOnFailure = True)) + factory.addStep(ShellCommand(command=["cmake", "--build", ".", "--target", "install"], workdir = working_folder+'/32bitDLL', haltOnFailure = True)) + # Make 64-bit DLL + factory.addStep(ShellCommand(command=["cmake", "../..", "-DCOOLPROP_64BIT_SHARED_LIBRARY=ON","-G", "Visual Studio 10 Win64"], + workdir= working_folder+'/64bitDLL', + haltOnFailure = True)) + factory.addStep(ShellCommand(command=["cmake", "--build", ".", "--target", "install"], workdir = working_folder+'/64bitDLL', haltOnFailure = True)) + + factory.addStep(MakeDirectory(dir='build\\bin\\MicrosoftExcel', haltOnFailure = True)) + # Copy the created DLL + factory.addStep(ShellCommand(command=' '.join(["copy", "/Y", "install_root\\shared_library\\Windows\\32bit__stdcall_calling_convention\\*.dll", "bin\\MicrosoftExcel"]), workdir = 'build', haltOnFailure = True)) + factory.addStep(ShellCommand(command=' '.join(["move", "CoolProp.dll", "CoolProp_x64.dll"]), workdir = 'build/install_root/shared_library/Windows/64bit', haltOnFailure = True)) + factory.addStep(ShellCommand(command=' '.join(["copy", "/Y", "install_root\\shared_library\\Windows\\64bit\\*.dll", "bin\\MicrosoftExcel"]), workdir = 'build', haltOnFailure = True)) + # Copy other files + factory.addStep(ShellCommand(command=["copy", "wrappers\Excel\CoolProp.xlam", "bin\MicrosoftExcel"], workdir = 'build', haltOnFailure = True)) + factory.addStep(ShellCommand(command=["copy", "wrappers\Excel\CoolProp.xla", "bin\MicrosoftExcel"], workdir = 'build', haltOnFailure = True)) + factory.addStep(ShellCommand(command=["copy", "wrappers\Excel\TestExcel.xlsx", "bin\MicrosoftExcel"], workdir = 'build', haltOnFailure = True)) + # Upload the files + factory.addStep(DirectoryUpload(slavesrc="bin",masterdest="public_html/binaries",url="MicrosoftExcel",compress="bz2")) + return factory + +def SWIG_MATLAB_bin_builder(): + factory = BuildFactory() + + factory.addStep(ShellCommand(command=cleanCommand, description='fullclean?', workdir="")) + + # Check out the source + factory.addStep(Git(repourl='git://github.com/CoolProp/CoolProp', mode='incremental', submodules = False, progress=True, haltOnFailure = True)) + + # Build SWIG with MATLAB + factory.addStep(ShellCommand(command=' '.join(["python","build_swig_matlab.py"]), + workdir= "build/dev/scripts", + haltOnFailure = True)) + factory.addStep(MakeDirectory(dir='build/dev/scripts/swig-MATLAB', haltOnFailure = True)) + # Zip up the directory that was generated + factory.addStep(ShellCommand(command=' '.join(["tar","-cf","swig-MATLAB/swig_MATLAB.tar.gz","swig-matlab/swig-matlab-bin"]), + workdir= "build/dev/scripts", + haltOnFailure = True)) + + # Upload swig+MATLAB + factory.addStep(DirectoryUpload(slavesrc="dev/scripts/swig-MATLAB", + masterdest="public_html/nightly/swig-MATLAB", + url="nightly/swig-MATLAB", + compress="bz2")) + def nightly_builder(): factory = BuildFactory() factory.addStep(ShellCommand(command=cleanCommand, description='fullclean?', workdir="")) - # check out the source + # Check out the source factory.addStep(Git(repourl='git://github.com/CoolProp/CoolProp', mode='incremental', submodules = False, progress=True, haltOnFailure = True)) + # Build the incompressible files factory.addStep(ShellCommand(command=' '.join(["chmod", "+x", "nightly_build.bsh","&&","./nightly_build.bsh"]), workdir= "build/dev/incompressible_liquids", haltOnFailure = True)) + # Upload the incompressible data factory.addStep(DirectoryUpload(slavesrc="Web/_static/fluid_properties", masterdest="public_html/nightly/fluid_properties", url="nightly/fluid_properties", compress="bz2")) + + # Build SWIG with MATLAB + # factory.addStep(ShellCommand(command=' '.join(["python", "all_incompressibles.py"]), # workdir= "build/dev/incompressibles", # haltOnFailure = True)) return factory + + from buildbot.config import BuilderConfig @@ -417,6 +495,14 @@ c['builders'].append( ) ) +c['builders'].append( + BuilderConfig(name="SWIG-MATLAB-bin", + #branch = 'master', + slavenames=["linux-slave"], + factory = SWIG_MATLAB_bin_builder() + ) + ) + ####### SCHEDULERS from buildbot.schedulers.basic import SingleBranchScheduler @@ -439,9 +525,14 @@ c['schedulers'].append(ForceScheduler( c['schedulers'].append(Nightly(name='nightly', branch='master', - builderNames=['nightly-build'], - hour=[3, 15] + builderNames=['nightly-build','SWIG-MATLAB-bin], + hour=[3, 15] minute=0)) + +swig_matlab_dependent_scheduler = basic.Dependent(name="build-package", + upstream=swig_matlab_pre, # <- no quotes! + builderNames=["swig_matlab"]) +c['schedulers'] = [swig_matlab_pre, swig_matlab_scheduler] ####### STATUS TARGETS