PageRenderTime 50ms CodeModel.GetById 23ms RepoModel.GetById 1ms app.codeStats 0ms

/tags/v5_9_9/CMakeLists.txt

#
CMake | 274 lines | 164 code | 33 blank | 77 comment | 17 complexity | b2f3eea75a159a32223057f4c05a4d24 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. # Recommended way to do user overrides of C-related variables, is given at
  22. # http://public.kitware.com/pipermail/cmake/2006-July/010334.html.
  23. # See also, CMakeCInformation.cmake. There are also C++, and Fortran-specific
  24. # overrides that can be done. However, I prefer putting overrides in just
  25. # one file so I use the overall variable CMAKE_USER_MAKE_RULES_OVERRIDE
  26. # instead.
  27. set(
  28. CMAKE_USER_MAKE_RULES_OVERRIDE
  29. ${CMAKE_SOURCE_DIR}/cmake/UserOverride.cmake
  30. )
  31. # It is a fatal error if no working C compiler is available to build
  32. # the PLplot core C library and core C examples. All other compilers
  33. # required by our bindings are optional in that if no working compiler
  34. # of the kind needed is available, the associated bindings and
  35. # examples are disabled.
  36. project(plplot C)
  37. message(STATUS "CMake version = ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}")
  38. # Note that the variable MSYS is first known at this point in the
  39. # build process in case have different minimum version for that case.
  40. # Version 2.6.4 or above of cmake is currently required for all platforms.
  41. cmake_minimum_required(VERSION 2.6.4 FATAL_ERROR)
  42. #foreach(policy RANGE 0 9)
  43. # cmake_policy(GET CMP000${policy} policy_result)
  44. # message(STATUS "Policy CMP000${policy} is ${policy_result}")
  45. #endforeach(policy RANGE 0 9)
  46. set(PACKAGE plplot)
  47. # Locations where PLplot cmake build system first looks for cmake modules.
  48. if(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION EQUAL 6)
  49. set(CMAKE_MODULE_PATH
  50. ${PROJECT_SOURCE_DIR}/cmake/modules
  51. ${PROJECT_SOURCE_DIR}/cmake/modules/language_support/cmake
  52. ${PROJECT_SOURCE_DIR}/cmake/modules/language_support/cmake-2.6
  53. )
  54. else(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION EQUAL 6)
  55. set(CMAKE_MODULE_PATH
  56. ${PROJECT_SOURCE_DIR}/cmake/modules
  57. ${PROJECT_SOURCE_DIR}/cmake/modules/language_support/cmake
  58. ${PROJECT_SOURCE_DIR}/cmake/modules/language_support/cmake-2.8
  59. )
  60. endif(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION EQUAL 6)
  61. # We need the path to the MinGW/Borland compiler in order to find
  62. # the import libraries for system libraries.
  63. if(MINGW)
  64. get_filename_component(MINGWBINPATH ${CMAKE_C_COMPILER} PATH)
  65. set(MINGWLIBPATH ${MINGWBINPATH}/../lib
  66. CACHE FILEPATH
  67. DOCSTRING "Path to MinGW import libraries")
  68. endif(MINGW)
  69. if(BORLAND)
  70. get_filename_component(BORLANDBINPATH ${CMAKE_C_COMPILER} PATH)
  71. set(BORLANDLIBPATH ${BORLANDBINPATH}/../Lib/PSDK
  72. CACHE FILEPATH
  73. DOCSTRING "Path to Borland import libraries")
  74. endif(BORLAND)
  75. # Version data that need modification for each release.
  76. include(plplot_version)
  77. # parameters to control overall cmake behaviour.
  78. # Configure PLplot component variables....
  79. include(plplot)
  80. # Use configured variables to process configurable top-level files.
  81. # This CMake-configured template file is processed further by sed for
  82. # abi-compliance-checker.
  83. configure_file(
  84. ${CMAKE_CURRENT_SOURCE_DIR}/abi-compliance-checker.xml.template.in
  85. ${CMAKE_CURRENT_BINARY_DIR}/abi-compliance-checker.xml.template
  86. @ONLY
  87. )
  88. configure_file(
  89. ${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake
  90. ${CMAKE_CURRENT_BINARY_DIR}/config.h
  91. )
  92. # Allow access to the generated config.h for this build.
  93. add_definitions("-DHAVE_CONFIG_H")
  94. # Install top-level files
  95. # Enable testing framework for examples
  96. if(BUILD_TEST)
  97. include(CTest)
  98. endif(BUILD_TEST)
  99. # Disable warnings about deprecated functions (Visual C++ 2005)
  100. if(MSVC_VERSION GREATER 1399)
  101. add_definitions("/D_CRT_SECURE_NO_DEPRECATE")
  102. endif(MSVC_VERSION GREATER 1399)
  103. # in windows all created dlls are gathered in the dll directory
  104. # if you add this directory to your PATH all shared libraries are available
  105. if(BUILD_SHARED_LIBS AND WIN32 AND NOT CYGWIN)
  106. set(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dll)
  107. endif(BUILD_SHARED_LIBS AND WIN32 AND NOT CYGWIN)
  108. # Borland Compiler must compile in ANSII mode
  109. if(BORLAND)
  110. add_definitions(-A)
  111. endif(BORLAND)
  112. set(top_level_DOCFILES
  113. ABOUT
  114. AUTHORS
  115. COPYING.LIB
  116. ChangeLog.release
  117. Copyright
  118. FAQ
  119. NEWS
  120. PROBLEMS
  121. README
  122. README.release
  123. README.testing
  124. )
  125. install(FILES ${top_level_DOCFILES} DESTINATION ${DOC_DIR})
  126. # Process other directories including using configured variables to
  127. # process configurable files in those directories.
  128. # N.B. Order is important here at the cmake stage because targets must
  129. # be processed by cmake in a specific order e.g., due to get_target_property
  130. # invocations. Note, this order has nothing to do with the order which make
  131. # processes these subdirectories at build time. That build-time order
  132. # is determined by the dependencies between targets and also by file
  133. # dependencies that are established by the cmake configuration files.
  134. add_subdirectory(fonts)
  135. add_subdirectory(lib)
  136. add_subdirectory(include)
  137. add_subdirectory(src)
  138. add_subdirectory(data)
  139. add_subdirectory(bindings)
  140. add_subdirectory(drivers)
  141. add_subdirectory(utils)
  142. add_subdirectory(examples)
  143. add_subdirectory(plplot_test)
  144. add_subdirectory(scripts)
  145. add_subdirectory(doc)
  146. add_subdirectory(www)
  147. add_subdirectory(pkgcfg)
  148. summary()
  149. if(PREBUILD_DIST)
  150. # Pre-build everything required for a distribution tarball and copy it to
  151. # the source tree (if build tree is different from source tree).
  152. # List of targets that must be (pre-)built.
  153. set(DIST_TARGETS)
  154. if(ENABLE_octave)
  155. list(APPEND DIST_TARGETS make_documentation)
  156. endif(ENABLE_octave)
  157. if(BUILD_PRINT)
  158. list(APPEND DIST_TARGETS print)
  159. endif(BUILD_PRINT)
  160. if(BUILD_INFO)
  161. list(APPEND DIST_TARGETS info)
  162. endif(BUILD_INFO)
  163. if(BUILD_MAN)
  164. list(APPEND DIST_TARGETS man)
  165. endif(BUILD_MAN)
  166. if(BUILD_HTML)
  167. list(APPEND DIST_TARGETS html)
  168. endif(BUILD_HTML)
  169. if(BUILD_DOX_DOC)
  170. list(APPEND DIST_TARGETS build_doxygen)
  171. endif(BUILD_DOX_DOC)
  172. if(CMAKE_BINARY_DIR STREQUAL "${CMAKE_SOURCE_DIR}")
  173. add_custom_target(prebuild_dist)
  174. else(CMAKE_BINARY_DIR STREQUAL "${CMAKE_SOURCE_DIR}")
  175. # copy prebuilds back to source tree.
  176. # N.B. copy_directory quietly creates an empty directory with no
  177. # error condition if the source directory does not exist.
  178. add_custom_target(
  179. prebuild_dist
  180. COMMAND ${CMAKE_COMMAND} -E remove_directory
  181. ${CMAKE_SOURCE_DIR}/bindings/octave/plplot_octave_txt
  182. COMMAND ${CMAKE_COMMAND} -E copy_directory
  183. ${CMAKE_BINARY_DIR}/bindings/octave/plplot_octave_txt
  184. ${CMAKE_SOURCE_DIR}/bindings/octave/plplot_octave_txt
  185. COMMAND ${CMAKE_COMMAND} -E remove_directory
  186. ${CMAKE_SOURCE_DIR}/doc/doxygen
  187. COMMAND ${CMAKE_COMMAND} -E copy_directory
  188. ${CMAKE_BINARY_DIR}/doc/doxygen
  189. ${CMAKE_SOURCE_DIR}/doc/doxygen
  190. COMMAND cp
  191. `cat static_built_files ${INFO_MANIFEST} ${MAN_MANIFEST} ${HTML_MANIFEST}`
  192. ${CMAKE_SOURCE_DIR}/doc/docbook/src
  193. WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/doc/docbook/src
  194. )
  195. endif(CMAKE_BINARY_DIR STREQUAL "${CMAKE_SOURCE_DIR}")
  196. add_dependencies(prebuild_dist ${DIST_TARGETS})
  197. endif(PREBUILD_DIST)
  198. #
  199. # Packing stuff
  200. #
  201. set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The Scientific Plotting Library PLplot")
  202. set(CPACK_PACKAGE_VENDOR "PLplot development team")
  203. set(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_CURRENT_SOURCE_DIR}/README)
  204. set(CPACK_SET_DESTDIR ON)
  205. if(WIN32)
  206. set(CPACK_GENERATOR ZIP)
  207. else(WIN32)
  208. set(CPACK_GENERATOR TGZ)
  209. endif(WIN32)
  210. set(
  211. CPACK_SOURCE_PACKAGE_FILE_NAME
  212. "plplot-${VERSION}"
  213. CACHE INTERNAL "tarball basename"
  214. )
  215. set(CPACK_SOURCE_GENERATOR TGZ)
  216. # The following components are regex's to match anywhere (unless anchored)
  217. # in absolute path + filename to find files or directories to be excluded
  218. # from source tarball.
  219. set(CPACK_SOURCE_IGNORE_FILES
  220. "\\\\#*\\\\#$"
  221. "~$"
  222. "\\\\.cvsignore$"
  223. "^${PROJECT_SOURCE_DIR}.*/\\\\.svn/"
  224. "^${PROJECT_SOURCE_DIR}/old/"
  225. "^${PROJECT_SOURCE_DIR}/sys/mac"
  226. "^${PROJECT_SOURCE_DIR}/sys/os2"
  227. "^${PROJECT_SOURCE_DIR}/sys/unix"
  228. "^${PROJECT_SOURCE_DIR}/sys/dos/msc"
  229. "^${PROJECT_SOURCE_DIR}/sys/dos/bcc"
  230. "^${PROJECT_SOURCE_DIR}/sys/dos/emx"
  231. "^${PROJECT_SOURCE_DIR}/sys/win-tk"
  232. "^${PROJECT_SOURCE_DIR}/sys/win32"
  233. "^${PROJECT_SOURCE_DIR}/debian"
  234. )
  235. #message("CPACK_SOURCE_IGNORE_FILES = ${CPACK_SOURCE_IGNORE_FILES}")
  236. include(CPack)
  237. # Path to native build for executables required in the build process.
  238. # This is only required for cross compiling
  239. if(CMAKE_CROSSCOMPILING)
  240. set(CMAKE_NATIVE_BINARY_DIR NATIVEDIR-NOTFOUND CACHE FILEPATH "Point to the native build directory")
  241. endif(CMAKE_CROSSCOMPILING)