File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -129,9 +129,23 @@ def build_extension(self, ext):
129129 f"-DPython3_EXECUTABLE={ get_python_executable ()} " ,
130130 ]
131131 CONDA_PREFIX = os .environ .get ("CONDA_PREFIX" )
132+ # if CONDA_PREFIX:
133+ # CMAKE_PREFIX_PATH = os.environ.get("CMAKE_PREFIX_PATH")
134+ # if CMAKE_PREFIX_PATH:
135+ # cmake_args.append(f"-DCMAKE_PREFIX_PATH={CONDA_PREFIX}:{CMAKE_PREFIX_PATH}")
136+ # else:
137+ # cmake_args.append(f"-DCMAKE_PREFIX_PATH={CONDA_PREFIX}")
132138 if CONDA_PREFIX :
133- CMAKE_PREFIX_PATH = os .environ .get ("CMAKE_PREFIX_PATH" )
134- cmake_args .append (f"-DCMAKE_PREFIX_PATH={ CONDA_PREFIX } :{ CMAKE_PREFIX_PATH } " )
139+ # Find pybind11
140+ pybind11_dir = None
141+ for config_file in ["pybind11Config.cmake" , "pybind11-config.cmake" ]:
142+ config_path = glob .glob (os .path .join (CONDA_PREFIX , "**" , config_file ), recursive = True )
143+ if config_path :
144+ pybind11_dir = os .path .dirname (config_path [0 ])
145+ break
146+ if pybind11_dir :
147+ cmake_args .append (f"-DPYBIND11_DIR={ pybind11_dir } " )
148+
135149 build_args = []
136150 if not os .path .exists (self .build_temp ):
137151 os .makedirs (self .build_temp )
You can’t perform that action at this time.
0 commit comments