Building from sources
There is 2 way in which you can build the project:
As a CloudCompare Plugin
As “standalone” Python packages
When built as CloudCompare plugin, at the end of the process, you will have a standard CloudCompare plugin that embeds Python to allow running Python script directly in the app and allow scripts to interact with the currently running CloudCompare like a regular C++ plugin would. The plugin built, also embeds various Python bindings of CloudCompare’s libraries to be used in your script.
When build as standalone packages, you will install the Python bindings of the CloudCompare’s libraries in your Python environment.
The process to build is explained in the sections below.
Building as Plugin
Supported platforms: [Windows, Linux, macOS]
In the following sections we assume that you know how to compile CloudCompare from source, otherwise refer to the CloudCompare documentation on how to do.
To compile this plugin you need to have Python installed.
This plugin is known to compile and work with CloudCompare commit d17314ca8538e187bf12d4ebe97525d61886b735.
Python 3.8 or more is required to build as a plugin.
Windows
Clone this project into CloudCompare/plugins/private
Create a virtual environment via
venv
orconda
# Python's venv python -m venv .\pyccvenv # Conda environment conda create -n pyccenv
Activate the environment
# Python's venv (PowerShell) .\pyccenv\Scripts\Activate.ps1 # Conda environment conda activate pyccenv
install dependencies
pip install -r requirements-release.txt
Generate the cmake config
To generate the cmake config you have 2 options:
Start the cmake generation while still within the activated environment
Add
-DPYTHON_EXECUTABLE="somepath_to_python.exe"
Wheresomepath_to_python.exe
is the absolute path to the python executable of the pyccenv created earlier.To get it, run:
python -c "import sys;print(sys.executable)"
(while in the activated env)
In both cases the cmake option to add in order to build the plugin in
-DPLUGIN_PYTHON=ON
Build
Install
Linux
Clone this project in CloudCompare/plugins/private
Install additional dependencies
Ubuntu:
libpython3-dev
andpybind11-dev
(only available since 20.04)Fedora:
python3-devel
andpybind11-devel
Run cmake with
-DPLUGIN_PYTHON=ON
Build
Install
macOS
Clone this project in CloudCompare/plugins/private
Make sure you have python3 installed (and Qt)
Install additional dependencies
In this example, we will use brew
brew install pybind11
Run cmake with
-DPLUGIN_PYTHON=ON
Build
Install
Building as independent wheels
Supported platforms: [Windows, Linux, macOS]
It is also possible to build and install the bindings as standard python packages to use them in python scripts (run by a standalone python executable and not the embedded python in the plugin).
To build as standalone wheels, it is not necessary to clone the repo in CloudCompare’s plugins/private folder.
Important
To be able to pip install from source, you need pip version >= 21.1 Run pip install –upgrade pip to get the latest version
To do so:
Clone this project
Set path to Qt (Windows/macOS)
# Windows (PowerShell)
$env:CMAKE_PREFIX_PATH+=";C:\Qt\5.15.2\msvc2019_64"
macOS (bash)
export CMAKE_PREFIX_PATH=/usr/local/opt/qt@5
Run
# Building the wheels
pip wheel --no-deps wrapper/cccorelib
pip wheel --no-deps wrapper/pycc
# Installing directly
pip install wrapper/cccorelib
pip install wrapper/pycc
Supported CloudCompare Plugins
Some CloudCompare plugins (the ones in C++) are available through python. And are compiled only if the corresponding C++ plugin is also being compiled.
Currently the only available “plugin wrapper” is one for qM3C2
plugin.
To compile this wrapper do:
Building as Plugin
Add -DPLUGIN_STANDARD_QM3C2=ON
to the cmake configuration.
Building as independent wheels
Before the pip
command, add -DPLUGIN_STANDARD_QM3C2=ON
to the SKBUILD_CONFIGURE_OPTIONS
environment variable.
export SKBUILD_CONFIGURE_OPTIONS="-DPLUGIN_STANDARD_QM3C2=ON"