Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ViSP Python wrapper #1265

Merged
merged 176 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
176 commits
Select commit Hold shift + click to select a range
b16e9bb
Starting work on python module: iterating on submodules, parsing but …
SamFlt Aug 16, 2023
a5f2eb2
more work: class defs, trying to use cmake
SamFlt Aug 18, 2023
0fb8e7c
generating inits wip
SamFlt Aug 21, 2023
ac70d68
Better type expression, creating header environment for name resolution
SamFlt Aug 22, 2023
f3be384
fix name resolution, string representation of classes, start working …
SamFlt Aug 22, 2023
f78b2b5
header sorting, start work on template specialization
SamFlt Aug 23, 2023
cd53854
Refactoring code, working on specialization
SamFlt Aug 23, 2023
72c6fa3
first working version
SamFlt Aug 24, 2023
d011f81
generating functions wip, some linker issues related to hardcoded paths?
SamFlt Aug 24, 2023
7ba6cba
Fix linking error due to undefined symbols in ViSP
SamFlt Aug 25, 2023
96424a6
Start function configuration
SamFlt Aug 25, 2023
1313bf5
fixed static overloads generating erros
SamFlt Aug 27, 2023
e82a977
working on stubs
SamFlt Aug 28, 2023
fc9271e
working on enums, fix generation order for documentation
SamFlt Aug 29, 2023
38784c2
refactoring methods, start work on operators
SamFlt Aug 30, 2023
b5261d0
Major refactoring on method binding generation
SamFlt Aug 30, 2023
e573263
generating basic operators
SamFlt Aug 30, 2023
7fcd6e8
generate a very basic documentation for the python api
SamFlt Aug 31, 2023
a309d4d
working on enum
SamFlt Sep 1, 2023
c0b2979
enum work
SamFlt Sep 1, 2023
504ca44
Enums almost working, require ignoring those in ignored classes and t…
SamFlt Sep 4, 2023
cf43060
Enum export is working!
SamFlt Sep 4, 2023
312cf14
User defined bindings possible, ignore to string representation
SamFlt Sep 5, 2023
6075da4
More operators, numpy support for vpArray2D and linking with user def…
SamFlt Sep 7, 2023
b4814f8
Testing numpy implem, debugging stub generation
SamFlt Sep 7, 2023
ca5c68c
more work on numpy conversion
SamFlt Sep 8, 2023
422613f
reactivating generator in setup, add vpImage specializations
SamFlt Sep 8, 2023
33f17f6
Merge branch 'python_wrapper' of github.com:SamFlt/visp into python_w…
SamFlt Sep 8, 2023
989dda9
including vpImage, fixing some bugs related to templating
SamFlt Sep 11, 2023
a606650
fix for templating of vpImage binding
SamFlt Sep 11, 2023
d31fbc7
Add vpRGBf operators in vpImage, indexing for vpArray2D
SamFlt Sep 12, 2023
13449f8
more testing and indexing in numpy, gonna start writing a basic examp…
SamFlt Sep 12, 2023
fe512b6
Exporting vs, vision and visual feature modules, some issues but passes
SamFlt Sep 13, 2023
16d2107
compile with sensor module
SamFlt Sep 13, 2023
dcb1a42
Fixing argument parsing and rejection method, fix vpServoData
SamFlt Sep 13, 2023
8d5bc64
fix more undefined symbols
SamFlt Sep 13, 2023
d76d803
Merge remote-tracking branch 'upstream/master' into python_wrapper
SamFlt Sep 13, 2023
ef753c4
reproducing tps, function template specialization
SamFlt Sep 14, 2023
1c9df73
small modifications on tp repro and doc
SamFlt Sep 14, 2023
ae86b8d
trying to fix writability of numpy view
SamFlt Sep 14, 2023
ac0f5d2
Generate some documentation for the python wrapper
SamFlt Sep 18, 2023
069a673
change binding generation flow: first preprocess and fetch xml, then …
SamFlt Sep 18, 2023
a401dce
trying to parse method docs
SamFlt Sep 19, 2023
6598366
some improvement in method doc generation
SamFlt Sep 19, 2023
7c48289
small fix
SamFlt Sep 19, 2023
3dc81d4
better doc
SamFlt Sep 20, 2023
270fb3e
separate api reference link
SamFlt Sep 20, 2023
5ddcf1c
Better parsing of method doc, program lisitngs in cpp
SamFlt Sep 21, 2023
163765c
can now correctly find way more documentation, better organization an…
SamFlt Sep 25, 2023
3c46994
json report generation, finally outputting parameters in function doc…
SamFlt Sep 26, 2023
e3bdb9a
return type documentation, detect refs to python immutable types
SamFlt Sep 26, 2023
8741c58
revert include path
SamFlt Sep 26, 2023
f8eeb70
Merge upstream
SamFlt Sep 27, 2023
0c39a79
add correct but naive resolution of methods that have non const refs …
SamFlt Sep 27, 2023
f500cce
trying to implement realsense2, some issues with 3rd party types...
SamFlt Sep 28, 2023
23fa1d5
trying to generate robot and detection modules, some issues
SamFlt Oct 2, 2023
64403c9
fix undefined references in detection module, wrap robot and detectio…
SamFlt Oct 2, 2023
4fc0b89
generate report for methods with default param policy
SamFlt Oct 2, 2023
ae3a291
Generate empty image proc, better handle input/output params
SamFlt Oct 3, 2023
a4bb2f6
Better tuple return, better doc for methods with modified returntype
SamFlt Oct 4, 2023
7f00f6d
refactor method generation, improve documentation
SamFlt Oct 4, 2023
71917ae
remove py_args helpers for parameters that become output only
SamFlt Oct 4, 2023
59e5f7d
rework directory structure for future packaging, work on default para…
SamFlt Oct 5, 2023
42014bd
default values almost working, need to retrieve values from parent cl…
SamFlt Oct 5, 2023
8521217
some progress on resolving header environments for parent base classes
SamFlt Oct 6, 2023
35054b5
Adding default arguments, with some restrictions
SamFlt Oct 6, 2023
110cbed
export gui module, seems to work
SamFlt Oct 6, 2023
518b98f
fix header sorting
SamFlt Oct 6, 2023
25c20ac
Migrate header env to separate file, a lot of config, fix lvalue outp…
SamFlt Oct 9, 2023
b492ba7
parsing functions, almost good!
SamFlt Oct 9, 2023
92e9f0c
fix issue with name resolution when a symbol is in a namespace
SamFlt Oct 10, 2023
a0c4803
document todos, generate tt, tt_mi, blob and me wip
SamFlt Oct 10, 2023
0d7ab74
Exporting dnn_tracker and MBT modules, with some major issues
SamFlt Oct 11, 2023
714b5d5
move some hardcoded params into a config file
SamFlt Oct 12, 2023
7ce8d41
Cleanup hardcoded values and put them in a specific config file
SamFlt Oct 12, 2023
93d4a07
Start working on packaging
SamFlt Oct 13, 2023
76ea5b7
work on packaging: package generator and install and run through cmake
SamFlt Oct 16, 2023
171a4a2
rework cmake for package installation, still not great
SamFlt Oct 16, 2023
c8ca24b
more work on python bindings packaging, some issues with finding the …
SamFlt Oct 16, 2023
99203a6
worko n cmake
SamFlt Oct 17, 2023
a32de82
using set_source_files_properties for cmake, seems ok
SamFlt Oct 17, 2023
0c5d8ea
work on json file generation
SamFlt Oct 17, 2023
2edcd3e
still having problems finding correct cmake variables
SamFlt Oct 18, 2023
2b3c496
start working on pip install of the module
SamFlt Oct 19, 2023
c3e1a57
Working on pip install procedure, some problems with importing submod…
SamFlt Oct 19, 2023
d7abe71
Some issues with importing submodules, fix constant regeneration of p…
SamFlt Oct 20, 2023
9bbd8ed
Correct stub generation and module import, using includes from the ge…
SamFlt Oct 23, 2023
b6569e0
reworking preprocessing
SamFlt Oct 23, 2023
e36521b
reworking stubs package, investigating visp python package not being …
SamFlt Oct 23, 2023
b12a874
everything in order for packaging
SamFlt Oct 24, 2023
674321d
rework pybind11-stubgen call
SamFlt Oct 24, 2023
171f72d
more outputs on python cmake, start packaging sphinx doc
SamFlt Oct 25, 2023
2199aa9
merge upstream master
SamFlt Oct 25, 2023
2e42ba5
generating doc through cmake
SamFlt Oct 26, 2023
e05e73c
Removed hardcoding of XML documentation path and modules, modules req…
SamFlt Oct 26, 2023
b103ed2
Add compiler/OS defines, Sort submodules based on ViSP dependencies
SamFlt Oct 26, 2023
d19146b
Merge remote-tracking branch 'upstream/master' into python_wrapper
SamFlt Oct 26, 2023
ce8fb36
fix after merge
SamFlt Oct 27, 2023
b137a0a
Exporting struct and class public properties
SamFlt Oct 30, 2023
2072700
fix exported attributes, remove the forced opencv includes
SamFlt Oct 31, 2023
21c2f84
cleanup python doc, support for unary operators
SamFlt Oct 31, 2023
ec87c87
cleaning up operator list in documentation
SamFlt Oct 31, 2023
4ac87c0
Define new extra target, visp_doc_xml, and depend on it from python
SamFlt Nov 2, 2023
a61f8d4
start fixing numpy conversion for non writable arrays
SamFlt Nov 2, 2023
f1caafe
fix python tests
SamFlt Nov 2, 2023
da88d3f
wrap up numpy array reading, start MBT example
SamFlt Nov 3, 2023
018aba3
bugfix: booleans can now have default values
SamFlt Nov 3, 2023
7eac186
more work on MBT blender example
SamFlt Nov 6, 2023
ccd4f14
starting work on resolving shadowing, cleaning up generation code
SamFlt Nov 7, 2023
61d0594
Initial shadowing fix didn't work, resorting to lambda functions
SamFlt Nov 7, 2023
a7ccd70
Try and fix the shadowing issue, v2
SamFlt Nov 8, 2023
81c2d59
Finally resolved name shadowing
SamFlt Nov 9, 2023
e5556cf
more work on mbt, adding vectorized conversion functions
SamFlt Nov 9, 2023
1d75f46
Running MBT with depth at suboptimal framerate
SamFlt Nov 13, 2023
df0be12
small improvement to mbt python tutorial
SamFlt Nov 13, 2023
f589716
merge upstream master
SamFlt Nov 22, 2023
191663f
fix tuple return issues
SamFlt Nov 22, 2023
f698fe8
Fix bug introduced in previous commit
SamFlt Nov 22, 2023
c58147b
progressing on config files, adding some tests for specific cases (tu…
SamFlt Nov 23, 2023
375ea9f
fix blob module config
SamFlt Nov 24, 2023
147b94b
Add vpMatrix version of MBT tracking, modify mbt wrapper to use it
SamFlt Nov 24, 2023
ad69244
Remove timing print in MBT data conversion
SamFlt Nov 24, 2023
4f613e9
Started work on MBT with realsense example
SamFlt Nov 24, 2023
3b2c9bc
Model-based tracker with realsense camera
SamFlt Nov 27, 2023
79baefd
Update python3 detection and use ViSP mechanism to detect pybind11
fspindle Nov 27, 2023
2feede6
Update tutorial by mainly reducing the size of the lines
fspindle Nov 27, 2023
129320d
Add missing copyright header
fspindle Nov 27, 2023
39f248f
Doing some config for core module
SamFlt Nov 28, 2023
1a57a71
Display before initializing tracking in Python MBT + Realsense example
SamFlt Nov 28, 2023
007214d
Merge branch 'python_wrapper' of github.com:SamFlt/visp into python_w…
SamFlt Nov 28, 2023
5a65a24
Fix for extra generated comma when there are no additional arguments …
SamFlt Nov 28, 2023
9f2fd36
Image conversion bindings config
SamFlt Nov 28, 2023
0dad37b
Fix indentation in lambdas
SamFlt Nov 28, 2023
9d9ae11
Global python target
SamFlt Nov 28, 2023
5c20ef0
Log python bindings generation to a text file instead of cout, quiete…
SamFlt Nov 28, 2023
327ed0a
Update doxygen config file with doxygen 1.9.8
fspindle Nov 28, 2023
da8f55a
fix C++ compilation warnings
SamFlt Nov 28, 2023
96e0713
Fix doxygen warning by changing PAPER_TYPE: warning: argument 'a4wide…
fspindle Nov 29, 2023
8846f97
Add more logging to preprocessing step
SamFlt Nov 29, 2023
49c44e2
Disable multithreading to fix the different and undesired behaviour o…
SamFlt Nov 29, 2023
9aa457a
Add getitem for images
SamFlt Nov 29, 2023
2360562
testing image indexing
SamFlt Nov 29, 2023
3d08716
Fix default arguments for unsigned ints such as vpServo::addTask
SamFlt Nov 30, 2023
53ec73d
Add 1D indexing for col/row/translation vector, correct np representa…
SamFlt Nov 30, 2023
e338499
Fix warning detected when building python bindings on macos
fspindle Dec 1, 2023
9c8806b
Introduce OBVS and PBVS python bindings examples
fspindle Dec 1, 2023
d24edf3
Remove 'results' folder created by python examples from scm
fspindle Dec 1, 2023
cd51999
fix braced initialization warning
SamFlt Dec 1, 2023
1d458f9
Update keep alive for numpy conversions in order to avoid potential d…
SamFlt Dec 1, 2023
ff27e0e
Rename ImageRGBA to ImageRGBa
SamFlt Dec 1, 2023
bab9aba
Rename MBT examples, cleanup arguments
SamFlt Dec 1, 2023
06000e2
Remove practicals reimplems from examples
SamFlt Dec 1, 2023
d4b8aef
Rename python doc target to visp_python_bindings_doc, move html gener…
SamFlt Dec 1, 2023
42eb274
cleanup things that should not be in source control
SamFlt Dec 1, 2023
81d826a
Update git ignore for python documentation
SamFlt Dec 1, 2023
56e2f2c
silence warnings generated by pybind overloads in doc
SamFlt Dec 1, 2023
bec1db7
Documentation theming + scrolling
SamFlt Dec 1, 2023
4ff1376
Fixing documentation, WIP for enums
SamFlt Dec 4, 2023
c483b27
documentation for enums
SamFlt Dec 4, 2023
0cf45b6
Setup doc test
SamFlt Dec 5, 2023
823e01d
fix some doc warnings, icon, and doctest
SamFlt Dec 6, 2023
d9692b2
Log pybind11 version in ViSP-third-party
SamFlt Dec 6, 2023
65a98c7
More work on doc and testing
SamFlt Dec 6, 2023
6176f35
refactor documentation structure
SamFlt Dec 7, 2023
6e8a678
a lot of documentation
SamFlt Dec 7, 2023
b8a3ecf
doc: more numpy examples
SamFlt Dec 8, 2023
4663d69
Fixed bug where in place operators returned a new value
SamFlt Dec 8, 2023
f063903
fix conversion doc
SamFlt Dec 8, 2023
aa9571c
Documenting realsense usage, Numpy indexing
SamFlt Dec 11, 2023
8aa16c9
rework sphinx build
SamFlt Dec 11, 2023
c30025e
fix copying files on make doc
SamFlt Dec 12, 2023
f09113e
Add return_policy and keep alive options, log when returning a refere…
SamFlt Dec 12, 2023
e7b3d87
Configuration doc, custom image representation, find and warn about r…
SamFlt Dec 13, 2023
3b37e09
Finish config documentation
SamFlt Dec 13, 2023
9a3eb17
Auto build parallel level for python documentation
SamFlt Dec 14, 2023
f666a7e
Fix several warnings in Python doc generation
SamFlt Dec 14, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ modules/java/\.idea/
.scannerwork
build
*.blend1
**/results/**
79 changes: 78 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,28 @@ if(NOT IOS)
include(cmake/VISPDetectPython.cmake)
endif()

# --- Python Bindings requirements ---

# this avoids non-active conda from getting picked anyway on Windows
#set(Python_FIND_REGISTRY LAST)
# Use environment variable PATH to decide preference for Python
#set(Python_FIND_VIRTUALENV FIRST)
#set(Python_FIND_STRATEGY LOCATION)

#find_package(Python 3.7 COMPONENTS Interpreter Development) # TODO: use visp function to find python?
#if(Python_FOUND)
# set(VISP_PYTHON_BINDINGS_EXECUTABLE "${Python_EXECUTABLE}")
#endif()
#find_package(pybind11)
VP_OPTION(USE_PYBIND11 pybind11 QUIET "Include pybind11 to create Python bindings" "" ON)

#if(pybind11_FOUND)
# set(VISP_PYBIND11_DIR "${pybind11_DIR}")
#endif()
#message("${pybind11_FOUND}")
# ---


include_directories(${VISP_INCLUDE_DIR})

#----------------------------------------------------------------------
Expand Down Expand Up @@ -413,6 +435,11 @@ VP_OPTION(BUILD_ANDROID_PROJECTS "" "" "Build Android projects providing .apk f
VP_OPTION(BUILD_ANDROID_EXAMPLES "" "" "Build examples for Android platform" "" ON IF ANDROID )
VP_OPTION(INSTALL_ANDROID_EXAMPLES "" "" "Install Android examples" "" OFF IF ANDROID )

# Build python bindings as an option
VP_OPTION(BUILD_PYTHON_BINDINGS "" "" "Build Python bindings" "" ON IF (PYTHON3INTERP_FOUND AND USE_PYBIND11) )
VP_OPTION(BUILD_PYTHON_BINDINGS_DOC "" "" "Build the documentation for the Python bindings" "" ON IF BUILD_PYTHON_BINDINGS )


# Build demos as an option.
VP_OPTION(BUILD_DEMOS "" "" "Build ViSP demos" "" ON)
# Build tutorials as an option.
Expand Down Expand Up @@ -730,10 +757,38 @@ if(DOXYGEN_FOUND)
set(DOXYGEN_USE_MATHJAX "NO")
endif()

# HTML version of the doc
set(DOXYGEN_GENERATE_HTML "YES")
set(DOXYGEN_GENERATE_XML "NO")
set(DOXYGEN_GENERATE_TEST_LIST "YES")
set(DOXYGEN_QUIET "NO")
set(DOXYGEN_INPUTS
"${VISP_SOURCE_DIR}/modules"
"${VISP_SOURCE_DIR}/example"
"${VISP_SOURCE_DIR}/tutorial"
"${VISP_SOURCE_DIR}/demo"
"${VISP_SOURCE_DIR}/doc"
"${VISP_BINARY_DIR}/doc"
"${VISP_CONTRIB_MODULES_PATH}"
)
string (REPLACE ";" " " DOXYGEN_INPUTS "${DOXYGEN_INPUTS}")
configure_file(${VISP_SOURCE_DIR}/doc/config-doxygen.in
${VISP_DOC_DIR}/config-doxygen
@ONLY )

# XML version of the doc
set(DOXYGEN_GENERATE_HTML "NO")
set(DOXYGEN_GENERATE_XML "YES")
set(DOXYGEN_GENERATE_TEST_LIST "NO")
set(DOXYGEN_QUIET "YES")
set(DOXYGEN_INPUTS
"${VISP_SOURCE_DIR}/modules"
)
string (REPLACE ";" " " DOXYGEN_INPUTS "${DOXYGEN_INPUTS}")
configure_file(${VISP_SOURCE_DIR}/doc/config-doxygen.in
${VISP_DOC_DIR}/config-doxygen-xml
@ONLY )

# set vars used in mainpage.dox.in
# - VISP_MAINPAGE_EXTENSION
set(VISP_MAINPAGE_EXTENSION "")
Expand Down Expand Up @@ -826,6 +881,8 @@ if(BUILD_JAVA)
endif()
endif()



if(ANDROID AND ANDROID_EXECUTABLE AND ANT_EXECUTABLE AND (ANT_VERSION VERSION_GREATER 1.7) AND (ANDROID_TOOLS_Pkg_Revision GREATER 13))
SET(CAN_BUILD_ANDROID_PROJECTS TRUE)
else()
Expand Down Expand Up @@ -1172,6 +1229,14 @@ if(BUILD_TUTORIALS)
add_subdirectory(tutorial)
vp_add_subdirectories(VISP_CONTRIB_MODULES_PATH tutorial)
endif()
if(BUILD_APPS)
vp_add_subdirectories(VISP_CONTRIB_MODULES_PATH apps)
endif()
if(BUILD_PYTHON_BINDINGS)
add_subdirectory(modules/python)
endif()



# ----------------------------------------------------------------------------
# Make some cmake vars advanced
Expand Down Expand Up @@ -1442,7 +1507,8 @@ endif()

# ========================== java ==========================
status("")
status(" Python (for build):" PYTHON_DEFAULT_AVAILABLE THEN "${PYTHON_DEFAULT_EXECUTABLE}" ELSE "no")
status(" Python 3:")
status(" Interpreter:" PYTHON3INTERP_FOUND THEN "${PYTHON3_EXECUTABLE} (ver ${PYTHON3_VERSION_STRING})" ELSE "no")

if(BUILD_JAVA OR BUILD_visp_java)
status("")
Expand All @@ -1453,6 +1519,17 @@ if(BUILD_JAVA OR BUILD_visp_java)
endif()
endif()

# ======================= Python bindings ========================
status("")
status(" Python3 bindings:" BUILD_PYTHON_BINDINGS THEN "yes" ELSE "no")
if(BUILD_PYTHON_BINDINGS)
status(" Python3 interpreter:" PYTHON3INTERP_FOUND THEN "${PYTHON3_EXECUTABLE} (ver ${PYTHON3_VERSION_STRING})" ELSE "no")
status(" Pybind11:" USE_PYBIND11 THEN "${pybind11_DIR} (${pybind11_VERSION})" ELSE "no")
status(" Package version:" "${VISP_PYTHON_PACKAGE_VERSION}")
status(" Wrapped modules:" "${VISP_PYTHON_BOUND_MODULES}")
status(" Generated input config:" "${VISP_PYTHON_GENERATED_CONFIG_FILE}")
endif()

# ============================ Options ===========================
status("")
status(" Build options: ")
Expand Down
48 changes: 9 additions & 39 deletions cmake/VISPDetectPython.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,7 @@ if(NOT ${found})
endif()
vp_clear_vars(PYTHONINTERP_FOUND PYTHON_EXECUTABLE PYTHON_VERSION_STRING PYTHON_VERSION_MAJOR PYTHON_VERSION_MINOR PYTHON_VERSION_PATCH)
if(NOT CMAKE_VERSION VERSION_LESS "3.12")
if(_python_version_major STREQUAL "2")
set(__PYTHON_PREFIX Python2)
else()
set(__PYTHON_PREFIX Python3)
endif()
set(__PYTHON_PREFIX Python3)
find_host_package(${__PYTHON_PREFIX} "${preferred_version}" COMPONENTS Interpreter)
if(${__PYTHON_PREFIX}_EXECUTABLE)
set(PYTHON_EXECUTABLE "${${__PYTHON_PREFIX}_EXECUTABLE}")
Expand Down Expand Up @@ -208,9 +204,6 @@ if(NOT ${found})
if(CMAKE_CROSSCOMPILING)
message(STATUS "Cannot probe for Python/Numpy support (because we are cross-compiling ViSP)")
message(STATUS "If you want to enable Python/Numpy support, set the following variables:")
message(STATUS " PYTHON2_INCLUDE_PATH")
message(STATUS " PYTHON2_LIBRARIES (optional on Unix-like systems)")
message(STATUS " PYTHON2_NUMPY_INCLUDE_DIRS")
message(STATUS " PYTHON3_INCLUDE_PATH")
message(STATUS " PYTHON3_LIBRARIES (optional on Unix-like systems)")
message(STATUS " PYTHON3_NUMPY_INCLUDE_DIRS")
Expand Down Expand Up @@ -258,7 +251,7 @@ if(NOT ${found})
set(${include_path} "${_include_path}" CACHE INTERNAL "")
set(${include_dir} "${_include_dir}" CACHE PATH "Python include dir")
set(${include_dir2} "${_include_dir2}" CACHE PATH "Python include dir 2")
set(${packages_path} "${_packages_path}" CACHE PATH "Where to install the python packages.")
set(${packages_path} "${_packages_path}" CACHE STRING "Where to install the python packages.")
set(${numpy_include_dirs} ${_numpy_include_dirs} CACHE PATH "Path to numpy headers")
set(${numpy_version} "${_numpy_version}" CACHE INTERNAL "")
endif()
Expand All @@ -268,14 +261,6 @@ if(VISP_PYTHON_SKIP_DETECTION)
return()
endif()

find_python("" "${MIN_VER_PYTHON2}" PYTHON2_LIBRARY PYTHON2_INCLUDE_DIR
PYTHON2INTERP_FOUND PYTHON2_EXECUTABLE PYTHON2_VERSION_STRING
PYTHON2_VERSION_MAJOR PYTHON2_VERSION_MINOR PYTHON2LIBS_FOUND
PYTHON2LIBS_VERSION_STRING PYTHON2_LIBRARIES PYTHON2_LIBRARY
PYTHON2_DEBUG_LIBRARIES PYTHON2_LIBRARY_DEBUG PYTHON2_INCLUDE_PATH
PYTHON2_INCLUDE_DIR PYTHON2_INCLUDE_DIR2 PYTHON2_PACKAGES_PATH
PYTHON2_NUMPY_INCLUDE_DIRS PYTHON2_NUMPY_VERSION)

option(VISP_PYTHON3_VERSION "Python3 version" "")
find_python("${VISP_PYTHON3_VERSION}" "${MIN_VER_PYTHON3}" PYTHON3_LIBRARY PYTHON3_INCLUDE_DIR
PYTHON3INTERP_FOUND PYTHON3_EXECUTABLE PYTHON3_VERSION_STRING
Expand All @@ -285,31 +270,16 @@ find_python("${VISP_PYTHON3_VERSION}" "${MIN_VER_PYTHON3}" PYTHON3_LIBRARY PYTHO
PYTHON3_INCLUDE_DIR PYTHON3_INCLUDE_DIR2 PYTHON3_PACKAGES_PATH
PYTHON3_NUMPY_INCLUDE_DIRS PYTHON3_NUMPY_VERSION)

mark_as_advanced(PYTHON2_LIBRARY PYTHON2_INCLUDE_DIR
PYTHON2INTERP_FOUND PYTHON2_EXECUTABLE PYTHON2_VERSION_STRING
PYTHON2_VERSION_MAJOR PYTHON2_VERSION_MINOR PYTHON2LIBS_FOUND
PYTHON2LIBS_VERSION_STRING PYTHON2_LIBRARIES PYTHON2_LIBRARY
PYTHON2_DEBUG_LIBRARIES PYTHON2_LIBRARY_DEBUG PYTHON2_INCLUDE_PATH
PYTHON2_INCLUDE_DIR PYTHON2_INCLUDE_DIR2 PYTHON2_PACKAGES_PATH
PYTHON2_NUMPY_INCLUDE_DIRS PYTHON2_NUMPY_VERSION)

mark_as_advanced(PYTHON3_LIBRARY PYTHON3_INCLUDE_DIR
PYTHON3INTERP_FOUND PYTHON3_EXECUTABLE PYTHON3_VERSION_STRING
PYTHON3_VERSION_MAJOR PYTHON3_VERSION_MINOR PYTHON3LIBS_FOUND
PYTHON3LIBS_VERSION_STRING PYTHON3_LIBRARIES PYTHON3_LIBRARY
PYTHON3_DEBUG_LIBRARIES PYTHON3_LIBRARY_DEBUG PYTHON3_INCLUDE_PATH
PYTHON3_INCLUDE_DIR PYTHON3_INCLUDE_DIR2 PYTHON3_PACKAGES_PATH
PYTHON3_NUMPY_INCLUDE_DIRS PYTHON3_NUMPY_VERSION
VISP_PYTHON3_VERSION)

if(PYTHON_DEFAULT_EXECUTABLE)
set(PYTHON_DEFAULT_AVAILABLE "TRUE")
elseif(PYTHON2_EXECUTABLE AND PYTHON2INTERP_FOUND)
# Use Python 2 as default Python interpreter
set(PYTHON_DEFAULT_AVAILABLE "TRUE")
set(PYTHON_DEFAULT_EXECUTABLE "${PYTHON2_EXECUTABLE}")
elseif(PYTHON3_EXECUTABLE AND PYTHON3INTERP_FOUND)
# Use Python 3 as fallback Python interpreter (if there is no Python 2)
set(PYTHON_DEFAULT_AVAILABLE "TRUE")
set(PYTHON_DEFAULT_EXECUTABLE "${PYTHON3_EXECUTABLE}")
endif()

if(PYTHON_DEFAULT_AVAILABLE)
execute_process(COMMAND ${PYTHON_DEFAULT_EXECUTABLE} --version
OUTPUT_VARIABLE PYTHON_DEFAULT_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REGEX MATCH "[0-9]+.[0-9]+.[0-9]+" PYTHON_DEFAULT_VERSION "${PYTHON_DEFAULT_VERSION}")
endif()
8 changes: 8 additions & 0 deletions cmake/VISPExtraTargets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,25 @@ if(DOXYGEN_FOUND)
COMMAND "${DOXYGEN_EXECUTABLE}" "${VISP_DOC_DIR}/config-doxygen"
DEPENDS "${VISP_DOC_DIR}/config-doxygen"
)
add_custom_target(visp_doc_xml
COMMAND "${DOXYGEN_EXECUTABLE}" "${VISP_DOC_DIR}/config-doxygen-xml"
DEPENDS "${VISP_DOC_DIR}/config-doxygen-xml"
)

if(CMAKE_GENERATOR MATCHES "Xcode")
add_dependencies(visp_doc man) # developer_scripts not available when Xcode
add_dependencies(visp_doc man)
elseif(UNIX AND NOT ANDROID) # man target available only on unix
add_dependencies(visp_doc man developer_scripts)
add_dependencies(visp_doc_xml man developer_scripts)
elseif(NOT(MINGW OR IOS))
add_dependencies(visp_doc developer_scripts)
add_dependencies(visp_doc_xml developer_scripts)
endif()

if(ENABLE_SOLUTION_FOLDERS)
set_target_properties(visp_doc PROPERTIES FOLDER "extra")
set_target_properties(visp_doc_xml PROPERTIES FOLDER "extra")
set_target_properties(html-doc PROPERTIES FOLDER "extra")
endif()
endif()
Expand Down
Loading
Loading