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 6.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
  1. #
  2. # $Id$
  3. #
  4. # Copyright (c) 1991-2013 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. # Define project name
  46. project (GMT)
  47. # Where to find our CMake modules (this variable is visible in subdirectories).
  48. set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules/"
  49. CACHE INTERNAL "Location of our custom CMake modules." FORCE)
  50. # Include configuration options (default options and options overridden by user).
  51. include (ConfigCMake)
  52. # Find UNIX commands
  53. include (FindUnixCommands)
  54. find_program (SVN svn)
  55. # Global test target
  56. add_custom_target (check
  57. COMMAND ${CMAKE_CTEST_COMMAND}
  58. --force-new-ctest-process -j${N_TEST_JOBS})
  59. # Find test dependencies
  60. find_program (GRAPHICSMAGICK gm)
  61. if (DO_EXAMPLES OR DO_TESTS AND NOT GRAPHICSMAGICK)
  62. message (FATAL_ERROR "Cannot proceed without GraphicsMagick. "
  63. "Need to either install GraphicsMagick or disable tests.")
  64. endif (DO_EXAMPLES OR DO_TESTS AND NOT GRAPHICSMAGICK)
  65. # Add subdirectories
  66. #set(_manfiles_ps "" CACHE INTERNAL "Global list of PS manpages")
  67. add_subdirectory (src)
  68. add_subdirectory (share) # share must be processed *after* src (GSHHG_PATH)
  69. add_subdirectory (doc) # share must be processed *after* src (PDF manpages)
  70. add_subdirectory (test)
  71. add_subdirectory (cmake/dist) # make distribution bundles (always last)
  72. # Source release target
  73. if (SVN AND HAVE_SVN_VERSION)
  74. # Export svn working tree
  75. add_custom_target (svn_export_release
  76. COMMAND ${SVN} --force export
  77. ${GMT_SOURCE_DIR} ${GMT_RELEASE_PREFIX})
  78. add_depend_to_target (gmt_release svn_export_release)
  79. find_program (GNUTAR NAMES gnutar gtar tar)
  80. if (GNUTAR)
  81. # Targets for creating tarballs
  82. string (REGEX REPLACE ".*/" "" _release_dirname "${GMT_RELEASE_PREFIX}")
  83. add_custom_command (OUTPUT ${_release_dirname}-src.tar.gz
  84. COMMAND ${GNUTAR} -cz --owner 0 --group 0 --mode a=rX,u=rwX
  85. -f ${GMT_BINARY_DIR}/${_release_dirname}-src.tar.gz ${_release_dirname}
  86. DEPENDS ${GMT_RELEASE_PREFIX}
  87. WORKING_DIRECTORY ${GMT_RELEASE_PREFIX}/..
  88. VERBATIM)
  89. add_custom_command (OUTPUT ${_release_dirname}-src.tar.bz2
  90. COMMAND ${GNUTAR} -cj --owner 0 --group 0 --mode a=rX,u=rwX
  91. -f ${GMT_BINARY_DIR}/${_release_dirname}-src.tar.bz2 ${_release_dirname}
  92. DEPENDS ${GMT_RELEASE_PREFIX}
  93. WORKING_DIRECTORY ${GMT_RELEASE_PREFIX}/..
  94. VERBATIM)
  95. add_custom_target (gmt_release_tar
  96. DEPENDS ${GMT_RELEASE_PREFIX}
  97. ${_release_dirname}-src.tar.gz ${_release_dirname}-src.tar.bz2)
  98. endif (GNUTAR)
  99. endif (SVN AND HAVE_SVN_VERSION)
  100. get_target_property (_location gmtlib LOCATION)
  101. get_filename_component (GMT_CORE_LIB_NAME ${_location} NAME)
  102. get_target_property (_location pslib LOCATION)
  103. get_filename_component (PSL_LIB_NAME ${_location} NAME)
  104. if (BUILD_SUPPLEMENTS)
  105. # Get name of shared supplemental library
  106. get_target_property (_location supplib LOCATION)
  107. get_filename_component (GMT_SUPPL_LIB_NAME ${_location} NAME)
  108. set (SUPPL "yes [${GMT_SUPPL_LIB_NAME}]")
  109. else (BUILD_SUPPLEMENTS)
  110. set (SUPPL "no")
  111. endif (BUILD_SUPPLEMENTS)
  112. if (BUILD_SHARED_LIBS)
  113. set (BUILD_MODE "shared")
  114. else (BUILD_SHARED_LIBS)
  115. set (BUILD_MODE "static")
  116. endif (BUILD_SHARED_LIBS)
  117. if (EXTRA_BUILD_DIRS)
  118. set (PROTO ${EXTRA_BUILD_DIRS})
  119. else (EXTRA_BUILD_DIRS)
  120. set (PROTO "none")
  121. endif (EXTRA_BUILD_DIRS)
  122. # Configure a header file to pass some of the CMake settings to the source code
  123. configure_file (
  124. "${PROJECT_SOURCE_DIR}/config.h.in"
  125. "${PROJECT_BINARY_DIR}/config.h")
  126. # Configuration done
  127. message(
  128. "* Options:\n"
  129. "* Found GSHHG database : ${GSHHG_PATH} (${GSHHG_VERSION})\n"
  130. "* Found DCW-GMT database : ${DCW_PATH}\n"
  131. "* NetCDF library : ${NETCDF_LIBRARY}\n"
  132. "* NetCDF include dir : ${NETCDF_INCLUDE_DIR}\n"
  133. "* GDAL library : ${GDAL_LIBRARY}\n"
  134. "* GDAL include dir : ${GDAL_INCLUDE_DIR}\n"
  135. "* FFTW library : ${FFTW3F_LIBRARY}\n"
  136. "* FFTW include dir : ${FFTW3_INCLUDE_DIR}\n"
  137. "* Accelerate Framework : ${ACCELERATE_FRAMEWORK}\n"
  138. "* Regex support : ${GMT_CONFIG_REGEX_MESSAGE}\n"
  139. "* File locking : ${FLOCK}\n"
  140. "* License restriction : ${LICENSE_RESTRICTED}\n"
  141. "* Triangulation method : ${GMT_TRIANGULATE}\n"
  142. "* Build mode : ${BUILD_MODE}\n"
  143. "* Build GMT core : always [${GMT_CORE_LIB_NAME}]\n"
  144. "* Build PSL library : always [${PSL_LIB_NAME}]\n"
  145. "* Build GMT supplements : ${SUPPL}\n"
  146. "* Build proto supplements : ${PROTO}\n"
  147. "*\n"
  148. "* Locations:\n"
  149. "* Installing GMT in : ${CMAKE_INSTALL_PREFIX}\n"
  150. "* GMT_DATADIR : ${CMAKE_INSTALL_PREFIX}/${GMT_DATADIR}\n"
  151. "* GMT_DOCDIR : ${CMAKE_INSTALL_PREFIX}/${GMT_DOCDIR}\n"
  152. "* GMT_MANDIR : ${CMAKE_INSTALL_PREFIX}/${GMT_MANDIR}")
  153. # For debugging: print all set variables
  154. #get_cmake_property(_variableNames VARIABLES)
  155. #foreach (_variableName ${_variableNames})
  156. # message(STATUS "${_variableName}=${${_variableName}}")
  157. #endforeach()
  158. # 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...