|
1 | | -# helper to add set of include directories to unwinder targets |
2 | | -macro(add_unwinder_include_directories TARGET) |
3 | | - target_include_directories(${TARGET} BEFORE PRIVATE ${VM_DIR}) |
4 | | - target_include_directories(${TARGET} BEFORE PRIVATE ${VM_DIR}/${ARCH_SOURCES_DIR}) |
5 | | - target_include_directories(${TARGET} BEFORE PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) |
6 | | - target_include_directories(${TARGET} BEFORE PRIVATE ${CLR_DIR}/unwinder) |
7 | | - target_include_directories(${TARGET} PRIVATE ${CLR_DIR}/debug/ee) |
8 | | - target_include_directories(${TARGET} PRIVATE ${CLR_DIR}/gc) |
9 | | - target_include_directories(${TARGET} PRIVATE ${CLR_DIR}/gcdump) |
10 | | - target_include_directories(${TARGET} PRIVATE ${CLR_DIR}/debug/daccess) |
11 | | - target_include_directories(${TARGET} PRIVATE ${ARCH_SOURCES_DIR}) |
12 | | -endmacro() |
| 1 | +include_directories(BEFORE ${VM_DIR}) |
| 2 | +include_directories(BEFORE ${VM_DIR}/${ARCH_SOURCES_DIR}) |
| 3 | +include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}) |
| 4 | +include_directories(BEFORE ${CLR_DIR}/unwinder) |
| 5 | +include_directories(${CLR_DIR}/debug/ee) |
| 6 | +include_directories(${CLR_DIR}/gc) |
| 7 | +include_directories(${CLR_DIR}/gcdump) |
| 8 | +include_directories(${CLR_DIR}/debug/daccess) |
13 | 9 |
|
14 | 10 | set(UNWINDER_SOURCES |
15 | 11 | baseunwinder.cpp |
| 12 | +) |
| 13 | + |
| 14 | +# Include platform specific unwinder for applicable (native and cross-target) builds. |
| 15 | +include_directories(${ARCH_SOURCES_DIR}) |
| 16 | +list(APPEND UNWINDER_SOURCES |
16 | 17 | ${ARCH_SOURCES_DIR}/unwinder.cpp |
17 | 18 | ) |
18 | 19 |
|
19 | 20 | convert_to_absolute_path(UNWINDER_SOURCES ${UNWINDER_SOURCES}) |
20 | 21 |
|
21 | 22 | if(CLR_CMAKE_HOST_UNIX) |
22 | 23 | add_library_clr(unwinder_wks OBJECT ${UNWINDER_SOURCES}) |
23 | | - add_unwinder_include_directories(unwinder_wks) |
24 | 24 | add_dependencies(unwinder_wks eventing_headers) |
25 | 25 | endif(CLR_CMAKE_HOST_UNIX) |
26 | 26 |
|
27 | 27 | add_library_clr(unwinder_dac ${UNWINDER_SOURCES}) |
28 | | -add_unwinder_include_directories(unwinder_dac) |
29 | 28 | add_dependencies(unwinder_dac eventing_headers) |
30 | 29 | set_target_properties(unwinder_dac PROPERTIES DAC_COMPONENT TRUE) |
31 | 30 | target_compile_definitions(unwinder_dac PRIVATE FEATURE_NO_HOST) |
32 | | - |
33 | | -### cDAC Unwinders #### |
34 | | - |
35 | | -set(BASE_UNWINDER_SOURCES baseunwinder.cpp) |
36 | | -convert_to_absolute_path(BASE_UNWINDER_SOURCES ${BASE_UNWINDER_SOURCES}) |
37 | | -add_library_clr(unwinder_cdac_base STATIC ${BASE_UNWINDER_SOURCES}) |
38 | | - |
39 | | -target_include_directories(unwinder_cdac_base BEFORE PUBLIC ${VM_DIR}) |
40 | | -target_include_directories(unwinder_cdac_base BEFORE PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) |
41 | | -target_include_directories(unwinder_cdac_base BEFORE PUBLIC ${CLR_DIR}/unwinder) |
42 | | -target_include_directories(unwinder_cdac_base PUBLIC ${CLR_DIR}/debug/ee) |
43 | | -target_include_directories(unwinder_cdac_base PUBLIC ${CLR_DIR}/gc) |
44 | | -target_include_directories(unwinder_cdac_base PUBLIC ${CLR_DIR}/gcdump) |
45 | | -target_include_directories(unwinder_cdac_base PUBLIC ${CLR_DIR}/debug/daccess) |
46 | | -target_compile_definitions(unwinder_cdac_base PUBLIC FEATURE_NO_HOST FEATURE_CDAC_UNWINDER) |
47 | | - |
48 | | -if (CLR_CMAKE_TARGET_WIN32) |
49 | | - # cDAC unwinders are statically linked into the NativeAOT runtime which is built with |
50 | | - # release version of the statically linked CRT. Therefore we do the same here. |
51 | | - set_property(TARGET unwinder_cdac_base PROPERTY MSVC_RUNTIME_LIBRARY MultiThreaded) |
52 | | - |
53 | | - # _DEBUG is always passed as a parameter if the build is a debug build. |
54 | | - # This causes the debug CRT on MSVC to be used so we need to undefine it. |
55 | | - target_compile_options(unwinder_cdac_base PRIVATE -U_DEBUG) |
56 | | -endif() |
57 | | - |
58 | | -install_clr(TARGETS unwinder_cdac_base DESTINATIONS cdaclibs COMPONENT cdac) |
59 | | - |
60 | | -# Helper function for platform specific cDAC uwninder builds. |
61 | | -function(create_platform_unwinder) |
62 | | - set(oneValueArgs TARGET ARCH) |
63 | | - set(multiValueArgs DESTINATIONS) |
64 | | - cmake_parse_arguments(TARGETDETAILS "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) |
65 | | - |
66 | | - if(TARGETDETAILS_ARCH STREQUAL "x64") |
67 | | - set(ARCH_SOURCES_DIR amd64) |
68 | | - elseif((TARGETDETAILS_ARCH STREQUAL "arm") OR (TARGETDETAILS_ARCH STREQUAL "armel")) |
69 | | - set(ARCH_SOURCES_DIR arm) |
70 | | - elseif(TARGETDETAILS_ARCH STREQUAL "x86") |
71 | | - set(ARCH_SOURCES_DIR i386) |
72 | | - elseif(TARGETDETAILS_ARCH STREQUAL "arm64") |
73 | | - set(ARCH_SOURCES_DIR arm64) |
74 | | - else() |
75 | | - clr_unknown_arch() |
76 | | - endif() |
77 | | - |
78 | | - set(UNWINDER_SOURCES ${ARCH_SOURCES_DIR}/unwinder.cpp) |
79 | | - convert_to_absolute_path(UNWINDER_SOURCES ${UNWINDER_SOURCES}) |
80 | | - add_library_clr(${TARGETDETAILS_TARGET} STATIC ${UNWINDER_SOURCES}) |
81 | | - |
82 | | - target_include_directories(${TARGETDETAILS_TARGET} BEFORE PRIVATE ${VM_DIR}/${ARCH_SOURCES_DIR}) |
83 | | - target_include_directories(${TARGETDETAILS_TARGET} PRIVATE ${ARCH_SOURCES_DIR}) |
84 | | - |
85 | | - target_link_libraries(${TARGETDETAILS_TARGET} PRIVATE unwinder_cdac_base) |
86 | | - if (CLR_CMAKE_TARGET_WIN32) |
87 | | - # cDAC unwinders are statically linked into the NativeAOT runtime which is built with |
88 | | - # release version of the statically linked CRT. Therefore we do the same here. |
89 | | - set_property(TARGET ${TARGETDETAILS_TARGET} PROPERTY MSVC_RUNTIME_LIBRARY MultiThreaded) |
90 | | - |
91 | | - # _DEBUG is always passed as a parameter if the build is a debug build. |
92 | | - # This causes the debug CRT on MSVC to be used so we need to undefine it. |
93 | | - target_compile_options(${TARGETDETAILS_TARGET} PRIVATE -U_DEBUG) |
94 | | - endif() |
95 | | - |
96 | | - # add the install targets |
97 | | - install_clr(TARGETS ${TARGETDETAILS_TARGET} DESTINATIONS ${TARGETDETAILS_DESTINATIONS} COMPONENT cdac) |
98 | | - |
99 | | - # Set the target to be built for the specified OS and ARCH |
100 | | - set_target_definitions_to_custom_os_and_arch(TARGET ${TARGETDETAILS_TARGET} OS win ARCH ${TARGETDETAILS_ARCH}) |
101 | | - |
102 | | - target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE FEATURE_NO_HOST FEATURE_CDAC_UNWINDER) |
103 | | -endfunction() |
104 | | - |
105 | | -if(CLR_CMAKE_TARGET_WIN32 AND CLR_CMAKE_TARGET_ARCH_AMD64) |
106 | | - create_platform_unwinder(TARGET unwinder_cdac_amd64 ARCH x64 DESTINATIONS cdaclibs) |
107 | | - create_platform_unwinder(TARGET unwinder_cdac_arm64 ARCH arm64 DESTINATIONS cdaclibs) |
108 | | -endif(CLR_CMAKE_TARGET_WIN32 AND CLR_CMAKE_TARGET_ARCH_AMD64) |
109 | | - |
110 | | -if(CLR_CMAKE_TARGET_WIN32 AND CLR_CMAKE_TARGET_ARCH_ARM64) |
111 | | - create_platform_unwinder(TARGET unwinder_cdac_arm64 ARCH arm64 DESTINATIONS cdaclibs) |
112 | | -endif(CLR_CMAKE_TARGET_WIN32 AND CLR_CMAKE_TARGET_ARCH_ARM64) |
113 | | - |
114 | | -if(NOT CLR_CMAKE_TARGET_WIN32 AND CLR_CMAKE_TARGET_ARCH_AMD64) |
115 | | - create_platform_unwinder(TARGET unwinder_cdac_amd64 ARCH x64 DESTINATIONS cdaclibs) |
116 | | -endif(NOT CLR_CMAKE_TARGET_WIN32 AND CLR_CMAKE_TARGET_ARCH_AMD64) |
117 | | - |
118 | | -if(NOT CLR_CMAKE_TARGET_WIN32 AND CLR_CMAKE_TARGET_ARCH_ARM64) |
119 | | - create_platform_unwinder(TARGET unwinder_cdac_arm64 ARCH arm64 DESTINATIONS cdaclibs) |
120 | | -endif(NOT CLR_CMAKE_TARGET_WIN32 AND CLR_CMAKE_TARGET_ARCH_ARM64) |
121 | | - |
0 commit comments