-
Pixar USD 官方介绍地址:http://www.OpenUSD.org
-
Pixar USD 下载地址:https://github.com/PixarAnimationStudios/USD
-
主要参考 https://qiita.com/takahito-tejima/items/f820e16869ca4343a600
-
感谢何兄(Sol He)的帮助,帮我解决了报错问题,Sol He 博客:http://www.cnblogs.com/hksac/
准备编译前需要安装的工具:
- VisualStudio 2015 Update 3(社区版就可以)
- Python 2.7 x64 https://www.Python.org/ftp/python/2.7.13/python-2.7.13.amd64.msi
- NASM http://www.nasm.us
- cmake 3.8 以上版本
- Git https://git-scm.com/downloads
以上是必须安装的,Maya 需要保证安装了 maya2017,目前支持到 2017,如果需要 2018 需要手动修改脚本,另外可以选择安装 embree,它将做为 usdview 的渲染器使用。
Python 需要安装 pyside 及 PyOpenGL,可以通过以下命令完成安装
pip install PySide
pip install PyOpenGL

确保以下路径正确:
| CMake | C:\Program Files\CMake\bin |
| NASM | C:\Program Files\NASM |
| Python | C:\Python27 |
| Pip, Pyside, PyOpenGL | C:\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 获得配置说明

比如编译 Alembic 及 Maya 插件使用命令:
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 命令提示符工具需要的环境变量:
| environment | variables |
| PATH | C:\USD\bin;C:\USD\lib |
| PYTHONPATH | C:\USD\lib\Python |
Maya 插件所需要的环境变量:
| environment | variables |
| Maya_PLUG_IN_PATH | C:\USD\third_party\Maya\plugin |
| Maya_SCRIPT_PATH | C:\USD\third_party\Maya\share\USD\plugins\usdMaya\resources |
| XBMLANGPATH | C:\USD\third_party\Maya\share\USD\plugins\usdMaya\resources |
| PATH | C:\USD\third_party\Maya\lib |


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