Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion docs/sphinx/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@

# General information about the project.
project = u'SofaPython3'
copyright = u'2020, SOFA Framework'
copyright = u'2021, SOFA Framework'
author = u'[email protected]'

# The version info for the project you're documenting, acts as replacement for
Expand Down
39 changes: 17 additions & 22 deletions docs/sphinx/source/menu/Compilation.rst
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
Compilation
===========

The compilation of the SofaPython3 can be done automatically when `building SOFA <https://www.sofa-framework.org/community/doc/getting-started/build/linux/>`__,
or it can be done independently using an already compiled/installed SOFA. The former is called an *in-tree build*, which is,
the compilation of SofaPython3 is included inside the build tree of SOFA. The latter is called an *out-of-tree build*, hence
the compilation of SofaPython3 is done in its own build tree, usually placed somewhere else than SOFA. This page will
cover both methods.
The compilation of the SofaPython3 can be done automatically when `building SOFA <https://www.sofa-framework.org/community/doc/getting-started/build/linux/>`_,
or it can be done independently using an already compiled/installed SOFA:

* the former is called an *in-tree build*, which is, the compilation of SofaPython3 is included inside the build tree of SOFA
* the latter is called an *out-of-tree build*, hence the compilation of SofaPython3 is done in its own build tree, usually placed somewhere else than SOFA.



Prerequisites
-------------

The compilation of SofaPython3 requires the installation of some dependencies. The following table lists all of those
prerequisites.

Expand Down Expand Up @@ -65,6 +68,7 @@ prerequisites.
`compile it <https://www.sofa-framework.org/community/doc/getting-started/build/macos/>`__ from sources
-


.. tab-container:: tab3
:title: Windows

Expand All @@ -82,8 +86,7 @@ prerequisites.
- Used to link against the C-Python API
* - `pybind11 <https://pybind11.readthedocs.io/en/stable/>`__
- **Required**
- Compile and install it from `sources <https://github.com/pybind/pybind11>`__. Then, add the installation
path to your PATH environment variable.
- Compile and install pybind11 from `sources <https://github.com/pybind/pybind11>`__
- Heavily used to automatically create the binding code between SOFA and python
* - `SOFA Framework <https://www.sofa-framework.org/community/doc/>`__
- **Required**
Expand All @@ -100,6 +103,9 @@ prerequisites.

PS $env:Path += ";C:\sofa;C:\pybind11;C:\python"




In-tree build
-------------

Expand All @@ -114,8 +120,7 @@ When you get to the step **Generate a Makefile with CMake**, activate the CMake
:alt: Activate the cmake option SOFA_FETCH_SOFAPYTHON3
:align: center

and configure CMake. This will pull the source code of SofaPython3 into the `application/plugins` directory of SOFA's
source directory.
and configure CMake. This will pull the source code of SofaPython3 into the `application/plugins` directory of SOFA's source directory.

.. note::

Expand Down Expand Up @@ -154,22 +159,12 @@ of python and pybind11 used for the compilation of the plugin:

At this point, you are ready to start the compilation of SOFA and the SofaPython3 plugin.

Out-of-tree build
-----------------

If you want to compile the SofaPython3 plugin out-of-tree, you will need to either:

* [**Method 1**] Install the `SOFA binaries and headers <https://www.sofa-framework.org/download/>`__
somewhere on your computer and note its installation directory. Or,
* [**Method 2**] Compile it following the `SOFA build documentation <https://www.sofa-framework.org/community/doc/getting-started/build/linux/>`__.
Once it is built, execute the installation by going into the build directory of SOFA (for example,
*/home/user/sofa/build/master/*), and using the command ``cmake --install .``

.. warning::
Out-of-tree build
-----------------

If you choose the first method (installing the binaries), make sure you have all the SOFA dependencies installed on
your system (e.g. boost, Eigen3, etc.). You can follow the same instructions as if you had chosen the second method
(compiling SOFA), but skipping the compilation part.
As detailed above in the `Prerequisite <https://sofapython3.readthedocs.io/en/latest/menu/Compilation.html#prerequisites>`_ section, you must have an installed version of SOFA in order to compile the SofaPython3 plugin *out-of-tree*. Not only must the sources be compiled following the SOFA documentation, but you have to make sure to have an **install** directory, i.e. to execute the installation (e.g. by runnin the command ``cmake --install .`` from the SOFA build directory)

Once done, export the installation path of SOFA inside the ``SOFA_ROOT`` environment variable. For example,

Expand Down
15 changes: 15 additions & 0 deletions docs/sphinx/source/menu/Contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,18 @@ Contributing
============

We welcome any contribution.
The SofaPython3 plugin, bindings and this documentation can be directly improved following a pull-request process in the GitHub repository.

Pull requests
-------------

If you are able to patch a bug, add the feature yourself, add new examples or simply fix a typo – fantastic, make a pull request with the code! Be sure you have read any documents on contributing and you understand `the SOFA license <https://github.com/sofa-framework/sofa/blob/master/LICENCE.txt>`_. Once you have submitted a pull request the maintainer(s) can compare your branch to the existing one and decide whether or not to incorporate (pull in) your changes.

*Reminder - How to pull request*

* `Fork <http://guides.github.com/activities/forking/>`_ the repository and clone it locally.
* `Connect your clone <https://help.github.com/articles/configuring-a-remote-for-a-fork/>`_ to the `original upstream repository <https://github.com/sofa-framework/SofaPython3/>`_ by adding it as a remote.
* Create a branch for your changes.
* Make your changes.
* Pull in changes from upstream often to `synchronize your fork <https://help.github.com/articles/syncing-a-fork/>`_ so that merge conflicts will be less likely in your pull request.
* `Create a pull request <https://help.github.com/articles/creating-a-pull-request-from-a-fork/>`_ when you are ready to propose your changes into the main project.
8 changes: 6 additions & 2 deletions docs/sphinx/source/menu/CustomModule.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
Writing custom binding
======================

It is possible to write your custom binding for your own Sofa c++ components. For that you need to
follow the example provided in bindings/BindingExample. In this example a custom c++ Sofa object
It is possible to write your custom binding for your own SOFA c++ components. For that you need to
follow the example provided in bindings/BindingExample. In this example a custom c++ SOFA object
named CustomObject is binding to python and exposes some properties and methods.

See `here a video tutorial <https://www.youtube.com/watch?v=S0QWV4Wj-vs>`_ on How to create python bindings with pybind11 and SofaPython3!

.. raw:: html

<iframe width="600" height="400" src="http://www.youtube.com/embed/S0QWV4Wj-vs?rel=0" frameborder="0" allowfullscreen></iframe>
Loading