def _RealRequire(env): ilmbase_libsuffix = excons.GetArgument("ilmbase-libsuffix", "") # Add python bindings first if python: pyilmbase_inc, pyilmbase_lib = excons.GetDirs("ilmbase-python") pyilmbase_libsuffix = excons.GetArgument("ilmbase-python-libsuffix", ilmbase_libsuffix) if pyilmbase_inc: if not pyilmbase_inc.endswith("OpenEXR"): pyilmbase_inc += "/OpenEXR" env.Append(CPPPATH=[pyilmbase_inc, os.path.dirname(pyilmbase_inc)]) if pyilmbase_lib: env.Append(LIBPATH=[pyilmbase_lib]) env.Append(LIBS=["PyImath" + pyilmbase_libsuffix]) ilmbase_inc, ilmbase_lib = excons.GetDirs("ilmbase") static = (excons.GetArgument("ilmbase-static", 0, int) != 0) if ilmbase_inc and not ilmbase_inc.endswith("OpenEXR"): ilmbase_inc += "/OpenEXR" libs = [] if ilmthread: libs.append("IlmThread") libs.append("Imath") if iexmath: libs.append("IexMath") libs.append("Iex") libs.append("Half") if ilmbase_libsuffix: libs = map(lambda x: x+ilmbase_libsuffix, libs) if sys.platform == "win32": if not static: env.Append(CPPDEFINES=["OPENEXR_DLL"]) if ilmbase_inc: env.Append(CPPPATH=[ilmbase_inc, os.path.dirname(ilmbase_inc)]) if ilmbase_lib: env.Append(LIBPATH=[ilmbase_lib]) env.Append(LIBS=libs)
def Version(asString=True): arnoldinc, _ = excons.GetDirs( "arnold", libdirname=("bin" if sys.platform != "win32" else "lib")) if arnoldinc is None: return ("0.0.0.0" if asString else (0, 0, 0, 0)) ai_version = os.path.join(arnoldinc, "ai_version.h") varch, vmaj, vmin, vpatch = 0, 0, 0, 0 if os.path.isfile(ai_version): defexp = re.compile( r"^\s*#define\s+AI_VERSION_(ARCH_NUM|MAJOR_NUM|MINOR_NUM|FIX)\s+([^\s]+)" ) f = open(ai_version, "r") for line in f.readlines(): m = defexp.match(line) if m: which = m.group(1) if which == "ARCH_NUM": varch = int(m.group(2)) elif which == "MAJOR_NUM": vmaj = int(m.group(2)) elif which == "MINOR_NUM": vmin = int(m.group(2)) elif which == "FIX": m = re.search(r"\d+", m.group(2)) vpatch = (0 if m is None else int(m.group(0))) f.close() rv = (varch, vmaj, vmin, vpatch) return ("%s.%s.%s.%s" % rv if asString else rv)
def Require(env): zlibinc, zliblib = excons.GetDirs("zlib") if zlibinc: env.Append(CPPPATH=[zlibinc]) if zliblib: env.Append(LIBPATH=[zliblib]) if str(Platform()) != "win32": zlib_name = excons.GetArgument("zlib-libname", None) if not zlib_name: zlib_name = "z%s" % excons.GetArgument("zlib-libsuffix", "") env.Append(LIBS=[zlib_name]) else: static = (excons.GetArgument("zlib-static", 0, int) != 0) if static: zlib_name = excons.GetArgument("zlib-libname", None) if not zlib_name: zlib_name = "zlib%s" % excons.GetArgument("zlib-libsuffix", "") env.Append(LIBS=[zlib_name]) else: zlib_name = excons.GetArgument("zlib-libname", None) if not zlib_name: zlib_name = "zdll%s" % excons.GetArgument("zlib-libsuffix", "") env.Append(CPPDEFINES=["ZLIB_DLL"]) env.Append(LIBS=[zlib_name])
def Require(env): zlibinc, zliblib = excons.GetDirs("zlib") if zlibinc: env.Append(CPPPATH=[zlibinc]) if zliblib: env.Append(LIBPATH=[zliblib]) static = (excons.GetArgument("zlib-static", 0, int) != 0) if str(Platform()) != "win32": zlib_name = excons.GetArgument("zlib-name", None) if not zlib_name: zlib_name = "%sz%s" % (excons.GetArgument( "zlib-prefix", ""), excons.GetArgument("zlib-suffix", "")) else: if static: zlib_name = excons.GetArgument("zlib-name", None) if not zlib_name: zlib_name = "zlib%s" % excons.GetArgument("zlib-suffix", "") else: zlib_name = excons.GetArgument("zlib-name", None) if not zlib_name: zlib_name = "zdll%s" % excons.GetArgument("zlib-suffix", "") env.Append(CPPDEFINES=["ZLIB_DLL"]) excons.Link(env, zlib_name, static=static, force=True, silent=True) excons.AddHelpOptions(zlib=GetOptionsString())
def Require(env): szip_inc, szip_lib = excons.GetDirs("szip") if szip_inc: env.Append(CPPPATH=[szip_inc]) if szip_lib: env.Append(LIBPATH=[szip_lib]) szip_static = (excons.GetArgument("szip-static", 0, int) != 0) if not szip_static: env.Append(CPPDEFINES=["SZ_BUILT_AS_DYNAMIC_LIB"]) szip_libname = excons.GetArgument("szip-name", None) if not szip_libname: szip_libprefix = excons.GetArgument("szip-prefix", "") szip_libsuffix = excons.GetArgument("szip-suffix", "") szip_libname = "%s%s%s" % (szip_libprefix, ("sz" if sys.platform != "win32" else "libszip"), szip_libsuffix) excons.Link(env, szip_libname, static=szip_static, force=True, silent=True) excons.AddHelpOptions(szip=GetOptionsString())
def Require(ilmbase=False, zlib=False): openexr_libprefix = excons.GetArgument("openexr-prefix", "") openexr_libsuffix = excons.GetArgument("openexr-suffix", "") openexr_libname = excons.GetArgument("openexr-name", "%sIlmImf%s" % (openexr_libprefix, openexr_libsuffix)) openexr_inc, openexr_lib = excons.GetDirs("openexr") if openexr_inc and not openexr_inc.endswith("OpenEXR"): openexr_inc += "/OpenEXR" openexr_static = (excons.GetArgument("openexr-static", 0, int) != 0) excons.AddHelpOptions(openexr=GetOptionsString()) def _RequireOpenEXR(env): if sys.platform == "win32" and not openexr_static: env.Append(CPPDEFINES=["OPENEXR_DLL"]) if openexr_inc: env.Append(CPPPATH=[openexr_inc, os.path.dirname(openexr_inc)]) if openexr_lib: env.Append(LIBPATH=[openexr_lib]) excons.Link(env, openexr_libname, static=openexr_static, force=True, silent=True) if ilmbase: excons.tools.ilmbase.Require()(env) if zlib: excons.tools.zlib.Require(env) return _RequireOpenEXR
def Require(env): glutinc, glutlib = excons.GetDirs("glut") if glutinc: env.Append(CPPPATH=[glutinc]) if glutlib: env.Append(LIBPATH=[glutlib]) static = (excons.GetArgument("glut-static", 0, int) != 0) libname = excons.GetArgument("glut-name", "") if not libname: libprefix = excons.GetArgument("glut-prefix", "") libsuffix = excons.GetArgument("glut-suffix", "") if sys.platform == "win32": libname = ("glut64" if excons.Build64() else "glut32") + libsuffix else: libname = "%sglut%s" % (libprefix, libsuffix) if sys.platform == "win32": env.Append(CPPDEFINES=["GLUT_NO_LIB_PRAGMA"]) env.Append(LIBS=[libname]) elif sys.platform == "darwin": env.Append(LINKFLAGS=" -framework GLUT") else: excons.Link(env, libname, static=static, force=True, silent=True) excons.AddHelpOptions(glut=GetOptionsString())
def Version(asString=True, compat=False): mtoa_inc, mtoa_lib = excons.GetDirs( "mtoa", libdirname=("lib" if sys.platform == "win32" else "bin")) if mtoa_inc and mtoa_lib: versionh = excons.joinpath(mtoa_inc, "utils", "Version.h") varch, vmaj, vmin = 0, 0, 0 if os.path.isfile(versionh): defexp = re.compile( r"^\s*#define\s+MTOA_(ARCH|MAJOR|MINOR)_VERSION_NUM\s+([^\s]+)" ) f = open(versionh, "r") for line in f.readlines(): m = defexp.match(line) if m: which = m.group(1) if which == "ARCH": varch = int(m.group(2)) elif which == "MAJOR": vmaj = int(m.group(2)) elif which == "MINOR": vmin = int(m.group(2)) f.close() if compat: rv = (varch, vmaj) return ("%s.%s" % rv if asString else rv) else: rv = (varch, vmaj, vmin) return ("%s.%s.%s" % rv if asString else rv) else: if compat: return ("0.0" if asString else (0, 0)) else: return ("0.0.0" if asString else (0, 0, 0))
def Version(asString=True, nice=False): vrayinc, _ = excons.GetDirs("vray") vraybase = excons.joinpath(vrayinc, "vraybase.h") if os.path.isfile(vraybase): defexp = re.compile( r"^\s*#define\s+VRAY_DLL_VERSION\s+(0x[a-fA-F0-9]+)") f = open(vraybase, "r") for line in f.readlines(): m = defexp.match(line) if m: #rv = (int(m.group(1), 16) if not asString else m.group(1)[2:]) rv = m.group(1)[2:] if nice: iv = int(rv) major = iv / 10000 minor = (iv % 10000) / 100 patch = iv % 100 rv = (major, minor, patch) if asString: rv = "%d.%d.%d" % rv else: if not asString: rv = int(rv) return rv f.close() return ("" if asString else (0 if not nice else (0, 0, 0)))
def _RequireOpenEXR(env): openexr_libsuffix = excons.GetArgument("openexr-libsuffix", "") openexr_libname = excons.GetArgument("openexr-libname", "IlmImf%s" % openexr_libsuffix) openexr_inc, openexr_lib = excons.GetDirs("openexr") openexr_static = (excons.GetArgument("openexr-static", 0, int) != 0) if openexr_inc and not openexr_inc.endswith("OpenEXR"): openexr_inc += "/OpenEXR" if sys.platform == "win32" and not openexr_static: env.Append(CPPDEFINES=["OPENEXR_DLL"]) if openexr_inc: env.Append(CPPPATH=[openexr_inc, os.path.dirname(openexr_inc)]) if openexr_lib: env.Append(LIBPATH=[openexr_lib]) env.Append(LIBS=[openexr_libname]) if ilmbase: excons.tools.ilmbase.Require()(env) if zlib: excons.tools.zlib.Require(env)
def Require(env): arnoldinc, arnoldlib = excons.GetDirs( "arnold", libdirname=("bin" if sys.platform != "win32" else "lib")) if arnoldinc: env.Append(CPPPATH=[arnoldinc]) if arnoldlib: env.Append(LIBPATH=[arnoldlib]) aver = Version(asString=False) if aver[0] >= 5: if sys.platform == "win32": if float(excons.mscver) < 14: excons.WarnOnce( "Arnold 5 and above require Visual Studio 2015 or newer (mscver 14.0)" ) if aver[0] >= 6: if sys.platform != "win32": if not excons.GetArgument("use-c++11", 0, int): excons.SetArgument("use-c++11", 1) if not "-std=c++11" in " ".join(env["CXXFLAGS"]): env.Append(CXXFLAGS=" -std=c++11") env.Append(LIBS=["ai"]) excons.AddHelpOptions(arnold=GetOptionsString())
def Require(env): nukespec = excons.GetArgument("with-nuke") if nukespec is None: excons.WarnOnce("Please set Nuke version or directory using with-nuke=", tool="nuke") return idn = ("Contents/MacOS/include" if sys.platform == "darwin" else "include") ldn = ("Contents/MacOS" if sys.platform == "darwin" else "") if os.path.isdir(nukespec): if sys.platform == "darwin": bn = os.path.basename(nukespec) _, ext = os.path.splitext(bn) if ext != ".app": nukespec += "/%s.app" % bn excons.SetArgument("with-nuke", nukespec) ndkinc, ndklib = excons.GetDirs("nuke", incdirname=idn, libdirname=ldn, libdirarch="none") else: if not re.match(r"\d+\.\d+v\d+", nukespec): excons.WarnOnce("Invalid Nuke version format: \"%s\"" % nukespec, tool="nuke") return if sys.platform == "win32": ndkbase = "C:/Program Files/Nuke%s" % nukespec elif sys.platform == "darwin": ndkbase = "/Applications/Nuke%s/Nuke%s.app" % (nukespec, nukespec) else: ndkbase = "/usr/local/Nuke%s" % nukespec ndkinc = "%s/%s" % (ndkbase, idn) ndklib = "%s/%s" % (ndkbase, ldn) if ldn else ndkbase if ndkinc: env.Append(CPPPATH=[ndkinc]) if ndklib: env.Append(LIBPATH=[ndklib]) if sys.platform == "darwin": #env.Append(CCFLAGS=" -isysroot /Developer/SDKs/MacOSX10.4u.sdk") #env.Append(LINKFLAGS=" -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk") #env.Append(LINKFLAGS=" -framework QuartzCore -framework IOKit -framework CoreFoundation -framework Carbon -framework ApplicationServices -framework OpenGL -framework AGL -framework Quicktime") pass env.Append(DEFINES=["USE_GLEW"]) if sys.platform != "win32": env.Append(CCFLAGS=" -Wno-unused-variable -Wno-unused-parameter") env.Append(LIBS=["DDImage", "GLEW"]) else: env.Append(LIBS=["DDImage", "glew32"])
def Require(env): arnoldinc, arnoldlib = excons.GetDirs( "arnold", libdirname=("bin" if sys.platform != "win32" else "lib")) if arnoldinc: env.Append(CPPPATH=[arnoldinc]) if arnoldlib: env.Append(LIBPATH=[arnoldlib]) env.Append(LIBS=["ai"])
def Require(env): mtoa_inc, mtoa_lib = excons.GetDirs("mtoa", libdirname=("lib" if sys.platform == "win32" else "bin")) if sys.platform == "darwin": env.Append(CPPDEFINES=["_DARWIN"]) elif sys.platform == "win32": env.Append(CPPDEFINES=["_WIN32"]) else: env.Append(CPPDEFINES=["_LINUX"]) env.Append(CPPPATH=[mtoa_inc]) env.Append(LIBPATH=[mtoa_lib]) excons.Link(env, "mtoa_api", static=False, force=True, silent=True) excons.AddHelpOptions(mtoa=GetOptionsString())
def Require(env): linc, llib = excons.GetDirs("lua") if linc: env.Append(CPPPATH=[linc]) if llib: env.Append(LIBPATH=[llib]) if sys.platform == "win32": env.Append(CPPDEFINES=["LUA_BUILD_AS_DLL"]) env.Append(LIBS=["lua51"]) else: env.Append(LIBS=["lua"])
def Version(asString=True): vrayinc, _ = excons.GetDirs("vray") vraybase = os.path.join(vrayinc, "vraybase.h") if os.path.isfile(vraybase): defexp = re.compile( r"^\s*#define\s+VRAY_DLL_VERSION\s+(0x[a-fA-F0-9]+)") f = open(vraybase, "r") for line in f.readlines(): m = defexp.match(line) if m: return (int(m.group(1), 16) if not asString else m.group(1)[2:]) f.close() return None
def Require(env): fiinc, filib = excons.GetDirs("freeimage") if fiinc: env.Append(CPPPATH=[fiinc]) if filib: env.Append(LIBPATH=[filib]) if excons.GetArgument("freeimage-static", 0, int) != 0: env.Append(CPPDEFINES=["FREEIMAGE_LIB"]) filibname = excons.GetArgument("freeimage-libname", None) if not filibname: filibsuffix = excons.GetArgument("freeimage-libsuffix", "") filibname = "freeimage%s" % filibsuffix env.Append(LIBS=[filibname])
def Require(env): tbbinc, tbblib = excons.GetDirs("tbb") if tbbinc: env.Append(CPPPATH=[tbbinc]) if tbblib: env.Append(LIBPATH=[tbblib]) static = (excons.GetArgument("tbb-static", 0, int) != 0) # Any specific defines? #env.Append(CPPDEFINES=[]) tbblibname = excons.GetArgument("tbb-libname", None) if not tbblibname: tbblibname = "tbb%s" % excons.GetArgument("tbb-libsuffix", "") env.Append(LIBS=[tbblibname])
def Require(env): szip_inc, szip_lib = excons.GetDirs("szip") if szip_inc: env.Append(CPPPATH=[szip_inc]) if szip_lib: env.Append(LIBPATH=[szip_lib]) if excons.GetArgument("szip-static", 0, int) == 0: env.Append(CPPDEFINES=["SZ_BUILT_AS_DYNAMIC_LIB"]) szip_libname = excons.GetArgument("szip-libname", None) if not szip_libname: szip_libsuffix = excons.GetArgument("szip_libsuffix", "") szip_libname = "%s%s" % ( ("sz" if sys.platform != "win32" else "libszip"), szip_libsuffix) env.Append(LIBS=[szip_libname])
def Require(env): glew_inc, glew_lib = excons.GetDirs("glew") glew_static = (excons.GetArgument("glew-static", 1, int) != 0) glew_no_glu = (excons.GetArgument("glew-noglu", 1, int) != 0) glew_mx = (excons.GetArgument("glew-mx", 0, int) != 0) if glew_inc: env.Append(CPPPATH=[glew_inc]) if glew_lib: env.Append(LIBPATH=[glew_lib]) defs = [] if glew_no_glu: defs.append("GLEW_NO_GLU") if glew_static: defs.append("GLEW_STATIC") if glew_mx: defs.append("GLEW_MX") env.Append(CPPDEFINES=defs) glew_libname = excons.GetArgument("glew-name", None) if not glew_libname: glew_libprefix = excons.GetArgument("glew-prefix", "") glew_libsuffix = excons.GetArgument("glew-suffix", "") glew_libname = glew_libprefix + ("glew32" if sys.platform == "win32" else "GLEW") + glew_libsuffix if glew_mx: glew_libname += "mx" if sys.platform == "win32" and glew_static: glew_libname += "s" excons.Link(env, glew_libname, static=glew_static, force=True, silent=True) excons.AddHelpOptions(glew=GetOptionsString())
def Require(env): tbbinc, tbblib = excons.GetDirs("tbb") if tbbinc: env.Append(CPPPATH=[tbbinc]) if tbblib: env.Append(LIBPATH=[tbblib]) static = (excons.GetArgument("tbb-static", 0, int) != 0) # Any specific defines? #env.Append(CPPDEFINES=[]) tbblibname = excons.GetArgument("tbb-name", None) if not tbblibname: tbblibname = "%stbb%s" % (excons.GetArgument("tbb-prefix", ""), excons.GetArgument("tbb-suffix", "")) excons.Link(env, tbblibname, static=static, force=True, silent=True) excons.AddHelpOptions(tbb=GetOptionsString())
def Require(env): fiinc, filib = excons.GetDirs("freeimage") if fiinc: env.Append(CPPPATH=[fiinc]) if filib: env.Append(LIBPATH=[filib]) static = (excons.GetArgument("freeimage-static", 0, int) != 0) if static: env.Append(CPPDEFINES=["FREEIMAGE_LIB"]) filibname = excons.GetArgument("freeimage-name", None) if not filibname: filibprefix = excons.GetArgument("freeimage-prefix", "") filibsuffix = excons.GetArgument("freeimage-suffix", "") filibname = "%sfreeimage%s" % (filibprefix, filibsuffix) excons.Link(env, filibname, static=static, force=True, silent=True) excons.AddHelpOptions(freeimage=GetOptionsString())
def Require(env): glew_inc, glew_lib = excons.GetDirs("glew") glew_static = (excons.GetArgument("glew-static", 1, int) != 0) glew_no_glu = (excons.GetArgument("glew-noglu", 1, int) != 0) glew_mx = (excons.GetArgument("glew-mx", 0, int) != 0) if glew_inc: env.Append(CPPPATH=[glew_inc]) if glew_lib: env.Append(LIBPATH=[glew_lib]) defs = [] if glew_no_glu: defs.append("GLEW_NO_GLU") if glew_static: defs.append("GLEW_STATIC") if glew_mx: defs.append("GLEW_MX") env.Append(CPPDEFINES=defs) glew_libname = excons.GetArgument("glew-libname", None) if not glew_libname: glew_libsuffix = excons.GetArgument("glew-libsuffix", "") glew_libname = ("glew32" if sys.platform == "win32" else "GLEW") + glew_libsuffix if glew_mx: glew_libname += "mx" if sys.platform == "win32" and glew_static: glew_libname += "s" env.Append(LIBS=[glew_libname])
def Require(env): vrayinc, vraylib = excons.GetDirs("vray") if vrayinc: env.Append(CPPPATH=[vrayinc]) if vraylib: if sys.platform == "win32": lookfor = "plugman_s.lib" else: lookfor = "libplugman_s.a" vraylib = FindFileIn(lookfor, vraylib) if vraylib: env.Append(LIBPATH=[vraylib]) env.Append(LIBS=["vray", "plugman_s", "vutils_s"]) if sys.platform == "win32": env.Append(CPPDEFINES=[ "SENSELESS_DEFINE_FOR_WIN32", "_CRT_SECURE_NO_DEPRECATE", "_CRT_NONSTDC_NO_DEPRECATE" ]) env.Append(LIBS=["user32", "advapi32", "shell32"])
def Require(env): glutinc, glutlib = excons.GetDirs("glut") glutlibsuffix = excons.GetArgument("glut-libsuffix", "") if glutinc: env.Append(CPPPATH=[glutinc]) if glutlib: env.Append(LIBPATH=[glutlib]) if sys.platform == "win32": env.Append(CPPDEFINES=["GLUT_NO_LIB_PRAGMA"]) if excons.Build64(): env.Append(LIBS=["glut64%s" % glutlibsuffix]) else: env.Append(LIBS=["glut32"]) elif sys.platform == "darwin": env.Append(LINKFLAGS=" -framework GLUT") else: env.Append(LIBS=["glut%s" % glutlibsuffix])
def _RealRequire(env): linklibs = [] defs = [] boost_inc_dir, boost_lib_dir = excons.GetDirs("boost") static = (excons.GetArgument("boost-static", 0, int) != 0) boost_libsuffix = excons.GetArgument("boost-libsuffix", "") useautolink = False autolinkcount = 0 if sys.platform == "win32": useautolink = (excons.GetArgument("boost-autolink", 1, int) != 0) # All libs but Boost.Python are statically linked by default # => use BOOST_PYTHON_STATIC_LIB to enable static linking # Libraries are auto-linked on windows by default # => disable for all libraries using BOOST_ALL_NO_LIB # => disable for a specific lib using BOOST_[libraryname]_NO_LIB for lib in libs: incdir, libdir = excons.GetDirs("boost-%s" % lib) if incdir: env.Append(CPPPATH=[incdir]) if libdir: env.Append(LIBPATH=[libdir]) libname = excons.GetArgument("boost-%s-libname" % lib, None) if not libname: libsuffix = excons.GetArgument("boost-%s-libsuffix" % lib, boost_libsuffix) libname = "boost_%s%s" % (lib, libsuffix) libstatic = (excons.GetArgument("boost-%s-static" % lib, (1 if static else 0), int) != 0) autolinklib = False if sys.platform == "win32": autolinklib = (excons.GetArgument("boost-%s-autolink" % lib, (1 if useautolink else 0), int) != 0) if not autolinklib: defs.append("BOOST_%s_NO_LIB" % lib.upper()) else: autolinkcount += 1 if libstatic: if lib == "thread": # Not to confure with the 'LIB' meaning of BOOST_xxx_NO_LIB defs.append("BOOST_THREAD_USE_LIB") elif lib == "python": # Boost.Python is dynamically linked by 'default' defs.append("BOOST_PYTHON_STATIC_LIB") else: # Should not have to make a special case of Boost.Thread anymore, but # for backward compatibility sake if lib == "thread": defs.append("BOOST_THREAD_USE_DLL") elif lib != "python": defs.append("BOOST_%s_DYN_LINK" % lib.upper()) if not autolinklib: linklibs.append(libname) if sys.platform == "win32" and autolinkcount == 0: defs.append("BOOST_ALL_NO_LIB") env.Append(CPPDEFINES=defs) if boost_inc_dir: env.Append(CPPPATH=boost_inc_dir) if boost_lib_dir: env.Append(LIBPATH=boost_lib_dir) if linklibs: env.Append(LIBS=linklibs)
def Require(libs=None): if libs is None: libs = [] boost_inc_dir, boost_lib_dir = excons.GetDirs("boost") static = (excons.GetArgument("boost-static", 0, int) != 0) boost_libprefix = excons.GetArgument("boost-prefix", "") boost_libsuffix = excons.GetArgument("boost-suffix", "") useautolink = False if sys.platform == "win32": useautolink = (excons.GetArgument("boost-autolink", 1, int) != 0) libargs = {} for lib in libs: incdir, libdir = excons.GetDirs("boost-%s" % lib) libname = excons.GetArgument("boost-%s-name" % lib, None) if libname is None: libprefix = excons.GetArgument("boost-%s-prefix" % lib, boost_libprefix) libsuffix = excons.GetArgument("boost-%s-suffix" % lib, boost_libsuffix) libname = "%sboost_%s%s" % (libprefix, lib, libsuffix) libstatic = (excons.GetArgument("boost-%s-static" % lib, (1 if static else 0), int) != 0) autolinklib = False if sys.platform == "win32": autolinklib = (excons.GetArgument("boost-%s-autolink" % lib, (1 if useautolink else 0), int) != 0) libargs[lib] = { "incdir": incdir, "libdir": libdir, "name": libname, "static": libstatic, "autolink": autolinklib } def _RealRequire(env): if boost_inc_dir: env.Append(CPPPATH=boost_inc_dir) if boost_lib_dir: env.Append(LIBPATH=boost_lib_dir) autolinkcount = 0 defs = [] # All libs but Boost.Python are statically linked by default # => use BOOST_PYTHON_STATIC_LIB to enable static linking # Libraries are auto-linked on windows by default # => disable for all libraries using BOOST_ALL_NO_LIB # => disable for a specific lib using BOOST_[libraryname]_NO_LIB for lib in libs: incdir = libargs[lib]["incdir"] libdir = libargs[lib]["libdir"] libname = libargs[lib]["name"] libstatic = libargs[lib]["static"] autolinklib = libargs[lib]["autolink"] if incdir: env.Append(CPPPATH=[incdir]) if libdir: env.Append(LIBPATH=[libdir]) if sys.platform == "win32": if not autolinklib: defs.append("BOOST_%s_NO_LIB" % lib.upper()) else: autolinkcount += 1 if libstatic: if lib == "thread": # Not to confure with the 'LIB' meaning of BOOST_xxx_NO_LIB defs.append("BOOST_THREAD_USE_LIB") elif lib == "python": # Boost.Python is dynamically linked by 'default' defs.append("BOOST_PYTHON_STATIC_LIB") else: # Should not have to make a special case of Boost.Thread anymore, but # for backward compatibility sake if lib == "thread": defs.append("BOOST_THREAD_USE_DLL") elif lib != "python": defs.append("BOOST_%s_DYN_LINK" % lib.upper()) if not autolinklib: excons.Link(env, libname, static=libstatic, force=True, silent=True) if sys.platform == "win32" and autolinkcount == 0: defs.append("BOOST_ALL_NO_LIB") env.Append(CPPDEFINES=defs) excons.AddHelpOptions(boost=GetOptionsString()) return _RealRequire
def Require(ilmthread=None, iexmath=None, python=None, halfonly=False): if not halfonly: if ilmthread is None: ilmthread = (excons.GetArgument("ilmbase-thread", 1, int) != 0) if iexmath is None: iexmath = (excons.GetArgument("ilmbase-iexmath", 1, int) != 0) if python is None: python = (excons.GetArgument("ilmbase-python", 0, int) != 0) else: ilmthread = False iexmath = False python = False ilmbase_libsuffix = excons.GetArgument("ilmbase-suffix", "") ilmbase_libprefix = excons.GetArgument("ilmbase-prefix", "") pyilmbase_inc, pyilmbase_lib, pyilmbase_libprefix, pyilmbase_libsuffix = "", "", "", "" if python: pyilmbase_inc, pyilmbase_lib = excons.GetDirs("ilmbase-python") if pyilmbase_inc and not pyilmbase_inc.endswith("OpenEXR"): pyilmbase_inc += "/OpenEXR" pyilmbase_libprefix = excons.GetArgument("ilmbase-python-prefix", ilmbase_libprefix) pyilmbase_libsuffix = excons.GetArgument("ilmbase-python-suffix", ilmbase_libsuffix) ilmbase_inc, ilmbase_lib = excons.GetDirs("ilmbase") if ilmbase_inc and not ilmbase_inc.endswith("OpenEXR"): ilmbase_inc += "/OpenEXR" static = (excons.GetArgument("ilmbase-static", 0, int) != 0) pystatic = static if python: pystatic = (excons.GetArgument("ilmbase-python-static", (1 if static else 0), int) != 0) excons.AddHelpOptions(ilmbase=GetOptionsString()) def _RealRequire(env): # Add python bindings first if python: if pystatic: env.Append(CPPDEFINES=["PLATFORM_BUILD_STATIC"]) if sys.platform != "win32": env.Append(CPPDEFINES=["PLATFORM_VISIBILITY_AVAILABLE"]) if pyilmbase_inc: env.Append(CPPPATH=[pyilmbase_inc, os.path.dirname(pyilmbase_inc)]) if pyilmbase_lib: env.Append(LIBPATH=[pyilmbase_lib]) excons.Link(env, "%sPyImath%s" % (pyilmbase_libprefix, pyilmbase_libsuffix), static=pystatic, silent=True) excons.Link(env, "%sPyIex%s" % (pyilmbase_libprefix, pyilmbase_libsuffix), static=pystatic, silent=True) if ilmbase_inc: env.Append(CPPPATH=[ilmbase_inc, os.path.dirname(ilmbase_inc)]) if ilmbase_lib: env.Append(LIBPATH=[ilmbase_lib]) if sys.platform == "win32" and not static: env.Append(CPPDEFINES=["OPENEXR_DLL"]) if ilmthread: # ilmthread will be False if halfonly is True libname = "%sIlmThread%s" % (ilmbase_libprefix, ilmbase_libsuffix) excons.Link(env, libname, static=static, force=True, silent=True) if not halfonly: libname = "%sImath%s" % (ilmbase_libprefix, ilmbase_libsuffix) excons.Link(env, libname, static=static, force=True, silent=True) if iexmath: # iexmath will be False if halfonly is True libname = "%sIexMath%s" % (ilmbase_libprefix, ilmbase_libsuffix) excons.Link(env, libname, static=static, force=True, silent=True) if not halfonly: libname = "%sIex%s" % (ilmbase_libprefix, ilmbase_libsuffix) excons.Link(env, libname, static=static, force=True, silent=True) libname = "%sHalf%s" % (ilmbase_libprefix, ilmbase_libsuffix) excons.Link(env, libname, static=static, force=True, silent=True) return _RealRequire
def _RealRequire(env): global ThreadSafe_exp, Szlib_exp, Zlib_exp, hdf5_confs hdf5_inc, hdf5_lib = excons.GetDirs("hdf5") if hdf5_inc: env.Append(CPPPATH=[hdf5_inc]) if hdf5_lib: env.Append(LIBPATH=[hdf5_lib]) hdf5_libname = excons.GetArgument("hdf5-libname", None) if not hdf5_libname: hdf5_libsuffix = excons.GetArgument("hdf5-libsuffix", "") hdf5_basename = ("hdf5" if sys.platform != "win32" else "libhdf5") hdf5_libname = hdf5_basename + hdf5_libsuffix hdf5hl_libname = hdf5_basename + "_hl" + hdf5_libsuffix else: hdf5hl_libname = hdf5_libname + "_hl" if hl: env.Append(LIBS=[hdf5hl_libname, hdf5_libname]) else: env.Append(LIBS=[hdf5_libname]) hdf5_static = (excons.GetArgument("hdf5-static", 0, int) != 0) hdf5_threadsafe = False hdf5_szip = False hdf5_zlib = False h5conf = None if hdf5_inc: # Note: On Fedora 14, H5pubconf.h has been renamed to H5pubconf-64.h # -> be slightly more flexible when looking up this file lst = filter(lambda x: os.path.basename(x).startswith("H5pubconf"), glob.glob(hdf5_inc + "/*.h")) if len(lst) > 0: h5conf = lst[0].replace("\\", "/") else: # Look in current include paths for d in env["CPPPATH"]: lst = filter( lambda x: os.path.basename(x).startswith("H5pubconf"), glob.glob(d + "/*.h")) if len(lst) > 0: h5conf = lst[0].replace("\\", "/") break quiet = not verbose if h5conf: if h5conf in hdf5_confs: hdf5_threadsafe = hdf5_confs[h5conf]["threadsafe"] hdf5_zlib = hdf5_confs[h5conf]["zlib"] hdf5_szip = hdf5_confs[h5conf]["szip"] quiet = True else: if verbose: excons.PrintOnce("Reading configuration header '%s'..." % h5conf, tool="hdf5") f = open(h5conf, "r") for l in f.readlines(): l = l.strip() if ThreadSafe_exp.match(l): hdf5_threadsafe = True elif Szip_exp.match(l): hdf5_szip = True elif Zlib_exp.match(l): hdf5_zlib = True hdf5_confs[h5conf] = { "threadsafe": hdf5_threadsafe, "zlib": hdf5_zlib, "szip": hdf5_szip } f.close() if not quiet: if hdf5_threadsafe: excons.PrintOnce("Thread safe", tool="hdf5") if hdf5_zlib: excons.PrintOnce("Using zlib", tool="hdf5") if hdf5_szip: excons.PrintOnce("Using szip", tool="hdf5") else: excons.WarnOnce("Could not find configuration header", tool="hdf5") if hdf5_static: if not quiet: excons.PrintOnce("Static build", tool="hdf5") if hdf5_threadsafe: threads.Require(env) if hdf5_zlib: if excons.GetArgument("zlib-static", None) is None: if not quiet: excons.PrintOnce("Force static zlib", tool="hdf5") excons.SetArgument("zlib-static", 1) zlib.Require(env) if hdf5_szip: szip_static = excons.GetArgument("szip-static", None) if szip_static is None: if not quiet: excons.PrintOnce("Force static szip", tool="hdf5") excons.SetArgument("szip-static", 1) szip.Require(env)
def Require(hl=False, verbose=False): global ThreadSafe_exp, Szlib_exp, Zlib_exp, hdf5_confs hdf5_inc, hdf5_lib = excons.GetDirs("hdf5") hdf5_static = (excons.GetArgument("hdf5-static", 0, int) != 0) hdf5_libname = excons.GetArgument("hdf5-name", None) if not hdf5_libname: hdf5_libprefix = excons.GetArgument("hdf5-prefix", "") hdf5_libsuffix = excons.GetArgument("hdf5-suffix", "") hdf5_basename = ("hdf5" if sys.platform != "win32" else "libhdf5") hdf5_libname = hdf5_basename + hdf5_libsuffix hdf5hl_libname = hdf5_libprefix + hdf5_basename + "_hl" + hdf5_libsuffix else: hdf5hl_libname = hdf5_libname + "_hl" def GetConf(env, incdir): h5conf = None cfg = {"threadsafe": False, "zlib": False, "szip": False} quiet = not verbose if incdir: # Note: On Fedora 14, H5pubconf.h has been renamed to H5pubconf-64.h # -> be slightly more flexible when looking up this file lst = filter(lambda x: os.path.basename(x).startswith("H5pubconf"), excons.glob(incdir + "/*.h")) if len(lst) > 0: h5conf = lst[0].replace("\\", "/") else: # Look in current include paths for d in env["CPPPATH"]: lst = filter( lambda x: os.path.basename(x).startswith("H5pubconf"), excons.glob(d + "/*.h")) if len(lst) > 0: h5conf = lst[0].replace("\\", "/") break if h5conf: if h5conf in hdf5_confs: quiet = True cfg = hdf5_confs[h5conf] else: if verbose: excons.PrintOnce("Reading configuration header '%s'..." % h5conf, tool="hdf5") f = open(h5conf, "r") for l in f.readlines(): l = l.strip() if ThreadSafe_exp.match(l): cfg["threadsafe"] = True elif Szip_exp.match(l): cfg["szip"] = True elif Zlib_exp.match(l): cfg["zlib"] = True hdf5_confs[h5conf] = cfg f.close() if not quiet: if cfg["threadsafe"]: excons.PrintOnce("Thread safe", tool="hdf5") if cfg["zlib"]: excons.PrintOnce("Using zlib", tool="hdf5") if cfg["szip"]: excons.PrintOnce("Using szip", tool="hdf5") else: excons.WarnOnce("Could not find configuration header", tool="hdf5") return (False, cfg) def _RealRequire(env): quiet, cfg = GetConf(env, hdf5_inc) if hdf5_inc: env.Append(CPPPATH=[hdf5_inc]) if hdf5_lib: env.Append(LIBPATH=[hdf5_lib]) if hl: excons.Link(env, hdf5hl_libname, static=hdf5_static, force=True, silent=True) excons.Link(env, hdf5_libname, static=hdf5_static, force=True, silent=True) if hdf5_static: if not quiet: excons.PrintOnce("Static build", tool="hdf5") if cfg["threadsafe"]: threads.Require(env) if cfg["zlib"]: if excons.GetArgument("zlib-static", None) is None: if not quiet: excons.PrintOnce("Force static zlib", tool="hdf5") excons.SetArgument("zlib-static", 1) zlib.Require(env) if cfg["szip"]: if excons.GetArgument("szip-static", None) is None: if not quiet: excons.PrintOnce("Force static szip", tool="hdf5") excons.SetArgument("szip-static", 1) szip.Require(env) excons.AddHelpOptions(hdf5=GetOptionsString()) return _RealRequire