Skip to content

Commit e2a86c2

Browse files
Fix CMAKE_PREFIX_PATH by using cmake.define in scikit-build-core
1 parent 0b5bc7f commit e2a86c2

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

pyproject-pypi.toml.j2

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ cmake.args = [
9393
"-DMOMENTUM_USE_SYSTEM_PYBIND11=ON",
9494
"-DCMAKE_DISABLE_FIND_PACKAGE_Arrow=ON",
9595
]
96+
# Read CMAKE_PREFIX_PATH from environment variable
97+
# This is needed for cibuildwheel where pixi installs deps to a custom location
98+
cmake.define.CMAKE_PREFIX_PATH = {env = "CMAKE_PREFIX_PATH"}
9699
minimum-version = "0.10"
97100
metadata.version.provider = "scikit_build_core.metadata.setuptools_scm"
98101
sdist.exclude = [
@@ -118,7 +121,7 @@ cmake.args = [
118121
"-DMOMENTUM_USE_SYSTEM_RERUN_CPP_SDK=OFF",
119122
"-DMOMENTUM_USE_SYSTEM_PYBIND11=ON",
120123
]
121-
# CMAKE_PREFIX_PATH is set by cibuildwheel environment
124+
cmake.define.CMAKE_PREFIX_PATH = {env = "CMAKE_PREFIX_PATH"}
122125

123126
[[tool.scikit-build.overrides]]
124127
if.platform-system = "^linux"
@@ -137,6 +140,7 @@ cmake.args = [
137140
"-DCMAKE_CXX_FLAGS=-static-libstdc++ -static-libgcc",
138141
"-DCMAKE_C_FLAGS=-static-libgcc",
139142
]
143+
cmake.define.CMAKE_PREFIX_PATH = {env = "CMAKE_PREFIX_PATH"}
140144
{% endif %}
141145

142146
{% if variant == "gpu" %}
@@ -156,6 +160,7 @@ cmake.args = [
156160
# from CMake's FindPython, but pixi's Python only has Interpreter component
157161
"-DMOMENTUM_USE_SYSTEM_PYBIND11=OFF",
158162
]
163+
cmake.define.CMAKE_PREFIX_PATH = {env = "CMAKE_PREFIX_PATH"}
159164
{% endif %}
160165

161166
[[tool.scikit-build.overrides]]
@@ -174,6 +179,7 @@ cmake.args = [
174179
"-DCMAKE_CXX_SCAN_FOR_MODULES=OFF",
175180
{% endif %}
176181
]
182+
cmake.define.CMAKE_PREFIX_PATH = {env = "CMAKE_PREFIX_PATH"}
177183

178184
[tool.setuptools_scm]
179185
# Automatically determine version from git tags
@@ -261,9 +267,9 @@ before-build = """
261267
pip install scikit-build-core pybind11 setuptools-scm
262268
pip install "torch>=2.8.0,<2.9" --index-url https://download.pytorch.org/whl/cpu
263269
"""
264-
# Pass CMAKE_PREFIX_PATH via both environment and cmake.define
270+
# Pass CMAKE_PREFIX_PATH via environment and CMAKE_ARGS for scikit-build-core
265271
# The {project} placeholder is expanded by cibuildwheel
266-
environment = { CMAKE_PREFIX_PATH = "{project}/.pixi/envs/default", MOMENTUM_BUILD_WITH_FBXSDK = "OFF", SKBUILD_CMAKE_DEFINE = "CMAKE_PREFIX_PATH={project}/.pixi/envs/default" }
272+
environment = { CMAKE_PREFIX_PATH = "{project}/.pixi/envs/default", MOMENTUM_BUILD_WITH_FBXSDK = "OFF" }
267273

268274
[tool.cibuildwheel.windows]
269275
# Disable build isolation to ensure CMAKE_PREFIX_PATH is properly passed to CMake
@@ -273,7 +279,7 @@ before-build = """
273279
pip install scikit-build-core pybind11 setuptools-scm
274280
pip install "torch>=2.8.0,<2.9" --index-url https://download.pytorch.org/whl/cpu
275281
"""
276-
# Pass CMAKE_PREFIX_PATH via both environment and cmake.define
282+
# Pass CMAKE_PREFIX_PATH via environment and CMAKE_ARGS for scikit-build-core
277283
# The {project} placeholder is expanded by cibuildwheel
278-
environment = { CMAKE_PREFIX_PATH = "{project}/.pixi/envs/default", MOMENTUM_BUILD_WITH_FBXSDK = "OFF", SKBUILD_CMAKE_DEFINE = "CMAKE_PREFIX_PATH={project}/.pixi/envs/default" }
284+
environment = { CMAKE_PREFIX_PATH = "{project}/.pixi/envs/default", MOMENTUM_BUILD_WITH_FBXSDK = "OFF" }
279285
{% endif %}

0 commit comments

Comments
 (0)