ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
cloudViewer_pybind.cpp
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
9 
10 #include <Logging.h>
11 
13 #include "pybind/camera/camera.h"
14 #include "pybind/core/core.h"
15 #include "pybind/data/dataset.h"
17 #include "pybind/io/io.h"
18 #include "pybind/ml/ml.h"
21 #include "pybind/t/t.h"
22 #include "pybind/utility/utility.h"
24 
25 namespace cloudViewer {
26 
27 PYBIND11_MODULE(pybind, m) {
28  utility::Logger::GetInstance().SetPrintFunction([](const std::string& msg) {
29  py::gil_scoped_acquire acquire;
30  py::print(msg);
31  });
32 
33  m.doc() = "Python binding of CloudViewer";
34 
35  // Check CloudViewer CXX11_ABI with
36  // import cloudViewer as cv3d;
37  // print(cv3d.cloudViewer_pybind._GLIBCXX_USE_CXX11_ABI)
38  m.add_object("_GLIBCXX_USE_CXX11_ABI",
39  _GLIBCXX_USE_CXX11_ABI ? Py_True : Py_False);
40 
41  // The binding order matters: if a class haven't been binded, binding the
42  // user of this class will result in "could not convert default argument
43  // into a Python object" error.
49  t::pybind_t(m);
50  ml::pybind_ml(m);
51  io::pybind_io(m);
54 #ifdef BUILD_RECONSTRUCTION
56 #endif
57 
58  // pybind11 will internally manage the lifetime of default arguments for
59  // function bindings. Since these objects will live longer than the memory
60  // manager statistics, the latter will report leaks. Reset the statistics to
61  // ignore them and transfer the responsibility to pybind11.
63 }
64 
65 } // namespace cloudViewer
static MemoryManagerStatistic & GetInstance()
void SetPrintFunction(std::function< void(const std::string &)> print_fcn)
Definition: Logging.cpp:68
static Logger & GetInstance()
Get Logger global singleton instance.
Definition: Logging.cpp:25
void pybind_camera(py::module &m)
void pybind_core(py::module &m)
Definition: core.cpp:20
void pybind_data(py::module &m)
Definition: dataset.cpp:1173
void pybind_geometry(py::module &m)
Definition: geometry.cpp:1021
void pybind_io(py::module &m)
Definition: io.cpp:15
void pybind_ml(py::module &m)
Definition: ml.cpp:16
void pybind_pipelines(py::module &m)
Definition: pipelines.cpp:19
void pybind_reconstruction(py::module &m)
void pybind_t(py::module &m)
Definition: t.cpp:18
void pybind_utility(py::module &m)
Definition: utility.cpp:16
void pybind_visualization(py::module &m)
Generic file read and write utility for python interface.
PYBIND11_MODULE(pybind, m)