summaryrefslogtreecommitdiff
path: root/libs/cglm/docs/source/build.rst
blob: e2eb23da01ae0bd7816734fd9b18845275a24d70 (plain)
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
Build cglm
================================

| **cglm** does not have any external dependencies.

**NOTE:**
If you only need to inline versions, you don't need to build **cglm**, you don't need to link it to your program.
Just import cglm to your project as dependency / external lib by copy-paste then use it as usual

CMake (All platforms):
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. code-block:: bash
  :linenos:

  $ mkdir build
  $ cd build
  $ cmake .. # [Optional] -DCGLM_SHARED=ON
  $ make
  $ sudo make install # [Optional]

**make** will build cglm to **build** folder.
If you don't want to install **cglm** to your system's folder you can get static and dynamic libs in this folder.

**CMake Options:**

.. code-block:: CMake
  :linenos:

  option(CGLM_SHARED "Shared build" ON)
  option(CGLM_STATIC "Static build" OFF)
  option(CGLM_USE_C99 "" OFF) # C11 
  option(CGLM_USE_TEST "Enable Tests" OFF) # for make check - make test

**Use as header-only library with your CMake project example**
This requires no building or installation of cglm.

.. code-block:: CMake
  :linenos:

  cmake_minimum_required(VERSION 3.8.2)
  
  project(<Your Project Name>)
  
  add_executable(${PROJECT_NAME} src/main.c)
  target_link_libraries(${LIBRARY_NAME} PRIVATE
    cglm_headers)
  
  add_subdirectory(external/cglm/ EXCLUDE_FROM_ALL)

**Use with your CMake project example**

.. code-block:: CMake
  :linenos:

  cmake_minimum_required(VERSION 3.8.2)
  
  project(<Your Project Name>)
  
  add_executable(${PROJECT_NAME} src/main.c)
  target_link_libraries(${LIBRARY_NAME} PRIVATE
    cglm)
  
  add_subdirectory(external/cglm/)

Meson (All platforms):
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. code-block::
  :linenos:

  $ meson build # [Optional] --default-library=static
  $ cd build
  $ ninja
  $ sudo ninja install # [Optional]

**Meson Options:**

.. code-block:: 
  :linenos:

  c_std=c11
  buildtype=release
  default_library=shared
  enable_tests=false # to run tests: ninja test


**Use with your Meson project**

.. code-block::
  :linenos:

  # Clone cglm or create a cglm.wrap under <source_root>/subprojects
  project('name', 'c')
  
  cglm_dep = dependency('cglm', fallback : 'cglm', 'cglm_dep')
  
  executable('exe', 'src/main.c', dependencies : cglm_dep)


Unix (Autotools):
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. code-block:: bash
  :linenos:

  $ sh autogen.sh
  $ ./configure
  $ make
  $ make check            # run tests (optional)
  $ [sudo] make install   # install to system (optional)

**make** will build cglm to **.libs** sub folder in project folder.
If you don't want to install **cglm** to your system's folder you can get static and dynamic libs in this folder.

Windows (MSBuild):
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Windows related build files, project files are located in `win` folder,
make sure you are inside in cglm/win folder.

Code Analysis are enabled, it may take awhile to build.

.. code-block:: bash
  :linenos:

  $ cd win
  $ .\build.bat

if *msbuild* is not worked (because of multi versions of Visual Studio)
then try to build with *devenv*:

.. code-block:: bash
  :linenos:

  $ devenv cglm.sln /Build Release

Currently tests are not available on Windows.

Documentation (Sphinx):
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

**cglm** uses sphinx framework for documentation, it allows lot of formats for documentation. To see all options see sphinx build page:

https://www.sphinx-doc.org/en/master/man/sphinx-build.html

Example build:

.. code-block:: bash
  :linenos:

  $ cd cglm/docs
  $ sphinx-build source build