Skip to content

Commit 1eb662a

Browse files
committed
Added additional patch for correct OS-specific python libs detection
1 parent e894696 commit 1eb662a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

setup.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ def main():
104104
]) + [
105105
# skbuild inserts PYTHON_* vars. That doesn't satisfy opencv build scripts in case of Py3
106106
"-DPYTHON_DEFAULT_EXECUTABLE=%s" % sys.executable,
107-
"-DPYTHON3_LIBRARY=%s" % os.path.join('/usr/lib/x86_64-linux-gnu/', sysconfig.get_config_var('LDLIBRARY')),
108107
"-DPYTHON3_INCLUDE_DIR=%s" % gp()['include'],
109108
"-DBUILD_opencv_python3=ON",
110109
"-DBUILD_opencv_python2=OFF",
@@ -124,7 +123,10 @@ def main():
124123
"-DBUILD_TESTS=OFF",
125124
"-DBUILD_PERF_TESTS=OFF",
126125
"-DBUILD_DOCS=OFF"
127-
] + (["-DOPENCV_EXTRA_MODULES_PATH=" + os.path.abspath("opencv_contrib/modules")] if build_contrib else [])
126+
] +
127+
# patch for OS-specific python libs
128+
(["-DPYTHON3_LIBRARY=%s" % os.path.join(*[sysconfig.get_config_var('BINDIR'), "libs","python{}.lib".format("".join(str(v) for v in sys.version_info[:2]))])] if sys.platform.startswith('win') else ["-DPYTHON3_LIBRARY=%s" % os.path.join('/usr/lib/x86_64-linux-gnu/', sysconfig.get_config_var('LDLIBRARY'))]) +
129+
(["-DOPENCV_EXTRA_MODULES_PATH=" + os.path.abspath("opencv_contrib/modules")] if build_contrib else [])
128130

129131
# OS-specific components
130132
if sys.platform.startswith('linux') and not build_headless:

0 commit comments

Comments
 (0)