Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Koritzinsky <jekoritz@microsoft.com>2021-05-20 02:43:37 +0300
committerGitHub <noreply@github.com>2021-05-20 02:43:37 +0300
commitd49bcbe0441f5c954cddcbe28a222eb34917bcaf (patch)
tree355f6e22bb309aecf2f8cd54d378849b2704eda1 /eng/native/functions.cmake
parentaad916c7111323d4b5744eb2444252d149c57a8a (diff)
Add basic natvis visualizations for some VM types (#52853)
Diffstat (limited to 'eng/native/functions.cmake')
-rw-r--r--eng/native/functions.cmake54
1 files changed, 36 insertions, 18 deletions
diff --git a/eng/native/functions.cmake b/eng/native/functions.cmake
index f5b4a446191..1ca230c3e53 100644
--- a/eng/native/functions.cmake
+++ b/eng/native/functions.cmake
@@ -467,7 +467,38 @@ if (CMAKE_VERSION VERSION_LESS "3.16")
endfunction()
endif()
-function(add_executable_clr)
+# add_linker_flag(Flag [Config1 Config2 ...])
+function(add_linker_flag Flag)
+ if (ARGN STREQUAL "")
+ set("CMAKE_EXE_LINKER_FLAGS" "${CMAKE_EXE_LINKER_FLAGS} ${Flag}" PARENT_SCOPE)
+ set("CMAKE_SHARED_LINKER_FLAGS" "${CMAKE_SHARED_LINKER_FLAGS} ${Flag}" PARENT_SCOPE)
+ else()
+ foreach(Config ${ARGN})
+ set("CMAKE_EXE_LINKER_FLAGS_${Config}" "${CMAKE_EXE_LINKER_FLAGS_${Config}} ${Flag}" PARENT_SCOPE)
+ set("CMAKE_SHARED_LINKER_FLAGS_${Config}" "${CMAKE_SHARED_LINKER_FLAGS_${Config}} ${Flag}" PARENT_SCOPE)
+ endforeach()
+ endif()
+endfunction()
+
+function(link_natvis_sources_for_target targetName linkKind)
+ if (NOT CLR_CMAKE_HOST_WIN32)
+ return()
+ endif()
+ foreach(source ${ARGN})
+ if (NOT IS_ABSOLUTE "${source}")
+ convert_to_absolute_path(source ${source})
+ endif()
+ get_filename_component(extension "${source}" EXT)
+ if ("${extension}" STREQUAL ".natvis")
+ message("Embedding natvis ${source}")
+ # Since natvis embedding is only supported on Windows
+ # we can use target_link_options since our minimum version is high enough
+ target_link_options(${targetName} "${linkKind}" "-NATVIS:${source}")
+ endif()
+ endforeach()
+endfunction()
+
+function(add_executable_clr targetName)
if(NOT WIN32)
add_executable(${ARGV} ${VERSION_FILE_PATH})
disable_pax_mprotect(${ARGV})
@@ -479,26 +510,13 @@ function(add_executable_clr)
endif()
endfunction()
-function(add_library_clr)
- if(NOT WIN32 AND "${ARGV1}" STREQUAL "SHARED")
+function(add_library_clr targetName kind)
+ if(NOT WIN32 AND "${kind}" STREQUAL "SHARED")
add_library(${ARGV} ${VERSION_FILE_PATH})
else()
add_library(${ARGV})
- endif(NOT WIN32 AND "${ARGV1}" STREQUAL "SHARED")
- if("${ARGV1}" STREQUAL "SHARED" AND NOT CLR_CMAKE_KEEP_NATIVE_SYMBOLS)
+ endif()
+ if("${kind}" STREQUAL "SHARED" AND NOT CLR_CMAKE_KEEP_NATIVE_SYMBOLS)
strip_symbols(${ARGV0} symbolFile)
endif()
endfunction()
-
-# add_linker_flag(Flag [Config1 Config2 ...])
-function(add_linker_flag Flag)
- if (ARGN STREQUAL "")
- set("CMAKE_EXE_LINKER_FLAGS" "${CMAKE_EXE_LINKER_FLAGS} ${Flag}" PARENT_SCOPE)
- set("CMAKE_SHARED_LINKER_FLAGS" "${CMAKE_SHARED_LINKER_FLAGS} ${Flag}" PARENT_SCOPE)
- else()
- foreach(Config ${ARGN})
- set("CMAKE_EXE_LINKER_FLAGS_${Config}" "${CMAKE_EXE_LINKER_FLAGS_${Config}} ${Flag}" PARENT_SCOPE)
- set("CMAKE_SHARED_LINKER_FLAGS_${Config}" "${CMAKE_SHARED_LINKER_FLAGS_${Config}} ${Flag}" PARENT_SCOPE)
- endforeach()
- endif()
-endfunction()