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

README.CMake 7.8 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
  1. ////
  2. $Id$
  3. Copyright (c) 1991-2016 by P. Wessel, W. H. F. Smith, R. Scharroo, J. Luis
  4. and F. Wobbe. See LICENSE.TXT file for copying and redistribution conditions.
  5. Contact info: http://gmt.soest.hawaii.edu/
  6. ////
  7. CMake User Guide
  8. ================
  9. Note: This guide is also available at http://gmt.soest.hawaii.edu/
  10. Package maintainers note packaging recommendations at
  11. http://gmt.soest.hawaii.edu/projects/gmt/wiki/PackagingGMT
  12. Build and runtime prerequisites
  13. -------------------------------
  14. 1. Software:
  15. You need Ghostscript, CMake (>=2.8.5), netCDF (>=4.0, netCDF-4/HDF5
  16. support mandatory). Optionally install Sphinx, PCRE, GDAL, LAPACK
  17. and FFTW (single precision version).
  18. 2. Data:
  19. You need gshhg (>=2.2.2); optionally install dcw-gmt (>=1.0.5)
  20. Information for building GMT 5 with CMake
  21. -----------------------------------------
  22. Quick start:
  23. ~~~~~~~~~~~~
  24. Checkout GMT5 from its subversion repository:
  25. $ svn co svn://gmtserver.soest.hawaii.edu/gmt5/trunk gmt5-dev
  26. $ cd gmt5-dev
  27. $ cp cmake/ConfigUserTemplate.cmake cmake/ConfigUser.cmake
  28. Edit *cmake/ConfigUser.cmake* [see comments in the file]. Then:
  29. $ mkdir build
  30. $ cd build
  31. $ cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
  32. $ make -jx
  33. where _x_ is the number of threads you want to use and depends on the number
  34. of cores in your CPU and if hyperthreading is available or not.
  35. cmake ill build out-of-source in the the directory _build_. 'CMAKE_BUILD_TYPE'
  36. can be one of: empty, Debug, Release, RelWithDebInfo or MinSizeRel
  37. $ make -jx install
  38. installs a basic gmt in _build/gmt5_.
  39. NOTE: All cmake command line options such as _-DCMAKE_INSTALL_PREFIX_ can be
  40. configured in *cmake/ConfigUser.cmake*.
  41. In more detail:
  42. ~~~~~~~~~~~~~~~
  43. For CMake related questions refer to the CMake manual which is available
  44. online: http://www.cmake.org/cmake/help/documentation.html
  45. To avoid CMake's lengthy command line options you can create your custom
  46. ConfigUser.cmake file in the cmake directory. Simply duplicate the
  47. cmake/ConfigUserTemplate.cmake to cmake/ConfigUser.cmake and then make
  48. changes in cmake/ConfigUser.cmake. See additional comments in that file.
  49. There are two configuration files:
  50. 1. "ConfigDefault.cmake" -- is version controlled and used to add new default
  51. variables and set defaults for everyone. You should not edit this file.
  52. 2. "ConfigUser.cmake" -- is not version controlled (currently listed in
  53. svn:ignore property) and used to override defaults on a per-user basis.
  54. There is a template file, ConfigUserTemplate.cmake, that you should copy
  55. to ConfigUser.cmake and make your changes therein.
  56. NOTE: If you want to change CMake behaviour for your build then only modify
  57. the "ConfigUser.cmake" file (not "ConfigDefault.cmake").
  58. Invoking CMake:
  59. ~~~~~~~~~~~~~~~
  60. CMake supports out-of-source builds and puts generated files in a completely
  61. separate directory, so that the source tree is unchanged. Trying to run CMake
  62. in the source tree will result in an error. CMake will first check for the
  63. minimal required version and then search for required and optional libraries
  64. (netCDF, PCRE, GDAL, LAPACK) in the default locations. The configuration step
  65. will fail if dependencies are not met. You have to ensure that CMake can find
  66. the required resources by configuring *cmake/ConfigUser.cmake*.
  67. Finding GSHHG:
  68. ~~~~~~~~~~~~~~
  69. GSHHG shorelines are searched in FindGSHHG.cmake and a little helper program
  70. tests the version (gshhg_version.c). If CMake cannot find the shorelines you
  71. have to configure _GSHHG_ROOT_ in cmake/ConfigUser.cmake.
  72. Finding DCW:
  73. ~~~~~~~~~~~~~~
  74. DCW (Digital Chart of the World) country polygons are searched at compile time.
  75. The DCW data are optional; they are currently used in pscoast -E for painting
  76. individual countries only. If CMake cannot auto-find DCW for you then you can
  77. configure _DCW_ROOT_ in cmake/ConfigUser.cmake.
  78. Documentation:
  79. ~~~~~~~~~~~~~~
  80. The GMT manual is available in different formats and can be generated with:
  81. $ make -jx docs_man # UNIX manual pages
  82. $ make -jx docs_html # HTML manual, cookbook, and API reference
  83. $ make -jx docs_pdf # PDF manual, cookbook, and API reference
  84. $ make -jx docs_pdf_shrink # Like docs_pdf but with reduced size
  85. To generate the documentation you need to install the Sphinx documentation
  86. builder, and for PDFs you also need LaTeX. You can choose to install the
  87. documentation files from an external location instead of generating the
  88. Manpages, PDF, and HTML files from the sources. This is convenient if Sphinx
  89. and/or LaTeX are not available. Set GMT_INSTALL_EXTERNAL_DOC in
  90. cmake/ConfigUser.cmake.
  91. Installing:
  92. ~~~~~~~~~~~
  93. $ make -jx install
  94. will compile and install libps, libgmt, and the gmt executable. Optionally it
  95. will install the GSHHG shorelines (if found), DCW (if found), UNIX manpages,
  96. and HTML and PDF documentation.
  97. You have to explicitly make the latter two beforehand or they will be omitted
  98. during installation. You have the choice between installing into a
  99. traditional directory structure (_-DGMT_INSTALL_TRADITIONAL_FOLDERNAMES=ON_)
  100. where everything goes into a common subdirectory or a distribution-like
  101. installation (PREFIX/bin/gmtSUFFIX, PREFIX/lib/gmtSUFFIX/,
  102. PREFIX/include/gmtSUFFIX/, PREFIX/share/gmtSUFFIX/,
  103. PREFIX/share/doc/gmtSUFFIX/).
  104. GMT is shipped as a single executable. By default we also set "classic mode"
  105. by installing convenience links for all GMT modules. New GMT users should set
  106. GMT_INSTALL_MODULE_LINKS to FALSE in cmake/ConfigUser.cmake.
  107. Updating:
  108. ~~~~~~~~~
  109. Assuming you did not delete the build directory and that your current
  110. working directory is the build directory this is just as simple as
  111. $ cd ..
  112. $ svn up
  113. $ cd -
  114. $ make -jx install
  115. CMake will detect any changes to the source files and will automatically
  116. reconfigure. If you deleted all files inside the build directory you have to
  117. run cmake again manually.
  118. Packaging:
  119. ~~~~~~~~~~
  120. Currently, packaging with CPack works on MacOSX (Bundle, TGZ, TBZ2),
  121. Windows (ZIP, NSIS), and UNIX (TGZ, TBZ2). On Windows you need to install NSIS
  122. (http://nsis.sourceforge.net/). After building GMT and the documentation run
  123. either one of these:
  124. $ make package
  125. $ cpack -G <TGZ|TBZ2|Bundle|ZIP|NSIS>
  126. Creating a source package:
  127. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  128. Set GMT_RELEASE_PREFIX in cmake/ConfigUser.cmake and run cmake. Then do
  129. $ make -jx docs_depends # optional but increases speed (parallel build)
  130. $ make gmt_release # export the source tree and install doc
  131. You should then edit ${GMT_RELEASE_PREFIX}/cmake/ConfigDefault.cmake and
  132. set GMT_PACKAGE_VERSION_MAJOR, GMT_PACKAGE_VERSION_MINOR, and
  133. GMT_PACKAGE_VERSION_PATCH. Also uncomment and set
  134. GMT_SOURCE_CODE_CONTROL_VERSION_STRING to the current svn version. Then
  135. create tarballs with:
  136. $ make -jx gmt_release_tar
  137. In-build-dir tests:
  138. ~~~~~~~~~~~~~~~~~~~
  139. A complete set of the example scripts used to create all the example plots,
  140. including all necessary data files, are provided by the installation.
  141. Examples and tests can be build inside GMT_BINARY_DIR *without* installing.
  142. This is very convenient for testing. Just _enable_testing()_, set
  143. _DO_EXAMPLES_ and/or _DO_TESTS_ in ConfigUser.cmake and do:
  144. $ make -jx
  145. $ make check
  146. Optionally set _N_TEST_JOBS_ to the number of ctest jobs to run
  147. simultaneously. You can also select individual tests using regexp with ctest,
  148. e.g.:
  149. $ ctest -R ex2[3-6]
  150. Tests are preferably run through valgrind and GMT's internal memory tracker.
  151. Configure cmake with _add_definitions(-DMEMDEBUG)_ and prior to invoking the
  152. test, export the following variables:
  153. $ export GMT_TRACK_MEMORY=2
  154. $ export VALGRIND_ARGS="--track-origins=yes --leak-check=full"
  155. The test script will keep gmt_memtrack_<pid>.log and valgrind_<pid>.log files
  156. in the test directories for later inspection, when memory related errors were
  157. identified.
  158. ////
  159. vim: ft=asciidoc tw=78 et ts=2 sts=2 sw=2 autoindent smartindent
  160. ////
Tip!

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

Comments

Loading...