@@ -34,7 +34,13 @@ def main():
3434 numpy_version = get_or_install ("numpy" , minimum_supported_numpy )
3535 get_or_install ("scikit-build" )
3636 get_or_install ("cmake" )
37+
3738 import skbuild
39+ from skbuild import cmaker
40+
41+ python_version = cmaker .CMaker .get_python_version ()
42+ python_lib_path = cmaker .CMaker .get_python_library (python_version )
43+ python_include_dir = cmaker .CMaker .get_python_include_dir (python_version )
3844
3945 if os .path .exists (".git" ):
4046
@@ -109,7 +115,8 @@ def main():
109115 + [
110116 # skbuild inserts PYTHON_* vars. That doesn't satisfy opencv build scripts in case of Py3
111117 "-DPYTHON_DEFAULT_EXECUTABLE=%s" % sys .executable ,
112- "-DPYTHON3_INCLUDE_DIR=%s" % sysconfig .get_paths ()["include" ],
118+ "-DPYTHON3_INCLUDE_DIR=%s" % python_include_dir ,
119+ "-DPYTHON3_LIBRARY=%s" % python_lib_path ,
113120 "-DBUILD_opencv_python3=ON" ,
114121 "-DBUILD_opencv_python2=OFF" ,
115122 # When off, adds __init__.py and a few more helper .py's. We use our own helper files with a different structure.
@@ -127,27 +134,6 @@ def main():
127134 "-DBUILD_PERF_TESTS=OFF" ,
128135 "-DBUILD_DOCS=OFF" ,
129136 ]
130- + (
131- [
132- "-DPYTHON3_LIBRARY=%s"
133- % os .path .join (
134- * [
135- sysconfig .get_config_var ("BINDIR" ),
136- "libs" ,
137- "python{}.lib" .format (
138- "" .join (str (v ) for v in sys .version_info [:2 ])
139- ),
140- ]
141- )
142- ]
143- if sys .platform .startswith ("win" )
144- else [
145- "-DPYTHON3_LIBRARY=%s"
146- % os .path .join (
147- "/usr/lib/x86_64-linux-gnu/" , sysconfig .get_config_var ("LDLIBRARY" )
148- )
149- ]
150- )
151137 + (
152138 ["-DOPENCV_EXTRA_MODULES_PATH=" + os .path .abspath ("opencv_contrib/modules" )]
153139 if build_contrib
@@ -178,9 +164,10 @@ def main():
178164
179165 if sys .platform .startswith ("linux" ):
180166 cmake_args .append ("-DWITH_V4L=ON" )
167+ cmake_args .append ("-DWITH_LAPACK=ON" )
181168 cmake_args .append ("-DENABLE_PRECOMPILED_HEADERS=OFF" )
182169
183- if sys .platform .startswith (' linux' ) and not x64 :
170+ if sys .platform .startswith (" linux" ) and not x64 :
184171 subprocess .check_call ("patch -p0 < patches/patchOpenEXR" , shell = True )
185172
186173 # Fixes for macOS builds
@@ -190,21 +177,9 @@ def main():
190177
191178 if "CMAKE_ARGS" in os .environ :
192179 import shlex
193-
194180 cmake_args .extend (shlex .split (os .environ ["CMAKE_ARGS" ]))
195181 del shlex
196182
197- # ABI config variables are introduced in PEP 425
198- if sys .version_info [:2 ] < (3 , 2 ):
199- import warnings
200-
201- warnings .filterwarnings (
202- "ignore" ,
203- r"Config variable '[^']+' is unset, " r"Python ABI tag may be incorrect" ,
204- category = RuntimeWarning ,
205- )
206- del warnings
207-
208183 # works via side effect
209184 RearrangeCMakeOutput (
210185 rearrange_cmake_output_data , files_outside_package_dir , package_data .keys ()
0 commit comments