@@ -34,7 +34,13 @@ def main():
34
34
numpy_version = get_or_install ("numpy" , minimum_supported_numpy )
35
35
get_or_install ("scikit-build" )
36
36
get_or_install ("cmake" )
37
+
37
38
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 )
38
44
39
45
if os .path .exists (".git" ):
40
46
@@ -109,7 +115,8 @@ def main():
109
115
+ [
110
116
# skbuild inserts PYTHON_* vars. That doesn't satisfy opencv build scripts in case of Py3
111
117
"-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 ,
113
120
"-DBUILD_opencv_python3=ON" ,
114
121
"-DBUILD_opencv_python2=OFF" ,
115
122
# 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():
127
134
"-DBUILD_PERF_TESTS=OFF" ,
128
135
"-DBUILD_DOCS=OFF" ,
129
136
]
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
- )
151
137
+ (
152
138
["-DOPENCV_EXTRA_MODULES_PATH=" + os .path .abspath ("opencv_contrib/modules" )]
153
139
if build_contrib
@@ -178,9 +164,10 @@ def main():
178
164
179
165
if sys .platform .startswith ("linux" ):
180
166
cmake_args .append ("-DWITH_V4L=ON" )
167
+ cmake_args .append ("-DWITH_LAPACK=ON" )
181
168
cmake_args .append ("-DENABLE_PRECOMPILED_HEADERS=OFF" )
182
169
183
- if sys .platform .startswith (' linux' ) and not x64 :
170
+ if sys .platform .startswith (" linux" ) and not x64 :
184
171
subprocess .check_call ("patch -p0 < patches/patchOpenEXR" , shell = True )
185
172
186
173
# Fixes for macOS builds
@@ -190,21 +177,9 @@ def main():
190
177
191
178
if "CMAKE_ARGS" in os .environ :
192
179
import shlex
193
-
194
180
cmake_args .extend (shlex .split (os .environ ["CMAKE_ARGS" ]))
195
181
del shlex
196
182
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
-
208
183
# works via side effect
209
184
RearrangeCMakeOutput (
210
185
rearrange_cmake_output_data , files_outside_package_dir , package_data .keys ()
0 commit comments