PageRenderTime 46ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/v5_9_6/CMakeLists.txt

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