Skip to content

Commit 7377bcc

Browse files
build: Improve resolution of Python for OCIO (#1219)
### Improve resolution of Python for OCIO ### Linked issues None ### Summarize your change. Fix `Python.h` not found when building PyOpenColorIO (OCIO's Python bindings). ### Describe the reason for the change. The CI was failing since the merge of OIIO 3 PR because OCIO was having issue finding Python. Altough, I am not 100% certain how that PR caused this. ### Describe what you have tested and on which operating system. MacOS, CI Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
1 parent 5b8c0f8 commit 7377bcc

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

cmake/dependencies/ocio.cmake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,11 @@ ELSE() # Windows
206206
"-DZLIB_INCLUDE_DIR=${_zlib_include_dir}"
207207
"-Dexpat_ROOT=${RV_DEPS_EXPAT_ROOT_DIR}"
208208
"-DImath_DIR=${RV_DEPS_IMATH_ROOT_DIR}/lib/cmake/Imath"
209-
"-DPython_ROOT=${RV_DEPS_BASE_DIR}/RV_DEPS_PYTHON3/install"
209+
"-DPython_ROOT_DIR=${RV_DEPS_BASE_DIR}/RV_DEPS_PYTHON3/install"
210+
# Force CMake to use our custom Python, not the system/registry Python. Python_FIND_REGISTRY=NEVER prevents Windows registry lookups that find the system
211+
# Python from actions/setup-python. Python_FIND_STRATEGY=LOCATION ensures Python_ROOT_DIR is checked before the default search paths.
212+
"-DPython_FIND_REGISTRY=NEVER"
213+
"-DPython_FIND_STRATEGY=LOCATION"
210214
# Mandatory param: OCIO CMake code finds Python.
211215
"-DPython_LIBRARY=${RV_DEPS_BASE_DIR}/RV_DEPS_PYTHON3/install/bin/python${PYTHON_VERSION_SHORT_NO_DOT}.lib" # with this param
212216
# DRV_Python_LIBRARIES: A Patch RV created for PyOpenColorIO inside OCIO: Hardcode to Release since FindPython.cmake will find the Debug lib, which we don't

src/build/patch_OCIO/ocio_pyopencolorio_patch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def patch_execute(filename):
1111
with open(backup_cmakelist_path, "r") as backup_cmakelist:
1212
with open(filename, "w") as cmakelist:
1313
for line in backup_cmakelist:
14-
if re.match("^\s*set.*_PublicLibs", line):
14+
if re.match(r"^\s*set.*_PublicLibs", line, re.IGNORECASE):
1515
new_line = line.replace(
1616
"set(_PublicLibs ${Python_LIBRARIES})",
1717
"set(_PublicLibs ${RV_Python_LIBRARIES})",

0 commit comments

Comments
 (0)