File: compile-and-install.rst

package info (click to toggle)
libccd 2.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 672 kB
  • sloc: ansic: 5,295; makefile: 376; python: 319; sh: 165
file content (122 lines) | stat: -rw-r--r-- 2,720 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
Compile And Install
====================

libccd contains several mechanisms for compiling and installing.
Using a simple Makefile, using autotools, and using CMake.


1. Using Makefile
------------------
Directory ``src/`` contains Makefile that should contain everything needed for compilation and installation:

.. code-block:: bash

    $ cd src/
    $ make
    $ make install

Library libccd is by default compiled in double precision of floating point
numbers - you can change this by options ``USE_SINGLE``/``USE_DOUBLE``, i.e.:

.. code-block:: bash

    $ make USE_SINGLE=yes

will compile library in single precision.
Installation directory can be changed by options ``PREFIX``, ``INCLUDEDIR``
and ``LIBDIR``. 
For more info type '``make help``'.


2. Using Autotools
-------------------
libccd also contains support for autotools:
Generate configure script etc.:

.. code-block:: bash

    $ ./bootstrap

Create new ``build/`` directory:

.. code-block:: bash

    $ mkdir build && cd build

Run configure script:

.. code-block:: bash

    $ ../configure

Run make and make install:

.. code-block:: bash

    $ make && make install

configure script can change the way libccd is compiled and installed, most
significant option is ``--enable-double-precision`` which enables double
precision (single is default in this case).

3. Using CMake
---------------

To build using ``make``:

.. code-block:: bash

    $ mkdir build && cd build
    $ cmake -G "Unix Makefiles" ..
    $ make && make install

To build using ``ninja``:

.. code-block:: bash

    $ mkdir build && cd build
    $ cmake -G Ninja ..
    $ ninja && ninja install

Other build tools may be using by specifying a different generator. For example:

.. code-block:: bash

    $ cmake -G Xcode ..

.. code-block:: batch

    > cmake -G "Visual Studio 14 2015" ..

To compile using double precision, set the ``ENABLE_DOUBLE_PRECISION`` option:

.. code-block:: bash

    $ mkdir build && cd build
    $ cmake -G "Unix Makefiles" -DENABLE_DOUBLE_PRECISION=ON ..
    $ make && make install

To build libccd as a shared library, set the ``BUILD_SHARED_LIBS`` option:

.. code-block:: bash

    $ mkdir build && cd build
    $ cmake -G "Unix Makefiles" -DBUILD_SHARED_LIBS=ON ..
    $ make && make install

To build the test suite, set the ``BUILD_TESTING`` option:

.. code-block:: bash

    $ mkdir build && cd build
    $ cmake -G "Unix Makefiles" -DBUILD_TESTING=ON ..
    $ make && make test


The installation directory may be changed by specifying the ``CMAKE_INSTALL_PREFIX`` variable:

.. code-block:: bash

    $ mkdir build && cd build
    $ cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/path/to/install ..
    $ make && make install