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