Merge pull request #18757 from CarolEidt/Fix17969in2.1
[platform/upstream/coreclr.git] / clrdefinitions.cmake
1 include(clrfeatures.cmake)
2
3 # If set, indicates that this is not an officially supported release
4 # Keep in sync with IsPrerelease in dir.props
5 set(PRERELEASE 0)
6
7 # Features we're currently flighting, but don't intend to ship in officially supported releases
8 if (PRERELEASE)
9   add_definitions(-DFEATURE_DEFAULT_INTERFACES=1)  
10 endif (PRERELEASE)
11
12 if (CLR_CMAKE_TARGET_ARCH_AMD64)
13   if (CLR_CMAKE_PLATFORM_UNIX)
14     add_definitions(-DDBG_TARGET_AMD64_UNIX)
15   endif()
16   add_definitions(-D_TARGET_AMD64_=1)
17   add_definitions(-D_TARGET_64BIT_=1)
18   add_definitions(-DDBG_TARGET_64BIT=1)
19   add_definitions(-DDBG_TARGET_AMD64=1)
20   add_definitions(-DDBG_TARGET_WIN64=1)
21 elseif (CLR_CMAKE_TARGET_ARCH_ARM64)
22   if (CLR_CMAKE_PLATFORM_UNIX)
23     add_definitions(-DDBG_TARGET_ARM64_UNIX)
24   endif()
25   add_definitions(-D_TARGET_ARM64_=1)
26   add_definitions(-D_TARGET_64BIT_=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     add_definitions(-DFEATURE_DATATARGET4)
55   endif(CLR_CMAKE_PLATFORM_DARWIN)
56
57   if (CLR_CMAKE_TARGET_ARCH_AMD64)
58     add_definitions(-DUNIX_AMD64_ABI)
59   elseif (CLR_CMAKE_TARGET_ARCH_ARM)
60     add_definitions(-DUNIX_ARM_ABI)
61     add_definitions(-DFEATURE_DATATARGET4)
62   elseif (CLR_CMAKE_TARGET_ARCH_I386)
63     add_definitions(-DUNIX_X86_ABI)
64   endif()
65
66 endif(CLR_CMAKE_PLATFORM_UNIX)
67
68 if(CLR_CMAKE_PLATFORM_ALPINE_LINUX)
69   # Alpine Linux doesn't have fixed stack limit, this define disables some stack pointer
70   # sanity checks in debug / checked build that rely on a fixed stack limit
71   add_definitions(-DNO_FIXED_STACK_LIMIT)
72 endif(CLR_CMAKE_PLATFORM_ALPINE_LINUX)
73
74 add_definitions(-D_BLD_CLR)
75 add_definitions(-DDEBUGGING_SUPPORTED)
76 add_definitions(-DPROFILING_SUPPORTED)
77
78 if(WIN32)
79   add_definitions(-DWIN32)
80   add_definitions(-D_WIN32)
81   add_definitions(-DWINVER=0x0602)
82   add_definitions(-D_WIN32_WINNT=0x0602)
83   add_definitions(-DWIN32_LEAN_AND_MEAN=1)
84   add_definitions(-D_CRT_SECURE_NO_WARNINGS)
85   if(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386)
86     # Only enable edit and continue on windows x86 and x64
87     # exclude Linux, arm & arm64
88     add_definitions(-DEnC_SUPPORTED)
89   endif(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386)
90 endif(WIN32)
91
92 # Features - please keep them alphabetically sorted
93 if (FEATURE_APPDOMAIN_RESOURCE_MONITORING)
94   add_definitions(-DFEATURE_APPDOMAIN_RESOURCE_MONITORING)
95 endif(FEATURE_APPDOMAIN_RESOURCE_MONITORING)
96
97 if(WIN32)
98   add_definitions(-DFEATURE_APPX)
99   if(NOT CLR_CMAKE_TARGET_ARCH_I386)
100     add_definitions(-DFEATURE_ARRAYSTUB_AS_IL)
101     add_definitions(-DFEATURE_MULTICASTSTUB_AS_IL)
102   endif()
103 else(WIN32)
104   add_definitions(-DFEATURE_ARRAYSTUB_AS_IL)
105   add_definitions(-DFEATURE_MULTICASTSTUB_AS_IL)
106 endif(WIN32)
107 add_definitions(-DFEATURE_CODE_VERSIONING)
108 add_definitions(-DFEATURE_COLLECTIBLE_TYPES)
109
110 if(WIN32)
111     add_definitions(-DFEATURE_CLASSIC_COMINTEROP)
112     add_definitions(-DFEATURE_COMINTEROP)
113     add_definitions(-DFEATURE_COMINTEROP_APARTMENT_SUPPORT)
114     add_definitions(-DFEATURE_COMINTEROP_UNMANAGED_ACTIVATION)
115     add_definitions(-DFEATURE_COMINTEROP_WINRT_MANAGED_ACTIVATION)
116 endif(WIN32)
117
118 add_definitions(-DFEATURE_CORECLR)
119 if (CLR_CMAKE_PLATFORM_UNIX)
120   add_definitions(-DFEATURE_COREFX_GLOBALIZATION)
121 endif(CLR_CMAKE_PLATFORM_UNIX)
122 add_definitions(-DFEATURE_CORESYSTEM)
123 add_definitions(-DFEATURE_CORRUPTING_EXCEPTIONS)
124 if(FEATURE_DBGIPC)
125   add_definitions(-DFEATURE_DBGIPC_TRANSPORT_DI)
126   add_definitions(-DFEATURE_DBGIPC_TRANSPORT_VM)
127 endif(FEATURE_DBGIPC)
128 if(FEATURE_EVENT_TRACE)
129     add_definitions(-DFEATURE_EVENT_TRACE=1)
130     add_definitions(-DFEATURE_PERFTRACING=1)
131 endif(FEATURE_EVENT_TRACE)
132 if(FEATURE_GDBJIT)
133     add_definitions(-DFEATURE_GDBJIT)
134 endif()
135 if(FEATURE_GDBJIT_FRAME)
136     add_definitions(-DFEATURE_GDBJIT_FRAME)
137 endif(FEATURE_GDBJIT_FRAME)
138 if(FEATURE_GDBJIT_LANGID_CS)
139     add_definitions(-DFEATURE_GDBJIT_LANGID_CS)
140 endif(FEATURE_GDBJIT_LANGID_CS)
141 if(FEATURE_GDBJIT_SYMTAB)
142     add_definitions(-DFEATURE_GDBJIT_SYMTAB)
143 endif(FEATURE_GDBJIT_SYMTAB)
144 if(CLR_CMAKE_PLATFORM_UNIX)
145     add_definitions(-DFEATURE_EVENTSOURCE_XPLAT=1)
146 endif(CLR_CMAKE_PLATFORM_UNIX)
147 # NetBSD doesn't implement this feature
148 if(NOT CMAKE_SYSTEM_NAME STREQUAL NetBSD)
149     add_definitions(-DFEATURE_HIJACK)
150 endif(NOT CMAKE_SYSTEM_NAME STREQUAL NetBSD)
151 add_definitions(-DFEATURE_ICASTABLE)
152 if (WIN32 AND (CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386))
153     add_definitions(-DFEATURE_INTEROP_DEBUGGING)
154 endif (WIN32 AND (CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386))
155 if(FEATURE_INTERPRETER)
156   add_definitions(-DFEATURE_INTERPRETER)
157 endif(FEATURE_INTERPRETER)
158 add_definitions(-DFEATURE_ISYM_READER)
159 if(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386)
160     add_definitions(-DFEATURE_JUMPSTAMP)
161   endif(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386)
162 add_definitions(-DFEATURE_LOADER_OPTIMIZATION)
163 if (CLR_CMAKE_PLATFORM_LINUX OR WIN32)
164     add_definitions(-DFEATURE_MANAGED_ETW)
165 endif(CLR_CMAKE_PLATFORM_LINUX OR WIN32)
166 add_definitions(-DFEATURE_MANAGED_ETW_CHANNELS)
167
168 if(FEATURE_MERGE_JIT_AND_ENGINE)
169   add_definitions(-DFEATURE_MERGE_JIT_AND_ENGINE)
170 endif(FEATURE_MERGE_JIT_AND_ENGINE)
171 add_definitions(-DFEATURE_MULTICOREJIT)
172 if (FEATURE_NI_BIND_FALLBACK)
173   add_definitions(-DFEATURE_NI_BIND_FALLBACK)
174 endif(FEATURE_NI_BIND_FALLBACK)
175 if(CLR_CMAKE_PLATFORM_UNIX)
176   add_definitions(-DFEATURE_PAL)
177   add_definitions(-DFEATURE_PAL_SXS)
178   add_definitions(-DFEATURE_PAL_ANSI)
179 endif(CLR_CMAKE_PLATFORM_UNIX)
180 if(CLR_CMAKE_PLATFORM_LINUX)
181     add_definitions(-DFEATURE_PERFMAP)
182 endif(CLR_CMAKE_PLATFORM_LINUX)
183 add_definitions(-DFEATURE_PREJIT)
184
185 add_definitions(-DFEATURE_READYTORUN)
186 set(FEATURE_READYTORUN 1)
187
188 if (CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386)
189   add_definitions(-DFEATURE_REJIT)
190 endif(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386)
191
192 add_definitions(-DFEATURE_STANDALONE_SN)
193 add_definitions(-DFEATURE_STRONGNAME_DELAY_SIGNING_ALLOWED)
194 add_definitions(-DFEATURE_STRONGNAME_MIGRATION)
195 if (CLR_CMAKE_PLATFORM_UNIX OR CLR_CMAKE_TARGET_ARCH_ARM64)
196     add_definitions(-DFEATURE_STUBS_AS_IL)
197 endif ()
198 add_definitions(-DFEATURE_SVR_GC)
199 add_definitions(-DFEATURE_SYMDIFF)
200 add_definitions(-DFEATURE_TIERED_COMPILATION)
201 if (CLR_CMAKE_PLATFORM_ARCH_AMD64)
202   # Enable the AMD64 Unix struct passing JIT-EE interface for all AMD64 platforms, to enable altjit.
203   add_definitions(-DFEATURE_UNIX_AMD64_STRUCT_PASSING_ITF)
204 endif (CLR_CMAKE_PLATFORM_ARCH_AMD64)
205 if(CLR_CMAKE_PLATFORM_UNIX_AMD64)
206   add_definitions(-DFEATURE_MULTIREG_RETURN)
207 endif (CLR_CMAKE_PLATFORM_UNIX_AMD64)
208 if(CLR_CMAKE_PLATFORM_UNIX AND CLR_CMAKE_TARGET_ARCH_AMD64)
209   add_definitions(-DFEATURE_UNIX_AMD64_STRUCT_PASSING)
210 endif(CLR_CMAKE_PLATFORM_UNIX AND CLR_CMAKE_TARGET_ARCH_AMD64)
211 add_definitions(-DFEATURE_USE_ASM_GC_WRITE_BARRIERS)
212 if(CLR_CMAKE_PLATFORM_ARCH_AMD64 OR (CLR_CMAKE_PLATFORM_ARCH_ARM64 AND NOT WIN32))
213   add_definitions(-DFEATURE_USE_SOFTWARE_WRITE_WATCH_FOR_GC_HEAP)
214 endif(CLR_CMAKE_PLATFORM_ARCH_AMD64 OR (CLR_CMAKE_PLATFORM_ARCH_ARM64 AND NOT WIN32))
215 if((CLR_CMAKE_PLATFORM_ARCH_AMD64 OR CLR_CMAKE_PLATFORM_ARCH_ARM64) AND NOT WIN32)
216   add_definitions(-DFEATURE_MANUALLY_MANAGED_CARD_BUNDLES)
217 endif((CLR_CMAKE_PLATFORM_ARCH_AMD64 OR CLR_CMAKE_PLATFORM_ARCH_ARM64) AND NOT WIN32)
218
219 if(WIN32)
220     add_definitions(-DFEATURE_VERSIONING_LOG)
221 endif(WIN32)
222 if(NOT CLR_CMAKE_PLATFORM_UNIX)
223     add_definitions(-DFEATURE_WIN32_REGISTRY)
224 endif(NOT CLR_CMAKE_PLATFORM_UNIX)
225 add_definitions(-DFEATURE_LEGACYNETCF_DBG_HOST_CONTROL)
226 add_definitions(-DFEATURE_WINDOWSPHONE)
227 add_definitions(-DFEATURE_WINMD_RESILIENT)
228 add_definitions(-D_SECURE_SCL=0)
229 add_definitions(-DUNICODE)
230 add_definitions(-D_UNICODE)