Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
6cb90c0e
Commit
6cb90c0e
authored
Jan 20, 2014
by
Vincent Rabaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix cross-compilation issue with Numpy
parent
6bf599b1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
8 deletions
+29
-8
OpenCVDetectPython.cmake
cmake/OpenCVDetectPython.cmake
+29
-8
No files found.
cmake/OpenCVDetectPython.cmake
View file @
6cb90c0e
...
...
@@ -80,14 +80,29 @@ if(PYTHON_EXECUTABLE)
endif
()
SET
(
PYTHON_PACKAGES_PATH
"
${
_PYTHON_PACKAGES_PATH
}
"
CACHE PATH
"Where to install the python packages."
)
if
(
NOT PYTHON_NUMPY_INCLUDE_DIR
)
# Attempt to discover the NumPy include directory. If this succeeds, then build python API with NumPy
execute_process
(
COMMAND
${
PYTHON_EXECUTABLE
}
-c
"import os; os.environ['DISTUTILS_USE_SDK']='1'; import numpy.distutils; print numpy.distutils.misc_util.get_numpy_include_dirs()[0]"
RESULT_VARIABLE PYTHON_NUMPY_PROCESS
OUTPUT_VARIABLE PYTHON_NUMPY_INCLUDE_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if
(
NOT CMAKE_CROSSCOMPILING
)
if
(
NOT PYTHON_NUMPY_INCLUDE_DIR
)
# Attempt to discover the NumPy include directory. If this succeeds, then build python API with NumPy
execute_process
(
COMMAND
${
PYTHON_EXECUTABLE
}
-c
"import os; os.environ['DISTUTILS_USE_SDK']='1'; import numpy.distutils; print numpy.distutils.misc_util.get_numpy_include_dirs()[0]"
RESULT_VARIABLE PYTHON_NUMPY_PROCESS
OUTPUT_VARIABLE PYTHON_NUMPY_INCLUDE_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if
(
PYTHON_NUMPY_PROCESS EQUAL 0
)
if
(
PYTHON_NUMPY_PROCESS EQUAL 0
)
file
(
TO_CMAKE_PATH
"
${
PYTHON_NUMPY_INCLUDE_DIR
}
"
_PYTHON_NUMPY_INCLUDE_DIR
)
set
(
PYTHON_NUMPY_INCLUDE_DIR
${
_PYTHON_NUMPY_INCLUDE_DIR
}
CACHE PATH
"Path to numpy headers"
)
endif
()
endif
()
else
()
if
(
NOT PYTHON_NUMPY_INCLUDE_DIR
)
message
(
STATUS
"Cannot probe for Python/Numpy support (because we are cross-compiling OpenCV)"
)
message
(
STATUS
"If you want to enable Python/Numpy support, set the following variables:"
)
message
(
STATUS
" PYTHON_EXECUTABLE"
)
message
(
STATUS
" PYTHON_INCLUDE_DIR"
)
message
(
STATUS
" PYTHON_LIBRARY"
)
message
(
STATUS
" PYTHON_NUMPY_INCLUDE_DIR"
)
message
(
STATUS
" PYTHON_NUMPY_VERSION"
)
else
()
file
(
TO_CMAKE_PATH
"
${
PYTHON_NUMPY_INCLUDE_DIR
}
"
_PYTHON_NUMPY_INCLUDE_DIR
)
set
(
PYTHON_NUMPY_INCLUDE_DIR
${
_PYTHON_NUMPY_INCLUDE_DIR
}
CACHE PATH
"Path to numpy headers"
)
endif
()
...
...
@@ -95,10 +110,16 @@ if(PYTHON_EXECUTABLE)
if
(
PYTHON_NUMPY_INCLUDE_DIR
)
set
(
PYTHON_USE_NUMPY TRUE
)
execute_process
(
COMMAND
${
PYTHON_EXECUTABLE
}
-c
"import numpy; print numpy.version.version"
if
(
NOT CMAKE_CROSSCOMPILING
)
execute_process
(
COMMAND
${
PYTHON_EXECUTABLE
}
-c
"import numpy; print numpy.version.version"
RESULT_VARIABLE PYTHON_NUMPY_PROCESS
OUTPUT_VARIABLE PYTHON_NUMPY_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
else
()
if
(
NOT PYTHON_NUMPY_VERSION
)
set
(
PYTHON_NUMPY_VERSION
"undefined - cannot be probed because of the cross-compilation"
)
endif
()
endif
()
endif
()
endif
(
NOT ANDROID AND NOT IOS
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment