def make_nuke_plugin(env, **keywords): if not "nuke_ver" in keywords: raise Exception("Missing \"nuke_ver\" keyword argument") if not "app" in keywords: keywords["app"] = "nuke" if not "sources" in keywords: raise Exception("Missing \"sources\" keyword argument") name, subdir = env._make_any_pre(keywords) prefix = env.out_prefix() plug = "%s/%s/%s/%s/%s" % (env.out_dir(), prefix, keywords["nuke_ver"], env.platform(), env.arch()) plug += subdir + "/" + name env.ignore_import_lib() env['SHLIBPREFIX'] = '' env['SHLIBSUFFIX'] = get_nuke_plugin_ext(env) if str(Platform()) == 'darwin': env['SHLINKFLAGS'] = '$LINKFLAGS -bundle' build_prefix = keywords.get("build_prefix", "nuke-%s" % keywords["nuke_ver"]) if sys.platform == "win32": build_prefix += "/msvc-%s" % env.compiler_ver() env["OBJDIR"] = env.obj_dir() + "/" + build_prefix sconsutils.SetRPath(env, keywords) target = env.SharedLibrary( plug, env._collect_objects(keywords["sources"], sconsutils._shared_objects)) keywords["build_files"] = { str(target[0]): "%s/%s/%s/%s" % (keywords["nuke_ver"], env.platform(), env.arch(), subdir) } if env.generates_manifest() and env.keep_manifest(): keywords["build_files"][str(target[0]) + ".manifest"] = keywords["build_files"][str( target[0])] env._make_any_post(target, keywords) # extra cleanup MSVC shit ! if env.platform() == "windows": if env.generates_manifest() and not env.keep_manifest(): manifest = (str(target[0]) + '.manifest').replace("/", "\\") env.AddPostAction(target, "del /Q \"%s\"" % manifest) if env.build_debug(): Clean(target, plug + '.ilk') else: env.Append(CCFLAGS=["-fvisibility=hidden"]) return target
def _setup_rman_env(env, keywords): ver = keywords["renderman_ver"] if not "app" in keywords: if ver.startswith("3Delight"): keywords["app"] = "delight" else: keywords["app"] = "prman" if not "sources" in keywords: raise Exception("Missing \"sources\" keyword argument") name, subdir = env._make_any_pre(keywords) prefix = env.out_prefix() env['SHLIBPREFIX'] = env['RMAN_SHLIBPREFIX'] env['SHLIBSUFFIX'] = env['RMAN_SHLIBSUFFIX'] env.ignore_import_lib() dll = "%s/%s/%s/%s/%s" % (env.out_dir(), prefix, map_ver[ver], env.platform(), env.arch()) dll += subdir + "/" + name build_prefix = keywords.get("build_prefix", "rman-%s" % ver) if sys.platform == "win32": build_prefix += "/msvc-%s" % env.compiler_ver() env["OBJDIR"] = env.obj_dir() + "/" + build_prefix sconsutils.SetRPath(env, keywords) target = env.SharedLibrary( dll, env._collect_objects(keywords["sources"], sconsutils._shared_objects)) keywords["build_files"] = { str(target[0]): "%s/%s/%s/%s" % (map_ver[ver], env.platform(), env.arch(), subdir) } if env.generates_manifest() and env.keep_manifest(): keywords["build_files"][str(target[0]) + ".manifest"] = keywords["build_files"][str( target[0])] env._make_any_post(target, keywords) # extra cleanup MSVC shit ! if env.platform() == "windows": if env.generates_manifest() and not env.keep_manifest(): manifest = (str(target[0]) + ".manifest").replace("/", "\\") env.AddPostAction(target, "del /Q \"%s\"" % manifest) if env.build_debug(): Clean(target, dll + '.ilk') else: env.Append(CCFLAGS=["-fvisibility=hidden"]) return target
def make_python_ext(env, **keywords): if not "app" in keywords: keywords["app"] = "python" if not "sources" in keywords: raise Exception("Missing \"sources\" keywords argument") name, subdir = env._make_any_pre(keywords) prefix = env.out_prefix() if not "prefix" in keywords: prefix2 = "%s/%s" % (env.platform(), env.arch()) else: prefix2 = keywords["prefix"] pyver = python_version(env) ext = "%s/%s/%s/%s" % (env.out_dir(), prefix, pyver, prefix2) ext += subdir + "/" + name env.require_python(True, osx_link="runtime") build_prefix = keywords.get("build_prefix", "python-%s" % pyver) if sys.platform == "win32": build_prefix += "/msvc-%s" % env.compiler_ver() env["OBJDIR"] = env.obj_dir() + "/" + build_prefix sconsutils.SetRPath(env, keywords) target = env.SharedLibrary( ext, env._collect_objects(keywords["sources"], sconsutils._shared_objects)) keywords["build_files"] = { str(target[0]): "%s/%s/%s" % (pyver, prefix2, subdir) } if env.generates_manifest() and env.keep_manifest(): keywords["build_files"][str(target[0]) + ".manifest"] = keywords["build_files"][str( target[0])] env._make_any_post(target, keywords) # extra cleanup for windows if env.platform() == "windows": if env.generates_manifest() and not env.keep_manifest(): manifest = (str(target[0]) + '.manifest').replace("/", "\\") env.AddPostAction(target, "del /Q \"%s\"" % manifest) if env.build_debug(): Clean(target, ext + '.ilk') else: env.Append(CCFLAGS=["-fvisibility=hidden"]) return target
def _setup_houdini_env(env, keywords): if not "app" in keywords: keywords["app"] = "houdini" if not "sources" in keywords: raise Exception("Missing \"sources\" keyword argument") hsiteDir = False if "hsite" in keywords and keywords["hsite"]: hsiteDir = True ver = keywords["houdini_ver"] # sometimes houdini version has 4 digits, strip last one ver = ".".join(ver.split(".")[:3]) name, subdir = env._make_any_pre(keywords) prefix = env.out_prefix() env['SHLIBPREFIX'] = env['HOUDINI_SHLIBPREFIX'] env['SHLIBSUFFIX'] = env['HOUDINI_SHLIBSUFFIX'] env.ignore_import_lib() if env.platform() == "osx": env['SHLINKFLAGS'] = '$LINKFLAGS -bundle -flat_namespace' if hsiteDir: dll = "%s/%s/%s/%s/%s/dso" % (env.out_dir(), prefix, ver, env.platform(), env.arch()) else: dll = "%s/%s/%s/dso/%s/%s" % (env.out_dir(), prefix, ver, env.platform(), env.arch()) dll += subdir + "/" + name build_prefix = keywords.get("build_prefix", "houdini-%s" % ver) if sys.platform == "win32": build_prefix += "/msvc-%s" % env.compiler_ver() env["OBJDIR"] = env.obj_dir() + "/" + build_prefix sconsutils.SetRPath(env, keywords) target = env.SharedLibrary( dll, env._collect_objects(keywords["sources"], sconsutils._shared_objects)) if hsiteDir: keywords["build_files"] = { str(target[0]): "%s/%s/%s/dso/%s" % (ver, env.platform(), env.arch(), subdir) } else: keywords["build_files"] = { str(target[0]): "%s/dso/%s/%s/%s" % (ver, env.platform(), env.arch(), subdir) } if env.generates_manifest() and env.keep_manifest(): keywords["build_files"][str(target[0]) + ".manifest"] = keywords["build_files"][str( target[0])] env._make_any_post(target, keywords) # extra cleanup MSVC shit ! if env.platform() == "windows": if env.generates_manifest() and not env.keep_manifest(): manifest = (str(target[0]) + ".manifest").replace("/", "\\") env.AddPostAction(target, "del /Q \"%s\"" % manifest) if env.build_debug(): Clean(target, dll + '.ilk') else: env.Append(CCFLAGS=["-fvisibility=hidden"]) return target
def make_ofx_plugin(env, **keywords): if not "app" in keywords: keywords["app"] = "openfx" if not "sources" in keywords: raise Exception("Missing \"sources\" keyword argument") name, subdir = env._make_any_pre(keywords) prefix = env.out_prefix() # platform and arch are handled by the OpenFX bundle directory layout plug = "%s/%s/all" % (env.out_dir(), prefix) plug += subdir contents_path = name + ".ofx.bundle/Contents" res_path = contents_path + "/Resources" res_stage_path = "all/" + res_path contents_stage_path = "all/" + contents_path if not "install_files" in keywords: keywords["install_files"] = {} if "ofx_icons" in keywords: for pattern in keywords["ofx_icons"]: for iconpath in glob.glob(pattern): keywords["install_files"][iconpath] = res_stage_path if "ofx_res" in keywords: for pattern in keywords["ofx_res"]: for respath in glob.glob(pattern): keywords["install_files"][respath] = res_stage_path if env.platform() == "osx": plist = """ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>CFBundleDevelopmentRegion</key> <string>English</string> <key>CFBundleExecutable</key> <string>%s</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundlePackageType</key> <string>BNDL</string> <key>CFBundleVersion</key> <string>1.0</string> </dict> </plist> """ % (name+".ofx") # Might want to find a better solution for this temporary file # -> what if we build several Ofx plugin with the same SConstruct? plist_path = "Info.plist" plist_file = open(plist_path, "w") plist_file.write(plist) plist_file.close() keywords["install_files"][plist_path] = contents_stage_path archdir = "MacOS" env['SHLINKFLAGS'] = '$LINKFLAGS -bundle' elif env.platform() == "windows": archdir = ("Win64" if env.arch() == "x64" else "Win32") elif env.platform() == "linux": archdir = ("Linux-x86-64" if env.arch() == "x64" else "Linux-x86") else: raise Exception("Unknown platform \"%s\"" % env.platform()) plug += "/" + contents_path + "/" + archdir + "/" + name deploy_target = "all/"+subdir+"/"+contents_path+"/"+archdir env.ignore_import_lib() env['SHLIBPREFIX'] = '' env['SHLIBSUFFIX'] = env['OFX_MOD_SUFFIX'] build_prefix = keywords.get("build_prefix", "openfx-%s" % env["OPENFX_VERSION"]) if sys.platform == "win32": build_prefix += "/msvc-%s" % env.compiler_ver() env["OBJDIR"] = env.obj_dir() + "/" + build_prefix sconsutils.SetRPath(env, keywords) target = env.SharedLibrary(plug, env._collect_objects(keywords["sources"], sconsutils._shared_objects)) keywords["build_files"] = {str(target[0]): deploy_target} if env.generates_manifest() and env.keep_manifest(): keywords["build_files"][str(target[0])+".manifest"] = keywords["build_files"][str(target[0])] # don't forget install_files for resources env._make_any_post(target, keywords) # extra cleanup MSVC shit ! if env.platform() == "windows": if env.generates_manifest() and not env.keep_manifest(): manifest = (str(target[0])+'.manifest').replace("/", "\\") env.AddPostAction(target, "del /Q \"%s\"" % manifest) if env.build_debug(): Clean(target, plug+'.ilk') else: env.Append(CCFLAGS = ["-fvisibility=hidden"]) if env.platform() == "osx": Clean(target, "Info.plist") return target