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 9.7 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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
  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. # Common CPack settings:
  20. set (CPACK_PACKAGE_NAME "GMT")
  21. set (CPACK_PACKAGE_VENDOR "The GMT Team")
  22. set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "The Generic Mapping Tools data processing and display software package")
  23. set (CPACK_PACKAGE_VERSION_MAJOR ${GMT_PACKAGE_VERSION_MAJOR})
  24. set (CPACK_PACKAGE_VERSION_MINOR ${GMT_PACKAGE_VERSION_MINOR})
  25. set (CPACK_PACKAGE_VERSION_PATCH ${GMT_PACKAGE_VERSION_PATCH})
  26. set (CPACK_PACKAGE_VERSION ${GMT_PACKAGE_VERSION_WITH_SVN_REVISION})
  27. if (NOT DEFINED CPACK_PACKAGE_INSTALL_DIRECTORY)
  28. if (WIN32)
  29. set (CPACK_PACKAGE_INSTALL_DIRECTORY gmt${GMT_PACKAGE_VERSION_MAJOR})
  30. else (WIN32)
  31. set (CPACK_PACKAGE_INSTALL_DIRECTORY GMT-${GMT_PACKAGE_VERSION_WITH_SVN_REVISION})
  32. endif (WIN32)
  33. endif (NOT DEFINED CPACK_PACKAGE_INSTALL_DIRECTORY)
  34. set (CPACK_PACKAGE_DESCRIPTION_FILE
  35. "${CMAKE_CURRENT_SOURCE_DIR}/cpack_package_description.txt")
  36. if (GMT_BUNDLE_ACCEPT_BUTTON)
  37. # A license with an accept button will only be displayed if
  38. # GMT_BUNDLE_ACCEPT_BUTTON is set.
  39. set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_BINARY_DIR}/COPYING.COMBINED")
  40. # Read GPL and LGPL license files
  41. file(READ ${COPYING_GPL} _license_gpl)
  42. file(READ ${COPYING_LGPL} _license_lgpl)
  43. set (_license_extra)
  44. if (NOT LICENSE_RESTRICTED)
  45. # Read extra license files
  46. foreach (_license_file ${GMT_EXTRA_LICENSE_FILES})
  47. file(READ ${_license_file} _license_string)
  48. set (_license_extra
  49. "${_license_extra}\n---------------------------------------------------------------------------\n\n${_license_string}")
  50. endforeach (_license_file ${GMT_EXTRA_LICENSE_FILES})
  51. # Copy combined license template
  52. execute_process(COMMAND ${CMAKE_COMMAND} -E copy
  53. ${CMAKE_CURRENT_SOURCE_DIR}/COPYING.RESTRICTED.template
  54. ${CMAKE_CURRENT_BINARY_DIR}/COPYING.COMBINED)
  55. else (NOT LICENSE_RESTRICTED)
  56. # Clear contents of license file if it exists
  57. execute_process(COMMAND ${CMAKE_COMMAND} -E remove -f
  58. ${CMAKE_CURRENT_BINARY_DIR}/COPYING.COMBINED)
  59. endif (NOT LICENSE_RESTRICTED)
  60. # Append GPL, LGPL, and licenses from GMT_EXTRA_LICENSE_FILES
  61. set (_license_combined "${_license_gpl}")
  62. if (NOT LICENSE_RESTRICTED STREQUAL GPL)
  63. set (_license_combined
  64. "${_license_combined}\n---------------------------------------------------------------------------\n\n${_license_lgpl}")
  65. endif (NOT LICENSE_RESTRICTED STREQUAL GPL)
  66. set (_license_combined "${_license_combined}\n${_license_extra}")
  67. # Append to COPYING.COMBINED or create new combined license file
  68. file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/COPYING.COMBINED "${_license_combined}")
  69. endif (GMT_BUNDLE_ACCEPT_BUTTON)
  70. # Install components:
  71. set (CPACK_COMPONENTS_ALL Runtime Documentation DCW GSHHG)
  72. # set (CPACK_COMPONENT_DOCUMENTATION_DISABLED ON)
  73. set (CPACK_COMPONENT_RUNTIME_DISPLAY_NAME "Runtime files")
  74. set (CPACK_COMPONENT_RUNTIME_DESCRIPTION
  75. "GMT programs, libraries and shared files.")
  76. set (CPACK_COMPONENT_DOCUMENTATION_DESCRIPTION
  77. "Documentation and example files.")
  78. set (CPACK_COMPONENT_DCW_DESCRIPTION
  79. "Digital Chart of the World files.")
  80. set (CPACK_COMPONENT_GSHHG_DESCRIPTION
  81. "Shoreline database files.")
  82. # Create two installation types with pre-selected components:
  83. set (CPACK_ALL_INSTALL_TYPES Full Minimal)
  84. set (CPACK_INSTALL_TYPE_FULL_DISPLAY_NAME "Everything")
  85. set (CPACK_COMPONENT_RUNTIME_INSTALL_TYPES Minimal Full)
  86. set (CPACK_COMPONENT_DOCUMENTATION_INSTALL_TYPES Full)
  87. set (CPACK_COMPONENT_GSHHG_INSTALL_TYPES Full)
  88. # One package per COMPONENT:
  89. set(CPACK_COMPONENTS_GROUPING "IGNORE")
  90. # Enable component install for archive generators:
  91. set (CPACK_ARCHIVE_COMPONENT_INSTALL ON)
  92. # Debian:
  93. set (CPACK_DEBIAN_PACKAGE_MAINTAINER "GMT Team <gmt-help@lists.hawaii.edu>")
  94. set (CPACK_DEBIAN_PACKAGE_SECTION science)
  95. # set (CPACK_PACKAGE_DESCRIPTION_SUMMARY ${CPACK_PACKAGE_DESCRIPTION_SUMMARY})
  96. # set (CPACK_PACKAGE_DESCRIPTION "GMT is an open source collection of ~80
  97. # command-line tools for manipulating geographic and Cartesian data sets
  98. # (including filtering, trend fitting, gridding, projecting, etc.) and
  99. # producing PostScript illustrations ranging from simple x-y plots via contour
  100. # maps to artificially illuminated surfaces and 3D perspective views; the GMT
  101. # supplements add another ~40 more specialized tools. GMT supports over 30 map
  102. # projections and transformations and comes with support data such as GSHHG
  103. # coastlines, rivers, and political boundaries.")
  104. #set (CPACK_MONOLITHIC_INSTALL TRUE)
  105. set (CPACK_RPM_COMPONENT_INSTALL ON)
  106. #set(CPACK_COMPONENT_RUNTIME_GROUP "Runtime")
  107. #set(CPACK_COMPONENT_LEFTOVER_GROUP "Documentation")
  108. #set(CPACK_COMPONENTS_IGNORE_GROUPS 1)
  109. set (CPACK_COMPONENT_UNSPECIFIED_HIDDEN FALSE)
  110. set (CPACK_COMPONENT_UNSPECIFIED_REQUIRED FALSE)
  111. # Windows:
  112. if (WIN32 AND NOT CYGWIN)
  113. # By default, do not warn when built on machines using only VS Express:
  114. #set (CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON)
  115. # Install MSVC runtime DLLs:
  116. include (InstallRequiredSystemLibraries)
  117. # InstallRequiredSystemLibraries installs the runtime libraries without
  118. # specifying COMPONENT Runtime. We have to do it manually here:
  119. set (CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE)
  120. install (PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}
  121. DESTINATION ${CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION}
  122. COMPONENT Runtime)
  123. set (CPACK_GENERATOR ZIP NSIS)
  124. set (CPACK_NSIS_DISPLAY_NAME
  125. "${CPACK_PACKAGE_NAME}${GMT_PACKAGE_VERSION_MAJOR}")
  126. if (NOT DEFINED CPACK_NSIS_INSTALL_ROOT)
  127. set (CPACK_NSIS_INSTALL_ROOT "c:\\\\programs")
  128. endif (NOT DEFINED CPACK_NSIS_INSTALL_ROOT)
  129. set (CPACK_NSIS_MODIFY_PATH ON)
  130. string(REPLACE "/" "\\\\" _native_share_path "${GMT_DATADIR}")
  131. set (CPACK_NSIS_ADD_ENVVAR1 "GMT5_SHAREDIR")
  132. set (CPACK_NSIS_ADD_ENVVAL1 "\\\$INSTDIR\\\\${_native_share_path}")
  133. # StartMenu items:
  134. set (CPACK_NSIS_MENU_LINKS
  135. "${GMT_BINDIR}/startup_win.bat" "GMT Command Prompt"
  136. "${GMT_DOCDIR}" "Documentation")
  137. # Install startup batch file:
  138. install (PROGRAMS startup_win.bat
  139. DESTINATION ${GMT_BINDIR}
  140. COMPONENT Runtime)
  141. if (OMP_DLL_LOC)
  142. # Install vcomp120.dll
  143. install (PROGRAMS ${OMP_DLL_LOC} DESTINATION ${GMT_BINDIR} COMPONENT Runtime)
  144. endif (OMP_DLL_LOC)
  145. # Fix bundle:
  146. install (CODE "
  147. if (CMAKE_INSTALL_PREFIX MATCHES \"_CPack_Packages\")
  148. include (BundleUtilities)
  149. fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/${GMT_BINDIR}/gmt${CMAKE_EXECUTABLE_SUFFIX}\" \"\" \"\")
  150. endif ()
  151. " COMPONENT Runtime)
  152. endif(WIN32 AND NOT CYGWIN)
  153. # If defined, import a list of files to add to the installer
  154. if(EXTRA_INCLUDE_EXES)
  155. include (${EXTRA_INCLUDE_EXES})
  156. endif()
  157. # MacOSX:
  158. if (APPLE)
  159. # Generate startup script:
  160. configure_file (startup_macosx.sh.in startup_macosx.sh @ONLY)
  161. configure_file (Info.plist.in Info.plist @ONLY)
  162. # Configure CPack:
  163. set (CPACK_GENERATOR Bundle TGZ TBZ2)
  164. set (CPACK_BUNDLE_NAME
  165. "${CPACK_PACKAGE_NAME}-${GMT_PACKAGE_VERSION_WITH_SVN_REVISION}")
  166. set (CPACK_BUNDLE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/GMT.icns")
  167. set (CPACK_BUNDLE_PLIST "${CMAKE_CURRENT_BINARY_DIR}/Info.plist")
  168. set (CPACK_BUNDLE_STARTUP_COMMAND "${CMAKE_CURRENT_BINARY_DIR}/startup_macosx.sh")
  169. # Fix bundle:
  170. install (CODE "
  171. set (BU_CHMOD_BUNDLE_ITEMS TRUE CACHE INTERNAL
  172. \"make bundle items writable before invoking install_name_tool\")
  173. if (CMAKE_INSTALL_PREFIX MATCHES \"_CPack_Packages.+[.]app/Contents/Resources\")
  174. cmake_policy (SET CMP0009 NEW)
  175. cmake_policy (SET CMP0011 NEW)
  176. # Workaround incompatible 'file' utilities possibly used in
  177. # is_file_executable() from GetPrerequisites.cmake:
  178. set (file_cmd /usr/bin/file)
  179. # gp_item_default_embedded_path item default_embedded_path_var
  180. #
  181. # Return the path that others should refer to the item by when the item
  182. # is embedded inside a bundle.
  183. #
  184. # Override on a per-project basis by providing a project-specific
  185. # gp_item_default_embedded_path_override function.
  186. #
  187. function(gp_item_default_embedded_path_override item default_embedded_path_var)
  188. # By default, embed items as set by gp_item_default_embedded_path:
  189. set(path \"\${\${default_embedded_path_var}}\")
  190. # Embed *.dylib in the lib folder:
  191. if(item MATCHES \"[.]dylib\$\")
  192. set(path \"@executable_path/../lib\")
  193. endif()
  194. set(\${default_embedded_path_var} \"\${path}\" PARENT_SCOPE)
  195. endfunction(gp_item_default_embedded_path_override)
  196. include (BundleUtilities)
  197. fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/${GMT_BINDIR}/gmt${CMAKE_EXECUTABLE_SUFFIX}\" \"\${CMAKE_INSTALL_PREFIX}/${GMT_LIBDIR}/gmt${CMAKE_EXECUTABLE_SUFFIX}/plugins/supplements.so\" \"\")
  198. endif ()
  199. " COMPONENT Runtime)
  200. # Workaround: move documentation:
  201. install (CODE "
  202. if (CMAKE_INSTALL_PREFIX MATCHES \"_CPack_Packages.+[.]app/Contents/Resources\")
  203. execute_process (COMMAND ${CMAKE_COMMAND} -E rename
  204. \${CMAKE_INSTALL_PREFIX}/${GMT_DOCDIR}
  205. \${CMAKE_INSTALL_PREFIX}/../../../Documentation)
  206. endif ()
  207. " COMPONENT Documentation)
  208. endif (APPLE)
  209. # Linux, Cygwin & Co:
  210. if (UNIX AND NOT APPLE)
  211. set (CPACK_GENERATOR TGZ TBZ2)
  212. endif (UNIX AND NOT APPLE)
  213. # Generators used for the source package (make package_source)
  214. set (CPACK_SOURCE_GENERATOR TGZ TBZ2 ZIP)
  215. # This must always be last:
  216. include (CPack)
  217. # 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...