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 5.3 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
135
136
137
138
139
140
141
142
  1. #
  2. #
  3. # Copyright (c) 1991-2021 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. if (SPHINX_FOUND)
  19. # Create configuration file
  20. configure_file (conf.py.in conf.py @ONLY)
  21. # path for the cached environment and doctree files
  22. set (SPHINX_CACHE_DIR "${CMAKE_CURRENT_BINARY_DIR}/_doctrees")
  23. # Copy reST sources to build tree
  24. include (CopyDirIfDifferent)
  25. foreach (subdir source themes _static _templates _extensions)
  26. copy_dir_if_different (_docs_copy_rst_tree_${subdir}
  27. ${CMAKE_CURRENT_SOURCE_DIR}/${subdir}/
  28. ${CMAKE_CURRENT_BINARY_DIR}/${subdir})
  29. add_depend_to_target (docs_depends _docs_copy_rst_tree_${subdir})
  30. endforeach ()
  31. add_custom_target (_docs_rst_mkdir_verbatim
  32. COMMAND ${CMAKE_COMMAND} -E make_directory
  33. ${CMAKE_CURRENT_BINARY_DIR}/source/_verbatim
  34. DEPENDS _docs_copy_rst_tree_source)
  35. add_custom_target (_docs_rst_mkdir_images
  36. COMMAND ${CMAKE_COMMAND} -E make_directory
  37. ${CMAKE_CURRENT_BINARY_DIR}/source/_images
  38. DEPENDS _docs_copy_rst_tree_source)
  39. # Copy two C codes into the build tree, so that they can be included in the documentation
  40. add_custom_target (_docs_rst_src
  41. COMMAND ${CMAKE_COMMAND} -E copy
  42. ${CMAKE_SOURCE_DIR}/src/gmt_common_longoptions.h
  43. ${CMAKE_SOURCE_DIR}/src/blockmean.c
  44. ${CMAKE_CURRENT_BINARY_DIR}/source/
  45. DEPENDS _docs_copy_rst_tree_source)
  46. add_depend_to_target (docs_depends _docs_rst_src)
  47. # clean target
  48. add_custom_target (_rst_clean
  49. # cmake<3.15 can't remove multiple directories using cmake -E remove_directory
  50. COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_CURRENT_BINARY_DIR}/_doctrees
  51. COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_CURRENT_BINARY_DIR}/_extensions
  52. COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_CURRENT_BINARY_DIR}/_static
  53. COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_CURRENT_BINARY_DIR}/_templates
  54. COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_CURRENT_BINARY_DIR}/source
  55. COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_CURRENT_BINARY_DIR}/themes
  56. COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_CURRENT_BINARY_DIR}/html
  57. COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_CURRENT_BINARY_DIR}/man
  58. COMMENT "Removing rst tree")
  59. # register with spotless target
  60. add_depend_to_target (spotless _rst_clean)
  61. # HTML build target
  62. add_custom_target (docs_html
  63. COMMAND ${SPHINX_EXECUTABLE} -q -b html
  64. -c "${CMAKE_CURRENT_BINARY_DIR}"
  65. -d "${SPHINX_CACHE_DIR}"
  66. -w "${CMAKE_CURRENT_BINARY_DIR}/html.log"
  67. ${CMAKE_CURRENT_BINARY_DIR}/source
  68. ${CMAKE_CURRENT_BINARY_DIR}/html
  69. COMMENT "Building HTML documentation...")
  70. add_dependencies (docs_html docs_depends)
  71. # Build and compress manpages
  72. if (GZIP)
  73. add_custom_target (docs_man
  74. COMMAND ${SPHINX_EXECUTABLE} -q -b man
  75. -c "${CMAKE_CURRENT_BINARY_DIR}"
  76. -d "${SPHINX_CACHE_DIR}"
  77. -w "${CMAKE_CURRENT_BINARY_DIR}/man.log"
  78. -t nosphinxpanels
  79. ${CMAKE_CURRENT_BINARY_DIR}/source
  80. ${CMAKE_CURRENT_BINARY_DIR}/man
  81. COMMAND ${GZIP} -9 -n -f ${CMAKE_CURRENT_BINARY_DIR}/man/*.?
  82. COMMENT "Building manpages...")
  83. add_dependencies (docs_man docs_depends)
  84. endif (GZIP)
  85. # Install targets for release documentation
  86. if (GIT_FOUND AND HAVE_GIT_VERSION)
  87. # HTML
  88. add_custom_target (_html_release
  89. COMMAND ${CMAKE_COMMAND} -E copy_directory
  90. ${CMAKE_CURRENT_BINARY_DIR}/html/
  91. ${GMT_RELEASE_PREFIX}/doc_release/html
  92. DEPENDS docs_html git_export_release)
  93. add_depend_to_target (gmt_release _html_release)
  94. # Manpages
  95. add_custom_target (_man_release
  96. COMMAND ${CMAKE_COMMAND} -E copy_directory
  97. ${CMAKE_CURRENT_BINARY_DIR}/man/
  98. ${GMT_RELEASE_PREFIX}/man_release
  99. DEPENDS docs_man git_export_release)
  100. add_depend_to_target (gmt_release _man_release)
  101. endif (GIT_FOUND AND HAVE_GIT_VERSION)
  102. endif (SPHINX_FOUND)
  103. # Install HTML documentation
  104. if (EXISTS ${GMT_INSTALL_EXTERNAL_DOC})
  105. # Install documentation from external location
  106. set (_doc_source ${GMT_INSTALL_EXTERNAL_DOC})
  107. set (_doc_dest ${GMT_DOCDIR})
  108. else (EXISTS ${GMT_INSTALL_EXTERNAL_DOC})
  109. # Install html from build tree
  110. set (_doc_source ${CMAKE_CURRENT_BINARY_DIR}/html)
  111. set (_doc_dest ${GMT_DOCDIR}/html)
  112. endif (EXISTS ${GMT_INSTALL_EXTERNAL_DOC})
  113. install (DIRECTORY ${_doc_source}/
  114. DESTINATION ${_doc_dest}
  115. COMPONENT Documentation
  116. USE_SOURCE_PERMISSIONS
  117. OPTIONAL)
  118. # Install man (if available)
  119. if (EXISTS ${GMT_INSTALL_EXTERNAL_MAN})
  120. # Install manpages from external location
  121. set (_man_source ${GMT_INSTALL_EXTERNAL_MAN})
  122. else (EXISTS ${GMT_INSTALL_EXTERNAL_MAN})
  123. # Install manpages from build tree
  124. set (_man_source ${CMAKE_CURRENT_BINARY_DIR}/man)
  125. endif (EXISTS ${GMT_INSTALL_EXTERNAL_MAN})
  126. install (DIRECTORY ${_man_source}/
  127. DESTINATION ${GMT_MANDIR}/man1
  128. COMPONENT Runtime
  129. FILES_MATCHING PATTERN "*.1.gz")
Tip!

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

Comments

Loading...