PageRenderTime 63ms CodeModel.GetById 18ms RepoModel.GetById 1ms app.codeStats 0ms

/branches/hbabcock/CMakeLists.txt

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