#. Install `Conan <https://docs.conan.io/en/latest/installation.html>`_ (you can use Python's ``pip``, but be sure to use python ``3`` -- you can check this by running ``pip --version``)
Install a c++ compiler and other development libraries.
.. tabs::
.. group-tab:: Linux
Install `gcc 7 <https://gcc.gnu.org/>`_ or `clang 6.0 <http://clang.llvm.org/>`_ (As pre-built packages are
only compiled with this versions).
Depending on which linux distribution you use,
for example on **Mint**, you can run the following command to download and install these tools:
If installed with default parameters ``git``, ``CMake`` and ``Python`` will be automatically loaded into your PATH
variable.
For static binaries like ``Ninja`` you will need to add them manually with a command similar to :
.. code:: bash
> PATH=%PATH%;C:\Bin
.. tip::
Writing a ``.bat`` script that loads all these previous locations to your path can save you time and effort!
.. group-tab:: Mac OSX
Make sure all of your Prerequisites_ are loaded into your path correctly, for all installation made through
`brew` this is done automatically but for manually downloaded binaries you'll need to do it yourself.
If you haven't done it, launch Xcode at least one time and install the ``Command Line Tools`` when prompted.
You can do this manually by using the following command:
.. code:: bash
$ xcode-select --install
If you already had installed the ``Command Line Tools``, it may be a good idea to check that the currently used ones are the default:
.. code:: bash
$ xcode-select --print-path
/Applications/Xcode.app/Contents/Developer
If the above command prints something different, you may reset to the default with:
.. code:: bash
$ sudo xcode-select --reset
Building your sources
----------------------
* `Clone <http://git-scm.com/book/en/v2/Git-Basics-Getting-a-Git-Repository#Cloning-an-Existing-Repository>`_ the following repository in the (Dev/Src) source folder:
* `sight <https://git.ircad.fr/Sight/sight.git>`_
.. code:: bash
$ cd Dev/Src
$ git clone https://git.ircad.fr/Sight/sight.git
* Go into your Build directory (Debug or Release) : here is an example if you want to compile in debug:
.. code:: bash
$ cd Dev/Build/Debug
.. warning:: Make sure your environment is properly set : :ref:`settingUpEnv` .
* Call cmake-gui.
.. code:: bash
$ cmake-gui .
Configuration
~~~~~~~~~~~~~~~~
* Set the desired Build directory (e.g. Dev/Build/Debug or Release)
* Set the desired Source directory (e.g. Dev/Src/sight)
* Click on "configure".
* During configure step, choose the generator 'Ninja' to compile Sight sources.
Generation
~~~~~~~~~~~~~~
* Set the following arguments:
``CMAKE_INSTALL_PREFIX``:
Set the install location (e.g. Dev/Install/Debug).
``CMAKE_BUILD_TYPE``:
Set to Debug or Release.
``PROJECTS_TO_BUILD``:
Set the names of the applications to build (see Dev/Src/Apps or Dev/Src/Samples, ex: VRRender, Tuto01Basic ...),
each project should be separated by ";".
.. note::
- If ``PROJECTS_TO_BUILD`` is empty, all application will be compiled.
* Click on "generate".
If you want to launch the ``cmake`` through the command line with the appropriate parameters
Good practices in Sight recommend to separate source files, build and install folders.
So to prepare the development environment, we propose to follow this layout:
* Create a development folder (Dev)
* Create a build folder (Dev/Build)
* Add a sub folder for Debug and Release.
* Create a source folder (Dev/Src)
* Create an install folder (Dev/Install)
* Add a sub folder for Debug and Release.
To prepare the third party environment:
* Create a third party folder (BinPkgs)
* Create a build folder (BinPkgs/Build)
* Add a sub folder for Debug and Release.
* Create a source folder (BinPkgs/Src)
* Create an install folder (BinPkgs/Install)
* Add a sub folder for Debug and Release.
.. image:: ../media/Directories.png
Of course you can name the folders as you wish, or choose a different layout,
but keep in mind to not build inside the source directory.
This is strongly discouraged by *CMake* authors.
Dependencies
~~~~~~~~~~~~
First, we need to build the third-party libraries.
We will now fetch the scripts that allow to build them and then launch the compilation.
* `Clone <http://git-scm.com/book/en/v2/Git-Basics-Getting-a-Git-Repository#Cloning-an-Existing-Repository>`_ the following repository in the (BinPkgs/Src) source folder:
Additional dependency repositories must be cloned in the same directory as **sight-deps** and they will be automatically discovered and then can be enabled via CMake.
* Ensure that all the cloned repositories are on the same `branch <https://git-scm.com/docs/git-branch>`_.
* Update the cloned repositories to the lastest stable `tag <https://git-scm.com/book/en/v2/Git-Basics-Tagging>`_.
* Go into your Build directory (Debug or Release) : here is an example if you want to compile in DEBUG
.. code:: bash
$ cd Dev/BinPkgs/Build/Debug
Configuration
~~~~~~~~~~~~~
To build the dependencies, you must configure the project with CMake into the Build folder.
As any CMake based project, there are three different ways to perform that.
1. Command-line
***************
In this case, you give all the necessary variables on the command-line in one shot :