build.rst 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. Build cglm
  2. ================================
  3. | **cglm** does not have any external dependencies.
  4. **NOTE:**
  5. If you only need to inline versions, you don't need to build **cglm**, you don't need to link it to your program.
  6. Just import cglm to your project as dependency / external lib by copy-paste then use it as usual
  7. CMake (All platforms):
  8. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  9. .. code-block:: bash
  10. :linenos:
  11. $ mkdir build
  12. $ cd build
  13. $ cmake .. # [Optional] -DCGLM_SHARED=ON
  14. $ make
  15. $ sudo make install # [Optional]
  16. **make** will build cglm to **build** folder.
  17. If you don't want to install **cglm** to your system's folder you can get static and dynamic libs in this folder.
  18. **CMake Options:**
  19. .. code-block:: CMake
  20. :linenos:
  21. option(CGLM_SHARED "Shared build" ON)
  22. option(CGLM_STATIC "Static build" OFF)
  23. option(CGLM_USE_C99 "" OFF) # C11
  24. option(CGLM_USE_TEST "Enable Tests" OFF) # for make check - make test
  25. **Use with your CMake project example**
  26. .. code-block:: CMake
  27. :linenos:
  28. cmake_minimum_required(VERSION 3.8.2)
  29. project(<Your Project Name>)
  30. add_executable(${PROJECT_NAME} src/main.c)
  31. target_link_libraries(${LIBRARY_NAME} PRIVATE
  32. cglm)
  33. add_subdirectory(external/cglm/)
  34. Unix (Autotools):
  35. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  36. .. code-block:: bash
  37. :linenos:
  38. $ sh autogen.sh
  39. $ ./configure
  40. $ make
  41. $ make check # run tests (optional)
  42. $ [sudo] make install # install to system (optional)
  43. **make** will build cglm to **.libs** sub folder in project folder.
  44. If you don't want to install **cglm** to your system's folder you can get static and dynamic libs in this folder.
  45. Windows (MSBuild):
  46. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  47. Windows related build files, project files are located in `win` folder,
  48. make sure you are inside in cglm/win folder.
  49. Code Analysis are enabled, it may take awhile to build.
  50. .. code-block:: bash
  51. :linenos:
  52. $ cd win
  53. $ .\build.bat
  54. if *msbuild* is not worked (because of multi versions of Visual Studio)
  55. then try to build with *devenv*:
  56. .. code-block:: bash
  57. :linenos:
  58. $ devenv cglm.sln /Build Release
  59. Currently tests are not available on Windows.
  60. Documentation (Sphinx):
  61. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  62. **cglm** uses sphinx framework for documentation, it allows lot of formats for documentation. To see all options see sphinx build page:
  63. https://www.sphinx-doc.org/en/master/man/sphinx-build.html
  64. Example build:
  65. .. code-block:: bash
  66. :linenos:
  67. $ cd cglm/docs
  68. $ sphinx-build source build