def postBuildAction(target, source, env): coralLib = str(source[0]) coralUiLib = str(source[1]) imathLib = str(source[2]) mayaPlugin = str(source[3]) coralMaya = str(source[4]) buildDir = os.path.join("build", "coralMayaBuild") shutil.rmtree(buildDir, ignore_errors = True) shutil.copytree(os.path.join("coralMaya", "py"), os.path.join(buildDir, "coralMaya")) shutil.copytree(os.path.join("coral", "py", "coral"), os.path.join(buildDir, "coral")) shutil.copy(coralLib, os.path.join(buildDir, "coral")) shutil.copy(coralMaya, os.path.join(buildDir, "coralMaya")) shutil.copy(mayaPlugin, os.path.join(buildDir, "coralMaya")) shutil.copy(imathLib, buildDir) shutil.copytree(os.path.join("coralUi", "py", "coralUi"), os.path.join(buildDir, "coral", "coralUi")) shutil.copy(coralUiLib, os.path.join(buildDir, "coral", "coralUi")) if sys.platform == "darwin": # fix lib link path on Mac Os X sconsUtils.autoFixDynamicLinks(os.path.join(buildDir, "coralMaya", "coralMayaPlugin.bundle")) sconsUtils.autoFixDynamicLinks(os.path.join(buildDir, "coral", "_coral.so")) sconsUtils.autoFixDynamicLinks(os.path.join(buildDir, "coral", "coralUi", "_coralUi.so")) sconsUtils.autoFixDynamicLinks(os.path.join(buildDir, "coralMaya", "_coralMaya.so")) pycFiles = sconsUtils.findFiles(os.path.join(buildDir), pattern = "*.pyc") for pycFile in pycFiles: os.remove(pycFile)
def buildSdkLibs(coralLib, coralUiLib, buildDir): coralLibsDir = os.path.join(buildDir, "coral", "libs") coralUiLibsDir = os.path.join(buildDir, "coralUi", "libs") imathLibsDir = os.path.join(buildDir, "Imath", "libs") boostLibsDir = os.path.join(buildDir, "boost", "libs") os.makedirs(coralLibsDir) os.makedirs(coralUiLibsDir) os.makedirs(imathLibsDir) os.makedirs(boostLibsDir) targetCoralLibName = str(SharedLibrary("coral")[0]) targetCoralUiLibName = str(SharedLibrary("coralUi")[0]) sourceCoralLibName = os.path.split(coralLib)[-1] sourceCoralUiLibName = os.path.split(coralUiLib)[-1] os.symlink( os.path.join(os.pardir, os.pardir, os.pardir, "coral", sourceCoralLibName), os.path.join(coralLibsDir, targetCoralLibName)) os.symlink( os.path.join(os.pardir, os.pardir, os.pardir, "coral", "coralUi", sourceCoralUiLibName), os.path.join(coralUiLibsDir, targetCoralUiLibName)) ImathLibName = str( SharedLibrary(sconsUtils.getEnvVar("CORAL_IMATH_LIB"))[0]) ImathIexLibName = str( SharedLibrary(sconsUtils.getEnvVar("CORAL_IMATH_IEX_LIB"))[0]) boostPythonLibName = str( SharedLibrary(sconsUtils.getEnvVar("CORAL_BOOST_PYTHON_LIB"))[0]) ImathLib = os.path.join(sconsUtils.getEnvVar("CORAL_IMATH_LIBS_PATH"), ImathLibName) ImathIexLib = os.path.join(sconsUtils.getEnvVar("CORAL_IMATH_LIBS_PATH"), ImathIexLibName) boostPythonLib = os.path.join( sconsUtils.getEnvVar("CORAL_BOOST_LIBS_PATH"), boostPythonLibName) shutil.copy(ImathLib, imathLibsDir) shutil.copy(ImathIexLib, imathLibsDir) shutil.copy(boostPythonLib, boostLibsDir) if sys.platform == "darwin": sconsUtils.autoFixDynamicLinks(os.path.join(imathLibsDir, ImathLibName)) sconsUtils.autoFixDynamicLinks( os.path.join(imathLibsDir, ImathIexLibName)) sconsUtils.autoFixDynamicLinks( os.path.join(boostLibsDir, boostPythonLibName))
def postBuildAction(target, source, env): coralLib = str(source[0]) coralUiLib = str(source[1]) imathLib = str(source[2]) mayaPlugin = str(source[3]) coralMaya = str(source[4]) buildDir = os.path.join("build", "coralMayaBuild") shutil.rmtree(buildDir, ignore_errors=True) shutil.copytree(os.path.join("coralMaya", "py"), os.path.join(buildDir, "coralMaya")) shutil.copytree(os.path.join("coral", "py", "coral"), os.path.join(buildDir, "coral")) shutil.copy(coralLib, os.path.join(buildDir, "coral")) shutil.copy(coralMaya, os.path.join(buildDir, "coralMaya")) shutil.copy(mayaPlugin, os.path.join(buildDir, "coralMaya")) shutil.copy(imathLib, buildDir) shutil.copytree(os.path.join("coralUi", "py", "coralUi"), os.path.join(buildDir, "coral", "coralUi")) shutil.copy(coralUiLib, os.path.join(buildDir, "coral", "coralUi")) if sys.platform == "darwin": # fix lib link path on Mac Os X sconsUtils.autoFixDynamicLinks( os.path.join(buildDir, "coralMaya", "coralMayaPlugin.bundle")) sconsUtils.autoFixDynamicLinks( os.path.join(buildDir, "coral", "_coral.so")) sconsUtils.autoFixDynamicLinks( os.path.join(buildDir, "coral", "coralUi", "_coralUi.so")) sconsUtils.autoFixDynamicLinks( os.path.join(buildDir, "coralMaya", "_coralMaya.so")) pycFiles = sconsUtils.findFiles(os.path.join(buildDir), pattern="*.pyc") for pycFile in pycFiles: os.remove(pycFile)
def buildMainTree(coralLib, coralUiLib, imathLib, buildDir): if sys.platform == "darwin": # fix lib link path on Mac Os X sconsUtils.autoFixDynamicLinks(coralLib) sconsUtils.autoFixDynamicLinks(coralUiLib) sconsUtils.autoFixDynamicLinks(imathLib) shutil.copytree(os.path.join("coral", "py"), buildDir) shutil.copy(coralLib, os.path.join(buildDir, "coral")) shutil.copy(imathLib, buildDir) shutil.copytree(os.path.join("coralUi", "py", "coralUi"), os.path.join(buildDir, "coral", "coralUi")) shutil.copy(coralUiLib, os.path.join(buildDir, "coral", "coralUi")) pycFiles = sconsUtils.findFiles(os.path.join(buildDir), pattern = "*.pyc") for pycFile in pycFiles: os.remove(pycFile) compileall.compile_dir(buildDir, quiet = True) if buildSdk: buildSdkTree(coralLib, coralUiLib, sdkInstallDir)
def buildSdkLibs(coralLib, coralUiLib, buildDir): coralLibsDir = os.path.join(buildDir, "coral", "libs") coralUiLibsDir = os.path.join(buildDir, "coralUi", "libs") imathLibsDir = os.path.join(buildDir, "Imath", "libs") boostLibsDir = os.path.join(buildDir, "boost", "libs") os.makedirs(coralLibsDir) os.makedirs(coralUiLibsDir) os.makedirs(imathLibsDir) os.makedirs(boostLibsDir) targetCoralLibName = str(SharedLibrary("coral")[0]) targetCoralUiLibName = str(SharedLibrary("coralUi")[0]) sourceCoralLibName = os.path.split(coralLib)[-1] sourceCoralUiLibName = os.path.split(coralUiLib)[-1] os.symlink(os.path.join(os.pardir, os.pardir, os.pardir, "coral", sourceCoralLibName), os.path.join(coralLibsDir, targetCoralLibName)) os.symlink(os.path.join(os.pardir, os.pardir, os.pardir, "coral", "coralUi", sourceCoralUiLibName), os.path.join(coralUiLibsDir, targetCoralUiLibName)) ImathLibName = str(SharedLibrary(sconsUtils.getEnvVar("CORAL_IMATH_LIB"))[0]) ImathIexLibName = str(SharedLibrary(sconsUtils.getEnvVar("CORAL_IMATH_IEX_LIB"))[0]) boostPythonLibName = str(SharedLibrary(sconsUtils.getEnvVar("CORAL_BOOST_PYTHON_LIB"))[0]) ImathLib = os.path.join(sconsUtils.getEnvVar("CORAL_IMATH_LIBS_PATH"), ImathLibName) ImathIexLib = os.path.join(sconsUtils.getEnvVar("CORAL_IMATH_LIBS_PATH"), ImathIexLibName) boostPythonLib = os.path.join(sconsUtils.getEnvVar("CORAL_BOOST_LIBS_PATH"), boostPythonLibName) shutil.copy(ImathLib, imathLibsDir) shutil.copy(ImathIexLib, imathLibsDir) shutil.copy(boostPythonLib, boostLibsDir) if sys.platform == "darwin": sconsUtils.autoFixDynamicLinks(os.path.join(imathLibsDir, ImathLibName)) sconsUtils.autoFixDynamicLinks(os.path.join(imathLibsDir, ImathIexLibName)) sconsUtils.autoFixDynamicLinks(os.path.join(boostLibsDir, boostPythonLibName))
def buildMainTree(coralLib, coralUiLib, imathLib, buildDir): if sys.platform == "darwin": # fix lib link path on Mac Os X sconsUtils.autoFixDynamicLinks(coralLib) sconsUtils.autoFixDynamicLinks(coralUiLib) sconsUtils.autoFixDynamicLinks(imathLib) shutil.copytree(os.path.join("coral", "py"), buildDir) shutil.copy(coralLib, os.path.join(buildDir, "coral")) shutil.copy(imathLib, buildDir) shutil.copytree(os.path.join("coralUi", "py", "coralUi"), os.path.join(buildDir, "coral", "coralUi")) shutil.copy(coralUiLib, os.path.join(buildDir, "coral", "coralUi")) pycFiles = sconsUtils.findFiles(os.path.join(buildDir), pattern="*.pyc") for pycFile in pycFiles: os.remove(pycFile) compileall.compile_dir(buildDir, quiet=True) if buildSdk: buildSdkTree(coralLib, coralUiLib, sdkInstallDir)
def buildOsXApp(coralLib, coralUiLib, imathLib): print "* building app bundle" # clean buildDir = os.path.join("build", "coralStandaloneApp") shutil.rmtree(buildDir, ignore_errors = True) # make dirs os.mkdir(buildDir) appBundle = os.path.join(buildDir, "CoralStandalone.app") os.mkdir(appBundle) contentsDir = os.path.join(appBundle, "Contents") os.mkdir(contentsDir) resourcesDir = os.path.join(contentsDir, "Resources") os.mkdir(resourcesDir) global sdkInstallDir sdkInstallDir = os.path.join(contentsDir, "sdk") buildMainTree(coralLib, coralUiLib, imathLib, os.path.join(contentsDir, "coral")) # copy stuff over shutil.copy(os.path.join("resources", "macAppBundle", "Info.plist"), contentsDir) shutil.copy(os.path.join("resources", "macAppBundle", "PkgInfo"), contentsDir) macOsDir = os.path.join(contentsDir, "MacOS") os.mkdir(macOsDir) shutil.copy(os.path.join("resources", "macAppBundle", "CoralStandalone"), macOsDir) for envName in os.environ.keys(): if envName.startswith("CORAL_Qt"): qtLib = os.environ[envName] shutil.copy(qtLib, macOsDir) shutil.copy("/usr/local/lib/libboost_filesystem.dylib", macOsDir) shutil.copy("/usr/local/lib/libboost_regex.dylib", macOsDir) shutil.copy("/usr/local/lib/libboost_system.dylib", macOsDir) shutil.copy("/usr/local/lib/libboost_thread.dylib", macOsDir) shutil.copy("/usr/local/lib/libHalf.6.dylib", macOsDir) shutil.copy("/usr/local/lib/libIex.6.dylib", macOsDir) shutil.copy("/usr/local/lib/libImath.6.dylib", macOsDir) shutil.copy("/usr/local/lib/libIlmThread.6.dylib", macOsDir) shutil.copy("/usr/X11/lib/libpng15.15.dylib", macOsDir) shutil.copy("/usr/local/lib/libtiff.5.dylib", macOsDir) shutil.copy("/usr/local/lib/libjpeg.8.dylib", macOsDir) shutil.copy("/usr/local/lib/libIlmImf.6.dylib", macOsDir) glewLib = os.path.join(sconsUtils.getEnvVar("CORAL_GLEW_LIBS_PATH"), "lib" + sconsUtils.getEnvVar("CORAL_GLEW_LIB") + ".dylib") shutil.copy(glewLib, macOsDir) openImageIoLib = os.path.join(sconsUtils.getEnvVar("CORAL_OIIO_LIBS_PATH"), "lib" + sconsUtils.getEnvVar("CORAL_OIIO_LIB") + ".dylib") shutil.copy(openImageIoLib, macOsDir) tbbLib = os.path.join(sconsUtils.getEnvVar("CORAL_TBB_LIBS_PATH"), "lib" + sconsUtils.getEnvVar("CORAL_TBB_LIB") + ".dylib") shutil.copy(tbbLib, macOsDir) boostPythonLib = os.path.join(sconsUtils.getEnvVar("CORAL_BOOST_LIBS_PATH"), "lib" + sconsUtils.getEnvVar("CORAL_BOOST_PYTHON_LIB") + ".dylib") shutil.copy(boostPythonLib, macOsDir) qtUiPath = os.path.split(sconsUtils.getEnvVar("CORAL_QtGui_LIB"))[0] qtnib = os.path.join(qtUiPath, "Resources", "qt_menu.nib") shutil.copytree(qtnib, os.path.join(resourcesDir, "qt_menu.nib")) os.system("chmod +x " + os.path.join(macOsDir, "coralStandalone")) shutil.copy(os.path.join("resources", "macAppBundle", "coral.icns"), resourcesDir) pythonVersion = os.path.split(sconsUtils.getEnvVar("CORAL_PYTHON_PATH"))[-1] pythonFrameworkDir = os.path.join(contentsDir, "Frameworks", "Python.framework", "Versions", pythonVersion) shutil.copytree(sconsUtils.getEnvVar("CORAL_PYTHON_PATH"), pythonFrameworkDir) shutil.copy(os.path.join(contentsDir, "Frameworks", "Python.framework", "Versions", pythonVersion, "Resources/Python.app/Contents/MacOS/Python-64"), os.path.join(macOsDir, "python")) # fix dylib links libs = sconsUtils.findFiles(macOsDir, pattern = "*.dylib") libs.extend(sconsUtils.findFiles(macOsDir, pattern = "Qt*")) libs.extend(sconsUtils.findFiles(os.path.join(pythonFrameworkDir, "lib", "python" + pythonVersion, "site-packages", "PyQt4"), pattern = "*.so")) for lib in libs: sconsUtils.autoFixDynamicLinks(lib)
def _postBuildAction(target, source, env): if sys.platform == "darwin": # fix lib link path on Mac Os X dylib = str(source[0]) sconsUtils.autoFixDynamicLinks(dylib)
def buildOsXApp(coralLib, coralUiLib, imathLib): print "* building app bundle" # clean buildDir = os.path.join("build", "coralStandaloneApp") shutil.rmtree(buildDir, ignore_errors=True) # make dirs os.mkdir(buildDir) appBundle = os.path.join(buildDir, "CoralStandalone.app") os.mkdir(appBundle) contentsDir = os.path.join(appBundle, "Contents") os.mkdir(contentsDir) resourcesDir = os.path.join(contentsDir, "Resources") os.mkdir(resourcesDir) global sdkInstallDir sdkInstallDir = os.path.join(contentsDir, "sdk") buildMainTree(coralLib, coralUiLib, imathLib, os.path.join(contentsDir, "coral")) # copy stuff over shutil.copy(os.path.join("resources", "macAppBundle", "Info.plist"), contentsDir) shutil.copy(os.path.join("resources", "macAppBundle", "PkgInfo"), contentsDir) macOsDir = os.path.join(contentsDir, "MacOS") os.mkdir(macOsDir) shutil.copy(os.path.join("resources", "macAppBundle", "CoralStandalone"), macOsDir) for envName in os.environ.keys(): if envName.startswith("CORAL_Qt"): qtLib = os.environ[envName] shutil.copy(qtLib, macOsDir) shutil.copy("/usr/local/lib/libboost_filesystem.dylib", macOsDir) shutil.copy("/usr/local/lib/libboost_regex.dylib", macOsDir) shutil.copy("/usr/local/lib/libboost_system.dylib", macOsDir) shutil.copy("/usr/local/lib/libboost_thread.dylib", macOsDir) shutil.copy("/usr/local/lib/libHalf.6.dylib", macOsDir) shutil.copy("/usr/local/lib/libIex.6.dylib", macOsDir) shutil.copy("/usr/local/lib/libImath.6.dylib", macOsDir) shutil.copy("/usr/local/lib/libIlmThread.6.dylib", macOsDir) shutil.copy("/usr/X11/lib/libpng15.15.dylib", macOsDir) shutil.copy("/usr/local/lib/libtiff.5.dylib", macOsDir) shutil.copy("/usr/local/lib/libjpeg.8.dylib", macOsDir) shutil.copy("/usr/local/lib/libIlmImf.6.dylib", macOsDir) glewLib = os.path.join( sconsUtils.getEnvVar("CORAL_GLEW_LIBS_PATH"), "lib" + sconsUtils.getEnvVar("CORAL_GLEW_LIB") + ".dylib") shutil.copy(glewLib, macOsDir) openImageIoLib = os.path.join( sconsUtils.getEnvVar("CORAL_OIIO_LIBS_PATH"), "lib" + sconsUtils.getEnvVar("CORAL_OIIO_LIB") + ".dylib") shutil.copy(openImageIoLib, macOsDir) tbbLib = os.path.join( sconsUtils.getEnvVar("CORAL_TBB_LIBS_PATH"), "lib" + sconsUtils.getEnvVar("CORAL_TBB_LIB") + ".dylib") shutil.copy(tbbLib, macOsDir) boostPythonLib = os.path.join( sconsUtils.getEnvVar("CORAL_BOOST_LIBS_PATH"), "lib" + sconsUtils.getEnvVar("CORAL_BOOST_PYTHON_LIB") + ".dylib") shutil.copy(boostPythonLib, macOsDir) qtUiPath = os.path.split(sconsUtils.getEnvVar("CORAL_QtGui_LIB"))[0] qtnib = os.path.join(qtUiPath, "Resources", "qt_menu.nib") shutil.copytree(qtnib, os.path.join(resourcesDir, "qt_menu.nib")) os.system("chmod +x " + os.path.join(macOsDir, "coralStandalone")) shutil.copy(os.path.join("resources", "macAppBundle", "coral.icns"), resourcesDir) pythonVersion = os.path.split( sconsUtils.getEnvVar("CORAL_PYTHON_PATH"))[-1] pythonFrameworkDir = os.path.join(contentsDir, "Frameworks", "Python.framework", "Versions", pythonVersion) shutil.copytree(sconsUtils.getEnvVar("CORAL_PYTHON_PATH"), pythonFrameworkDir) shutil.copy( os.path.join(contentsDir, "Frameworks", "Python.framework", "Versions", pythonVersion, "Resources/Python.app/Contents/MacOS/Python-64"), os.path.join(macOsDir, "python")) # fix dylib links libs = sconsUtils.findFiles(macOsDir, pattern="*.dylib") libs.extend(sconsUtils.findFiles(macOsDir, pattern="Qt*")) libs.extend( sconsUtils.findFiles(os.path.join(pythonFrameworkDir, "lib", "python" + pythonVersion, "site-packages", "PyQt4"), pattern="*.so")) for lib in libs: sconsUtils.autoFixDynamicLinks(lib)