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.2 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
  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. if (SPHINX_FOUND)
  18. # Convert figures to PNG
  19. file (GLOB _examples RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/*/*.ps")
  20. set (_examples_png)
  21. foreach (_ps ${_examples})
  22. get_filename_component (_fig ${_ps} NAME)
  23. string (REPLACE ".ps" ".png" _png_fig ${_fig})
  24. list (APPEND _examples_png ${RST_BINARY_DIR}/_images/${_png_fig})
  25. add_custom_command (OUTPUT ${RST_BINARY_DIR}/_images/${_png_fig}
  26. COMMAND ${CMAKE_COMMAND} -E env
  27. GMT_SHAREDIR=${GMT_SOURCE_DIR}/share
  28. ${GMT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/src/gmt psconvert
  29. -A -P -E150 -Tg -Qg4 -Qt4
  30. -C-sFONTPATH="${GMT_SOURCE_DIR}/doc/examples/ex31/fonts"
  31. -D${RST_BINARY_DIR}/_images
  32. ${CMAKE_CURRENT_SOURCE_DIR}/${_ps}
  33. WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
  34. DEPENDS gmt_for_img_convert ${CMAKE_CURRENT_SOURCE_DIR}/${_ps})
  35. endforeach (_ps ${_examples})
  36. # Convert scripts to verbatim
  37. file (GLOB _examples RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/*/*.sh")
  38. set (_examples_txt)
  39. foreach (_script ${_examples})
  40. get_filename_component (_txt ${_script} NAME)
  41. string (REPLACE ".sh" ".txt" _txt ${_txt})
  42. list (APPEND _examples_txt ${RST_BINARY_DIR}/_verbatim/${_txt})
  43. add_custom_command (OUTPUT ${RST_BINARY_DIR}/_verbatim/${_txt}
  44. COMMAND ${GMT_BINARY_DIR}/src/script2verbatim
  45. ${CMAKE_CURRENT_SOURCE_DIR}/${_script}
  46. ${RST_BINARY_DIR}/_verbatim/${_txt}
  47. WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
  48. DEPENDS script2verbatim _docs_rst_mkdir_verbatim ${CMAKE_CURRENT_SOURCE_DIR}/${_script})
  49. endforeach (_script ${_examples})
  50. # Add build target
  51. add_custom_target (_docs_examples_verbatim DEPENDS ${_examples_txt})
  52. add_custom_target (_docs_html_examples_fig DEPENDS ${_examples_png})
  53. add_depend_to_target (docs_depends _docs_html_examples_fig _docs_examples_verbatim)
  54. # Animations
  55. if (UNIX AND DO_ANIMATIONS)
  56. configure_file (animate.in animate @ONLY)
  57. foreach (_num 01)
  58. add_custom_command (
  59. OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/anim${_num}/anim${_num}.gif
  60. COMMAND ${BASH} animate anim${_num}/anim${_num}.sh
  61. WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
  62. DEPENDS gmt_for_img_convert ${CMAKE_CURRENT_SOURCE_DIR}/anim${_num}/anim${_num}.sh)
  63. add_custom_command (
  64. OUTPUT ${RST_BINARY_DIR}/_images/anim${_num}.gif
  65. COMMAND ${CMAKE_COMMAND} -E copy_if_different
  66. ${CMAKE_CURRENT_BINARY_DIR}/anim${_num}/anim${_num}.gif
  67. ${RST_BINARY_DIR}/_images/anim${_num}.gif
  68. DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/anim${_num}/anim${_num}.gif)
  69. list (APPEND _animations ${RST_BINARY_DIR}/_images/anim${_num}.gif)
  70. endforeach ()
  71. add_custom_target (animation DEPENDS ${_animations})
  72. # clean target
  73. foreach (_num 01)
  74. add_custom_target (_anim_clean${_num}
  75. COMMAND ${CMAKE_COMMAND} -E remove_directory
  76. ${CMAKE_CURRENT_BINARY_DIR}/anim${_num}
  77. COMMENT "Removing animation ${_num}")
  78. add_depend_to_target (spotless _anim_clean${_num})
  79. endforeach ()
  80. endif (UNIX AND DO_ANIMATIONS)
  81. endif (SPHINX_FOUND)
  82. # run examples (test)
  83. file (GLOB _examples RELATIVE ${CMAKE_SOURCE_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/ex*/*.sh")
  84. # Remove a few known failed examples from tests
  85. list (REMOVE_ITEM _examples "doc/examples/ex51/ex51.sh")
  86. file (GLOB _anims RELATIVE ${CMAKE_SOURCE_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/anim0[1]/*.sh")
  87. if (DO_EXAMPLES AND BASH)
  88. foreach (_job ${_examples} ${_anims})
  89. add_test (NAME ${_job}
  90. WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
  91. COMMAND ${BASH} ${CMAKE_BINARY_DIR}/test/gmtest ${_job})
  92. endforeach (_job ${_examples} ${_anims})
  93. endif (DO_EXAMPLES AND BASH)
Tip!

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

Comments

Loading...