No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 
 

103 líneas
3.0 KiB

  1. # How to build from source
  2. ## Requirements
  3. ### Common requirements
  4. In order to build cmocka, you need to install several components:
  5. - A C compiler
  6. - [CMake](http://www.cmake.org) >= 2.8.0.
  7. Note that these version numbers are version we know works correctly. If you
  8. build and run cmocka successfully with an older version, please let us know.
  9. ## Building
  10. First, you need to configure the compilation, using CMake. Go inside the
  11. `build` dir. Create it if it doesn't exist.
  12. GNU/Linux, MacOS X, MSYS/MinGW:
  13. cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debug ..
  14. make
  15. On Windows you should choose a makefile gernerator with -G, for example:
  16. cmake -G "Visual Studio 12 2013" -DCMAKE_BUILD_TYPE=Debug /path/to/source
  17. You can also use the CMake GUI which is shipped with CMake. It will list all
  18. available generators for MSVC on Windows.
  19. ### CMake standard options
  20. Here is a list of the most interesting options provided out of the box by
  21. CMake.
  22. - CMAKE_BUILD_TYPE: The type of build (can be Debug Release MinSizeRel
  23. RelWithDebInfo)
  24. - CMAKE_INSTALL_PREFIX: The prefix to use when running make install (Default
  25. to /usr/local on GNU/Linux and MacOS X)
  26. - CMAKE_C_COMPILER: The path to the C compiler
  27. - CMAKE_CXX_COMPILER: The path to the C++ compiler
  28. ### CMake options defined for cmocka
  29. Options are defined in the following files:
  30. - DefineOptions.cmake
  31. They can be changed with the -D option:
  32. `cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debug -DUNIT_TESTING=ON ..`
  33. ### Browsing/editing CMake options
  34. In addition to passing options on the command line, you can browse and edit
  35. CMake options using `cmakesetup` (Windows), `cmake-gui` or `ccmake` (GNU/Linux
  36. and MacOS X).
  37. - Go to the build dir
  38. - On Windows: run `cmakesetup`
  39. - On GNU/Linux and MacOS X: run `ccmake ..`
  40. ## Installing
  41. If you want to install cmocka after compilation run:
  42. make install
  43. ## Running
  44. The cmocka library can be found in the `build/src` directory.
  45. You can run the binaries in `build/examples/*` which is a
  46. are exsample tests.
  47. ## Testing
  48. As mention above you can turn on the unit tests and make it possible to easily
  49. execute them:
  50. `cmake -DCMAKE_BUILD_TYPE=Debug -DUNIT_TESTING=ON ..`
  51. After that you can simply call `make test` in the build directory or if you
  52. want more output simply call `ctest -V`.
  53. If you want to enable the generation of coverage files you can do this by
  54. using the following options:
  55. `cmake -DCMAKE_BUILD_TYPE=Profiling -DUNIT_TESTING=ON ..`
  56. After building it you will see that you have several coverage options in
  57. `make help`
  58. You should have `make ExperimentalCoverage` and running it will create
  59. coverage files. The result is stored in Testing directory.
  60. ## About this document
  61. This document is written using [Markdown][] syntax, making it possible to
  62. provide usable information in both plain text and HTML format. Whenever
  63. modifying this document please use [Markdown][] syntax.
  64. [markdown]: http://www.daringfireball.net/projects/markdown