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

CreateDebugSym.cmake 3.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
  1. #
  2. # $Id$
  3. #
  4. # - Generates Mac .dSYM bundle
  5. # CREATE_DEBUG_SYM ( DESTINATION TARGETS )
  6. #
  7. # DESTINATION - destination directory for installed targets
  8. # TARGETS - list of targets
  9. #
  10. # Copyright (c) 1991-2015 by P. Wessel, W. H. F. Smith, R. Scharroo, J. Luis and F. Wobbe
  11. # See LICENSE.TXT file for copying and redistribution conditions.
  12. #
  13. # This program is free software; you can redistribute it and/or modify
  14. # it under the terms of the GNU Lesser General Public License as published by
  15. # the Free Software Foundation; version 3 or any later version.
  16. #
  17. # This program is distributed in the hope that it will be useful,
  18. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. # GNU Lesser General Public License for more details.
  21. #
  22. # Contact info: gmt.soest.hawaii.edu
  23. #-------------------------------------------------------------------------------
  24. string(TOLOWER ${CMAKE_BUILD_TYPE} _build_type)
  25. if (_build_type MATCHES "debug|relwithdebinfo")
  26. set (DEBUG_BUILD TRUE)
  27. endif ()
  28. set (_build_type)
  29. if (APPLE AND DEBUG_BUILD)
  30. # usefull macros
  31. include (GmtHelperMacros)
  32. # Check for dsymutil only on Mac
  33. find_program(DSYMUTIL dsymutil)
  34. # Macro for generating Mac debugging symbols
  35. macro (CREATE_DEBUG_SYM DESTINATION)
  36. if (DSYMUTIL AND "${CMAKE_GENERATOR}" MATCHES "Make")
  37. # create tag from current dirname
  38. tag_from_current_source_dir (_tag "_")
  39. # generator
  40. foreach (target ${ARGN}) # get all args past the last expected
  41. add_custom_command (TARGET ${target}
  42. POST_BUILD
  43. COMMAND ${DSYMUTIL} $<TARGET_FILE:${target}>
  44. COMMENT "Generating .dSYM bundle for ${target}"
  45. VERBATIM)
  46. # clean target
  47. get_target_property (_location ${target} LOCATION)
  48. get_target_property (_type ${target} TYPE)
  49. get_target_property (_version ${target} VERSION)
  50. get_filename_component (_path ${_location} PATH)
  51. get_filename_component (_name ${_location} NAME)
  52. if (_type STREQUAL "SHARED_LIBRARY")
  53. string (REPLACE ".dylib" ".${_version}.dylib" _name "${_name}")
  54. endif (_type STREQUAL "SHARED_LIBRARY")
  55. set (_dsym_bundle "${_path}/${_name}.dSYM")
  56. add_custom_target (_dsym_clean_${target}
  57. COMMAND ${RM} -rf ${_dsym_bundle}
  58. COMMENT "Removing .dSYM bundle")
  59. add_depend_to_target (dsym_clean${_tag} _dsym_clean_${target})
  60. # install target
  61. install (DIRECTORY ${_dsym_bundle}
  62. DESTINATION ${DESTINATION}
  63. COMPONENT Debug)
  64. endforeach (target)
  65. # register with spotless target
  66. add_depend_to_target (spotless dsym_clean${_tag})
  67. endif (DSYMUTIL AND "${CMAKE_GENERATOR}" MATCHES "Make")
  68. endmacro (CREATE_DEBUG_SYM _TARGETS)
  69. elseif (MSVC AND DEBUG_BUILD)
  70. # Macro for installing MSVC debugging symbol files
  71. macro (CREATE_DEBUG_SYM DESTINATION)
  72. # create tag from current dirname
  73. tag_from_current_source_dir (_tag "_")
  74. foreach (target ${ARGN}) # get all args past the last expected
  75. # clean target
  76. get_target_property (_location ${target} LOCATION)
  77. get_filename_component (_path ${_location} PATH)
  78. get_filename_component (_name ${_location} NAME_WE)
  79. set (_pdb_file "${_path}/${_name}.pdb")
  80. add_custom_target (_pdb_clean_${target}
  81. COMMAND ${CMAKE_COMMAND} remove -f ${_pdb_file}
  82. COMMENT "Removing .pdb file")
  83. add_depend_to_target (pdb_clean${_tag} _pdb_clean_${target})
  84. # install target
  85. install (FILES ${_pdb_file}
  86. DESTINATION ${DESTINATION}
  87. COMPONENT Debug)
  88. endforeach (target)
  89. # register with spotless target
  90. add_depend_to_target (spotless pdb_clean${_tag})
  91. endmacro (CREATE_DEBUG_SYM _TARGETS)
  92. else (APPLE AND DEBUG_BUILD)
  93. macro (CREATE_DEBUG_SYM _TARGETS)
  94. # do nothing
  95. endmacro (CREATE_DEBUG_SYM _TARGETS)
  96. endif (APPLE AND DEBUG_BUILD)
  97. # 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...