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

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

Comments

Loading...