Skip to content

Commit

Permalink
Python bindings: rbt config, enable parallel LTO when supported by co…
Browse files Browse the repository at this point in the history
…mpiler
  • Loading branch information
SamFlt committed Sep 23, 2024
1 parent 52267a9 commit c6b4f4a
Show file tree
Hide file tree
Showing 2 changed files with 290 additions and 1 deletion.
29 changes: 28 additions & 1 deletion modules/python/bindings/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,42 @@ set_source_files_properties(${python_bindings_cpp_src} PROPERTIES GENERATED TRUE

pybind11_add_module(_visp ${python_bindings_cpp_src})




# Place library in build/modules/python/bindings dir so that it doesn't pollute lib dir
# This .so file is not treated the same as the others and we shouldn't link against it when compiling in C++
# when installing the python module, pip will look into this subfolder for .so files to copy into the site-packages
file(MAKE_DIRECTORY "${bindings_gen_location}/src")

get_target_property(PYTHON_CXX_FLAGS _visp COMPILE_OPTIONS)
get_target_property( PYTHON_LINKER_FLAGS _visp LINK_OPTIONS)


set_target_properties(_visp PROPERTIES COMPILE_FLAGS ${PYTHON_CXX_FLAGS})
if(PYTHON_CXX_FLAGS STREQUAL "PYTHON_CXX_FLAGS-NOTFOUND")
SET(PYTHON_CXX_FLAGS "") # Set to empty string
else()
SET(PYTHON_CXX_FLAGS "${PYTHON_CXX_FLAGS} ") # A space to cleanly separate from existing content
endif()
if(PYTHON_LINKER_FLAGS STREQUAL "PYTHON_LINKER_FLAGS-NOTFOUND")
SET(PYTHON_LINKER_FLAGS "") # Set to empty string
else()
SET(PYTHON_LINKER_FLAGS "${PYTHON_LINKER_FLAGS} ") # A space to cleanly separate from existing content
endif()
CHECK_CXX_COMPILER_FLAG("-flto=auto" COMPILER_SUPPORTS_FLTOAUTO)
if(COMPILER_SUPPORTS_FLTOAUTO)
SET(PYTHON_CXX_FLAGS "${PYTHON_CXX_FLAGS} -flto=auto")
SET(PYTHON_LINKER_FLAGS "${PYTHON_LINKER_FLAGS} -flto=auto")
endif()

set_target_properties(_visp PROPERTIES COMPILE_FLAGS ${PYTHON_CXX_FLAGS})
set_target_properties(_visp PROPERTIES LINK_FLAGS ${PYTHON_LINKER_FLAGS})


set_target_properties(_visp PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"

)
# With MSVC, the compiled pyd file is placed in a Release/Debug folder
set(build_configs "NONE" "RELEASE" "DEBUG" "RELEASEWITHDEBINFO" "RELWITHDEBINFO")
Expand Down
262 changes: 262 additions & 0 deletions modules/python/config/rbt.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,268 @@
"vpRBDriftDetector"
]
}
],
"acknowledge_pointer_or_ref_fields": [
"std::map<std::string, std::function<std::shared_ptr<T>(const nlohmann::json&)>>",
"std::function<std::string(const nlohmann::json&)>"
]
},
"vpRBTracker": {
"methods": [
{
"static": false,
"signature": "const vpRBFeatureTrackerInput& getMostRecentFrame()",
"return_policy": "reference",
"keep_alive": [
[
1,
0
]
],
"returns_ref_ok": true
},
{
"static": false,
"signature": "const vpRBTrackerLogger& getLogger()",
"return_policy": "reference",
"keep_alive": [
[
1,
0
]
],
"returns_ref_ok": true
},
{
"static": false,
"signature": "vpObjectCentricRenderer& getRenderer()",
"return_policy": "reference",
"keep_alive": [
[
1,
0
]
],
"returns_ref_ok": true
}
]
},
"vpRBRenderData": {
"methods": [
{
"static": false,
"signature": " vpRBRenderData(vpRBRenderData&&)",
"ignore": true
},
{
"static": false,
"signature": "vpRBRenderData& operator=(vpRBRenderData&&)",
"ignore": true
}
]
},
"vpRBFeatureTrackerInput": {
"methods": [
{
"static": false,
"signature": " vpRBFeatureTrackerInput(vpRBFeatureTrackerInput&&)",
"ignore": true
},
{
"static": false,
"signature": "vpRBFeatureTrackerInput& operator=(vpRBFeatureTrackerInput&&)",
"ignore": true
}
]
},
"vpRBFeatureTracker": {
"methods": [
{
"static": false,
"signature": "const vpColVector& getWeightedError()",
"return_policy": "reference",
"keep_alive": [
[
1,
0
]
],
"returns_ref_ok": true
}
]
},
"vpRBSilhouetteControlPoint": {
"acknowledge_pointer_or_ref_fields": [
"const vpMe*",
"const vpCameraParameters*"
],
"methods": [
{
"static": false,
"signature": " vpRBSilhouetteControlPoint(const vpRBSilhouetteControlPoint&&)",
"ignore": true
},
{
"static": false,
"signature": "vpRBSilhouetteControlPoint& operator=(const vpRBSilhouetteControlPoint&&)",
"ignore": true
},
{
"static": false,
"signature": "const vpLine& getLine()",
"return_policy": "reference",
"keep_alive": [
[
1,
0
]
],
"returns_ref_ok": true
},
{
"static": false,
"signature": "const vpFeatureLine& getFeatureLine()",
"return_policy": "reference",
"keep_alive": [
[
1,
0
]
],
"returns_ref_ok": true
},
{
"static": false,
"signature": "vpMeSite& getSite()",
"return_policy": "reference",
"keep_alive": [
[
1,
0
]
],
"returns_ref_ok": true
},
{
"static": false,
"signature": "const vpMeSite& getSite()",
"return_policy": "reference",
"keep_alive": [
[
1,
0
]
],
"returns_ref_ok": true
},
{
"static": false,
"signature": "const vpCameraParameters& getCameraParameters()",
"return_policy": "reference",
"keep_alive": [
[
1,
0
]
],
"returns_ref_ok": true
}
]
},
"vpRBKltTracker": {
"methods": [
{
"static": false,
"signature": "vpKltOpencv& getKltTracker()",
"return_policy": "reference",
"keep_alive": [
[
1,
0
]
],
"returns_ref_ok": true
},
{
"static": false,
"signature": "const vpKltOpencv& getKltTracker()",
"ignore": true
}
]
},
"vpRBDriftDetectorFactory": {
"methods": [
{
"static": true,
"signature": "vpRBDriftDetectorFactory& getFactory()",
"return_policy": "reference",
"keep_alive": [
[
1,
0
]
],
"returns_ref_ok": true
}
]
},
"vpObjectMaskFactory": {
"methods": [
{
"static": true,
"signature": "vpObjectMaskFactory& getFactory()",
"return_policy": "reference",
"keep_alive": [
[
1,
0
]
],
"returns_ref_ok": true
}
]
},
"vpRBFeatureTrackerFactory": {
"methods": [
{
"static": true,
"signature": "vpRBFeatureTrackerFactory& getFactory()",
"return_policy": "reference",
"keep_alive": [
[
1,
0
]
],
"returns_ref_ok": true
}
]
},
"vpObjectCentricRenderer": {
"methods": [
{
"static": false,
"signature": "void computeClipping(float&, float&)",
"use_default_param_policy": false,
"param_is_input": [
false,
false
],
"param_is_output": [
true,
true
]
}
]
},
"vpPanda3DDepthGaussianBlur": {
"acknowledge_pointer_or_ref_fields": [
"const char*"
]
},
"vpPanda3DDepthCannyFilter": {
"acknowledge_pointer_or_ref_fields": [
"const char*"
]
}
},
Expand Down

0 comments on commit c6b4f4a

Please sign in to comment.