Add MP_DISABLE_GPU to .so target

PiperOrigin-RevId: 536537732
This commit is contained in:
Sebastian Schmidt 2023-05-30 16:16:07 -07:00 committed by Copybara-Service
parent 32e48dd2d9
commit d76b48ec8b

View File

@ -407,11 +407,16 @@ class BuildExtension(build_ext.build_ext):
'build', 'build',
'--compilation_mode=opt', '--compilation_mode=opt',
'--copt=-DNDEBUG', '--copt=-DNDEBUG',
'--copt=-DMESA_EGL_NO_X11_HEADERS',
'--copt=-DEGL_NO_X11',
'--action_env=PYTHON_BIN_PATH=' + _normalize_path(sys.executable), '--action_env=PYTHON_BIN_PATH=' + _normalize_path(sys.executable),
str(ext.bazel_target + '.so'), str(ext.bazel_target + '.so'),
] ]
if MP_DISABLE_GPU:
bazel_command.append('--define=MEDIAPIPE_DISABLE_GPU=1')
else:
bazel_command.append('--copt=-DMESA_EGL_NO_X11_HEADERS')
bazel_command.append('--copt=-DEGL_NO_X11')
if extra_args: if extra_args:
bazel_command += extra_args bazel_command += extra_args
if not self.link_opencv and not IS_WINDOWS: if not self.link_opencv and not IS_WINDOWS: