PageRenderTime 42ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/v5_9_5/CMakeLists.txt

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