Add custom default base address option to crossgen (#25227)
[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 1)
6
7 # Features we're currently flighting, but don't intend to ship in officially supported releases
8 if (PRERELEASE)
9   add_definitions(-DFEATURE_UTF8STRING)  
10   # add_definitions(-DFEATURE_XXX)
11 endif (PRERELEASE)
12
13 if (CLR_CMAKE_TARGET_ARCH_AMD64)
14   if (CLR_CMAKE_PLATFORM_UNIX)
15     add_definitions(-DDBG_TARGET_AMD64_UNIX)
16   endif()
17   add_definitions(-D_TARGET_AMD64_)
18   add_definitions(-D_TARGET_64BIT_)
19   add_definitions(-DDBG_TARGET_64BIT)
20   add_definitions(-DDBG_TARGET_AMD64)
21   add_definitions(-DDBG_TARGET_WIN64)
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_)
27   add_definitions(-D_TARGET_64BIT_)
28   add_definitions(-DDBG_TARGET_64BIT)
29   add_definitions(-DDBG_TARGET_ARM64)
30   add_definitions(-DDBG_TARGET_WIN64)
31   add_definitions(-DFEATURE_MULTIREG_RETURN)
32 elseif (CLR_CMAKE_TARGET_ARCH_ARM)
33   if (CLR_CMAKE_PLATFORM_UNIX)
34     add_definitions(-DDBG_TARGET_ARM_UNIX)
35   elseif (WIN32 AND NOT DEFINED CLR_CROSS_COMPONENTS_BUILD)
36     # Set this to ensure we can use Arm SDK for Desktop binary linkage when doing native (Arm32) build
37     add_definitions(-D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE)
38     add_definitions(-D_ARM_WORKAROUND_)
39   endif (CLR_CMAKE_PLATFORM_UNIX)
40   add_definitions(-D_TARGET_ARM_)
41   add_definitions(-DDBG_TARGET_32BIT)
42   add_definitions(-DDBG_TARGET_ARM)
43 elseif (CLR_CMAKE_TARGET_ARCH_I386)
44   add_definitions(-D_TARGET_X86_)
45   add_definitions(-DDBG_TARGET_32BIT)
46   add_definitions(-DDBG_TARGET_X86)
47 else ()
48   clr_unknown_arch()
49 endif (CLR_CMAKE_TARGET_ARCH_AMD64)
50
51 if (CLR_CMAKE_PLATFORM_UNIX)
52
53   if(CLR_CMAKE_PLATFORM_DARWIN)
54     add_definitions(-D_XOPEN_SOURCE)
55     add_definitions(-DFEATURE_DATATARGET4)
56   endif(CLR_CMAKE_PLATFORM_DARWIN)
57
58   if (CLR_CMAKE_TARGET_ARCH_AMD64)
59     add_definitions(-DUNIX_AMD64_ABI)
60   elseif (CLR_CMAKE_TARGET_ARCH_ARM)
61     add_definitions(-DUNIX_ARM_ABI)
62     add_definitions(-DFEATURE_DATATARGET4)
63   elseif (CLR_CMAKE_TARGET_ARCH_I386)
64     add_definitions(-DUNIX_X86_ABI)
65   endif()
66
67 endif(CLR_CMAKE_PLATFORM_UNIX)
68
69 if(CLR_CMAKE_PLATFORM_ALPINE_LINUX)
70   # Alpine Linux doesn't have fixed stack limit, this define disables some stack pointer
71   # sanity checks in debug / checked build that rely on a fixed stack limit
72   add_definitions(-DNO_FIXED_STACK_LIMIT)
73 endif(CLR_CMAKE_PLATFORM_ALPINE_LINUX)
74
75 add_definitions(-D_BLD_CLR)
76 add_definitions(-DDEBUGGING_SUPPORTED)
77 add_definitions(-DPROFILING_SUPPORTED)
78
79 if(WIN32)
80   add_definitions(-DWIN32)
81   add_definitions(-D_WIN32)
82   add_definitions(-DWINVER=0x0602)
83   add_definitions(-D_WIN32_WINNT=0x0602)
84   add_definitions(-DWIN32_LEAN_AND_MEAN)
85   add_definitions(-D_CRT_SECURE_NO_WARNINGS)
86   if(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386)
87     # Only enable edit and continue on windows x86 and x64
88     # exclude Linux, arm & arm64
89     add_definitions(-DEnC_SUPPORTED)
90   endif(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386)
91 endif(WIN32)
92
93 # Features - please keep them alphabetically sorted
94 if(WIN32)
95   add_definitions(-DFEATURE_APPX)
96   if(NOT CLR_CMAKE_TARGET_ARCH_I386)
97     add_definitions(-DFEATURE_ARRAYSTUB_AS_IL)
98     add_definitions(-DFEATURE_MULTICASTSTUB_AS_IL)
99   endif()
100 else(WIN32)
101   add_definitions(-DFEATURE_ARRAYSTUB_AS_IL)
102   add_definitions(-DFEATURE_MULTICASTSTUB_AS_IL)
103 endif(WIN32)
104 add_definitions(-DFEATURE_CODE_VERSIONING)
105 add_definitions(-DFEATURE_COLLECTIBLE_TYPES)
106
107 if(WIN32)
108     add_definitions(-DFEATURE_CLASSIC_COMINTEROP)
109     add_definitions(-DFEATURE_COMINTEROP)
110     add_definitions(-DFEATURE_COMINTEROP_APARTMENT_SUPPORT)
111     add_definitions(-DFEATURE_COMINTEROP_UNMANAGED_ACTIVATION)
112     add_definitions(-DFEATURE_COMINTEROP_WINRT_MANAGED_ACTIVATION)
113 endif(WIN32)
114
115 add_definitions(-DFEATURE_BASICFREEZE)
116 add_definitions(-DFEATURE_CORECLR)
117 add_definitions(-DFEATURE_CORESYSTEM)
118 add_definitions(-DFEATURE_CORRUPTING_EXCEPTIONS)
119 if(FEATURE_DBGIPC)
120   add_definitions(-DFEATURE_DBGIPC_TRANSPORT_DI)
121   add_definitions(-DFEATURE_DBGIPC_TRANSPORT_VM)
122 endif(FEATURE_DBGIPC)
123 add_definitions(-DFEATURE_DEFAULT_INTERFACES)
124 if(FEATURE_EVENT_TRACE)
125     add_definitions(-DFEATURE_EVENT_TRACE)
126     add_definitions(-DFEATURE_PERFTRACING)
127 endif(FEATURE_EVENT_TRACE)
128 if(FEATURE_GDBJIT)
129     add_definitions(-DFEATURE_GDBJIT)
130 endif()
131 if(FEATURE_GDBJIT_FRAME)
132     add_definitions(-DFEATURE_GDBJIT_FRAME)
133 endif(FEATURE_GDBJIT_FRAME)
134 if(FEATURE_GDBJIT_LANGID_CS)
135     add_definitions(-DFEATURE_GDBJIT_LANGID_CS)
136 endif(FEATURE_GDBJIT_LANGID_CS)
137 if(FEATURE_GDBJIT_SYMTAB)
138     add_definitions(-DFEATURE_GDBJIT_SYMTAB)
139 endif(FEATURE_GDBJIT_SYMTAB)
140 if(CLR_CMAKE_PLATFORM_UNIX)
141     add_definitions(-DFEATURE_EVENTSOURCE_XPLAT)
142 endif(CLR_CMAKE_PLATFORM_UNIX)
143 # NetBSD doesn't implement this feature
144 if(NOT CMAKE_SYSTEM_NAME STREQUAL NetBSD)
145     add_definitions(-DFEATURE_HIJACK)
146 endif(NOT CMAKE_SYSTEM_NAME STREQUAL NetBSD)
147 add_definitions(-DFEATURE_ICASTABLE)
148 if (WIN32 AND (CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386 OR CLR_CMAKE_TARGET_ARCH_ARM64))
149     add_definitions(-DFEATURE_INTEROP_DEBUGGING)
150 endif (WIN32 AND (CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386 OR CLR_CMAKE_TARGET_ARCH_ARM64))
151 if(FEATURE_INTERPRETER)
152   add_definitions(-DFEATURE_INTERPRETER)
153 endif(FEATURE_INTERPRETER)
154 add_definitions(-DFEATURE_ISYM_READER)
155 if(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386)
156     add_definitions(-DFEATURE_JUMPSTAMP)
157 endif(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386)
158 if (CLR_CMAKE_PLATFORM_LINUX OR WIN32)
159     add_definitions(-DFEATURE_MANAGED_ETW)
160 endif(CLR_CMAKE_PLATFORM_LINUX OR WIN32)
161 add_definitions(-DFEATURE_MANAGED_ETW_CHANNELS)
162
163 if(FEATURE_MERGE_JIT_AND_ENGINE)
164   add_definitions(-DFEATURE_MERGE_JIT_AND_ENGINE)
165 endif(FEATURE_MERGE_JIT_AND_ENGINE)
166 add_definitions(-DFEATURE_MULTICOREJIT)
167 if (FEATURE_NI_BIND_FALLBACK)
168   add_definitions(-DFEATURE_NI_BIND_FALLBACK)
169 endif(FEATURE_NI_BIND_FALLBACK)
170 if(CLR_CMAKE_PLATFORM_UNIX)
171   add_definitions(-DFEATURE_PAL)
172   add_definitions(-DFEATURE_PAL_SXS)
173   add_definitions(-DFEATURE_PAL_ANSI)
174 endif(CLR_CMAKE_PLATFORM_UNIX)
175 if(CLR_CMAKE_PLATFORM_LINUX OR CLR_CMAKE_PLATFORM_FREEBSD)
176     add_definitions(-DFEATURE_PERFMAP)
177 endif(CLR_CMAKE_PLATFORM_LINUX OR CLR_CMAKE_PLATFORM_FREEBSD)
178 if(FEATURE_PREJIT)
179   add_definitions(-DFEATURE_PREJIT)
180 endif(FEATURE_PREJIT)
181
182 if(WIN32 OR CLR_CMAKE_PLATFORM_LINUX)
183     add_definitions(-DFEATURE_PROFAPI_ATTACH_DETACH)
184 endif(WIN32 OR CLR_CMAKE_PLATFORM_LINUX)
185
186 add_definitions(-DFEATURE_READYTORUN)
187 set(FEATURE_READYTORUN 1)
188
189 if (CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386)
190   add_definitions(-DFEATURE_REJIT)
191 endif(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386)
192
193 if (CLR_CMAKE_PLATFORM_UNIX OR CLR_CMAKE_TARGET_ARCH_ARM64)
194     add_definitions(-DFEATURE_STUBS_AS_IL)
195 endif ()
196 if (FEATURE_NGEN_RELOCS_OPTIMIZATIONS)
197    add_definitions(-DFEATURE_NGEN_RELOCS_OPTIMIZATIONS)
198 endif(FEATURE_NGEN_RELOCS_OPTIMIZATIONS)
199 if (FEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION)
200   add_definitions(-DFEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION)
201 endif(FEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION)
202 add_definitions(-DFEATURE_SVR_GC)
203 add_definitions(-DFEATURE_SYMDIFF)
204 add_definitions(-DFEATURE_TIERED_COMPILATION)
205 if (WIN32)
206     add_definitions(-DFEATURE_TYPEEQUIVALENCE)
207 endif(WIN32)
208 if (CLR_CMAKE_PLATFORM_ARCH_AMD64)
209   # Enable the AMD64 Unix struct passing JIT-EE interface for all AMD64 platforms, to enable altjit.
210   add_definitions(-DUNIX_AMD64_ABI_ITF)
211 endif (CLR_CMAKE_PLATFORM_ARCH_AMD64)
212 if(CLR_CMAKE_PLATFORM_UNIX_AMD64)
213   add_definitions(-DFEATURE_MULTIREG_RETURN)
214 endif (CLR_CMAKE_PLATFORM_UNIX_AMD64)
215 if(CLR_CMAKE_PLATFORM_UNIX AND CLR_CMAKE_TARGET_ARCH_AMD64)
216   add_definitions(-DUNIX_AMD64_ABI)
217 endif(CLR_CMAKE_PLATFORM_UNIX AND CLR_CMAKE_TARGET_ARCH_AMD64)
218 add_definitions(-DFEATURE_USE_ASM_GC_WRITE_BARRIERS)
219 if(CLR_CMAKE_PLATFORM_ARCH_AMD64 OR CLR_CMAKE_PLATFORM_ARCH_ARM64)
220   add_definitions(-DFEATURE_USE_SOFTWARE_WRITE_WATCH_FOR_GC_HEAP)
221 endif(CLR_CMAKE_PLATFORM_ARCH_AMD64 OR CLR_CMAKE_PLATFORM_ARCH_ARM64)
222 if((CLR_CMAKE_PLATFORM_ARCH_AMD64 OR CLR_CMAKE_PLATFORM_ARCH_ARM64) AND NOT WIN32)
223   add_definitions(-DFEATURE_MANUALLY_MANAGED_CARD_BUNDLES)
224 endif((CLR_CMAKE_PLATFORM_ARCH_AMD64 OR CLR_CMAKE_PLATFORM_ARCH_ARM64) AND NOT WIN32)
225
226 if(WIN32)
227     add_definitions(-DFEATURE_VERSIONING_LOG)
228 endif(WIN32)
229 if(NOT CLR_CMAKE_PLATFORM_UNIX)
230     add_definitions(-DFEATURE_WIN32_REGISTRY)
231 endif(NOT CLR_CMAKE_PLATFORM_UNIX)
232 add_definitions(-DFEATURE_WINMD_RESILIENT)
233 add_definitions(-D_SECURE_SCL=0)
234 add_definitions(-DUNICODE)
235 add_definitions(-D_UNICODE)
236
237 if(WIN32)
238   if (CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386)
239     add_definitions(-DFEATURE_DATABREAKPOINT)
240   endif(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386)
241 endif(WIN32)