PageRenderTime 52ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/v5_9_1/CMakeLists.txt

#
CMake | 226 lines | 130 code | 27 blank | 69 comment | 13 complexity | a845d8d968c9c03c7bb3451738b0429e MD5 | raw file
Possible License(s): LGPL-2.0, BSD-3-Clause-No-Nuclear-License-2014, Apache-2.0, GPL-2.0
  1. # Top-level CMakeLists.txt for PLplot
  2. ###
  3. ### Process this file with cmake to produce Makefile
  4. ###
  5. # Copyright (C) 2006 Alan W. Irwin
  6. #
  7. # This file is part of PLplot.
  8. #
  9. # PLplot is free software; you can redistribute it and/or modify
  10. # it under the terms of the GNU Library General Public License as published
  11. # by the Free Software Foundation; version 2 of the License.
  12. #
  13. # PLplot is distributed in the hope that it will be useful,
  14. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. # GNU Library General Public License for more details.
  17. #
  18. # You should have received a copy of the GNU Library General Public License
  19. # along with PLplot; if not, write to the Free Software
  20. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  21. # Version 2.4.5 or above of cmake is required!
  22. CMAKE_MINIMUM_REQUIRED(VERSION 2.4.5 FATAL_ERROR)
  23. # set CMake 2.6.x policy if the cmake_policy command exists, (i.e., if
  24. # the user is using CMake 2.6.0 or newer).
  25. if(COMMAND cmake_policy)
  26. # empty elements are not ignored in lists.
  27. cmake_policy(SET CMP0007 NEW)
  28. endif(COMMAND cmake_policy)
  29. # Recommended way to do user overrides of C-related variables, is given at
  30. # http://public.kitware.com/pipermail/cmake/2006-July/010334.html.
  31. # See also, CMakeCInformation.cmake. There are also C++, and Fortran-specific
  32. # overrides that can be done. However, I prefer putting overrides in just
  33. # one file so I use the overall variable CMAKE_USER_MAKE_RULES_OVERRIDE
  34. # instead.
  35. set(
  36. CMAKE_USER_MAKE_RULES_OVERRIDE
  37. ${CMAKE_SOURCE_DIR}/cmake/UserOverride.cmake
  38. )
  39. project(plplot)
  40. set(PACKAGE plplot)
  41. # Location where PLplot cmake build system first looks for cmake modules.
  42. set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules)
  43. # We need the path to the MinGW compiler in order to find
  44. # the import libraries for system libraries.
  45. IF(MINGW)
  46. get_filename_component(MINGWBINPATH ${CMAKE_C_COMPILER} PATH)
  47. set(MINGWLIBPATH ${MINGWBINPATH}/../lib
  48. CACHE FILEPATH
  49. DOCSTRING "Path to MinGW import libraries")
  50. ENDIF(MINGW)
  51. # Version data that need modification for each release.
  52. include(plplot_version)
  53. # parameters to control overall cmake behaviour.
  54. # Configure PLplot component variables....
  55. include(plplot)
  56. # Use configured variables to process configurable top-level files.
  57. configure_file(
  58. ${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake
  59. ${CMAKE_CURRENT_BINARY_DIR}/config.h
  60. )
  61. # Allow access to the generated config.h for this build.
  62. ADD_DEFINITIONS("-DHAVE_CONFIG_H")
  63. # Install top-level files
  64. # Enable testing framework for examples
  65. if (BUILD_TEST)
  66. include(CTest)
  67. endif (BUILD_TEST)
  68. # Disable warnings about deprecated functions (Visual C++ 2005)
  69. if(MSVC_VERSION GREATER 1399)
  70. ADD_DEFINITIONS("/D_CRT_SECURE_NO_DEPRECATE")
  71. endif(MSVC_VERSION GREATER 1399)
  72. # in windows all created dlls are gathered in the dll directory
  73. # if you add this directory to your PATH all shared libraries are available
  74. if(BUILD_SHARED_LIBS AND WIN32 AND NOT CYGWIN)
  75. SET(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dll)
  76. endif(BUILD_SHARED_LIBS AND WIN32 AND NOT CYGWIN)
  77. # Borland Compiler must compile in ANSII mode
  78. if(BORLAND)
  79. ADD_DEFINITIONS(-A)
  80. endif(BORLAND)
  81. set(top_level_DOCFILES
  82. AUTHORS
  83. COPYING.LIB
  84. ChangeLog
  85. Copyright
  86. FAQ
  87. NEWS
  88. PROBLEMS
  89. README
  90. README.release
  91. )
  92. install(FILES ${top_level_DOCFILES} DESTINATION ${DOC_DIR})
  93. # Process other directories including using configured variables to
  94. # process configurable files in those directories.
  95. # N.B. Order is important here at the cmake stage because targets must
  96. # be processed by cmake in a specific order e.g., due to get_target_property
  97. # invocations. Note, this order has nothing to do with the order which make
  98. # processes these subdirectories at build time. That build-time order
  99. # is determined by the dependencies between targets and also by file
  100. # dependencies that are established by the cmake configuration files.
  101. # needs no cmake processing
  102. #add_subdirectory(fonts)
  103. add_subdirectory(lib)
  104. add_subdirectory(include)
  105. add_subdirectory(src)
  106. add_subdirectory(data)
  107. add_subdirectory(bindings)
  108. add_subdirectory(drivers)
  109. add_subdirectory(examples)
  110. add_subdirectory(utils)
  111. add_subdirectory(plplot_test)
  112. add_subdirectory(scripts)
  113. add_subdirectory(doc)
  114. add_subdirectory(www)
  115. add_subdirectory(pkgcfg)
  116. # needs no cmake processing
  117. #add_subdirectory(cf)
  118. summary()
  119. if(PREBUILD_DIST)
  120. # Pre-build everything required for a distribution tarball and copy it to
  121. # the source tree (if build tree is different from source tree).
  122. # List of targets that must be (pre-)built.
  123. # N.B. the plhershey-unicode.h_built target has to be pre-built only because
  124. # of the needs of the old windows build at sys/win32/msdev.
  125. set(
  126. DIST_TARGETS
  127. plhershey-unicode.h_built
  128. )
  129. if(ENABLE_octave)
  130. set(DIST_TARGETS ${DIST_TARGETS} make_documentation)
  131. endif(ENABLE_octave)
  132. if(BUILD_PRINT)
  133. set(DIST_TARGETS ${DIST_TARGETS} print)
  134. endif(BUILD_PRINT)
  135. if(BUILD_INFO)
  136. set(DIST_TARGETS ${DIST_TARGETS} info)
  137. endif(BUILD_INFO)
  138. if(BUILD_MAN)
  139. set(DIST_TARGETS ${DIST_TARGETS} man)
  140. endif(BUILD_MAN)
  141. if(BUILD_HTML)
  142. set(DIST_TARGETS ${DIST_TARGETS} html)
  143. endif(BUILD_HTML)
  144. if(CMAKE_BINARY_DIR STREQUAL "${CMAKE_SOURCE_DIR}")
  145. add_custom_target(prebuild_dist)
  146. else(CMAKE_BINARY_DIR STREQUAL "${CMAKE_SOURCE_DIR}")
  147. # copy prebuilds back to source tree.
  148. add_custom_target(
  149. prebuild_dist
  150. COMMAND ${CMAKE_COMMAND} -E copy
  151. ${CMAKE_BINARY_DIR}/include/plhershey-unicode.h
  152. ${CMAKE_SOURCE_DIR}/include
  153. COMMAND ${CMAKE_COMMAND} -E copy_directory
  154. ${CMAKE_BINARY_DIR}/bindings/octave/plplot_octave_txt
  155. ${CMAKE_SOURCE_DIR}/bindings/octave/plplot_octave_txt
  156. COMMAND cp
  157. `cat static_built_files ${INFO_MANIFEST} ${MAN_MANIFEST} ${HTML_MANIFEST}`
  158. ${CMAKE_SOURCE_DIR}/doc/docbook/src
  159. WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/doc/docbook/src
  160. )
  161. endif(CMAKE_BINARY_DIR STREQUAL "${CMAKE_SOURCE_DIR}")
  162. add_dependencies(prebuild_dist ${DIST_TARGETS})
  163. endif(PREBUILD_DIST)
  164. #
  165. # Packing stuff
  166. #
  167. set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The Scientific Plotting Library PLplot")
  168. set(CPACK_PACKAGE_VENDOR "PLplot development team")
  169. set(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_CURRENT_SOURCE_DIR}/README)
  170. if(WIN32)
  171. set(CPACK_GENERATOR ZIP)
  172. else(WIN32)
  173. set(CPACK_GENERATOR TGZ)
  174. endif(WIN32)
  175. set(
  176. CPACK_SOURCE_PACKAGE_FILE_NAME
  177. "plplot-${VERSION}"
  178. CACHE INTERNAL "tarball basename"
  179. )
  180. set(CPACK_SOURCE_GENERATOR TGZ)
  181. # The following components are regex's to match anywhere (unless anchored)
  182. # in absolute path + filename to find files or directories to be excluded
  183. # from source tarball.
  184. set(CPACK_SOURCE_IGNORE_FILES
  185. "~$"
  186. "\\\\.cvsignore$"
  187. "^${PROJECT_SOURCE_DIR}.*/\\\\.svn/"
  188. "^${PROJECT_SOURCE_DIR}/old/"
  189. "^${PROJECT_SOURCE_DIR}/sys/mac"
  190. "^${PROJECT_SOURCE_DIR}/sys/os2"
  191. "^${PROJECT_SOURCE_DIR}/sys/unix"
  192. "^${PROJECT_SOURCE_DIR}/sys/dos/msc"
  193. "^${PROJECT_SOURCE_DIR}/sys/dos/bcc"
  194. "^${PROJECT_SOURCE_DIR}/sys/dos/emx"
  195. "^${PROJECT_SOURCE_DIR}/sys/win-tk"
  196. "^${PROJECT_SOURCE_DIR}/sys/win32"
  197. )
  198. #message("CPACK_SOURCE_IGNORE_FILES = ${CPACK_SOURCE_IGNORE_FILES}")
  199. include(CPack)