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

/tags/v5_9_4/CMakeLists.txt

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