PageRenderTime 48ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/v5_9_2/CMakeLists.txt

#
CMake | 227 lines | 131 code | 27 blank | 69 comment | 13 complexity | 69daeb8747e28c08ecc8edbd10618492 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. README.testing
  92. )
  93. install(FILES ${top_level_DOCFILES} DESTINATION ${DOC_DIR})
  94. # Process other directories including using configured variables to
  95. # process configurable files in those directories.
  96. # N.B. Order is important here at the cmake stage because targets must
  97. # be processed by cmake in a specific order e.g., due to get_target_property
  98. # invocations. Note, this order has nothing to do with the order which make
  99. # processes these subdirectories at build time. That build-time order
  100. # is determined by the dependencies between targets and also by file
  101. # dependencies that are established by the cmake configuration files.
  102. # needs no cmake processing
  103. #add_subdirectory(fonts)
  104. add_subdirectory(lib)
  105. add_subdirectory(include)
  106. add_subdirectory(src)
  107. add_subdirectory(data)
  108. add_subdirectory(bindings)
  109. add_subdirectory(drivers)
  110. add_subdirectory(examples)
  111. add_subdirectory(utils)
  112. add_subdirectory(plplot_test)
  113. add_subdirectory(scripts)
  114. add_subdirectory(doc)
  115. add_subdirectory(www)
  116. add_subdirectory(pkgcfg)
  117. # needs no cmake processing
  118. #add_subdirectory(cf)
  119. summary()
  120. if(PREBUILD_DIST)
  121. # Pre-build everything required for a distribution tarball and copy it to
  122. # the source tree (if build tree is different from source tree).
  123. # List of targets that must be (pre-)built.
  124. # N.B. the plhershey-unicode.h_built target has to be pre-built only because
  125. # of the needs of the old windows build at sys/win32/msdev.
  126. set(
  127. DIST_TARGETS
  128. plhershey-unicode.h_built
  129. )
  130. if(ENABLE_octave)
  131. set(DIST_TARGETS ${DIST_TARGETS} make_documentation)
  132. endif(ENABLE_octave)
  133. if(BUILD_PRINT)
  134. set(DIST_TARGETS ${DIST_TARGETS} print)
  135. endif(BUILD_PRINT)
  136. if(BUILD_INFO)
  137. set(DIST_TARGETS ${DIST_TARGETS} info)
  138. endif(BUILD_INFO)
  139. if(BUILD_MAN)
  140. set(DIST_TARGETS ${DIST_TARGETS} man)
  141. endif(BUILD_MAN)
  142. if(BUILD_HTML)
  143. set(DIST_TARGETS ${DIST_TARGETS} html)
  144. endif(BUILD_HTML)
  145. if(CMAKE_BINARY_DIR STREQUAL "${CMAKE_SOURCE_DIR}")
  146. add_custom_target(prebuild_dist)
  147. else(CMAKE_BINARY_DIR STREQUAL "${CMAKE_SOURCE_DIR}")
  148. # copy prebuilds back to source tree.
  149. add_custom_target(
  150. prebuild_dist
  151. COMMAND ${CMAKE_COMMAND} -E copy
  152. ${CMAKE_BINARY_DIR}/include/plhershey-unicode.h
  153. ${CMAKE_SOURCE_DIR}/include
  154. COMMAND ${CMAKE_COMMAND} -E copy_directory
  155. ${CMAKE_BINARY_DIR}/bindings/octave/plplot_octave_txt
  156. ${CMAKE_SOURCE_DIR}/bindings/octave/plplot_octave_txt
  157. COMMAND cp
  158. `cat static_built_files ${INFO_MANIFEST} ${MAN_MANIFEST} ${HTML_MANIFEST}`
  159. ${CMAKE_SOURCE_DIR}/doc/docbook/src
  160. WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/doc/docbook/src
  161. )
  162. endif(CMAKE_BINARY_DIR STREQUAL "${CMAKE_SOURCE_DIR}")
  163. add_dependencies(prebuild_dist ${DIST_TARGETS})
  164. endif(PREBUILD_DIST)
  165. #
  166. # Packing stuff
  167. #
  168. set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The Scientific Plotting Library PLplot")
  169. set(CPACK_PACKAGE_VENDOR "PLplot development team")
  170. set(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_CURRENT_SOURCE_DIR}/README)
  171. if(WIN32)
  172. set(CPACK_GENERATOR ZIP)
  173. else(WIN32)
  174. set(CPACK_GENERATOR TGZ)
  175. endif(WIN32)
  176. set(
  177. CPACK_SOURCE_PACKAGE_FILE_NAME
  178. "plplot-${VERSION}"
  179. CACHE INTERNAL "tarball basename"
  180. )
  181. set(CPACK_SOURCE_GENERATOR TGZ)
  182. # The following components are regex's to match anywhere (unless anchored)
  183. # in absolute path + filename to find files or directories to be excluded
  184. # from source tarball.
  185. set(CPACK_SOURCE_IGNORE_FILES
  186. "~$"
  187. "\\\\.cvsignore$"
  188. "^${PROJECT_SOURCE_DIR}.*/\\\\.svn/"
  189. "^${PROJECT_SOURCE_DIR}/old/"
  190. "^${PROJECT_SOURCE_DIR}/sys/mac"
  191. "^${PROJECT_SOURCE_DIR}/sys/os2"
  192. "^${PROJECT_SOURCE_DIR}/sys/unix"
  193. "^${PROJECT_SOURCE_DIR}/sys/dos/msc"
  194. "^${PROJECT_SOURCE_DIR}/sys/dos/bcc"
  195. "^${PROJECT_SOURCE_DIR}/sys/dos/emx"
  196. "^${PROJECT_SOURCE_DIR}/sys/win-tk"
  197. "^${PROJECT_SOURCE_DIR}/sys/win32"
  198. )
  199. #message("CPACK_SOURCE_IGNORE_FILES = ${CPACK_SOURCE_IGNORE_FILES}")
  200. include(CPack)