Merge pull request #23321 from franksinankaya/gcc_cleanup_14
[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=1)  
10   # add_definitions(-DFEATURE_XXX=1)
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_=1)
18   add_definitions(-D_TARGET_64BIT_=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(-D_TARGET_64BIT_=1)
28   add_definitions(-DDBG_TARGET_64BIT=1)
29   add_definitions(-DDBG_TARGET_ARM64=1)
30   add_definitions(-DDBG_TARGET_WIN64=1)
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=1)
38     add_definitions(-D_ARM_WORKAROUND_)
39   endif (CLR_CMAKE_PLATFORM_UNIX)
40   add_definitions(-D_TARGET_ARM_=1)
41   add_definitions(-DDBG_TARGET_32BIT=1)
42   add_definitions(-DDBG_TARGET_ARM=1)
43 elseif (CLR_CMAKE_TARGET_ARCH_I386)
44   add_definitions(-D_TARGET_X86_=1)
45   add_definitions(-DDBG_TARGET_32BIT=1)
46   add_definitions(-DDBG_TARGET_X86=1)
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=1)
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=1)
126     add_definitions(-DFEATURE_PERFTRACING=1)
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=1)
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 add_definitions(-DFEATURE_PREJIT)
179
180 if(NOT CLR_CMAKE_PLATFORM_UNIX)
181     add_definitions(-DFEATURE_PROFAPI_ATTACH_DETACH)
182 endif(NOT CLR_CMAKE_PLATFORM_UNIX)
183
184 add_definitions(-DFEATURE_READYTORUN)
185 set(FEATURE_READYTORUN 1)
186
187 if (CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386)
188   add_definitions(-DFEATURE_REJIT)
189 endif(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386)
190
191 if (CLR_CMAKE_PLATFORM_UNIX OR CLR_CMAKE_TARGET_ARCH_ARM64)
192     add_definitions(-DFEATURE_STUBS_AS_IL)
193 endif ()
194 if (FEATURE_NGEN_RELOCS_OPTIMIZATIONS)
195    add_definitions(-DFEATURE_NGEN_RELOCS_OPTIMIZATIONS)
196 endif(FEATURE_NGEN_RELOCS_OPTIMIZATIONS)
197 add_definitions(-DFEATURE_SVR_GC)
198 add_definitions(-DFEATURE_SYMDIFF)
199 add_definitions(-DFEATURE_TIERED_COMPILATION)
200 if (WIN32)
201     add_definitions(-DFEATURE_TYPEEQUIVALENCE)
202 endif(WIN32)
203 if (CLR_CMAKE_PLATFORM_ARCH_AMD64)
204   # Enable the AMD64 Unix struct passing JIT-EE interface for all AMD64 platforms, to enable altjit.
205   add_definitions(-DUNIX_AMD64_ABI_ITF)
206 endif (CLR_CMAKE_PLATFORM_ARCH_AMD64)
207 if(CLR_CMAKE_PLATFORM_UNIX_AMD64)
208   add_definitions(-DFEATURE_MULTIREG_RETURN)
209 endif (CLR_CMAKE_PLATFORM_UNIX_AMD64)
210 if(CLR_CMAKE_PLATFORM_UNIX AND CLR_CMAKE_TARGET_ARCH_AMD64)
211   add_definitions(-DUNIX_AMD64_ABI)
212 endif(CLR_CMAKE_PLATFORM_UNIX AND CLR_CMAKE_TARGET_ARCH_AMD64)
213 add_definitions(-DFEATURE_USE_ASM_GC_WRITE_BARRIERS)
214 if(CLR_CMAKE_PLATFORM_ARCH_AMD64 OR (CLR_CMAKE_PLATFORM_ARCH_ARM64 AND NOT WIN32))
215   add_definitions(-DFEATURE_USE_SOFTWARE_WRITE_WATCH_FOR_GC_HEAP)
216 endif(CLR_CMAKE_PLATFORM_ARCH_AMD64 OR (CLR_CMAKE_PLATFORM_ARCH_ARM64 AND NOT WIN32))
217 if((CLR_CMAKE_PLATFORM_ARCH_AMD64 OR CLR_CMAKE_PLATFORM_ARCH_ARM64) AND NOT WIN32)
218   add_definitions(-DFEATURE_MANUALLY_MANAGED_CARD_BUNDLES)
219 endif((CLR_CMAKE_PLATFORM_ARCH_AMD64 OR CLR_CMAKE_PLATFORM_ARCH_ARM64) AND NOT WIN32)
220
221 if(WIN32)
222     add_definitions(-DFEATURE_VERSIONING_LOG)
223 endif(WIN32)
224 if(NOT CLR_CMAKE_PLATFORM_UNIX)
225     add_definitions(-DFEATURE_WIN32_REGISTRY)
226 endif(NOT CLR_CMAKE_PLATFORM_UNIX)
227 add_definitions(-DFEATURE_LEGACYNETCF_DBG_HOST_CONTROL)
228 add_definitions(-DFEATURE_WINDOWSPHONE)
229 add_definitions(-DFEATURE_WINMD_RESILIENT)
230 add_definitions(-D_SECURE_SCL=0)
231 add_definitions(-DUNICODE)
232 add_definitions(-D_UNICODE)
233
234 if(WIN32)
235   if (CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386)
236     add_definitions(-DFEATURE_DATABREAKPOINT)
237   endif(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386)
238 endif(WIN32)