Merge pull request #10190 from sdmaclea/PR-ARM64-BACKPORT-9500
[platform/upstream/coreclr.git] / clrdefinitions.cmake
1 if(WIN32 AND CLR_CMAKE_TARGET_ARCH_I386 AND BUILD_JIT32)  
2   set(CLR_BUILD_JIT32 1)  
3 else()  
4   set(CLR_BUILD_JIT32 0)  
5 endif()  
6
7 if (WIN32)
8   set(FEATURE_EVENT_TRACE 1)
9 endif()
10 if(CLR_CMAKE_PLATFORM_LINUX AND CLR_CMAKE_TARGET_ARCH_AMD64)
11   set(FEATURE_EVENT_TRACE 1)
12 endif()
13
14 if (CLR_CMAKE_TARGET_ARCH_AMD64)
15   if (CLR_CMAKE_PLATFORM_UNIX)
16     add_definitions(-DDBG_TARGET_AMD64_UNIX)
17   endif()
18   add_definitions(-D_TARGET_AMD64_=1)
19   add_definitions(-DDBG_TARGET_64BIT=1)
20   add_definitions(-DDBG_TARGET_AMD64=1)
21   add_definitions(-DDBG_TARGET_WIN64=1)
22 elseif (CLR_CMAKE_TARGET_ARCH_ARM64)
23   if (CLR_CMAKE_PLATFORM_UNIX)
24     add_definitions(-DDBG_TARGET_ARM64_UNIX)
25   endif()
26   add_definitions(-D_TARGET_ARM64_=1)
27   add_definitions(-DDBG_TARGET_64BIT=1)
28   add_definitions(-DDBG_TARGET_ARM64=1)
29   add_definitions(-DDBG_TARGET_WIN64=1)
30   add_definitions(-DFEATURE_MULTIREG_RETURN)
31 elseif (CLR_CMAKE_TARGET_ARCH_ARM)
32   if (CLR_CMAKE_PLATFORM_UNIX)
33     add_definitions(-DDBG_TARGET_ARM_UNIX)
34   elseif (WIN32 AND NOT DEFINED CLR_CROSS_COMPONENTS_BUILD)
35     # Set this to ensure we can use Arm SDK for Desktop binary linkage when doing native (Arm32) build
36     add_definitions(-D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1)
37     add_definitions(-D_ARM_WORKAROUND_)
38   endif (CLR_CMAKE_PLATFORM_UNIX)
39   add_definitions(-D_TARGET_ARM_=1)
40   add_definitions(-DDBG_TARGET_32BIT=1)
41   add_definitions(-DDBG_TARGET_ARM=1)
42 elseif (CLR_CMAKE_TARGET_ARCH_I386)
43   add_definitions(-D_TARGET_X86_=1)
44   add_definitions(-DDBG_TARGET_32BIT=1)
45   add_definitions(-DDBG_TARGET_X86=1)
46 else ()
47   clr_unknown_arch()
48 endif (CLR_CMAKE_TARGET_ARCH_AMD64)
49
50 if (CLR_CMAKE_PLATFORM_UNIX)
51
52   if(CLR_CMAKE_PLATFORM_DARWIN)
53     add_definitions(-D_XOPEN_SOURCE)
54   endif(CLR_CMAKE_PLATFORM_DARWIN)
55
56   if (CLR_CMAKE_TARGET_ARCH_AMD64)
57     add_definitions(-DUNIX_AMD64_ABI)
58   elseif (CLR_CMAKE_TARGET_ARCH_ARM)
59     add_definitions(-DUNIX_ARM_ABI)
60   elseif (CLR_CMAKE_TARGET_ARCH_I386)
61     add_definitions(-DUNIX_X86_ABI)
62   endif()
63
64 endif(CLR_CMAKE_PLATFORM_UNIX)
65
66 if(CLR_CMAKE_PLATFORM_ALPINE_LINUX)
67   # Alpine Linux doesn't have fixed stack limit, this define disables some stack pointer
68   # sanity checks in debug / checked build that rely on a fixed stack limit
69   add_definitions(-DNO_FIXED_STACK_LIMIT)
70 endif(CLR_CMAKE_PLATFORM_ALPINE_LINUX)
71
72 add_definitions(-D_BLD_CLR)
73 add_definitions(-DDEBUGGING_SUPPORTED)
74 add_definitions(-DPROFILING_SUPPORTED)
75
76 if(WIN32)
77   add_definitions(-DWIN32)
78   add_definitions(-D_WIN32)
79   add_definitions(-DWINVER=0x0602)
80   add_definitions(-D_WIN32_WINNT=0x0602)
81   add_definitions(-DWIN32_LEAN_AND_MEAN=1)
82   add_definitions(-D_CRT_SECURE_NO_WARNINGS)
83   if(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386)
84     # Only enable edit and continue on windows x86 and x64
85     # exclude Linux, arm & arm64
86     add_definitions(-DEnC_SUPPORTED)
87   endif(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386)
88 endif(WIN32)
89
90 # Features - please keep them alphabetically sorted
91
92 add_definitions(-DFEATURE_APPDOMAIN_RESOURCE_MONITORING)
93 if(WIN32)
94   add_definitions(-DFEATURE_APPX)
95   if(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_ARM OR CLR_CMAKE_TARGET_ARCH_ARM64)
96     add_definitions(-DFEATURE_ARRAYSTUB_AS_IL)
97   endif()
98 else(WIN32)
99   add_definitions(-DFEATURE_ARRAYSTUB_AS_IL)
100 endif(WIN32)
101
102 add_definitions(-DFEATURE_COLLECTIBLE_TYPES)
103
104 if(WIN32)
105     add_definitions(-DFEATURE_CLASSIC_COMINTEROP)
106     add_definitions(-DFEATURE_COMINTEROP)
107     add_definitions(-DFEATURE_COMINTEROP_APARTMENT_SUPPORT)
108     add_definitions(-DFEATURE_COMINTEROP_UNMANAGED_ACTIVATION)
109     add_definitions(-DFEATURE_COMINTEROP_WINRT_MANAGED_ACTIVATION)
110 endif(WIN32)
111
112 add_definitions(-DFEATURE_CORECLR)
113 if (CLR_CMAKE_PLATFORM_UNIX)
114   add_definitions(-DFEATURE_COREFX_GLOBALIZATION)
115 endif(CLR_CMAKE_PLATFORM_UNIX)
116 add_definitions(-DFEATURE_CORESYSTEM)
117 add_definitions(-DFEATURE_CORRUPTING_EXCEPTIONS)
118 if(CLR_CMAKE_PLATFORM_UNIX AND (NOT CLR_CMAKE_PLATFORM_ANDROID))
119     add_definitions(-DFEATURE_DBGIPC_TRANSPORT_DI)
120     add_definitions(-DFEATURE_DBGIPC_TRANSPORT_VM)
121 endif(CLR_CMAKE_PLATFORM_UNIX AND (NOT CLR_CMAKE_PLATFORM_ANDROID))
122 if(FEATURE_EVENT_TRACE)
123     add_definitions(-DFEATURE_EVENT_TRACE=1)
124 endif(FEATURE_EVENT_TRACE)
125 if(CLR_CMAKE_PLATFORM_UNIX)
126     add_definitions(-DFEATURE_EVENTSOURCE_XPLAT=1)
127 endif(CLR_CMAKE_PLATFORM_UNIX)
128 add_definitions(-DFEATURE_TIERED_COMPILATION)
129 # NetBSD doesn't implement this feature
130 if(NOT CMAKE_SYSTEM_NAME STREQUAL NetBSD)
131     add_definitions(-DFEATURE_HIJACK)
132 endif(NOT CMAKE_SYSTEM_NAME STREQUAL NetBSD)
133 add_definitions(-DFEATURE_ICASTABLE)
134 if (WIN32 AND (CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386))
135     add_definitions(-DFEATURE_INTEROP_DEBUGGING)
136 endif (WIN32 AND (CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386))
137 if (CLR_CMAKE_PLATFORM_UNIX OR CLR_CMAKE_TARGET_ARCH_ARM64)
138   add_definitions(-DFEATURE_IMPLICIT_TLS)
139   set(FEATURE_IMPLICIT_TLS 1)
140 endif(CLR_CMAKE_PLATFORM_UNIX OR CLR_CMAKE_TARGET_ARCH_ARM64)
141 add_definitions(-DFEATURE_ISYM_READER)
142 add_definitions(-DFEATURE_LOADER_OPTIMIZATION)
143 if (NOT CLR_CMAKE_PLATFORM_UNIX)
144     add_definitions(-DFEATURE_MANAGED_ETW)
145 endif(NOT CLR_CMAKE_PLATFORM_UNIX)
146 add_definitions(-DFEATURE_MANAGED_ETW_CHANNELS)
147
148 if(FEATURE_MERGE_JIT_AND_ENGINE)
149   add_definitions(-DFEATURE_MERGE_JIT_AND_ENGINE)
150 endif(FEATURE_MERGE_JIT_AND_ENGINE)
151 add_definitions(-DFEATURE_MULTICOREJIT)
152 if(CLR_CMAKE_PLATFORM_UNIX)
153   add_definitions(-DFEATURE_PAL)
154   add_definitions(-DFEATURE_PAL_SXS)
155   add_definitions(-DFEATURE_PAL_ANSI)
156 endif(CLR_CMAKE_PLATFORM_UNIX)
157 if(CLR_CMAKE_PLATFORM_LINUX)
158     add_definitions(-DFEATURE_PERFMAP)
159 endif(CLR_CMAKE_PLATFORM_LINUX)
160 add_definitions(-DFEATURE_PREJIT)
161 add_definitions(-DFEATURE_RANDOMIZED_STRING_HASHING)
162
163 add_definitions(-DFEATURE_READYTORUN)
164 set(FEATURE_READYTORUN 1)
165
166 if (CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386)
167   add_definitions(-DFEATURE_REJIT)
168 endif(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386)
169
170 add_definitions(-DFEATURE_STANDALONE_SN)
171 add_definitions(-DFEATURE_STRONGNAME_DELAY_SIGNING_ALLOWED)
172 add_definitions(-DFEATURE_STRONGNAME_MIGRATION)
173 if (CLR_CMAKE_PLATFORM_UNIX OR CLR_CMAKE_TARGET_ARCH_ARM64)
174     add_definitions(-DFEATURE_STUBS_AS_IL)
175 endif ()
176 add_definitions(-DFEATURE_SVR_GC)
177 add_definitions(-DFEATURE_SYMDIFF)
178 if (CLR_CMAKE_PLATFORM_ARCH_AMD64)
179   # Enable the AMD64 Unix struct passing JIT-EE interface for all AMD64 platforms, to enable altjit.
180   add_definitions(-DFEATURE_UNIX_AMD64_STRUCT_PASSING_ITF)
181 endif (CLR_CMAKE_PLATFORM_ARCH_AMD64)
182 if(CLR_CMAKE_PLATFORM_UNIX_AMD64)
183   add_definitions(-DFEATURE_MULTIREG_RETURN)
184   add_definitions(-DFEATURE_UNIX_AMD64_STRUCT_PASSING)
185 endif (CLR_CMAKE_PLATFORM_UNIX_AMD64)
186 add_definitions(-DFEATURE_USE_ASM_GC_WRITE_BARRIERS)
187 if(CLR_CMAKE_PLATFORM_ARCH_AMD64 AND NOT WIN32)
188   add_definitions(-DFEATURE_MANUALLY_MANAGED_CARD_BUNDLES)
189   add_definitions(-DFEATURE_USE_SOFTWARE_WRITE_WATCH_FOR_GC_HEAP)
190 endif(CLR_CMAKE_PLATFORM_ARCH_AMD64 AND NOT WIN32)
191 if(WIN32)
192     add_definitions(-DFEATURE_VERSIONING_LOG)
193 endif(WIN32)
194 if(NOT CLR_CMAKE_PLATFORM_UNIX)
195     add_definitions(-DFEATURE_WIN32_REGISTRY)
196 endif(NOT CLR_CMAKE_PLATFORM_UNIX)
197 add_definitions(-DFEATURE_LEGACYNETCF_DBG_HOST_CONTROL)
198 add_definitions(-DFEATURE_WINDOWSPHONE)
199 add_definitions(-DFEATURE_WINMD_RESILIENT)
200 add_definitions(-D_SECURE_SCL=0)
201 add_definitions(-DUNICODE)
202 add_definitions(-D_UNICODE)