@@ -758,6 +758,11 @@ def InstallUSD(context):
758
758
with CurrentWorkingDirectory (context .usdSrcDir ):
759
759
extraArgs = []
760
760
761
+ if context .buildPython :
762
+ extraArgs .append ('-DPXR_ENABLE_PYTHON_SUPPORT=ON' )
763
+ else :
764
+ extraArgs .append ('-DPXR_ENABLE_PYTHON_SUPPORT=OFF' )
765
+
761
766
if context .buildShared :
762
767
extraArgs .append ('-DBUILD_SHARED_LIBS=ON' )
763
768
elif context .buildMonolithic :
@@ -907,6 +912,12 @@ def InstallUSD(context):
907
912
default = False , help = "Build documentation" )
908
913
subgroup .add_argument ("--no-docs" , dest = "build_docs" , action = "store_false" ,
909
914
help = "Do not build documentation (default)" )
915
+ subgroup = group .add_mutually_exclusive_group ()
916
+ subgroup .add_argument ("--python" , dest = "build_python" , action = "store_true" ,
917
+ default = True , help = "Build python based components "
918
+ "(default)" )
919
+ subgroup .add_argument ("--no-python" , dest = "build_python" , action = "store_false" ,
920
+ help = "Do not build python based components" )
910
921
911
922
(NO_IMAGING , IMAGING , USD_IMAGING ) = (0 , 1 , 2 )
912
923
@@ -1021,6 +1032,7 @@ def __init__(self, args):
1021
1032
# Optional components
1022
1033
self .buildTests = args .build_tests
1023
1034
self .buildDocs = args .build_docs
1035
+ self .buildPython = args .build_python
1024
1036
1025
1037
# - Imaging
1026
1038
self .buildImaging = (args .build_imaging == IMAGING or
@@ -1053,7 +1065,7 @@ def __init__(self, args):
1053
1065
self .buildHoudini = args .build_houdini
1054
1066
self .houdiniLocation = (os .path .abspath (args .houdini_location )
1055
1067
if args .houdini_location else None )
1056
-
1068
+
1057
1069
def MustBuildDependency (self , dep ):
1058
1070
return self .forceBuildAll or dep .name .lower () in self .forceBuild
1059
1071
@@ -1092,7 +1104,7 @@ def MustBuildDependency(self, dep):
1092
1104
requiredDependencies += [JPEG , TIFF , PNG , OPENEXR , GLEW ,
1093
1105
OPENIMAGEIO , OPENSUBDIV ]
1094
1106
1095
- if context .buildUsdImaging :
1107
+ if context .buildUsdImaging and context . buildPython :
1096
1108
requiredDependencies += [PYOPENGL , PYSIDE ]
1097
1109
1098
1110
# Assume zlib already exists on Linux platforms and don't build
@@ -1102,6 +1114,21 @@ def MustBuildDependency(self, dep):
1102
1114
if Linux ():
1103
1115
requiredDependencies .remove (ZLIB )
1104
1116
1117
+
1118
+ # Error out if we try to build any third party plugins with python disabled.
1119
+ if not context .buildPython :
1120
+ pythonPluginErrorMsg = (
1121
+ "%s plugin cannot be built when python support is disabled" )
1122
+ if context .buildMaya :
1123
+ PrintError (pythonPluginErrorMsg % "Maya" )
1124
+ sys .exit (1 )
1125
+ if context .buildHoudini :
1126
+ PrintError (pythonPluginErrorMsg % "Houdini" )
1127
+ sys .exit (1 )
1128
+ if context .buildKatana :
1129
+ PrintError (pythonPluginErrorMsg % "Katana" )
1130
+ sys .exit (1 )
1131
+
1105
1132
# Error out if we're building the Maya plugin and have enabled Ptex support
1106
1133
# in imaging. Maya includes its own copy of Ptex, which we believe is
1107
1134
# version 2.0.41. We would need to build imaging against this version to
@@ -1182,6 +1209,7 @@ def MustBuildDependency(self, dep):
1182
1209
Imaging {buildImaging}
1183
1210
Ptex support: {enablePtex}
1184
1211
UsdImaging {buildUsdImaging}
1212
+ Python support {buildPython}
1185
1213
Documentation {buildDocs}
1186
1214
Tests {buildTests}
1187
1215
Alembic Plugin {buildAlembic}
@@ -1205,6 +1233,7 @@ def MustBuildDependency(self, dep):
1205
1233
buildImaging = ("On" if context .buildImaging else "Off" ),
1206
1234
enablePtex = ("On" if context .enablePtex else "Off" ),
1207
1235
buildUsdImaging = ("On" if context .buildUsdImaging else "Off" ),
1236
+ buildPython = ("On" if context .buildPython else "Off" ),
1208
1237
buildDocs = ("On" if context .buildDocs else "Off" ),
1209
1238
buildTests = ("On" if context .buildTests else "Off" ),
1210
1239
buildAlembic = ("On" if context .buildAlembic else "Off" ),
@@ -1273,16 +1302,18 @@ def MustBuildDependency(self, dep):
1273
1302
])
1274
1303
1275
1304
Print ("""
1276
- Success! To use USD, please ensure that you have:
1277
- The following in your PYTHONPATH environment variable:
1278
- {requiredInPythonPath}
1279
-
1280
- The following in your PATH environment variable:
1305
+ Success! To use USD, please ensure that you have:""" )
1306
+
1307
+ if context .buildPython :
1308
+ Print ("""
1309
+ The following in your PYTHONPATH environment variable:
1310
+ {requiredInPythonPath}""" .format (
1311
+ requiredInPythonPath = "\n " .join (sorted (requiredInPythonPath ))))
1312
+
1313
+ Print ("""
1314
+ The following in your PATH environment variable:
1281
1315
{requiredInPath}
1282
- """
1283
- .format (
1284
- requiredInPythonPath = "\n " .join (sorted (requiredInPythonPath )),
1285
- requiredInPath = "\n " .join (sorted (requiredInPath ))))
1316
+ """ .format (requiredInPath = "\n " .join (sorted (requiredInPath ))))
1286
1317
1287
1318
if context .buildMaya :
1288
1319
Print ("See documentation at http://openusd.org/docs/Maya-USD-Plugins.html "
0 commit comments