Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

CMakeLists.txt 4.9 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
  1. #
  2. #
  3. # Copyright (c) 1991-2020 by the GMT Team (https://www.generic-mapping-tools.org/team.html)
  4. # See LICENSE.TXT file for copying and redistribution conditions.
  5. #
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU Lesser General Public License as published by
  8. # the Free Software Foundation; version 3 or any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU Lesser General Public License for more details.
  14. #
  15. # Contact info: www.generic-mapping-tools.org
  16. #-------------------------------------------------------------------------------
  17. # reST documentation
  18. find_package (Sphinx)
  19. if (SPHINX_FOUND)
  20. # Create configuration file
  21. configure_file (conf.py.in conf.py @ONLY)
  22. # path for the cached environment and doctree files
  23. set (SPHINX_CACHE_DIR "${CMAKE_CURRENT_BINARY_DIR}/_doctrees")
  24. # Copy reST sources to build tree
  25. include (CopyDirIfDifferent)
  26. foreach (subdir source themes _static _templates _extensions)
  27. copy_dir_if_different (_docs_copy_rst_tree_${subdir}
  28. ${CMAKE_CURRENT_SOURCE_DIR}/${subdir}/
  29. ${CMAKE_CURRENT_BINARY_DIR}/${subdir})
  30. add_depend_to_target (docs_depends _docs_copy_rst_tree_${subdir})
  31. endforeach ()
  32. add_custom_target (_docs_rst_mkdir_verbatim
  33. COMMAND ${CMAKE_COMMAND} -E make_directory
  34. ${CMAKE_CURRENT_BINARY_DIR}/source/_verbatim
  35. DEPENDS _docs_copy_rst_tree_source)
  36. add_custom_target (_docs_rst_mkdir_images
  37. COMMAND ${CMAKE_COMMAND} -E make_directory
  38. ${CMAKE_CURRENT_BINARY_DIR}/source/_images
  39. DEPENDS _docs_copy_rst_tree_source)
  40. # clean target
  41. add_custom_target (_rst_clean
  42. # cmake<3.15 can't remove multiple directories using cmake -E remove_directory
  43. COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_CURRENT_BINARY_DIR}/_doctrees
  44. COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_CURRENT_BINARY_DIR}/_extensions
  45. COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_CURRENT_BINARY_DIR}/_static
  46. COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_CURRENT_BINARY_DIR}/_templates
  47. COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_CURRENT_BINARY_DIR}/source
  48. COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_CURRENT_BINARY_DIR}/themes
  49. COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_CURRENT_BINARY_DIR}/html
  50. COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_CURRENT_BINARY_DIR}/man
  51. COMMENT "Removing rst tree")
  52. # register with spotless target
  53. add_depend_to_target (spotless _rst_clean)
  54. # HTML build target
  55. add_custom_target (docs_html
  56. COMMAND ${SPHINX_EXECUTABLE} -q -b html
  57. -c "${CMAKE_CURRENT_BINARY_DIR}"
  58. -d "${SPHINX_CACHE_DIR}"
  59. -w "${CMAKE_CURRENT_BINARY_DIR}/html.log"
  60. ${CMAKE_CURRENT_BINARY_DIR}/source
  61. ${CMAKE_CURRENT_BINARY_DIR}/html
  62. COMMENT "Building HTML documentation...")
  63. add_dependencies (docs_html docs_depends)
  64. # Build and compress manpages
  65. if (GZIP)
  66. add_custom_target (docs_man
  67. COMMAND ${SPHINX_EXECUTABLE} -q -b man
  68. -c "${CMAKE_CURRENT_BINARY_DIR}"
  69. -d "${SPHINX_CACHE_DIR}"
  70. -w "${CMAKE_CURRENT_BINARY_DIR}/man.log"
  71. ${CMAKE_CURRENT_BINARY_DIR}/source
  72. ${CMAKE_CURRENT_BINARY_DIR}/man
  73. COMMAND ${GZIP} -9 -n -f ${CMAKE_CURRENT_BINARY_DIR}/man/*.?
  74. COMMENT "Building manpages...")
  75. add_dependencies (docs_man docs_depends)
  76. endif (GZIP)
  77. # Install targets for release documentation
  78. if (GIT_FOUND AND HAVE_GIT_VERSION)
  79. # HTML
  80. add_custom_target (_html_release
  81. COMMAND ${CMAKE_COMMAND} -E copy_directory
  82. ${CMAKE_CURRENT_BINARY_DIR}/html/
  83. ${GMT_RELEASE_PREFIX}/doc_release/html
  84. DEPENDS docs_html git_export_release)
  85. add_depend_to_target (gmt_release _html_release)
  86. # Manpages
  87. add_custom_target (_man_release
  88. COMMAND ${CMAKE_COMMAND} -E copy_directory
  89. ${CMAKE_CURRENT_BINARY_DIR}/man/
  90. ${GMT_RELEASE_PREFIX}/man_release
  91. DEPENDS docs_man git_export_release)
  92. add_depend_to_target (gmt_release _man_release)
  93. endif (GIT_FOUND AND HAVE_GIT_VERSION)
  94. endif (SPHINX_FOUND)
  95. # Install HTML documentation
  96. if (EXISTS ${GMT_INSTALL_EXTERNAL_DOC})
  97. # Install documentation from external location
  98. set (_doc_source ${GMT_INSTALL_EXTERNAL_DOC})
  99. set (_doc_dest ${GMT_DOCDIR})
  100. else (EXISTS ${GMT_INSTALL_EXTERNAL_DOC})
  101. # Install html from build tree
  102. set (_doc_source ${CMAKE_CURRENT_BINARY_DIR}/html)
  103. set (_doc_dest ${GMT_DOCDIR}/html)
  104. endif (EXISTS ${GMT_INSTALL_EXTERNAL_DOC})
  105. install (DIRECTORY ${_doc_source}/
  106. DESTINATION ${_doc_dest}
  107. COMPONENT Documentation
  108. USE_SOURCE_PERMISSIONS
  109. OPTIONAL)
  110. # Install man (if available)
  111. if (EXISTS ${GMT_INSTALL_EXTERNAL_MAN})
  112. # Install manpages from external location
  113. set (_man_source ${GMT_INSTALL_EXTERNAL_MAN})
  114. else (EXISTS ${GMT_INSTALL_EXTERNAL_MAN})
  115. # Install manpages from build tree
  116. set (_man_source ${CMAKE_CURRENT_BINARY_DIR}/man)
  117. endif (EXISTS ${GMT_INSTALL_EXTERNAL_MAN})
  118. install (DIRECTORY ${_man_source}/
  119. DESTINATION ${GMT_MANDIR}/man1
  120. COMPONENT Runtime
  121. FILES_MATCHING PATTERN "*.1.gz")
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...