README_cmake 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. Instruction for the CMake Build System
  2. ======================================
  3. CMake is a family of tools designed to build, test and
  4. package software and it is cross-platform and open
  5. source. CMake and can obtained from http://www.cmake.org.
  6. 0 Setup CMake
  7. -------------
  8. CMake is available in most of Linux repositories and can
  9. be therefore easily installed. In Cygwin just use the
  10. usual method with setup.exe to get the latest version of CMake.
  11. For Windows and Mac OS X go to http://www.cmake.org and
  12. download the appropriate binary packge. Make sure that the
  13. bin directory of the extracted CMake package is in the
  14. PATH environment variable. Check in the CLI with
  15. cmake --version
  16. that CMake can be found. There is also a graphical interface
  17. to CMake available which can be run with ccmake (Linux, Mac OS X)
  18. or cmake-gui (Windows, Linux, Mac OS X). In the next section
  19. the command line tool cmake is used, but the graphical interface
  20. works similar. Note, that CMake should always operate in a
  21. out-of-source directory. If you need to run CMake again it's best
  22. to remove the whole folder and start with the directory creation
  23. in order to prevent problems with stale CMake cache files.
  24. X Specific instructions for Linux and Mac OS X
  25. ==============================================
  26. Create a directory at the same level as the libharu source directory,
  27. e.g. "mkdir libharu_build". Cd into this directory.
  28. Than run cmake with the command
  29. cmake ../libharu
  30. CMake will configure the build and create the appropriate makefiles.
  31. Run "make" to create the library and the examples. There are some
  32. options available which are described below.
  33. X Specific instructions for Windows
  34. ===================================
  35. Create a directory at the same level as the libharu source directory,
  36. e.g. "mkdir libharu_build". Cd into this directory.
  37. Since there are more compiler toolsets available for Windows than
  38. the standard gcc compiler, you need to tell cmake which makefile
  39. generator to use
  40. cmake -G "Makefile Generator" ..\libharu
  41. where Make Generator is one of the following (most important listed)
  42. Borland Makefiles = Generates Borland makefiles.
  43. MSYS Makefiles = Generates MSYS makefiles.
  44. MinGW Makefiles = Generates a make file for use with
  45. mingw32-make.
  46. NMake Makefiles = Generates NMake makefiles.
  47. Visual Studio 6 = Generates Visual Studio 6 project files.
  48. Visual Studio 9 2008 = Generates Visual Studio 9 2008 project files.
  49. You get a complete list of all available generators for your platfrom
  50. with "cmake --help". I'll go into details for one specific compiler toolset.
  51. The other generators work similar.
  52. Using CMake to produce Visual C++ 2008 Makfiles
  53. -----------------------------------------------
  54. First you need to have the command line interface setup correctly. Start
  55. cmd.exe and run "%VS90COMNTOOLS%vsvars32.bat". This will set up the
  56. command line tools of Visual C++ 2008. Cd into the created build
  57. directory and run
  58. cmake -G "NMake Makefiles" ..\libharu
  59. After the configuration and creation of the makefile run "nmake" to create
  60. the libraries and demonstrations. By default a shared library will be
  61. created therefore you need to copy the haru.dll from the src directory
  62. in the demo directory in order for the demonstrations to run correctly.
  63. X Useful CMake options
  64. ======================
  65. There are some options available where you can influence the configuration
  66. stage. These options must be given at the command line with the -D flag, e.g.
  67. cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Debug ..\libharu
  68. CMAKE_BUILD_TYPE=Debug|Release - debug or release build
  69. BUILD_SHARED_LIBS=ON|OFF - shared or static build
  70. CMAKE_COLOR_MAKEFILE=ON|OFF - color output
  71. CMAKE_VERBOSE_MAKEFILE=ON|OFF - verbose makefile output
  72. More options can be found here: http://www.cmake.org/Wiki/CMake_Useful_Variables
  73. X How does CMake find libraries
  74. ===============================
  75. CMake searches usually in the standard locations to find libraries, which
  76. works well on Linux und Mac OS X. This is not the case for Windows (where
  77. there are simply no standard locations for libraries) or if you want to
  78. use a library at a non-standard location. You can help CMake to find
  79. libraries via two environment variables, e.g. for Windows:
  80. set CMAKE_INCLUDE_PATH=path_to_zlib_headers
  81. set CMAKE_LIBRARY_PATH=path_to_zlib
  82. and then CMake will be able to find zlib.