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