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 7.0 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
  1. #
  2. # $Id$
  3. #
  4. # Copyright (c) 1991-2015 by P. Wessel, W. H. F. Smith, R. Scharroo, J. Luis, and F. Wobbe
  5. # See LICENSE.TXT file for copying and redistribution conditions.
  6. #
  7. # This program is free software; you can redistribute it and/or modify
  8. # it under the terms of the GNU Lesser General Public License as published by
  9. # the Free Software Foundation; version 3 or any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU Lesser General Public License for more details.
  15. #
  16. # Contact info: gmt.soest.hawaii.edu
  17. #-------------------------------------------------------------------------------
  18. #
  19. # To modify the cmake process: Edit your cmake/ConfigUser.cmake file
  20. #
  21. # To build out-of-source do (example):
  22. #
  23. # mkdir build
  24. # cd build
  25. # cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
  26. #
  27. # CMAKE_BUILD_TYPE can be: empty, Debug, Release, RelWithDebInfo or MinSizeRel
  28. #
  29. # cmake creates a new file cmake/ConfigUser.cmake if it does not already
  30. # exist. You can configure additional options there.
  31. #
  32. # Make sure the user doesn't play dirty with symlinks
  33. get_filename_component (srcdir "${CMAKE_SOURCE_DIR}" REALPATH)
  34. get_filename_component (bindir "${CMAKE_BINARY_DIR}" REALPATH)
  35. # Disallow in-source builds
  36. if (${srcdir} STREQUAL ${bindir})
  37. message(FATAL_ERROR "In-source builds are not allowed. "
  38. "Please create a directory and run cmake from there, passing the path "
  39. "to this source directory as the last argument. This process created "
  40. "the file `CMakeCache.txt' and the directory `CMakeFiles' in ${srcdir}. "
  41. "Please remove them.")
  42. endif (${srcdir} STREQUAL ${bindir})
  43. # Define minimum CMake version required
  44. cmake_minimum_required (VERSION 2.8.5)
  45. # Use NEW behavior with newer CMake releases
  46. foreach(p
  47. CMP0025 # CMake 3.0: Compiler id for Apple Clang is now AppleClang
  48. )
  49. if(POLICY ${p})
  50. cmake_policy(SET ${p} NEW)
  51. endif()
  52. endforeach()
  53. # Use OLD behavior with newer CMake releases
  54. foreach(p
  55. CMP0026 # CMake 3.0: Disallow use of the LOCATION target property
  56. )
  57. if(POLICY ${p})
  58. cmake_policy(SET ${p} OLD)
  59. endif()
  60. endforeach()
  61. # Define project name and language
  62. project (GMT C)
  63. # Where to find our CMake modules (this variable is visible in subdirectories).
  64. set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules/"
  65. CACHE INTERNAL "Location of our custom CMake modules." FORCE)
  66. # Include configuration options (default options and options overridden by user).
  67. include (ConfigCMake)
  68. # Find UNIX commands
  69. include (FindUnixCommands)
  70. find_program (SVN svn)
  71. # Global test target
  72. add_custom_target (check
  73. COMMAND ${CMAKE_CTEST_COMMAND}
  74. --force-new-ctest-process -j${N_TEST_JOBS})
  75. # Find test dependencies
  76. find_program (GRAPHICSMAGICK gm)
  77. if (DO_EXAMPLES OR DO_TESTS AND NOT GRAPHICSMAGICK)
  78. message (FATAL_ERROR "Cannot proceed without GraphicsMagick. "
  79. "Need to either install GraphicsMagick or disable tests.")
  80. endif (DO_EXAMPLES OR DO_TESTS AND NOT GRAPHICSMAGICK)
  81. # Add subdirectories
  82. #set(_manfiles_ps "" CACHE INTERNAL "Global list of PS manpages")
  83. add_subdirectory (src)
  84. add_subdirectory (share) # share must be processed *after* src (GSHHG_PATH)
  85. add_subdirectory (doc) # share must be processed *after* src (PDF manpages)
  86. add_subdirectory (test)
  87. add_subdirectory (cmake/dist) # make distribution bundles (always last)
  88. # Source release target
  89. if (SVN AND HAVE_SVN_VERSION)
  90. # Export svn working tree
  91. add_custom_target (svn_export_release
  92. COMMAND ${SVN} --force export
  93. ${GMT_SOURCE_DIR} ${GMT_RELEASE_PREFIX})
  94. add_depend_to_target (gmt_release svn_export_release)
  95. find_program (GNUTAR NAMES gnutar gtar tar)
  96. if (GNUTAR)
  97. # Targets for creating tarballs
  98. string (REGEX REPLACE ".*/" "" _release_dirname "${GMT_RELEASE_PREFIX}")
  99. add_custom_command (OUTPUT ${_release_dirname}-src.tar.gz
  100. COMMAND ${GNUTAR} -cz --owner 0 --group 0 --mode a=rX,u=rwX
  101. -f ${GMT_BINARY_DIR}/${_release_dirname}-src.tar.gz ${_release_dirname}
  102. DEPENDS ${GMT_RELEASE_PREFIX}
  103. WORKING_DIRECTORY ${GMT_RELEASE_PREFIX}/..
  104. VERBATIM)
  105. add_custom_command (OUTPUT ${_release_dirname}-src.tar.bz2
  106. COMMAND ${GNUTAR} -cj --owner 0 --group 0 --mode a=rX,u=rwX
  107. -f ${GMT_BINARY_DIR}/${_release_dirname}-src.tar.bz2 ${_release_dirname}
  108. DEPENDS ${GMT_RELEASE_PREFIX}
  109. WORKING_DIRECTORY ${GMT_RELEASE_PREFIX}/..
  110. VERBATIM)
  111. add_custom_target (gmt_release_tar
  112. DEPENDS ${GMT_RELEASE_PREFIX}
  113. ${_release_dirname}-src.tar.gz ${_release_dirname}-src.tar.bz2)
  114. endif (GNUTAR)
  115. endif (SVN AND HAVE_SVN_VERSION)
  116. get_target_property (_location gmtlib LOCATION)
  117. get_filename_component (GMT_CORE_LIB_NAME ${_location} NAME)
  118. get_target_property (_location pslib LOCATION)
  119. get_filename_component (PSL_LIB_NAME ${_location} NAME)
  120. if (BUILD_SUPPLEMENTS)
  121. # Get name of shared supplemental library
  122. get_target_property (_location supplib LOCATION)
  123. get_filename_component (GMT_SUPPL_LIB_NAME ${_location} NAME)
  124. set (SUPPL "yes [${GMT_SUPPL_LIB_NAME}]")
  125. else (BUILD_SUPPLEMENTS)
  126. set (SUPPL "no")
  127. endif (BUILD_SUPPLEMENTS)
  128. if (BUILD_SHARED_LIBS)
  129. set (BUILD_MODE "shared")
  130. else (BUILD_SHARED_LIBS)
  131. set (BUILD_MODE "static")
  132. endif (BUILD_SHARED_LIBS)
  133. if (EXTRA_BUILD_DIRS)
  134. set (PROTO ${EXTRA_BUILD_DIRS})
  135. else (EXTRA_BUILD_DIRS)
  136. set (PROTO "none")
  137. endif (EXTRA_BUILD_DIRS)
  138. # Configure header file to pass some of the CMake settings to the source code
  139. configure_file (src/config.h.in src/config.h)
  140. # Configuration done
  141. message(
  142. "* Options:\n"
  143. "* Found GSHHG database : ${GSHHG_PATH} (${GSHHG_VERSION})\n"
  144. "* Found DCW-GMT database : ${DCW_PATH}\n"
  145. "* NetCDF library : ${NETCDF_LIBRARY}\n"
  146. "* NetCDF include dir : ${NETCDF_INCLUDE_DIR}\n"
  147. "* GDAL library : ${GDAL_LIBRARY}\n"
  148. "* GDAL include dir : ${GDAL_INCLUDE_DIR}\n"
  149. "* FFTW library : ${FFTW3F_LIBRARY}\n"
  150. "* FFTW include dir : ${FFTW3_INCLUDE_DIR}\n"
  151. "* Accelerate Framework : ${ACCELERATE_FRAMEWORK}\n"
  152. "* Regex support : ${GMT_CONFIG_REGEX_MESSAGE}\n"
  153. "* ZLIB library : ${ZLIB_LIBRARY}\n"
  154. "* ZLIB include dir : ${ZLIB_INCLUDE_DIR}\n"
  155. "* License restriction : ${LICENSE_RESTRICTED}\n"
  156. "* Triangulation method : ${GMT_TRIANGULATE}\n"
  157. "* Build mode : ${BUILD_MODE}\n"
  158. "* Build GMT core : always [${GMT_CORE_LIB_NAME}]\n"
  159. "* Build PSL library : always [${PSL_LIB_NAME}]\n"
  160. "* Build GMT supplements : ${SUPPL}\n"
  161. "* Build proto supplements : ${PROTO}\n"
  162. "*\n"
  163. "* Locations:\n"
  164. "* Installing GMT in : ${CMAKE_INSTALL_PREFIX}\n"
  165. "* GMT_DATADIR : ${CMAKE_INSTALL_PREFIX}/${GMT_DATADIR}\n"
  166. "* GMT_DOCDIR : ${CMAKE_INSTALL_PREFIX}/${GMT_DOCDIR}\n"
  167. "* GMT_MANDIR : ${CMAKE_INSTALL_PREFIX}/${GMT_MANDIR}")
  168. # For debugging: print all set variables
  169. #get_cmake_property(_variableNames VARIABLES)
  170. #foreach (_variableName ${_variableNames})
  171. # message(STATUS "${_variableName}=${${_variableName}}")
  172. #endforeach()
  173. # vim: textwidth=78 noexpandtab tabstop=2 softtabstop=2 shiftwidth=2
Tip!

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

Comments

Loading...