コード例 #1
0
ファイル: buildStandalone.py プロジェクト: achayan/coraline
def buildSdkHeaders(buildDir):
    coralIncludesDir = os.path.join(buildDir, "coral", "includes", "coral")
    coralUiIncludesDir = os.path.join(buildDir, "coralUi", "includes", "coralUi")
    
    os.makedirs(coralIncludesDir)
    os.makedirs(coralUiIncludesDir)
    
    coralHeaders = sconsUtils.findFiles(os.path.join("coral", "src"), pattern = "*.h")
    
    for header in coralHeaders:
        file = open(header)
        fileContent = file.read()
        file.close()
        
        if "CORAL_EXPORT" in fileContent:
            shutil.copy(header, coralIncludesDir)
    
    coralUiHeaders = sconsUtils.findFiles(os.path.join("coralUi", "src"), pattern = "*.h")
    
    for header in coralUiHeaders:
        file = open(header)
        fileContent = file.read()
        file.close()
        
        if "CORALUI_EXPORT" in fileContent:
            shutil.copy(header, coralUiIncludesDir)
    
    shutil.copytree(sconsUtils.getEnvVar("CORAL_IMATH_INCLUDES_PATH"), os.path.join(buildDir, "Imath", "includes"))
    shutil.copytree(sconsUtils.getEnvVar("CORAL_BOOST_INCLUDES_PATH"), os.path.join(buildDir, "boost", "includes", "boost"))
コード例 #2
0
def buildSdkHeaders(buildDir):
    coralIncludesDir = os.path.join(buildDir, "coral", "includes", "coral")
    coralUiIncludesDir = os.path.join(buildDir, "coralUi", "includes",
                                      "coralUi")

    os.makedirs(coralIncludesDir)
    os.makedirs(coralUiIncludesDir)

    coralHeaders = sconsUtils.findFiles(os.path.join("coral", "src"),
                                        pattern="*.h")

    for header in coralHeaders:
        file = open(header)
        fileContent = file.read()
        file.close()

        if "CORAL_EXPORT" in fileContent:
            shutil.copy(header, coralIncludesDir)

    coralUiHeaders = sconsUtils.findFiles(os.path.join("coralUi", "src"),
                                          pattern="*.h")

    for header in coralUiHeaders:
        file = open(header)
        fileContent = file.read()
        file.close()

        if "CORALUI_EXPORT" in fileContent:
            shutil.copy(header, coralUiIncludesDir)

    shutil.copytree(sconsUtils.getEnvVar("CORAL_IMATH_INCLUDES_PATH"),
                    os.path.join(buildDir, "Imath", "includes"))
    shutil.copytree(sconsUtils.getEnvVar("CORAL_BOOST_INCLUDES_PATH"),
                    os.path.join(buildDir, "boost", "includes", "boost"))
コード例 #3
0
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))
コード例 #4
0
ファイル: buildStandalone.py プロジェクト: achayan/coraline
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))
コード例 #5
0
ファイル: buildStandalone.py プロジェクト: achayan/coraline
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)
コード例 #6
0
ファイル: coralBuilder.py プロジェクト: BigMacchia/coral-repo
def buildEnv():
    env = SCons.Environment.Environment()
    
    if sys.platform.startswith("win"):
        coralLib = coralLib[1]
        
    env.Append(
        CPPPATH = [
        sconsUtils.getEnvVar("CORAL_INCLUDES_PATH"),
        sconsUtils.getEnvVar("CORALUI_INCLUDES_PATH"),
        sconsUtils.getEnvVar("CORAL_PYTHON_INCLUDES_PATH"),
        sconsUtils.getEnvVar("CORAL_IMATH_INCLUDES_PATH"),
        sconsUtils.getEnvVar("CORAL_BOOST_INCLUDES_PATH")])
    
    env.Append(
        LIBS = [
        "coral",
        "coralUi",
        sconsUtils.getEnvVar("CORAL_IMATH_LIB"),
        sconsUtils.getEnvVar("CORAL_IMATH_IEX_LIB"),
        sconsUtils.getEnvVar("CORAL_PYTHON_LIB"), 
        sconsUtils.getEnvVar("CORAL_BOOST_PYTHON_LIB")])
    
    env.Append(
        LIBPATH = [
        sconsUtils.getEnvVar("CORAL_LIBS_PATH"),
        sconsUtils.getEnvVar("CORALUI_LIBS_PATH"),
        sconsUtils.getEnvVar("CORAL_IMATH_LIBS_PATH"),
        sconsUtils.getEnvVar("CORAL_PYTHON_LIBS_PATH"), 
        sconsUtils.getEnvVar("CORAL_BOOST_LIBS_PATH")])
    
    env["SHLIBPREFIX"] = ""
    env["TARGET_ARCH"] = platform.machine()
    
    if sys.platform.startswith("linux"):
        pass
    elif sys.platform == "darwin":
        env["SHLIBSUFFIX"] = ".so"
        env["FRAMEWORKS"] = ["OpenGL"]
    elif sys.platform.startswith("win"):
        env.Append(CPPPATH = sconsUtils.getEnvVar("CORAL_OPENGL_INCLUDES_PATH"))
        env.Append(LIBS = sconsUtils.getEnvVar("CORAL_OPENGL_LIB"))
        env.Append(LIBPATH = sconsUtils.getEnvVar("CORAL_OPENGL_LIBS_PATH"))
        env["SHLIBSUFFIX"] = ".pyd"
        env["CXXFLAGS"] = Split("/Zm800 -nologo /EHsc /DBOOST_PYTHON_DYNAMIC_LIB /Z7 /Od /Ob0 /GR /MD /wd4675 /Zc:forScope /Zc:wchar_t")
        env["CCFLAGS"] = "-DCORAL_UI_COMPILE"
        env["LINKFLAGS"] = ["/MANIFEST:NO"]
    
    return env
