BACK TO ARCHIVE
USD Pipeline

windows7上编译Pixar USD

11.10.2017 ADUCG RESEARCH

准备编译前需要安装的工具:

以上是必须安装的,Maya 需要保证安装了 maya2017,目前支持到 2017,如果需要 2018 需要手动修改脚本,另外可以选择安装 embree,它将做为 usdview 的渲染器使用。

Python 需要安装 pyside 及 PyOpenGL,可以通过以下命令完成安装

pip install PySide 
pip install PyOpenGL

确保以下路径正确:

CMakeC:\Program Files\CMake\bin
NASMC:\Program Files\NASM
PythonC:\Python27
Pip, Pyside, PyOpenGLC:\Python27\Scripts
Embree(任意版本)C:\Program Files\Intel\Embree v2.16.5 x64\bin

下载源代码:

建立个目录用来存方源代码,比如:C:\dev**USD**

使用 Git 命令从 GitHub 上获取源代码

git clone https://github.com/PixarAnimationStudios/USD C:\dev\usd

开始编译:

首先需要修改 C:\dev\USD\build_scripts\build_USD.py 中的 def GetVisualStudioCompilerAndVersion(): 函数,否则后面会编译失败!

def GetVisualStudioCompilerAndVersion():
    """Returns a tuple containing the path to the Visual Studio compiler
    and a tuple for its version, e.g. (19, 00, 24210). If the compiler is
    not found, returns None."""
    if not Windows():
        return None

    msvcCompiler = find_executable('cl')
    # if msvcCompiler:
    #     match = re.search(
    #         "Compiler Version (\d+).(\d+).(\d+)", 
    #         subprocess.check_output("cl", stderr=subprocess.STDOUT))
    #     if match:
    #         return (msvcCompiler, tuple(int(v) for v in match.groups()))
    # return None
    return ("C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe", (19, 00, 24215))

以管理员身份运行 VS2015 x64 本机工具命令提示符

使用命令进行编译

cd c:\dev
python usd\build_scripts\build_usd.py "C:\usd"

可以利用-h 获得配置说明

比如编译 AlembicMaya 插件使用命令:

python usd\build_scripts\build_usd.py --tests --alembic --hdf5 --maya --maya-location="C:\Program Files\Autodesk\Maya2017" --embree --embree-location="C:\Program Files\Intel\Embree v2.16.5 x64\bin" "C:\usd"

整个编译过程大概半小时左右,因为编译前脚本还会下载部分依赖库,如果网速不好建议提前根据 build_USD.py 中的下载地址将所需要的库先下载到 C:**USD**\src 中

添加环境变量

USD 命令提示符工具需要的环境变量:

environmentvariables
PATHC:\USD\bin;C:\USD\lib
PYTHONPATHC:\USD\lib\Python

Maya 插件所需要的环境变量:

environmentvariables
Maya_PLUG_IN_PATHC:\USD\third_party\Maya\plugin
Maya_SCRIPT_PATHC:\USD\third_party\Maya\share\USD\plugins\usdMaya\resources
XBMLANGPATHC:\USD\third_party\Maya\share\USD\plugins\usdMaya\resources
PATHC:\USD\third_party\Maya\lib

最后再次感谢Sol He大神的技术支持!

本文采用 Creative Commons BY-NC-ND 4.0 协议进行授权。

BY-NC-ND: 署名-非商业性使用-禁止演绎

End of Article