def IMPModuleLib(envi, files): """Build, and optionally also install, an IMP module's C++ shared library. This is only available from within an environment created by `IMPSharedLibraryEnvironment`.""" if envi["IMP_PASS"] != "BUILD": return vars= _get_module_variables(envi) module = _get_module_name(envi) module_libname =_get_module_variables(envi)['module_libname'] version= _get_module_version(envi) data= scons_tools.data.get(envi).modules[_get_module_name(envi)] prefix=vars['module_libname'] if prefix=="imp": prefix="imp_kernel" config= envi.IMPModuleConfigCPP(target=[stp.get_build_source_file(envi,"config.cpp", module)], source=[envi.Value(version), envi.Value(envi.subst(envi['datadir'])), envi.Value(envi.subst(os.path.join(envi['docdir'], "examples")))]) #env.AlwaysBuild(version) build=[] if envi['percppcompilation']=="yes"\ or module in envi['percppcompilation'].split(":"): allf=files+config if envi['build']=="debug" and envi['linktest']: link0=envi.IMPModuleLinkTest(target=[stp.get_build_source_file(envi, 'link_0.cpp', module)], source=[]) link1=envi.IMPModuleLinkTest(target=[stp.get_build_source_file(envi, 'link_1.cpp', module)], source=[]) allf= allf+link0+link1 else: allf= [_all_cpp.get(envi, list(files))]+config if envi['build']=="debug" and envi['linktest']: link1=envi.IMPModuleLinkTest(target=[stp.get_build_source_file(envi, 'link.cpp', module)], source=[]) allf= allf+link1 if envi['IMP_BUILD_STATIC']: env= scons_tools.environment.get_staticlib_environment(envi) sl= env.StaticLibrary('#/build/lib/%s' % module_libname, allf) scons_tools.data.get(env).add_to_alias(_get_module_alias(env), sl[0]) if envi['IMP_BUILD_DYNAMIC']: env = scons_tools.environment.get_sharedlib_environment(envi, '%(EXPORT)s_EXPORTS' % vars, cplusplus=True) sl=env.SharedLibrary('#/build/lib/%s' % module_libname, allf ) scons_tools.data.get(env).add_to_alias(_get_module_alias(env), sl[0]) scons_tools.utility.postprocess_lib(env, sl)
def get(env, files): module= scons_tools.module._get_module_name(env) target=File(stp.get_build_source_file(env, "all.cpp", module)) return _All(env=env, target=target, source=files)
def IMPModulePython(env, swigfiles=[], pythonfiles=[]): """Build and install an IMP module's Python extension and the associated wrapper file from a SWIG interface file. This is only available from within an environment created by `IMPPythonExtensionEnvironment`.""" if env["IMP_PASS"] != "BUILD": return module =_get_module_name(env) vars=_get_module_variables(env) data=scons_tools.data.get(env) moduledata=data.modules[_get_module_name(env)] alldata= scons_tools.data.get(env).modules penv = scons_tools.environment.get_pyext_environment(env, module.upper(), cplusplus=True, extra_modules=[module]) #penv.Decider('timestamp-match') versions=[] vc= _swig.VersionCheck(penv, target=[File("#/build/lib/"\ +vars['module_include_path']\ +"/_version_check.py")], source=[env.Value(_get_module_version(env))]+versions) data.add_to_alias(_get_module_alias(env),vc[0]) prefix=vars['module_pylibname'][1:] if prefix=="IMP": prefix="IMP_kernel" swigfile= \ penv.IMPModuleSWIGPreface(target=[File("#/build/swig/"+prefix+".i")], source=[File("swig.i-in"), env.Value(_get_module_modules(env)), env.Value(" ".join(_get_module_dependencies(env))), env.Value(" ".join(_get_module_unfound_dependencies(env))), env.Value(_get_module_has_data(env))]) for i in swigfiles: if str(i).endswith('.i'): scons_tools.install.install_in_build(env,i, "#/build/swig/"+str(i)) produced=File("#/build/lib/"+vars['module_include_path']+"/__init__.py") version=_get_module_version(penv) cppin=stp.get_build_source_file(penv, "wrap.cpp-in", module) hin=stp.get_build_source_file(penv, "wrap.h-in", module) swigr=penv.IMPModuleSWIG(target=[produced, cppin, hin], source=[swigfile]) #print "Moving", produced.path, "to", dest.path cppf=stp.get_build_source_file(penv, "wrap.cpp", module) hf=stp.get_build_source_file(penv, "wrap.h", module) patched=penv.IMPModulePatchSWIG(target=[cppf], source=[cppin]) hpatched=penv.IMPModulePatchSWIG(target=[hf], source=[hin]) penv.Requires(patched, hpatched) lpenv= scons_tools.bug_fixes.clone_env(penv) buildlib = lpenv.LoadableModule("#/build/lib/"+vars["module_pylibname"], patched) #SCANNERS=scanners data.add_to_alias(_get_module_alias(env), buildlib[0]) if "kernel" in _get_module_dependencies(env): # all python support needs kernel, silly design to put it in the base # namespace/python module env.Requires(data.get_alias(module), data.get_alias("kernel")) scons_tools.utility.postprocess_lib(penv, buildlib) b= scons_tools.install.install_hierarchy_in_build(env, pythonfiles, "#/build/lib/"+vars['module_include_path'], prefix="src") for bc in b: data.add_to_alias(_get_module_alias(env), bc)