コード例 #7
0
ファイル: coralBuilder.py プロジェクト: ljkart/coraline
def buildEnv():
    env = SCons.Environment.Environment()

    if sys.platform.startswith("win"):
        coralLib = coralLib[1]

    env.Append(CPPPATH=[
        sconsUtils.getEnvVar("CORAL_INCLUDES_PATH"),
        sconsUtils.getEnvVar("CORALUI_INCLUDES_PATH"),
        sconsUtils.getEnvVar("CORAL_PYTHON_INCLUDES_PATH"),
        sconsUtils.getEnvVar("CORAL_IMATH_INCLUDES_PATH"),
        sconsUtils.getEnvVar("CORAL_BOOST_INCLUDES_PATH")
    ])

    env.Append(LIBS=[
        "coral", "coralUi",
        sconsUtils.getEnvVar("CORAL_IMATH_LIB"),
        sconsUtils.getEnvVar("CORAL_IMATH_IEX_LIB"),
        sconsUtils.getEnvVar("CORAL_PYTHON_LIB"),
        sconsUtils.getEnvVar("CORAL_BOOST_PYTHON_LIB")
    ])

    env.Append(LIBPATH=[
        sconsUtils.getEnvVar("CORAL_LIBS_PATH"),
        sconsUtils.getEnvVar("CORALUI_LIBS_PATH"),
        sconsUtils.getEnvVar("CORAL_IMATH_LIBS_PATH"),
        sconsUtils.getEnvVar("CORAL_PYTHON_LIBS_PATH"),
        sconsUtils.getEnvVar("CORAL_BOOST_LIBS_PATH")
    ])

    env["SHLIBPREFIX"] = ""
    env["TARGET_ARCH"] = platform.machine()

    if sys.platform.startswith("linux"):
        pass
    elif sys.platform == "darwin":
        env["SHLIBSUFFIX"] = ".so"
        env["FRAMEWORKS"] = ["OpenGL"]
    elif sys.platform.startswith("win"):
        env.Append(CPPPATH=sconsUtils.getEnvVar("CORAL_OPENGL_INCLUDES_PATH"))
        env.Append(LIBS=sconsUtils.getEnvVar("CORAL_OPENGL_LIB"))
        env.Append(LIBPATH=sconsUtils.getEnvVar("CORAL_OPENGL_LIBS_PATH"))
        env["SHLIBSUFFIX"] = ".pyd"
        env["CXXFLAGS"] = Split(
            "/Zm800 -nologo /EHsc /DBOOST_PYTHON_DYNAMIC_LIB /Z7 /Od /Ob0 /GR /MD /wd4675 /Zc:forScope /Zc:wchar_t"
        )
        env["CCFLAGS"] = "-DCORAL_UI_COMPILE"
        env["LINKFLAGS"] = ["/MANIFEST:NO"]

    return env
コード例 #8
0
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)