Skip to content

Commit 36a92db

Browse files
Fix issue with PyOpenGL-accelerate on MacOS x86_64 (#777)
### Fix issue with PyOpenGL-accelerate on MacOS x86_64 ### Linked issues n/a ### Summarize your change. This PR adds a temporary changes to build PyOpenGL-accelerate from source on MacOS x86_64. The source is patched with the changes from a pending [PR](mcfletch/pyopengl#146) in the PyOpenGL repository. ### Describe the reason for the change. Cython was updated to version 3.1.0+ on May 8, causing compatibility issues with PyOpenGL-accelerate on macOS x86_64. Until a pending [PR](mcfletch/pyopengl#146) is merged in the official PyOpenGL repository, PyOpenGL-accelerate will be built from source on macOS x86_64. ### Describe what you have tested and on which operating system. ### Add a list of changes, and note any that might need special attention during the review. ### If possible, provide screenshots. Signed-off-by: Cédrik Fuoco <[email protected]>
1 parent a8b65df commit 36a92db

File tree

3 files changed

+53
-2
lines changed

3 files changed

+53
-2
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
diff --git a/accelerate/src/vbo.pyx b/accelerate/src/vbo.pyx
2+
index 13f9e99d..6e92c059 100644
3+
--- a/accelerate/src/vbo.pyx
4+
+++ b/accelerate/src/vbo.pyx
5+
@@ -1,6 +1,7 @@
6+
"""Cython-coded VBO implementation"""
7+
#cython: language_level=3
8+
import ctypes, weakref
9+
+from ctypes import c_long as long
10+
from OpenGL_accelerate.formathandler cimport FormatHandler
11+
from OpenGL import error
12+
from OpenGL._bytes import bytes,unicode

cmake/dependencies/python3.cmake

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,41 @@ EXTERNALPROJECT_ADD(
291291
USES_TERMINAL_BUILD TRUE
292292
)
293293

294+
# ##############################################################################################################################################################
295+
# This is temporary until the patch gets into the official PyOpenGL repo. #
296+
# ##############################################################################################################################################################
297+
# Only for Apple Intel. Windows and Linux uses the requirements.txt file to install PyOpenGL-accelerate.
298+
IF(APPLE
299+
AND RV_TARGET_APPLE_X86_64
300+
)
301+
MESSAGE(STATUS "Patching PyOpenGL and building PyOpenGL from source")
302+
SET(_patch_pyopengl_command
303+
patch -p1 < ${CMAKE_CURRENT_SOURCE_DIR}/patch/pyopengl-accelerate.patch
304+
)
305+
306+
EXTERNALPROJECT_ADD(
307+
pyopengl_accelerate
308+
URL "https://github.com/mcfletch/pyopengl/archive/refs/tags/release-3.1.8.tar.gz"
309+
URL_MD5 "d7a9e2f8c2d981b58776ded865b3e22a"
310+
DOWNLOAD_NAME release-3.1.8.tar.gz
311+
DOWNLOAD_DIR ${RV_DEPS_DOWNLOAD_DIR}
312+
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
313+
SOURCE_DIR ${CMAKE_BINARY_DIR}/pyopengl_accelerate
314+
PATCH_COMMAND ${_patch_pyopengl_command}
315+
CONFIGURE_COMMAND ""
316+
BUILD_COMMAND "${_python3_executable}" -m pip install ./accelerate
317+
INSTALL_COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_BINARY_DIR}/pyopengl_accelerate/.pip_installed
318+
BUILD_BYPRODUCTS ${CMAKE_BINARY_DIR}/pyopengl_accelerate/setup.py
319+
DEPENDS ${${_python3_target}-requirements-flag}
320+
BUILD_IN_SOURCE TRUE
321+
USES_TERMINAL_BUILD TRUE
322+
)
323+
324+
# Ensure pyopengl_accelerate is built as part of the dependencies target
325+
ADD_DEPENDENCIES(dependencies pyopengl_accelerate)
326+
ENDIF()
327+
# ##############################################################################################################################################################
328+
294329
SET(${_python3_target}-requirements-flag
295330
${_install_dir}/${_python3_target}-requirements-flag
296331
)

src/build/requirements.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@ setuptools # License: MIT License
55
# We need to use the main branch of the OTIO Github repo since the latest release available as a Pypi package is missing some features we need for Live Review
66
git+https://github.com/AcademySoftwareFoundation/OpenTimelineIO@main#egg=OpenTimelineIO # License: Other/Proprietary License (Modified Apache 2.0 License)
77
PyOpenGL # License: BSD License (BSD)
8+
9+
# MacOS only - PyOpenGL_accelerate is built from source in python3.cmake as a workaround until the fix
10+
# is merged in the main branch.
11+
# See https://github.com/mcfletch/pyopengl/issues/147 and https://github.com/mcfletch/pyopengl/pull/146
12+
813
# PyOpenGL_accelerate as issue with native arm64 build on MacOS.
914
# Use PyOpenGL_accelerate only on x86_64 platform.
10-
PyOpenGL_accelerate ; platform_machine=='x86_64' # License: BSD License (BSD)
11-
15+
PyOpenGL_accelerate ; (platform_system=='Windows' or platform_system=='Linux') and platform_machine=='x86_64' # License: BSD License (BSD)
1216

1317
# Those are installed by the src/build/make_python.py script, adding them here to list their licenses.
1418

0 commit comments

Comments
 (0)